Replace global options with individual option check
This commit is contained in:
@@ -95,7 +95,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function import( $file ) {
|
function import( $file ) {
|
||||||
global $wpdb, $sportspress_options;
|
global $wpdb;
|
||||||
|
|
||||||
$this->imported = $this->skipped = 0;
|
$this->imported = $this->skipped = 0;
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
|
|
||||||
// Add delimiter if event name is set
|
// Add delimiter if event name is set
|
||||||
if ( $title ):
|
if ( $title ):
|
||||||
$title .= ' ' . sp_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' ';
|
$title .= ' ' . get_option( 'sportspress_event_teams_delimiter', 'vs' ) . ' ';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Append team name to event name
|
// Append team name to event name
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function wp_insert_post_data( $data, $postarr ) {
|
public function wp_insert_post_data( $data, $postarr ) {
|
||||||
global $sportspress_options;
|
|
||||||
|
|
||||||
if ( $data['post_type'] == 'sp_event' && $data['post_title'] == '' ):
|
if ( $data['post_type'] == 'sp_event' && $data['post_title'] == '' ):
|
||||||
|
|
||||||
$teams = sp_array_value( $postarr, 'sp_team', array() );
|
$teams = sp_array_value( $postarr, 'sp_team', array() );
|
||||||
@@ -76,7 +74,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
$team_names[] = get_the_title( $team );
|
$team_names[] = get_the_title( $team );
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
$data['post_title'] = implode( ' ' . sp_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' ', $team_names );
|
$data['post_title'] = implode( ' ' . get_option( 'sportspress_event_teams_delimiter', 'vs' ) . ' ', $team_names );
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
|
|||||||
echo '—';
|
echo '—';
|
||||||
else:
|
else:
|
||||||
$results = get_post_meta( $post_id, 'sp_results', true );
|
$results = get_post_meta( $post_id, 'sp_results', true );
|
||||||
global $sportspress_options;
|
$main_result = get_option( 'sportspress_primary_result', null );
|
||||||
$main_result = sp_array_value( $sportspress_options, 'main_result', null );
|
|
||||||
foreach( $teams as $team_id ):
|
foreach( $teams as $team_id ):
|
||||||
if ( ! $team_id ) continue;
|
if ( ! $team_id ) continue;
|
||||||
$team = get_post( $team_id );
|
$team = get_post( $team_id );
|
||||||
|
|||||||
@@ -856,8 +856,7 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
||||||
global $sportspress_options;
|
$main_result = get_option( 'sportspress_primary_result', null );
|
||||||
$main_result = sp_array_value( $sportspress_options, 'main_result', null );
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $data as $event ):
|
foreach ( $data as $event ):
|
||||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||||
@@ -941,8 +940,7 @@ if ( !function_exists( 'sp_edit_league_table' ) ) {
|
|||||||
function sp_edit_league_table( $columns = array(), $usecolumns = null, $data = array(), $placeholders = array() ) {
|
function sp_edit_league_table( $columns = array(), $usecolumns = null, $data = array(), $placeholders = array() ) {
|
||||||
if ( is_array( $usecolumns ) )
|
if ( is_array( $usecolumns ) )
|
||||||
$usecolumns = array_filter( $usecolumns );
|
$usecolumns = array_filter( $usecolumns );
|
||||||
global $sportspress_options;
|
$show_team_logo = get_option( 'sportspress_table_show_logos', false );
|
||||||
$show_team_logo = sp_array_value( $sportspress_options, 'league_table_show_team_logo', false );
|
|
||||||
?>
|
?>
|
||||||
<div class="sp-data-table-container">
|
<div class="sp-data-table-container">
|
||||||
<table class="widefat sp-data-table sp-league-table">
|
<table class="widefat sp-data-table sp-league-table">
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
|
|||||||
if ( $domain != 'sportspress' )
|
if ( $domain != 'sportspress' )
|
||||||
return $translated_text;
|
return $translated_text;
|
||||||
|
|
||||||
global $typenow, $sportspress_options;
|
global $typenow;
|
||||||
|
|
||||||
if ( is_admin() ):
|
if ( is_admin() ):
|
||||||
if ( in_array( $typenow, array( 'sp_event', 'sp_team', 'sp_player', 'sp_staff' ) ) ):
|
if ( in_array( $typenow, array( 'sp_event', 'sp_team', 'sp_player', 'sp_staff' ) ) ):
|
||||||
@@ -155,13 +155,6 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
|
|||||||
$translated_text = $venue->name;
|
$translated_text = $venue->name;
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
if ( isset( $sportspress_options['text'] ) ):
|
|
||||||
foreach( $sportspress_options['text'] as $key => $value ):
|
|
||||||
if ( $translated_text == $key ):
|
|
||||||
$translated_text = $value;
|
|
||||||
endif;
|
|
||||||
endforeach;
|
|
||||||
endif;
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
return $translated_text;
|
return $translated_text;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
global $sportspress_options;
|
$primary_result = get_option( 'sportspress_primary_result', null );
|
||||||
$primary_result = sp_array_value( $sportspress_options, 'sportspress_primary_result', null );
|
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
global $sportspress_options;
|
|
||||||
|
|
||||||
if ( ! isset( $id ) )
|
if ( ! isset( $id ) )
|
||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
global $sportspress_options;
|
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'id' => get_the_ID(),
|
'id' => get_the_ID(),
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
global $sportspress_options;
|
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'id' => get_the_ID(),
|
'id' => get_the_ID(),
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
global $sportspress_options;
|
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'id' => get_the_ID(),
|
'id' => get_the_ID(),
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
if ( ! isset( $id ) )
|
if ( ! isset( $id ) )
|
||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
|
|
||||||
global $sportspress_options;
|
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'show_nationality_flag' => get_option( 'sportspress_player_show_flag', 'yes' ) == 'yes' ? true : false,
|
'show_nationality_flag' => get_option( 'sportspress_player_show_flag', 'yes' ) == 'yes' ? true : false,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user