Fix activation errors
This commit is contained in:
@@ -23,9 +23,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
public function __construct() {
|
||||
$this->id = 'events';
|
||||
$this->label = __( 'Events', 'sportspress' );
|
||||
|
||||
$this->template = 'event';
|
||||
$this->templates = SP()->templates->event;
|
||||
|
||||
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
||||
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
||||
|
||||
@@ -20,7 +20,6 @@ class SP_Settings_Page {
|
||||
protected $id = '';
|
||||
protected $label = '';
|
||||
protected $template = '';
|
||||
public $templates = array();
|
||||
/**
|
||||
* Add this page to settings
|
||||
*/
|
||||
@@ -39,6 +38,17 @@ class SP_Settings_Page {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Templates
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function templates() {
|
||||
if ( ! isset( $this->template ) ) return array();
|
||||
$template = $this->template;
|
||||
return SP()->templates->$template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the settings
|
||||
*/
|
||||
@@ -60,7 +70,7 @@ class SP_Settings_Page {
|
||||
if ( $current_section )
|
||||
do_action( 'sportspress_update_options_' . $this->template . '_' . $current_section );
|
||||
|
||||
if ( ! empty( $this->templates ) )
|
||||
if ( ! empty( $this->templates() ) )
|
||||
update_option( 'sportspress_' . $this->template . '_template_order', sp_array_value( $_POST, 'sportspress_' . $this->template . '_template_order', false ) );
|
||||
|
||||
if ( isset( $_POST['sportspress_template_visibility'] ) && is_array( $_POST['sportspress_template_visibility'] ) ) {
|
||||
@@ -82,7 +92,7 @@ class SP_Settings_Page {
|
||||
* @return void
|
||||
*/
|
||||
public function layout_setting() {
|
||||
$templates = apply_filters( 'sportspress_' . $this->template . '_templates', $this->templates );
|
||||
$templates = apply_filters( 'sportspress_' . $this->template . '_templates', $this->templates() );
|
||||
|
||||
$layout = get_option( 'sportspress_' . $this->template . '_template_order' );
|
||||
if ( false === $layout ) {
|
||||
@@ -135,7 +145,7 @@ class SP_Settings_Page {
|
||||
* @return void
|
||||
*/
|
||||
public function tabs_setting() {
|
||||
$templates = apply_filters( 'sportspress_' . $this->template . '_templates', $this->templates );
|
||||
$templates = apply_filters( 'sportspress_' . $this->template . '_templates', $this->templates() );
|
||||
|
||||
$layout = get_option( 'sportspress_' . $this->template . '_template_order' );
|
||||
if ( false === $layout ) {
|
||||
|
||||
@@ -23,9 +23,7 @@ class SP_Settings_Players extends SP_Settings_Page {
|
||||
public function __construct() {
|
||||
$this->id = 'players';
|
||||
$this->label = __( 'Players', 'sportspress' );
|
||||
|
||||
$this->template = 'player';
|
||||
$this->templates = SP()->templates->player;
|
||||
|
||||
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
||||
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
||||
|
||||
@@ -23,9 +23,7 @@ class SP_Settings_Staff extends SP_Settings_Page {
|
||||
public function __construct() {
|
||||
$this->id = 'staff';
|
||||
$this->label = __( 'Staff', 'sportspress' );
|
||||
|
||||
$this->template = 'staff';
|
||||
$this->templates = SP()->templates->staff;
|
||||
|
||||
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
||||
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
||||
|
||||
@@ -23,9 +23,7 @@ class SP_Settings_Teams extends SP_Settings_Page {
|
||||
public function __construct() {
|
||||
$this->id = 'teams';
|
||||
$this->label = __( 'Teams', 'sportspress' );
|
||||
|
||||
$this->template = 'team';
|
||||
$this->templates = SP()->templates->team;
|
||||
|
||||
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
||||
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
||||
|
||||
Reference in New Issue
Block a user