コード例 #1
0
 /**
  * Validate color picker hex values.
  *
  * Only run on the customizer. If any color scheme hex value is only 3-digits or contains an uppercase character
  * it can cause issues when changing color schemes. This function makes sure the hex value is 6-digits and contains
  * only lowercase characters.
  *
  * @since 0.2.0
  */
 public function validate_color_scheme_hex_codes()
 {
     /* Exit if not on the Customizer. */
     if (!WPGo_Utility::is_customizer()) {
         return;
     }
     foreach ($this->_wpgo_color_schemes as $cs_index => $color_scheme) {
         foreach ($color_scheme['default_colors'] as $col_index => $default_colors) {
             $dc = $default_colors;
             // so we can change it's value
             if (strlen($dc) == 4) {
                 $dc = $dc[0] . $dc[1] . $dc[1] . $dc[2] . $dc[2] . $dc[3] . $dc[3];
             }
             $this->_wpgo_color_schemes[$cs_index]['default_colors'][$col_index] = strtolower($dc);
         }
     }
 }
コード例 #2
0
 /**
  * Enqueue Dashicons on the front end if user not logged in.
  *
  * From WordPress 3.8 the Dashicons font is automatically enqueued on front end when user is logged in. However,
  * we still need this to be enqueued when not logged in.
  *
  * @since 0.2.0
  */
 public function enqueue_dashicons_font()
 {
     // enqueue if user NOT logged in, or logged in and we're on the theme customizer
     if (is_user_logged_in() && !WPGo_Utility::is_customizer()) {
         return;
     }
     // Dashicons
     $suffix = SCRIPT_DEBUG ? '' : '.min';
     wp_register_style('wpgo-dashicons', "/wp-includes/css/dashicons{$suffix}.css");
     wp_enqueue_style('wpgo-dashicons');
 }