entry[0]; $responseObj = json_decode($json_response, true); if (isset($responseObj['error']['errors'][0]['reason'])) $validateString = $responseObj['error']['errors'][0]['reason']; if($validateString == "keyInvalid") return false; else return true; } // Add administrations notices function mmPlaypops_Admin_Notice() { // Get settings $settings = get_option('playpops_general_settings'); // -------------------------------------- // Check for key // -------------------------------------- // Check if variable is empty first to avoid notices if(isset($settings['playpops_youtube_key'])) { $mmPlaypopsKey = $settings['playpops_youtube_key']; // Check if the key is valid if(!$this->mmValidateKey($mmPlaypopsKey)) echo '

PlayPops for Wordpress : Invalid Key. Obtain your Playpops Key by signing up at Playpops Keys

'; } else { // $defaultSettings['playpops_header_color'] = "#6495ED"; echo '

PlayPops for Wordpress : Obtain your Playpops Key by signing up at Playpops Keys

'; } // -------------------------------------- // Check for facebook url // -------------------------------------- // Check if variable is empty first to avoid notices if(empty($settings['playpops_url'])) { // $defaultSettings['playpops_header_color'] = "#6495ED"; echo '

PlayPops for Wordpress : Enter your Facebook Page URL before enabling PlayPops in your Page or Post

'; } // -------------------------------------- // Check for Custom header Length // -------------------------------------- // Check if variable is empty first to avoid notices if(isset($settings['playpops_header'])) { $playpops_header = $settings['playpops_header']; if (strlen($playpops_header) > 60) { // $defaultSettings['playpops_header_color'] = "#6495ED"; echo '

PlayPops for Wordpress : Your Custom Header is longer than 52 characters. Please, reduce it to accordingly.

'; } } } /* Loads both the general and advanced settings from * the database into their respective arrays. Uses * array_merge to merge with default values if they're * missing. */ function mmLoad_Settings() { $this->general_settings = (array) get_option( $this->general_settings_key ); // Merge with defaults $this->general_settings = array_merge( array( 'general_option' => 'General value' ), $this->general_settings ); } /* Registers the general settings via the Settings API, * appends the setting to the tabs array of the object. */ function mmRegister_general_settings() { $this->plugin_settings_tabs[$this->general_settings_key] = __('General', 'wpytp'); register_setting( $this->general_settings_key, // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields() $this->general_settings_key // The name of an option to sanitize and save. ); // register the section add_settings_section( 'section_general', // ID to identify this section and to register options __('PlayPops for WordPress Settings', 'wpytp'), // Title to be displayed on the administration page array( &$this, 'mmSection_General_Desc' ), // Callback used to render the description of the section $this->general_settings_key ); // Page on which to add this section of options // ------------------------------------------- // Fields // -------------------------------------------- // youtube api secret add_settings_field( 'playpops_youtube_key', // id: name of the array index __('Playpops API Key:', 'wpytp'), // title: label array( &$this, 'mmField_Playpops_Key' ), // callback: funtion $this->general_settings_key, 'section_general' ); // page: The menu page on which to display this field. // facebook page url add_settings_field( 'playpops_url', // name of the array index __('Facebook Page Url:', 'wpytp'), // title label array( &$this, 'mmField_Playpops_Url' ), // callback funtion $this->general_settings_key, 'section_general' ); // The menu page on which to display this field. // header custom color add_settings_field( 'playpops_header_color', __('Custom Header Color:', 'wpytp'), array( &$this, 'mmField_Playpops_Header_Color' ), $this->general_settings_key, 'section_general' ); // custom header add_settings_field( 'playpops_header', __('Custom Header:', 'wpytp') , array( &$this, 'mmField_Playpops_Header' ), $this->general_settings_key, 'section_general' ); // skip message add_settings_field( 'playpops_skip_message', __('Custom Skip Message:', 'wpytp') , array( &$this, 'mmField_Playpops_Skip_Message' ), $this->general_settings_key, 'section_general' ); // transparency add_settings_field( 'playpops_transparency', __('Popup Transparency:','wpytp') , array( &$this, 'mmField_Playpops_Transparency' ), $this->general_settings_key, 'section_general' ); // popup type add_settings_field( 'playpops_popuptype', __('Popup Type:', 'wpytp') , array( &$this, 'mmField_Playpops_Popuptype' ), $this->general_settings_key, 'section_general' ); // skip message add_settings_field( 'playpops_sharemsg', __('Custom Share Message:', 'wpytp') , array( &$this, 'mmField_Playpops_Sharemsg' ), $this->general_settings_key, 'section_general' ); // like or share } /* ------------------------------------------------------------------------------------------------ * The following methods provide descriptions * for their respective sections, used as callbacks * with add_settings_section --------------------------------------------------------------------------------------------------- */ function mmSection_General_Desc() { //echo 'General section description goes here.'; } /* General Option field callback, renders a * text input, note the name and value. */ function mmField_Playpops_Key() { ?> (opacity) general_settings['playpops_popuptype'])) $valuetype = esc_attr($this->general_settings['playpops_popuptype']); // ** lite version only $valuetype = "Lite"; // Check the correct value of the radio if ($valuetype == "Share") { $optionshare = "checked"; $optionlike = ""; } else { $optionshare = ""; $optionlike = "checked"; } ?> >Like
>Share (This option is not available in Lite version) plugin_options_key, array( &$this, 'mmPlugin_options_page' ) ); } /* Plugin Options page rendering goes here, checks * for active tab and replaces key with the related * settings key. Uses the mmPlugin_options_tabs method * to render the tabs. */ function mmPlugin_options_page() { $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->general_settings_key; ?>
mmPlugin_options_tabs(); ?>
general_settings_key; screen_icon(); echo ''; } }; // end of object // Initialize the plugin add_action( 'plugins_loaded', create_function( '', '$settings_api_tabs_playpops_plugin = new Settings_API_Tabs_Wpytp_Plugin;' ) );