id = 'events'; $this->label = __( 'Events', '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_admin_field_delimiter', array( $this, 'delimiter_setting' ) ); add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) ); } /** * Get settings array * * @return array */ public function get_settings() { return apply_filters( 'sportspress_event_settings', array( array( 'title' => __( 'Event Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'event_options' ), array( 'title' => __( 'Link', 'sportspress' ), 'desc' => __( 'Link events', 'sportspress' ), 'id' => 'sportspress_link_events', 'default' => 'yes', 'type' => 'checkbox', ), array( 'title' => __( 'Display', 'sportspress' ), 'desc' => __( 'Logos', 'sportspress' ), 'id' => 'sportspress_event_show_logos', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', ), array( 'desc' => __( 'Results', 'sportspress' ), 'id' => 'sportspress_event_show_results', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', ), array( 'desc' => __( 'Details', 'sportspress' ), 'id' => 'sportspress_event_show_details', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', ), array( 'desc' => __( 'Venue', 'sportspress' ), 'id' => 'sportspress_event_show_venue', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', ), array( 'desc' => __( 'Players', 'sportspress' ), 'id' => 'sportspress_event_show_players', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', ), array( 'desc' => __( 'Staff', 'sportspress' ), 'id' => 'sportspress_event_show_staff', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', ), array( 'desc' => __( 'Total', 'sportspress' ), 'id' => 'sportspress_event_show_total', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end', ), array( 'title' => __( 'Limit', 'sportspress' ), 'id' => 'sportspress_event_teams', 'class' => 'small-text', 'default' => '2', 'desc' => __( 'teams', 'sportspress' ), 'type' => 'number', 'custom_attributes' => array( 'min' => 1, 'step' => 1 ), ), array( 'type' => 'delimiter' ), array( 'title' => __( 'Player Performance', 'sportspress' ), 'id' => 'sportspress_event_performance_mode', 'default' => 'values', 'type' => 'radio', 'options' => array( 'values' => __( 'Values', 'sportspress' ), 'icons' => __( 'Icons', 'sportspress' ), ), ), array( 'title' => __( 'Venues', 'sportspress' ), 'desc' => __( 'Display maps', 'sportspress' ), 'id' => 'sportspress_event_show_maps', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', ), array( 'desc' => __( 'Link venues', 'sportspress' ), 'id' => 'sportspress_link_venues', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end', ), array( 'title' => __( 'Full Time', 'sportspress' ), 'id' => 'sportspress_event_minutes', 'class' => 'small-text', 'default' => '90', 'desc' => __( 'mins', 'sportspress' ), 'type' => 'number', 'custom_attributes' => array( 'min' => 0, 'step' => 1 ), ), array( 'type' => 'sectionend', 'id' => 'event_options' ), array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ), array( 'title' => __( 'Pagination', 'sportspress' ), 'desc' => __( 'Paginate', 'sportspress' ), 'id' => 'sportspress_event_list_paginated', 'default' => 'yes', 'type' => 'checkbox', ), array( 'title' => __( 'Limit', 'sportspress' ), 'id' => 'sportspress_event_list_rows', 'class' => 'small-text', 'default' => '10', 'desc' => __( 'events', 'sportspress' ), 'type' => 'number', 'custom_attributes' => array( 'min' => 1, 'step' => 1 ), ), array( 'type' => 'sectionend', 'id' => 'event_list_options' ), array( 'title' => __( 'Event Blocks', 'sportspress' ), 'type' => 'title', 'id' => 'event_blocks_options' ), array( 'title' => __( 'Details', 'sportspress' ), 'desc' => __( 'Display league', 'sportspress' ), 'id' => 'sportspress_event_blocks_show_league', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start', ), array( 'desc' => __( 'Display season', 'sportspress' ), 'id' => 'sportspress_event_blocks_show_season', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end', ), array( 'title' => __( 'Pagination', 'sportspress' ), 'desc' => __( 'Paginate', 'sportspress' ), 'id' => 'sportspress_event_blocks_paginated', 'default' => 'yes', 'type' => 'checkbox', ), array( 'title' => __( 'Limit', 'sportspress' ), 'id' => 'sportspress_event_blocks_rows', 'class' => 'small-text', 'default' => '10', 'desc' => __( 'events', 'sportspress' ), 'type' => 'number', 'custom_attributes' => array( 'min' => 1, 'step' => 1 ), ), array( 'type' => 'sectionend', 'id' => 'event_list_options' ), )); // End event settings } /** * Save settings */ public function save() { $settings = $this->get_settings(); SP_Admin_Settings::save_fields( $settings ); if ( isset( $_POST['sportspress_event_teams_delimiter'] ) ) update_option( 'sportspress_event_teams_delimiter', $_POST['sportspress_event_teams_delimiter'] ); } /** * Delimiter settings * * @access public * @return void */ public function delimiter_setting() { $selection = get_option( 'sportspress_event_teams_delimiter', 'vs' ); $limit = get_option( 'sportspress_event_teams', 2 ); $example = str_repeat( __( 'Team', 'sportspress' ) . ' %1$s ', $limit ); $example = rtrim( $example, ' %1$s ' ); ?>