<?php
/**
 *
 *
 * @link       http://gianmr.com
 * @since      1.0.0
 *
 * @package    kentooz_socializer
 * @subpackage kentooz_socializer/includes
 */

/**
 * The Settings definition of the plugin.
 *
 *
 * @package    Kentooz_Socializer
 * @subpackage kentooz_socializer/includes
 * @author     Gian Mokhammad Ramadhan <g14nblog@gmail.com>
 */
class Kentooz_Socializer_Settings_Definition {

	// @TODO: change plugin-name
	public static $plugin_name = 'kentooz-socializer';

	/**
	 * [apply_tab_slug_filters description]
	 *
	 * @param  array $default_settings [description]
	 *
	 * @return array                   [description]
	 */
	static private function apply_tab_slug_filters( $default_settings ) {

		$extended_settings[] = array();
		$extended_tabs       = self::get_tabs();

		foreach ( $extended_tabs as $tab_slug => $tab_desc ) {

			$options = isset( $default_settings[ $tab_slug ] ) ? $default_settings[ $tab_slug ] : array();

			$extended_settings[ $tab_slug ] = apply_filters( 'kentooz_socializer_settings_' . $tab_slug, $options );
		}

		return $extended_settings;
	}

	/**
	 * [get_default_tab_slug description]
	 * @return [type] [description]
	 */
	static public function get_default_tab_slug() {

		return key( self::get_tabs() );
	}

	/**
	 * Retrieve settings tabs
	 *
	 * @since    1.0.0
	 * @return    array    $tabs    Settings tabs
	 */
	static public function get_tabs() {

		$tabs                = array();
		$tabs['general_tab'] = __( 'General', self::$plugin_name );
		$tabs['style_tab']  = __( 'Visual', self::$plugin_name );

		return apply_filters( 'kentooz_socializer_settings_tabs', $tabs );
	}

	/**
	 * 'Whitelisted' kentooz_socializer settings, filters are provided for each settings
	 * section to allow extensions and other plugins to add their own settings
	 *
	 *
	 * @since    1.0.0
	 * @return    mixed    $value    Value saved / $default if key if not exist
	 */
	static public function get_settings() {

		$settings[] = array();

		$settings = array(
			'general_tab' => array(
				'general_tab_settings'       => array(
					'name' => '<strong>' . __( 'General', self::$plugin_name ) . '</strong>',
					'type' => 'header'
				),
				'kentooz-socializer-disable'	=> array(
					'name' => __( 'Disable', self::$plugin_name ),
					'desc' => __( 'Check this options if you want disable kentooz socializer.', self::$plugin_name ),
					'type' => 'checkbox'
				),
				'kentooz-socializer-position'  => array(
					'name'    => __( 'Position', self::$plugin_name ),
					'desc'    => __( 'Select position of share buttons. Default is bottom article. Kentooz socializer support shortcode, if you use shortcode please select this manual. Our shortcode for display social share button is [kentooz_socializer]', self::$plugin_name ),
					'options' => array(
						'top'   => __( "Top content", self::$plugin_name ),
						'bottom' => __( "Bottom content", self::$plugin_name ),
						'both'     => __( 'Top and bottom', self::$plugin_name ),
						'manual'     => __( 'Manual', self::$plugin_name )
					),
					'type'    => 'select',
					'std'  => __( 'bottom', self::$plugin_name )
				),
				'kentooz-socializer-twitteraccount' => array(
					'name' => 'Twitter Handdle',
					'desc' => __( 'Optional: Using your twitter username, e.g. \'Kentooz\' results in via @Kentooz', self::$plugin_name ),
					'type' => 'text'
				),
				'kentooz-socializer-defaultimage' => array(
					'name' => 'Default Image',
					'desc' => __( 'Please select default image if you have no image in your post, so this image will share in your social network. Default image is ' . plugins_url('images/default.jpg',plugin_dir_path( dirname( __FILE__ ) ) ), self::$plugin_name ),
					'type' => 'upload'
				),
				'opengraph_tab_settings'       => array(
					'name' => '<strong>' . __( 'Opengraph & Twitter Card', self::$plugin_name ) . '</strong>',
					'type' => 'header'
				),
				'kentooz-socializer-opengraph'	=> array(
					'name' => __( 'Enable', self::$plugin_name ),
					'desc' => __( 'Check this options if you want enable opengraph metadata and twitter card.', self::$plugin_name ),
					'type' => 'checkbox'
				),
				'kentooz-socializer-fbappid' => array(
					'name' => 'Facebook application id',
					'desc' => __( 'Fill with your facebook application id. To add a Facebook Comments Box you will need to create a Facebook App first. Go to https://developers.facebook.com/apps/ and create a new app. Enter a name and define the locale for the app. Default my facebook app id. 226875977396331', self::$plugin_name ),
					'type' => 'text',
					'std' => '226875977396331'
				),
			),
			'style_tab'  => array(
				'kentooz-socializer-disablecount'	=> array(
					'name' => __( 'Disable count share', self::$plugin_name ),
					'desc' => __( 'Check this if you want disable count number in your share buttons.', self::$plugin_name ),
					'type' => 'checkbox'
				),
				'kentooz-socializer-style' => array(
					'name'    => __( 'Style Buttons', self::$plugin_name ),
					'desc'    => __( 'Please select style share buttons, default is Flat style', self::$plugin_name ),
					'options' => array(
						'flat-style'   => __( plugins_url('images/flat_style.jpg',plugin_dir_path( dirname( __FILE__ ) ) ), self::$plugin_name ),
						'classic-style' => __( plugins_url('images/classic_style.jpg',plugin_dir_path( dirname( __FILE__ ) )), self::$plugin_name ),
						'plain-style'     => __( plugins_url('images/plain_style.jpg',plugin_dir_path( dirname( __FILE__ ) )), self::$plugin_name ),
						'default-style' => __( plugins_url('images/default_style.jpg',plugin_dir_path( dirname( __FILE__ ) )), self::$plugin_name )
					),
					'type'    => 'radio_image',
					'std'  => __( 'flat-style', self::$plugin_name )
				),			
				'kentooz-socializer-floatbar' => array(
					'name'    => __( 'Floating social bar', self::$plugin_name ),
					'desc'    => __( 'Please select floating social bar, disable, left or right floating social bar', self::$plugin_name ),
					'options' => array(
						'disable'   => __( "Disable", self::$plugin_name ),
						'left-floatingbar' => __( "Left floating bar", self::$plugin_name ),
						'right-floatingbar' => __( "Right floating bar", self::$plugin_name )
					),
					'std'    => 'disable',
					'type'    => 'radio'
				),	
				'kentooz-socializer-sharecountitle' => array(
					'name' => 'Share count title',
					'desc' => __( 'Change the text of the Share count title. Default is: Shares', self::$plugin_name ),
					'type' => 'text',
					'std'  => __( 'Shares', self::$plugin_name )
				),				
				'kentooz-socializer-fbtitle' => array(
					'name' => 'Facebook Button title',
					'desc' => __( 'Change the text of the facebook button text. Default is: Shares on facebook', self::$plugin_name ),
					'type' => 'text',
					'std'  => __( 'Shares on facebook', self::$plugin_name )
				),				
				'kentooz-socializer-twittertitle' => array(
					'name' => 'Twitter Button title',
					'desc' => __( 'Change the text of the twitter button text. Default is: Tweet on twitter', self::$plugin_name ),
					'type' => 'text',
					'std'  => __( 'Tweet on twitter', self::$plugin_name )
				)
			)
		);

		return self::apply_tab_slug_filters( $settings );
	}
}
