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' => __( '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' => __( 'Teams', 'sportspress' ), 'desc' => __( 'Display logos', 'sportspress' ), 'id' => 'sportspress_event_show_logos', 'default' => 'yes', 'type' => 'checkbox', ), array( 'title' => __( 'Venue', 'sportspress' ), 'desc' => __( 'Display maps', 'sportspress' ), 'id' => 'sportspress_event_show_maps', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', ), array( 'desc' => __( 'Link venues', 'sportspress' ), 'id' => 'sportspress_event_link_venues', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end', ), array( 'title' => __( 'Players', 'sportspress' ), 'desc' => __( 'Display players', 'sportspress' ), 'id' => 'sportspress_event_show_players', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', ), array( 'desc' => __( 'Link players', 'sportspress' ), 'id' => 'sportspress_event_link_players', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end', ), array( 'title' => __( 'Staff', 'sportspress' ), 'desc' => __( 'Display staff', 'sportspress' ), 'id' => 'sportspress_event_show_staff', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', ), array( 'desc' => __( 'Link staff', 'sportspress' ), 'id' => 'sportspress_event_link_staff', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end', ), array( 'type' => 'sectionend', 'id' => 'event_options' ), array( 'title' => __( 'Calendars', 'sportspress' ), 'type' => 'title', 'id' => 'calendar_options' ), array( 'title' => __( 'Teams', 'sportspress' ), 'desc' => __( 'Link teams', 'sportspress' ), 'id' => 'sportspress_calendar_link_teams', 'default' => 'no', 'type' => 'checkbox', ), array( 'title' => __( 'Venues', 'sportspress' ), 'desc' => __( 'Link venues', 'sportspress' ), 'id' => 'sportspress_calendar_link_venues', 'default' => 'yes', 'type' => 'checkbox', ), array( 'title' => __( 'Pagination', 'sportspress' ), 'desc' => __( 'Paginate', 'sportspress' ), 'id' => 'sportspress_calendar_paginated', 'default' => 'yes', 'type' => 'checkbox', ), array( 'title' => __( 'Limit', 'sportspress' ), 'id' => 'sportspress_calendar_rows', 'class' => 'small-text', 'default' => '10', 'desc' => __( 'events', 'sportspress' ), 'type' => 'number', 'custom_attributes' => array( 'min' => 1, 'step' => 1 ), ), array( 'type' => 'sectionend', 'id' => 'calendar_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 ' ); ?>