/**
 * Get a setting from the settings API.
 *
 * @param mixed $option
 * @return string
 */
function wpclubmanager_settings_get_option($option_name, $default = '')
{
    if (!class_exists('WPCM_Admin_Settings')) {
        include 'class-wpcm-admin-settings.php';
    }
    return WPCM_Admin_Settings::get_option($option_name, $default);
}
 /**
  * Save settings
  */
 public function save()
 {
     global $current_section;
     $settings = $this->get_settings();
     WPCM_Admin_Settings::save_fields($settings);
     if ($current_section) {
         do_action('wpclubmanager_update_options_' . $this->id . '_' . $current_section);
     }
 }
 /**
  * Save settings
  */
 public function save()
 {
     if (isset($_POST['wpcm_sport']) && !empty($_POST['wpcm_sport']) && get_option('wpcm_sport', null) != $_POST['wpcm_sport']) {
         $sport = WPCM()->sports->{$_POST}['wpcm_sport'];
         WPCM_Admin_Settings::configure_sport($sport);
         update_option('_wpcm_needs_welcome', 0);
     } elseif (isset($_POST['wpcm_primary_result'])) {
         update_option('wpcm_primary_result', $_POST['wpcm_primary_result']);
     }
     $settings = $this->get_settings();
     WPCM_Admin_Settings::save_fields($settings);
 }
 /**
  * Include the settings page classes
  */
 public static function get_settings_pages()
 {
     if (empty(self::$settings)) {
         $settings = array();
         include_once 'settings/class-wpcm-settings-page.php';
         $settings[] = (include 'settings/class-wpcm-settings-general.php');
         $settings[] = (include 'settings/class-wpcm-settings-players.php');
         $settings[] = (include 'settings/class-wpcm-settings-staff.php');
         $settings[] = (include 'settings/class-wpcm-settings-matches.php');
         $settings[] = (include 'settings/class-wpcm-settings-standings.php');
         $settings[] = (include 'settings/class-wpcm-settings-licenses.php');
         self::$settings = apply_filters('wpclubmanager_get_settings_pages', $settings);
     }
     return self::$settings;
 }
 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     WPCM_Admin_Settings::save_fields($settings);
 }
 /**
  * Default options
  *
  * Sets up the default options used on the settings page
  *
  * @access public
  */
 private static function create_options()
 {
     // Include settings so that we can run through defaults
     include_once 'admin/class-wpcm-admin-settings.php';
     $settings = WPCM_Admin_Settings::get_settings_pages();
     foreach ($settings as $section) {
         foreach ($section->get_settings() as $value) {
             if (isset($value['default']) && isset($value['id'])) {
                 $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
                 add_option($value['id'], $value['default'], '', $autoload ? 'yes' : 'no');
             }
         }
     }
     if (!get_option('wpclubmanager_installed')) {
         // Configure default sport
         $sport = 'soccer';
         $options = wpcm_get_sport_presets();
         WPCM_Admin_Settings::configure_sport($options[$sport]);
         update_option('wpcm_sport', $sport);
         update_option('wpclubmanager_installed', 1);
     }
 }
    /**
     * Output the getting started screen
     */
    public function getting_started_screen()
    {
        // Save settings
        if (isset($_POST['wpcm_sport']) && !empty($_POST['wpcm_sport']) && get_option('wpcm_sport', null) != $_POST['wpcm_sport']) {
            $sport = WPCM()->sports->{$_POST}['wpcm_sport'];
            WPCM_Admin_Settings::configure_sport($sport);
            update_option('wpcm_sport', $_POST['wpcm_sport']);
        }
        if (isset($_POST['wpcm_default_club']) && !empty($_POST['wpcm_default_club']) && get_option('wpcm_default_club', null) != $_POST['wpcm_default_club']) {
            update_option('wpcm_default_club', $_POST['wpcm_default_club']);
        }
        ?>
		<div class="wrap about-wrap">

			<?php 
        $this->intro();
        ?>

			<?php 
        $this->tabs();
        ?>

			<p class="about-description"><?php 
        _e('WP Club Manager has been built with the focus on simplicity and ease of use so it won\'t be long before your club website is up and ready for action.', 'wp-club-manager');
        ?>
</p>

			<div id="message" class="updated wpclubmanager-message">
				<p><strong><?php 
        _e('Your settings have been saved.', 'wp-club-manager');
        ?>
</strong></p>
			</div>

			<div class="changelog">
				<form method="post" id="mainform" action="" enctype="multipart/form-data">
					<h3><?php 
        _e('Quick and Easy Setup', 'wp-club-manager');
        ?>
</h3>

					<div class="feature-section">

						<img src="<?php 
        echo WPCM_URL . 'assets/images/welcome/12-wpcm-settings.png';
        ?>
" class="wpcm-welcome-screenshots"/>

						<h4><?php 
        _e('1. Choose Your Sport', 'wp-club-manager');
        ?>
</h4>
						<p><?php 
        printf(__('Take your pick from 13 supported team sports. Each sport has preset player positions and statistics so it\'s a good idea to set this up before anything else. To select your default sport goto <a href="%s">General Settings</a> or use the form below.', 'wp-club-manager'), admin_url('admin.php?page=wpcm-settings'));
        ?>
</p>
						<p>
							<?php 
        $sport_options = wpcm_get_sport_options();
        $class = 'chosen_select' . (is_rtl() ? ' chosen-rtl' : '');
        $settings = array(array('id' => 'wpcm_sport', 'default' => 'soccer', 'type' => 'select', 'class' => $class, 'options' => $sport_options));
        WPCM_Admin_Settings::output_fields($settings);
        ?>
							<input name="save" class="button-primary" type="submit" value="<?php 
        _e('Save changes', 'wp-club-manager');
        ?>
" />
			        		<input type="hidden" name="subtab" id="last_tab" />
				        	<?php 
        wp_nonce_field('wpclubmanager-settings');
        ?>
						</p>

						<h4><?php 
        _e('2. Create Your Club', 'wp-club-manager');
        ?>
</h4>
						<p><?php 
        printf(__('The Clubs menu is where you create and edit clubs, including your own and create Competitions, Seasons, Teams and Venues. To create a club, click <em><a href="%s">Add New</a></em> and then fill out the club details. <strong>Your club will need to be set as the Default Club in <a href="%s">General Settings</a>.</strong> Alternatively, you can enter your default club in the box below.', 'wp-club-manager'), admin_url('post-new.php?post_type=wpcm_club'), admin_url('admin.php?page=wpcm-settings'));
        ?>
</p>
						<?php 
        if (isset($_POST['wpcm_default_club'])) {
            $title = $_POST['wpcm_default_club'];
            $post = array('post_title' => $title, 'post_type' => 'wpcm_club', 'post_status' => 'publish');
            $wpcm_default_club = wp_insert_post($post);
            update_option('wpcm_default_club', $wpcm_default_club);
        } else {
            $title = '';
        }
        if (get_option('wpcm_default_club') == null) {
            ?>

							<p>
								<?php 
            $settings = array(array('id' => 'wpcm_default_club', 'default' => '', 'type' => 'text'));
            WPCM_Admin_Settings::output_fields($settings);
            ?>
								<input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', 'wp-club-manager');
            ?>
" />
								<input type="hidden" name="subtab" id="last_tab" />
								<?php 
            wp_nonce_field('wpclubmanager-settings');
            ?>
							</p>
						<?php 
        }
        ?>

						<h4><?php 
        _e('3. Seasons, Competitions and Teams', 'wp-club-manager');
        ?>
</h4>
						<p><?php 
        printf(__('Before adding your players and opposition clubs you should create <a href="%s">Competitions</a> and <a href="%s">Seasons</a>. If your club has more than one team, for example, firsts, reserves, youth team etc. you will need to create <a href="%s">Teams</a> for each one. When creating players or adding more clubs you will need to choose the competitions, seasons and teams which they compete in.', 'wp-club-manager'), admin_url('edit-tags.php?taxonomy=wpcm_comp&post_type=wpcm_club'), admin_url('edit-tags.php?taxonomy=wpcm_season&post_type=wpcm_club'), admin_url('edit-tags.php?taxonomy=wpcm_team&post_type=wpcm_club'));
        ?>
</p>
						<p><?php 
        _e('<strong>If you have already created your default club you will need to edit your club to add competitions, seasons and teams.</strong>', 'wp-club-manager');
        ?>
</p>

						<img src="<?php 
        echo WPCM_URL . 'assets/images/welcome/12-create-players.png';
        ?>
" class="wpcm-welcome-screenshots"/>

						<h4><?php 
        _e('4. Add Your Players', 'wp-club-manager');
        ?>
</h4>
						<p><?php 
        printf(__('Now you should be ready to add your clubs players. The Players Menu is where you can create and edit your clubs players and player positions. To create a player, simply click <em><a href="%s">Add New</a></em> and then fill out the player details, including competitions, seasons and teams.', 'wp-club-manager'), admin_url('post-new.php?post_type=wpcm_player'));
        ?>
</p>

						<h4><?php 
        _e('5. Play A Match', 'wp-club-manager');
        ?>
</h4>
						<p><?php 
        printf(__('Now you should be ready to add your clubs players. The Players Menu is where you can create and edit your clubs players and player positions. To create a player, simply click <em><a href="%s">Add New</a></em> and then fill out the player details, including competitions, seasons and teams.', 'wp-club-manager'), admin_url('post-new.php?post_type=wpcm_match'));
        ?>
</p>
						<p><?php 
        printf(__('Don\'t forget to run through the <a href="%s">WP Club Manager settings</a> where you can set visibility options for player stats, set league standing options and loads more.', 'wp-club-manager'), admin_url('admin.php?page=wpcm-settings'));
        ?>
</p>

					</div>
				</form>
			</div>

			<div class="changelog">
				<h3><?php 
        _e('Need Help?', 'wp-club-manager');
        ?>
</h3>

				<div class="feature-section">

					<h4><?php 
        _e('Plugin Documentation', 'wp-club-manager');
        ?>
</h4>
					<p><?php 
        _e('If you need more help setting up WP Club Manager, using the shortcodes and widgets or customizing the plugin templates then visit our <a href="https://wpclubmanager.com/docs/">documentation</a>.', 'wp-club-manager');
        ?>
</p>

					<h4><?php 
        _e('Friendly Support', 'wpclubmanager');
        ?>
</h4>
					<p><?php 
        _e('We do our best to provide the best support we can. If you encounter a problem or have a question, post a question in the <a href="https://wpclubmanager.com/support">support forums</a>.', 'wp-club-manager');
        ?>
</p>

				</div>
			</div>

			<div class="changelog">
				<h3><?php 
        _e('Stay Up to Date', 'wp-club-manager');
        ?>
</h3>

				<div class="feature-section">

					<h4><?php 
        _e('Get Notified of New Extensions and Plugin Updates', 'wpclubmanager');
        ?>
</h4>
					<p><?php 
        _e('WP Club Manager is getting better every day with new features, extensions and themes being created. Stay in touch with the latest developments, newest extensions and get special offers by subscribing to our newsletter.', 'wp-club-manager');
        ?>
</p>
					<!-- Begin MailChimp Signup Form -->
					<div id="mc_embed_signup">
					<form action="//wpclubmanager.us1.list-manage.com/subscribe/post?u=5af3e709ddae81bdc7aa50610&amp;id=909adae053" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
						
						<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="Enter your email address" required>
					    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
					    <div style="position: absolute; left: -5000px;"><input type="text" name="b_5af3e709ddae81bdc7aa50610_909adae053" tabindex="-1" value=""></div>
					    <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
					</form>
					</div>

					<!--End mc_embed_signup-->

				</div>
			</div>

			<div class="return-to-dashboard">
				<a href="<?php 
        echo esc_url(admin_url(add_query_arg(array('page' => 'wpcm-settings'), 'admin.php')));
        ?>
"><?php 
        _e('Go to WP Club Manager Settings', 'wp-club-manager');
        ?>
</a>
			</div>
		</div>
		<?php 
    }
 /**
  * Init the settings page
  */
 public function settings_page()
 {
     include_once 'class-wpcm-admin-settings.php';
     WPCM_Admin_Settings::output();
 }