/**
  * Return an instance of this class.
  * 
  * @return    object    A single instance of this class.
  *
  * @since 1.2
  * @version 1.3.6
  * 
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 /**
  * Set Google Fonts API Key - Ajax Function
  * 
  * Checks WordPress nonce and upon successful validation
  * updates the Google API key.
  *
  * @since 1.2
  * @version 1.3.9
  * 
  */
 public function set_google_api_key()
 {
     // Check admin nonce for security
     check_ajax_referer('tt_font_edit_control_instance', 'tt_font_edit_control_instance_nonce');
     // Make sure user has the required access level
     if (!current_user_can('edit_theme_options')) {
         wp_die(-1);
     }
     if (isset($_POST['apiKey'])) {
         $apiKey = esc_attr($_POST['apiKey']);
         EGF_Font_Utilities::set_google_api_key($apiKey);
     }
     // Delete Font Transients
     EGF_Font_Utilities::delete_font_transients();
     wp_die();
 }
 /**
  * Load All Fonts in Customizer
  *
  * Loads the required fonts as a json object for the live
  * theme previewer and customizer. By enqueuing the fonts
  * on the screen we redice the number of ajax requests which
  * increases performance dramatically.
  * 
  * @return array complete list of fonts
  *
  * @since  1.3
  * @version 1.3.6
  */
 public function customize_load_all_fonts()
 {
     return EGF_Font_Utilities::get_all_fonts();
 }
 public function get_advanced_screen()
 {
     $api_key = EGF_Font_Utilities::get_google_api_key();
     $validity = EGF_Font_Utilities::is_valid_google_api_key($api_key) ? 'valid-key' : 'invalid-key';
     include_once plugin_dir_path(dirname(__FILE__)) . 'views/admin-page/advanced-screen.php';
 }
 /**
  * Get Font Weight Control
  *
  * Gets the font family select control. Preselects the 
  * appropriate font weight if is has been selected.
  *
  * @uses EGF_Font_Utilities::get_font() 	defined in includes\class-egf-font-utilities
  *
  * @since 1.2
  * @version 1.3.2
  * 
  */
 public function get_font_weight_control()
 {
     // Get values
     $this_value = $this->value();
     $font_id = isset($this_value['font_id']) ? $this_value['font_id'] : '';
     $font = EGF_Font_Utilities::get_font($font_id);
     $default_font_weight_style = $this->font_defaults['font_weight_style'];
     $font_weight_style = empty($this_value['font_weight_style']) ? $default_font_weight_style : $this_value['font_weight_style'];
     // Get control view
     include Easy_Google_Fonts::get_views_path() . '/customizer/controls/styles/font-weight.php';
 }
 /**
  * Get Font Weight Control
  *
  * Gets the font family select control. Preselects the 
  * appropriate font weight if is has been selected.
  *
  * @uses EGF_Font_Utilities::get_font() 	defined in includes\class-egf-font-utilities
  *
  * @since 1.2
  * @version 1.2.3
  * 
  */
 public function get_font_weight_control()
 {
     // Get values
     $this_value = $this->value();
     $font_id = isset($this_value['font_id']) ? $this_value['font_id'] : '';
     $font = EGF_Font_Utilities::get_font($font_id);
     $default_font_weight_style = $this->font_defaults['font_weight_style'];
     $font_weight_style = empty($this_value['font_weight_style']) ? $default_font_weight_style : $this_value['font_weight_style'];
     // Get control view
     include plugin_dir_path(dirname(__FILE__)) . '../views/customizer/controls/styles/font-weight.php';
 }