| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | namespace lsx\sharing\classes\admin; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Houses the functions for the Settings page. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @package lsx-sharing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | class Settings { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | 	 * Holds class instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 	 * @since 1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	 * @var      object \lsx\sharing\classes\admin\Settings() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	protected static $instance = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	 * Contructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	public function __construct() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 		add_action( 'lsx_sharing_settings_page', array( $this, 'configure_general_fields' ), 15, 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 		add_action( 'lsx_sharing_settings_page', array( $this, 'configure_archive_fields' ), 15, 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	 * Return an instance of this class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	 * @since 1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 	 * @return    object \lsx\sharing\classes\admin\Settings()    A single instance of this class. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 36 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  | 	public static function get_instance() { | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  | 		// If the single instance hasn't been set, set it now. | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  | 		if ( null == self::$instance ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  | 			self::$instance = new self(); | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  | 		return self::$instance; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	 * Configure fields for the Settings page. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	public function register_settings_page() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		$args = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 			'id'           => 'lsx_sharing_settings', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 			'title'        => '<h1>' . esc_html__( 'LSX Sharing Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SHARING_VER . '</span></h1>', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 			'menu_title'   => esc_html__( 'LSX Sharing', 'search' ), // Falls back to 'title' (above). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 			'object_types' => array( 'options-page' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 			'option_key'   => 'lsx-sharing-settings', // The option key and admin menu page slug. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 			'parent_slug'  => 'options-general.php', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 			'capability'   => 'manage_options', // Cap required to view options-page. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		$cmb  = new_cmb2_box( $args ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		do_action( 'lsx_sharing_settings_page', $cmb ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	 * Enqueue JS and CSS. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 	public function assets( $hook ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 		wp_enqueue_script( 'lsx-sharing-admin', LSX_SHARING_URL . 'assets/js/src/lsx-sharing-admin.js', array( 'jquery' ), LSX_SHARING_VER, true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 		wp_enqueue_style( 'lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	 * Enable Business Directory Search settings only if LSX Search plugin is enabled. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	 * @return  void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 	public function configure_general_fields( $cmb ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 		$global_args = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			'title' => __( 'Global', 'lsx-search' ), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 			'desc'  => esc_html__( 'Control the sharing WordPress post types.', 'lsx-search' ), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 		$this->get_fields( $cmb, 'global', $global_args ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	 * Enable Sharing settings only if LSX Search plugin is enabled. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 	 * @param object $cmb The CMB2() class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 	 * @param string $position either top of bottom. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	public function configure_archive_fields( $cmb ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 		$archives       = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 		$post_type_args = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 			'public' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 		$post_types     = get_post_types( $post_type_args ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 		if ( ! empty( $post_types ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 			foreach ( $post_types as $post_type_key => $post_type_value ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 				switch ( $post_type_key ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 					case 'post': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 						$page_url      = home_url(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 						$page_title    = __( 'Home', 'lsx-search' ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 						$show_on_front = get_option( 'show_on_front' ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 						if ( 'page' === $show_on_front ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 							$page_for_posts = get_option( 'page_for_posts' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 							if ( '' !== $page_for_posts ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 								$page_title   = get_the_title( $page_for_posts ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 								$page_url     = get_permalink( $page_for_posts ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 							} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 						} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 						$description = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 							/* translators: %s: The subscription info */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> posts.', 'lsx-search' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 							$page_url, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 							$page_title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 						); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 						$archives[ $post_type_key ] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 							'title' => __( 'Blog', 'lsx-search' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 							'desc'  => $description, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 						); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 						break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 					case 'product': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 						$page_url = home_url(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 						$page_title    = __( 'Shop', 'lsx-search' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 						if ( function_exists( 'wc_get_page_id' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 							$shop_page  = wc_get_page_id( 'shop' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 							$page_url   = get_permalink( $shop_page ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 							$page_title = get_the_title( $shop_page ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 						} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 						$description = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 							/* translators: %s: The subscription info */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> product pages.', 'lsx-search' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 							$page_url, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 							$page_title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 						); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 						$archives[ $post_type_key ] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 							'title' => __( 'Shop', 'lsx-search' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 							'desc'  => $description, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 						); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 						break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 					case 'page': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 					case 'attachment': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 					case 'forum': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 					case 'topic': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 					case 'lesson': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 					case 'quiz': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 					case 'question': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 					case 'reply': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 					case 'popup': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 					case 'sensei_message': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 					case 'envira': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 					case 'soliloquy': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 					case 'certificate_template': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 					case 'certificate': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 					case 'project': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 						break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 					default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 						$temp_post_type = get_post_type_object( $post_type_key ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 						if ( ! is_wp_error( $temp_post_type ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 							$page_url    = get_post_type_archive_link( $temp_post_type->name ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 							$description = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 								/* translators: %s: The subscription info */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 								__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> singles.', 'lsx-search' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 								$page_url, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 								$temp_post_type->label | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 							); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 							$archives[ $post_type_key ] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 								'title' => $temp_post_type->label, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 								'desc'  => $description, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 							); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 						} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 						break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 		if ( ! empty( $archives ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 			foreach ( $archives as $archive_key => $archive_args ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 				$this->get_fields( $cmb, $archive_key, $archive_args ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 	 * Gets the sharing fields and loops through them. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 	 * @param object $cmb | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 	 * @param string $section | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 	 * @param array $args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 	public function get_fields( $cmb, $section, $args ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 		$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 			array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 				'id'          => 'settings_' . $section . '_sharing', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 				'type'        => 'title', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 				'name'        => $args['title'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 				'default'     => $args['title'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 				'description' => $args['desc'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 			) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 		if ( 'global' === $section ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 			$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 				array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 					'name'        => esc_html__( 'Disable all', 'lsx-sharing' ), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 					'id'          => $section . '_disable_all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 					'description' => esc_html__( 'Disable all share buttons on the site', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 					'type'        => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 				) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 			$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 				array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 					'name'        => esc_html__( 'Disable', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 					'id'          => $section . '_disable_pt', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 					'description' => esc_html__( 'Disable the share buttons on this post type', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 					'type'        => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 				) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 		$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 			array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 				'name'        => esc_html__( 'Label text', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 				'id'          => $section . '_label_text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 				'description' => esc_html__( 'A default label for the sharing.', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 				'type'        => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 			) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'facebook' ) ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 			$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 				array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 					'name'        => esc_html__( 'Disable Facebook', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 					'id'          => $section . '_disable_facebook', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 					'description' => esc_html__( 'Disable Facebook share button.', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 					'type'        => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 				) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'twitter' ) ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 			$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 				array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 					'name'        => esc_html__( 'Disable Twitter', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 					'id'          => $section . '_disable_twitter', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 					'description' => esc_html__( 'Disable Twitter share button.', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 					'type'        => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 				) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 		if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled( 'global', 'pinterest' ) ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  | 			$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 				array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 					'name'        => esc_html__( 'Disable Pinterest', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 					'id'          => $section . '_disable_pinterest', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | 					'description' => esc_html__( 'Disable Pinterest button.', 'lsx-sharing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 					'type'        => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 				) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 		do_action( 'lsx_sharing_settings_section', $cmb, $section ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  | 		$cmb->add_field( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 			array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 				'id'   => $section . '_title_closing', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 				'type' => 'tab_closing', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 			) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 272 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 273 |  |  |  |