Move text settings to dedicated tab

This commit is contained in:
Brian Miyaji
2014-04-25 01:06:14 +10:00
parent e382174441
commit 88d43e0a4f
20 changed files with 129 additions and 143 deletions

View File

@@ -34,6 +34,7 @@ class SP_Admin_Settings {
$settings[] = include( 'settings/class-sp-settings-events.php' ); $settings[] = include( 'settings/class-sp-settings-events.php' );
$settings[] = include( 'settings/class-sp-settings-teams.php' ); $settings[] = include( 'settings/class-sp-settings-teams.php' );
$settings[] = include( 'settings/class-sp-settings-players.php' ); $settings[] = include( 'settings/class-sp-settings-players.php' );
$settings[] = include( 'settings/class-sp-settings-text.php' );
$settings[] = include( 'settings/class-sp-settings-config.php' ); $settings[] = include( 'settings/class-sp-settings-config.php' );
self::$settings = apply_filters( 'sportspress_get_settings_pages', $settings ); self::$settings = apply_filters( 'sportspress_get_settings_pages', $settings );

View File

@@ -220,7 +220,7 @@ class SP_Admin_Welcome {
<?php SP()->countries->country_dropdown_options( $selected ); ?> <?php SP()->countries->country_dropdown_options( $selected ); ?>
</select> </select>
</p> </p>
<h4><?php printf( __( 'Select %s', 'sportspress' ), __( 'Sport', 'sportspress' ) ); ?></h4> <h4><?php _e( 'Sport', 'sportspress' ); ?></h4>
<?php <?php
$sport_options = sp_get_sport_options(); $sport_options = sp_get_sport_options();
$class = 'chosen-select' . ( is_rtl() ? ' chosen-rtl' : '' ); $class = 'chosen-select' . ( is_rtl() ? ' chosen-rtl' : '' );

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin * @package SportsPress/Admin
* @version 0.7 * @version 0.8
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -41,19 +41,10 @@ class SP_Settings_Config extends SP_Settings_Page {
* @return array * @return array
*/ */
public function get_settings() { public function get_settings() {
$sports = sp_get_sport_options();
return apply_filters('sportspress_event_settings', array( return apply_filters('sportspress_event_settings', array(
array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ), array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
array(
'title' => __( 'Sport', 'sportspress' ),
'id' => 'sportspress_sport',
'default' => 'soccer',
'type' => 'select',
'options' => $sports,
),
array( 'type' => 'outcomes' ), array( 'type' => 'outcomes' ),
@@ -76,11 +67,7 @@ class SP_Settings_Config extends SP_Settings_Page {
* Save settings * Save settings
*/ */
public function save() { public function save() {
if ( isset( $_POST['sportspress_sport'] ) && ! empty( $_POST['sportspress_sport'] ) && get_option( 'sportspress_sport', null ) != $_POST['sportspress_sport'] ): if ( isset( $_POST['sportspress_primary_result'] ) ):
$sport = SP()->sports->$_POST['sportspress_sport'];
SP_Admin_Settings::configure_sport( $sport );
update_option( '_sp_needs_welcome', 0 );
elseif ( isset( $_POST['sportspress_primary_result'] ) ):
update_option( 'sportspress_primary_result', $_POST['sportspress_primary_result'] ); update_option( 'sportspress_primary_result', $_POST['sportspress_primary_result'] );
endif; endif;
@@ -114,7 +101,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th> <th scope="col" class="edit"></th>
</tr> </tr>
</thead> </thead>
@@ -169,7 +156,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<tr> <tr>
<th scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th> <th scope="col" class="edit"></th>
</tr> </tr>
</thead> </thead>
@@ -237,7 +224,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th> <th scope="col" class="edit"></th>
</tr> </tr>
</thead> </thead>
@@ -287,7 +274,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Sort Order', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Sort Order', 'sportspress' ); ?></th>
@@ -344,7 +331,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col">&nbsp;</th> <th scope="col">&nbsp;</th>
<th scope="col" class="edit"></th> <th scope="col" class="edit"></th>
</tr> </tr>
@@ -396,7 +383,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th> <th scope="col" class="edit"></th>

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin * @package SportsPress/Admin
* @version 0.7 * @version 0.8
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -37,9 +37,9 @@ class SP_Settings_Events extends SP_Settings_Page {
*/ */
public function get_settings() { public function get_settings() {
$settings = array( return apply_filters( 'sportspress_event_settings', array(
array( 'title' => __( 'Event Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'event_options' ), array( 'title' => __( 'Event Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'event_options' ),
array( 'type' => 'delimiter' ), array( 'type' => 'delimiter' ),
@@ -95,25 +95,7 @@ class SP_Settings_Events extends SP_Settings_Page {
array( 'type' => 'sectionend', 'id' => 'calendar_options' ), array( 'type' => 'sectionend', 'id' => 'calendar_options' ),
array( 'title' => __( 'Text', 'sportspress' ), 'type' => 'title', 'desc' => __( 'The following options affect how words are displayed on the frontend.', 'sportspress' ), 'id' => 'text_options' ), )); // End event settings
);
$strings = sp_get_text_options();
foreach ( sp_array_value( $strings, 'event', array() ) as $key => $value ):
$settings[] = array(
'title' => $value,
'id' => 'sportspress_event_' . $key . '_text',
'default' => '',
'placeholder' => $value,
'type' => 'text',
);
endforeach;
$settings[] = array( 'type' => 'sectionend', 'id' => 'text_options' );
return apply_filters( 'sportspress_event_settings', $settings ); // End event settings
} }
/** /**

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin * @package SportsPress/Admin
* @version 0.7 * @version 0.8
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -39,13 +39,22 @@ class SP_Settings_General extends SP_Settings_Page {
* @return array * @return array
*/ */
public function get_settings() { public function get_settings() {
$sports = sp_get_sport_options();
$settings = array( return apply_filters( 'sportspress_general_settings', array(
array( 'title' => __( 'General Options', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ), array( 'title' => __( 'General Options', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ),
array( 'type' => 'country' ), array( 'type' => 'country' ),
array(
'title' => __( 'Sport', 'sportspress' ),
'id' => 'sportspress_sport',
'default' => 'soccer',
'type' => 'select',
'options' => $sports,
),
array( 'type' => 'sectionend', 'id' => 'general_options' ), array( 'type' => 'sectionend', 'id' => 'general_options' ),
array( 'title' => __( 'Styles and Scripts', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'script_styling_options' ), array( 'title' => __( 'Styles and Scripts', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'script_styling_options' ),
@@ -89,25 +98,7 @@ class SP_Settings_General extends SP_Settings_Page {
array( 'type' => 'sectionend', 'id' => 'script_styling_options' ), array( 'type' => 'sectionend', 'id' => 'script_styling_options' ),
array( 'title' => __( 'Text', 'sportspress' ), 'type' => 'title', 'desc' => __( 'The following options affect how words are displayed on the frontend.', 'sportspress' ), 'id' => 'text_options' ), )); // End general settings
);
$strings = sp_get_text_options();
foreach ( sp_array_value( $strings, 'general', array() ) as $key => $value ):
$settings[] = array(
'title' => $value,
'id' => 'sportspress_' . $key . '_text',
'default' => '',
'placeholder' => $value,
'type' => 'text',
);
endforeach;
$settings[] = array( 'type' => 'sectionend', 'id' => 'text_options' );
return apply_filters( 'sportspress_general_settings', $settings ); // End general settings
} }
/** /**
@@ -117,9 +108,8 @@ class SP_Settings_General extends SP_Settings_Page {
if ( isset( $_POST['sportspress_sport'] ) && ! empty( $_POST['sportspress_sport'] ) && get_option( 'sportspress_sport', null ) != $_POST['sportspress_sport'] ): if ( isset( $_POST['sportspress_sport'] ) && ! empty( $_POST['sportspress_sport'] ) && get_option( 'sportspress_sport', null ) != $_POST['sportspress_sport'] ):
$sport = SP()->sports->$_POST['sportspress_sport']; $sport = SP()->sports->$_POST['sportspress_sport'];
SP_Admin_Settings::configure_sport( $sport ); SP_Admin_Settings::configure_sport( $sport );
update_option( 'sportspress_sport', $_POST['sportspress_sport'] );
update_option( '_sp_needs_welcome', 0 ); update_option( '_sp_needs_welcome', 0 );
endif; endif;
$settings = $this->get_settings(); $settings = $this->get_settings();
SP_Admin_Settings::save_fields( $settings ); SP_Admin_Settings::save_fields( $settings );

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin * @package SportsPress/Admin
* @version 0.7 * @version 0.8
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -36,7 +36,7 @@ class SP_Settings_Players extends SP_Settings_Page {
*/ */
public function get_settings() { public function get_settings() {
$settings = array( return apply_filters( 'sportspress_event_settings', array(
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ), array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
@@ -83,25 +83,7 @@ class SP_Settings_Players extends SP_Settings_Page {
array( 'type' => 'sectionend', 'id' => 'list_options' ), array( 'type' => 'sectionend', 'id' => 'list_options' ),
array( 'title' => __( 'Text', 'sportspress' ), 'type' => 'title', 'desc' => __( 'The following options affect how words are displayed on the frontend.', 'sportspress' ), 'id' => 'text_options' ), )); // End player settings
);
$strings = sp_get_text_options();
foreach ( sp_array_value( $strings, 'player', array() ) as $key => $value ):
$settings[] = array(
'title' => $value,
'id' => 'sportspress_player_' . $key . '_text',
'default' => '',
'placeholder' => $value,
'type' => 'text',
);
endforeach;
$settings[] = array( 'type' => 'sectionend', 'id' => 'text_options' );
return apply_filters( 'sportspress_event_settings', $settings ); // End player settings
} }
} }

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin * @package SportsPress/Admin
* @version 0.7 * @version 0.8
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -36,7 +36,7 @@ class SP_Settings_Teams extends SP_Settings_Page {
*/ */
public function get_settings() { public function get_settings() {
$settings = array( return apply_filters( 'sportspress_event_settings', array(
array( 'title' => __( 'Team Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'team_options' ), array( 'title' => __( 'Team Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'team_options' ),
@@ -84,25 +84,7 @@ class SP_Settings_Teams extends SP_Settings_Page {
array( 'type' => 'sectionend', 'id' => 'table_options' ), array( 'type' => 'sectionend', 'id' => 'table_options' ),
array( 'title' => __( 'Text', 'sportspress' ), 'type' => 'title', 'desc' => __( 'The following options affect how words are displayed on the frontend.', 'sportspress' ), 'id' => 'text_options' ), )); // End team settings
);
$strings = sp_get_text_options();
foreach ( sp_array_value( $strings, 'team', array() ) as $key => $value ):
$settings[] = array(
'title' => $value,
'id' => 'sportspress_team_' . $key . '_text',
'default' => '',
'placeholder' => $value,
'type' => 'text',
);
endforeach;
$settings[] = array( 'type' => 'sectionend', 'id' => 'text_options' );
return apply_filters( 'sportspress_event_settings', $settings ); // End team settings
} }
} }

View File

@@ -0,0 +1,65 @@
<?php
/**
* SportsPress Text Settings
*
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 0.8
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'SP_Settings_Text' ) ) :
/**
* SP_Settings_Text
*/
class SP_Settings_Text extends SP_Settings_Page {
/**
* Constructor
*/
public function __construct() {
$this->id = 'text';
$this->label = __( 'Text', 'sportspress' );
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
/**
* Get settings array
*
* @return array
*/
public function get_settings() {
$settings = array(
array( 'title' => __( 'Text', 'sportspress' ), 'type' => 'title', 'desc' => __( 'The following options affect how words are displayed on the frontend.', 'sportspress' ), 'id' => 'text_options' ),
);
$strings = sp_get_text_options();
foreach ( $strings as $key => $value ):
$settings[] = array(
'title' => $value,
'id' => 'sportspress_' . $key . '_text',
'default' => '',
'placeholder' => $value,
'type' => 'text',
);
endforeach;
$settings[] = array( 'type' => 'sectionend', 'id' => 'text_options' );
return apply_filters( 'sportspress_event_settings', $settings ); // End event settings
}
}
endif;
return new SP_Settings_Text();

View File

@@ -5,7 +5,7 @@
* The SportsPress text class stores editable strings. * The SportsPress text class stores editable strings.
* *
* @class SP_Text * @class SP_Text
* @version 0.7 * @version 0.8
* @package SportsPress/Classes * @package SportsPress/Classes
* @category Class * @category Class
* @author ThemeBoy * @author ThemeBoy
@@ -33,18 +33,15 @@ class SP_Text {
$this->data[ $key ] = $value; $this->data[ $key ] = $value;
} }
public function string( $string, $context = null ){ public function string( $string ){
if ( is_admin() ) if ( is_admin() )
return $string; return $string;
$key = str_replace( '-', '_', sanitize_title( $string ) ); $key = str_replace( '-', '_', sanitize_title( $string ) );
if ( $context == null ) if ( array_key_exists( $key, $this->data ) ):
$context = 'general'; $string = get_option( 'sportspress_' . $key . '_text' );
return ( empty( $string ) ? $this->data[ $key ] : $string );
if ( array_key_exists( $context, $this->data ) && array_key_exists( $key, $this->data[ $context ] ) ):
$string = get_option( 'sportspress_' . ( $context == 'general' ? '' : $context . '_' ) . $key . '_text' );
return ( empty( $string ) ? $this->data[ $context ][ $key ] : $string );
else: else:
return $string; return $string;
endif; endif;

View File

@@ -205,6 +205,6 @@ if ( $pad != 0 && $pad != 7 )
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>"; $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>";
if ( $id && $show_all_events_link ) if ( $id && $show_all_events_link )
$calendar_output .= '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events', 'event') . '</a>'; $calendar_output .= '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events') . '</a>';
echo apply_filters( 'sportspress_event_calendar', $calendar_output ); echo apply_filters( 'sportspress_event_calendar', $calendar_output );

View File

@@ -17,7 +17,7 @@ $time = get_the_time( get_option('time_format'), $id );
$leagues = get_the_terms( $id, 'sp_league' ); $leagues = get_the_terms( $id, 'sp_league' );
$seasons = get_the_terms( $id, 'sp_season' ); $seasons = get_the_terms( $id, 'sp_season' );
$data = array( SP()->text->string('Date', 'event') => $date, SP()->text->string('Time', 'event') => $time ); $data = array( SP()->text->string('Date') => $date, SP()->text->string('Time') => $time );
if ( $leagues ): if ( $leagues ):
$league = array_pop( $leagues ); $league = array_pop( $leagues );
@@ -29,7 +29,7 @@ if ( $seasons ):
$data[ SP()->text->string('Season') ] = $season->name; $data[ SP()->text->string('Season') ] = $season->name;
endif; endif;
?> ?>
<h3><?php echo SP()->text->string('Details', 'event'); ?></h3> <h3><?php echo SP()->text->string('Details'); ?></h3>
<div class="sp-table-wrapper"> <div class="sp-table-wrapper">
<table class="sp-event-details sp-data-table"> <table class="sp-event-details sp-data-table">
<thead> <thead>

View File

@@ -32,22 +32,22 @@ extract( $defaults, EXTR_SKIP );
if ( isset( $columns ) ) if ( isset( $columns ) )
$usecolumns = $columns; $usecolumns = $columns;
echo '<th class="data-date">' . SP()->text->string('Date', 'event') . '</th>'; echo '<th class="data-date">' . SP()->text->string('Date') . '</th>';
if ( $usecolumns == null || in_array( 'event', $usecolumns ) ) if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
echo '<th class="data-event">' . SP()->text->string('Event', 'event') . '</th>'; echo '<th class="data-event">' . SP()->text->string('Event') . '</th>';
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ) if ( $usecolumns == null || in_array( 'teams', $usecolumns ) )
echo '<th class="data-teams">' . SP()->text->string('Teams', 'event') . '</th>'; echo '<th class="data-teams">' . SP()->text->string('Teams') . '</th>';
if ( $usecolumns == null || in_array( 'time', $usecolumns ) ) if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
echo '<th class="data-time">' . SP()->text->string('Time', 'event') . '</th>'; echo '<th class="data-time">' . SP()->text->string('Time') . '</th>';
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ) if ( $usecolumns == null || in_array( 'venue', $usecolumns ) )
echo '<th class="data-venue">' . SP()->text->string('Venue', 'event') . '</th>'; echo '<th class="data-venue">' . SP()->text->string('Venue') . '</th>';
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ) if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
echo '<th class="data-article">' . SP()->text->string('Article', 'event') . '</th>'; echo '<th class="data-article">' . SP()->text->string('Article') . '</th>';
?> ?>
</tr> </tr>
</thead> </thead>
@@ -129,9 +129,9 @@ extract( $defaults, EXTR_SKIP );
endif; endif;
if ( $event->post_content !== null ): if ( $event->post_content !== null ):
if ( $event->post_status == 'publish' ): if ( $event->post_status == 'publish' ):
echo SP()->text->string('Recap', 'event'); echo SP()->text->string('Recap');
else: else:
echo SP()->text->string('Preview', 'event'); echo SP()->text->string('Preview');
endif; endif;
endif; endif;
@@ -148,6 +148,6 @@ extract( $defaults, EXTR_SKIP );
</table> </table>
<?php <?php
if ( $id && $show_all_events_link ) if ( $id && $show_all_events_link )
echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events', 'event') . '</a>'; echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events') . '</a>';
?> ?>
</div> </div>

View File

@@ -38,7 +38,7 @@ foreach( $teams as $key => $team_id ):
<tr> <tr>
<?php if ( $has_players ): ?> <?php if ( $has_players ): ?>
<th class="data-number">#</th> <th class="data-number">#</th>
<th class="data-name"><?php echo SP()->text->string('Player', 'event'); ?></th> <th class="data-name"><?php echo SP()->text->string('Player'); ?></th>
<?php endif; foreach( $performance_labels as $key => $label ): ?> <?php endif; foreach( $performance_labels as $key => $label ): ?>
<th class="data-<?php echo $key; ?>"><?php echo $label; ?></th> <th class="data-<?php echo $key; ?>"><?php echo $label; ?></th>
<?php endforeach; ?> <?php endforeach; ?>
@@ -102,7 +102,7 @@ foreach( $teams as $key => $team_id ):
<?php <?php
if ( $has_players ): if ( $has_players ):
echo '<td class="data-number">&nbsp;</td>'; echo '<td class="data-number">&nbsp;</td>';
echo '<td class="data-name">' . SP()->text->string('Total', 'event') . '</td>'; echo '<td class="data-name">' . SP()->text->string('Total') . '</td>';
endif; endif;
$row = $data[0]; $row = $data[0];

View File

@@ -59,11 +59,11 @@ if ( empty( $table_rows ) ):
else: else:
$output .= '<h3>' . SP()->text->string('Team Results', 'event') . '</h3>'; $output .= '<h3>' . SP()->text->string('Team Results') . '</h3>';
$output .= '<div class="sp-table-wrapper">' . $output .= '<div class="sp-table-wrapper">' .
'<table class="sp-event-results sp-data-table sp-responsive-table"><thead>' . '<table class="sp-event-results sp-data-table sp-responsive-table"><thead>' .
'<th class="data-name">' . SP()->text->string('Team', 'event') . '</th>'; '<th class="data-name">' . SP()->text->string('Team') . '</th>';
foreach( $result_labels as $key => $label ): foreach( $result_labels as $key => $label ):
$output .= '<th class="data-' . $key . '">' . $label . '</th>'; $output .= '<th class="data-' . $key . '">' . $label . '</th>';
endforeach; endforeach;

View File

@@ -32,7 +32,7 @@ foreach( $venues as $venue ):
$latitude = sp_array_value( $meta, 'sp_latitude', 0 ); $latitude = sp_array_value( $meta, 'sp_latitude', 0 );
$longitude = sp_array_value( $meta, 'sp_longitude', 0 ); $longitude = sp_array_value( $meta, 'sp_longitude', 0 );
?> ?>
<h3><?php echo SP()->text->string('Venue', 'event'); ?></h3> <h3><?php echo SP()->text->string('Venue'); ?></h3>
<table class="sp-data-table sp-event-venue"> <table class="sp-data-table sp-event-venue">
<thead> <thead>
<tr> <tr>

View File

@@ -41,7 +41,7 @@ if ( ! $columns )
if ( ! is_array( $columns ) ) if ( ! is_array( $columns ) )
$columns = explode( ',', $columns ); $columns = explode( ',', $columns );
$output .= '<th class="data-rank">' . SP()->text->string('Pos', 'team') . '</th>'; $output .= '<th class="data-rank">' . SP()->text->string('Pos') . '</th>';
foreach( $labels as $key => $label ): foreach( $labels as $key => $label ):
if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) ) if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) )
@@ -93,7 +93,7 @@ endforeach;
$output .= '</tbody>' . '</table>'; $output .= '</tbody>' . '</table>';
if ( $show_full_table_link ) if ( $show_full_table_link )
$output .= '<a class="sp-league-table-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View full table', 'team') . '</a>'; $output .= '<a class="sp-league-table-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View full table') . '</a>';
$output .= '</div>'; $output .= '</div>';

View File

@@ -28,20 +28,20 @@ $metrics = sp_get_player_metrics_data( $id );
$common = array(); $common = array();
if ( $nationality ): if ( $nationality ):
$country_name = sp_array_value( $countries, $nationality, null ); $country_name = sp_array_value( $countries, $nationality, null );
$common[ SP()->text->string('Nationality', 'player') ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;'; $common[ SP()->text->string('Nationality') ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;';
endif; endif;
$data = array_merge( $common, $metrics ); $data = array_merge( $common, $metrics );
if ( $current_team ) if ( $current_team )
$data[ SP()->text->string('Current Team', 'player') ] = '<a href="' . get_post_permalink( $current_team ) . '">' . get_the_title( $current_team ) . '</a>'; $data[ SP()->text->string('Current Team') ] = '<a href="' . get_post_permalink( $current_team ) . '">' . get_the_title( $current_team ) . '</a>';
if ( $past_teams ): if ( $past_teams ):
$teams = array(); $teams = array();
foreach ( $past_teams as $team ): foreach ( $past_teams as $team ):
$teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>'; $teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>';
endforeach; endforeach;
$data[ SP()->text->string('Past Teams', 'player') ] = implode( ', ', $teams ); $data[ SP()->text->string('Past Teams') ] = implode( ', ', $teams );
endif; endif;
$output = '<div class="sp-list-wrapper">' . $output = '<div class="sp-list-wrapper">' .

View File

@@ -136,6 +136,6 @@ $output .= "
</div>\n"; </div>\n";
if ( $show_all_players_link ) if ( $show_all_players_link )
$output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players', 'player') . '</a>'; $output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players') . '</a>';
echo apply_filters( 'sportspress_player_gallery', $output ); echo apply_filters( 'sportspress_player_gallery', $output );

View File

@@ -53,7 +53,7 @@ endif;
if ( in_array( $orderby, array( 'number', 'name' ) ) ): if ( in_array( $orderby, array( 'number', 'name' ) ) ):
$output .= '<th class="data-number">#</th>'; $output .= '<th class="data-number">#</th>';
else: else:
$output .= '<th class="data-rank">' . SP()->text->string('Rank', 'player') . '</th>'; $output .= '<th class="data-rank">' . SP()->text->string('Rank') . '</th>';
endif; endif;
foreach( $labels as $key => $label ): foreach( $labels as $key => $label ):
@@ -106,6 +106,6 @@ endforeach;
$output .= '</tbody>' . '</table>' . '</div>'; $output .= '</tbody>' . '</table>' . '</div>';
if ( $show_all_players_link ) if ( $show_all_players_link )
$output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players', 'player') . '</a>'; $output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players') . '</a>';
echo apply_filters( 'sportspress_player_list', $output ); echo apply_filters( 'sportspress_player_list', $output );

View File

@@ -92,7 +92,7 @@ foreach ( $positions as $position ):
if ( in_array( $r['orderby'], array( 'number', 'name' ) ) ): if ( in_array( $r['orderby'], array( 'number', 'name' ) ) ):
$output .= '<th class="data-number">#</th>'; $output .= '<th class="data-number">#</th>';
else: else:
$output .= '<th class="data-rank">' . SP()->text->string('Rank', 'player') . '</th>'; $output .= '<th class="data-rank">' . SP()->text->string('Rank') . '</th>';
endif; endif;
foreach( $labels as $key => $label ): foreach( $labels as $key => $label ):