'; echo '' . esc_html( $this->label ) . ''; if ( !empty( $this->description ) ) { echo '' . $this->description . ''; } echo '
'; echo ''; echo 'input_attrs(); $this->link(); echo '>'; echo '0'; echo ''; echo '
'; echo ''; } } } /*====== Toggle ======*/ if ( class_exists( 'WP_Customize_Control' ) ) { class Bianco_Customizer_Toggle_Control extends WP_Customize_Control { public $type = 'toggle'; public function render_content() { echo ''; } } } /*====== Radio Image ======*/ if ( class_exists( 'WP_Customize_Control' ) ) { class Bianco_Customize_Control_Radio_Image extends WP_Customize_Control { public $type = 'radio-image'; public function enqueue() { wp_enqueue_script( 'jquery-ui-button' ); } public function to_json() { parent::to_json(); foreach ( $this->choices as $value => $args ) { $this->choices[ $value ]['url'] = esc_url( sprintf( $args['url'], get_template_directory_uri(), get_stylesheet_directory_uri() ) ); $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['value'] = $this->value(); $this->json['id'] = $this->id; } } public function content_template() { ?> <# if ( ! data.choices ) { return; } #> <# if ( data.label ) { #> {{ data.label }} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #>
<# for ( key in data.choices ) { #> checked="checked" <# } #> /> <# } #>
fonts ) { if ( is_array( $this->fonts ) ) { $fonts = $this->fonts; } else { return; } } else { $fonts = $this->bianco_get_fonts(); if ( ! $fonts ) { return; } } if ( ! empty( $this->label ) ) { echo '' . esc_html( $this->label ) . ''; } if ( ! empty( $this->description ) ) { echo '' . esc_html( $this->description ) . ''; } echo ''; } private function bianco_get_fonts() { $api_key = $this->api_key; $cache_time = DAY_IN_SECONDS * $this->cache_time; if ( ! $api_key ) { return null; } if ( ! get_transient( 'bianco_google_fonts' ) ) { $cloud_url = 'https://www.googleapis.com/webfonts/v1/webfonts?key=' . $api_key; $local_url = get_template_directory_uri() . '/assets/fonts/google-fonts/google-fonts.json?ver=' . BIANCO_THEME_VERSION; $cloud_data = wp_remote_get( $cloud_url, array( 'sslverify' => false ) ); $local_data = wp_remote_get( $local_url, array( 'sslverify' => false ) ); if ( ! is_wp_error( $cloud_data ) ) { $content = json_decode( $cloud_data['body'] ); if ( isset( $content->error ) ) { if ( ! is_wp_error( $local_data ) ) { $content = json_decode( $local_data['body'] ); } else { return null; } } } else { if ( ! is_wp_error( $local_data ) ) { $content = json_decode( $local_data['body'] ); } else { return null; } } set_transient( 'bianco_google_fonts', $content, $cache_time ); } if ( ! get_transient( 'bianco_popular_google_fonts' ) ) { $cloud_url = 'https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key=' . $api_key; $local_url = get_template_directory_uri() . '/assets/fonts/google-fonts/google-fonts-popular.json?ver=' . BIANCO_THEME_VERSION; $cloud_data = wp_remote_get( $cloud_url, array( 'sslverify' => false ) ); $local_data = wp_remote_get( $local_url, array( 'sslverify' => false ) ); if ( ! is_wp_error( $cloud_data ) ) { $content = json_decode( $cloud_data['body'] ); if ( isset( $content->error ) ) { if ( ! is_wp_error( $local_data ) ) { $content = json_decode( $local_data['body'] ); } else { return null; } } } else { if ( ! is_wp_error( $local_data ) ) { $content = json_decode( $local_data['body'] ); } else { return null; } } set_transient( 'bianco_popular_google_fonts', $content, $cache_time ); } if ( 'all' == $this->amount ) { $content = get_transient( 'bianco_google_fonts' ); return $content->items; } else { $content = get_transient( 'bianco_popular_google_fonts' ); return array_slice( $content->items, 0, $this->amount ); } } } } add_action( 'customize_register', 'bianco_register_customizer_control_google_fonts', 0 ); } /*====== Sidebar Dropdown ======*/ if ( class_exists( 'WP_Customize_Control' ) ) { class Bianco_Sidebar_Dropdown_Custom_Control extends WP_Customize_Control { public $type = 'sidebar_dropdown'; public function render_content() { echo ''; } } } /*====== Social Media ======*/ function bianco_social_media_array_filter() { $social_sites = array( 'facebook' => 'bianco_facebook_url', 'twitter' => 'bianco_twitter_url', 'google-plus' => 'bianco_googleplus_url', 'pinterest' => 'bianco_pinterest_url', 'linkedin' => 'bianco_linkedin_url', 'youtube' => 'bianco_youtube_url', 'vimeo' => 'bianco_vimeo_url', 'tumblr' => 'bianco_tumblr_url', 'instagram' => 'bianco_instagram_url', 'flickr' => 'bianco_flickr_url', 'dribbble' => 'bianco_dribbble_url', 'reddit' => 'bianco_reddit_url', 'soundcloud' => 'bianco_soundcloud_url', 'spotify' => 'bianco_spotify_url', 'yahoo' => 'bianco_yahoo_url', 'behance' => 'bianco_behance_url', 'codepen' => 'bianco_codepen_url', 'delicious' => 'bianco_delicious_url', 'stumbleupon' => 'bianco_stumbleupon_url', 'deviantart' => 'bianco_deviantart_url', 'digg' => 'bianco_digg_url', 'github' => 'bianco_github_url', 'medium' => 'bianco_medium_url', 'steam' => 'bianco_steam_url', 'vk' => 'bianco_vk_url', '500px' => 'bianco_500px_url', 'foursquare' => 'bianco_foursquare_url', 'slack' => 'bianco_slack_url', 'whatsapp' => 'bianco_whatsapp_url', 'skype' => 'bianco_skype_url', 'twitch' => 'bianco_twitch_url', 'paypal' => 'bianco_paypal_url', 'rss' => 'bianco_rss_url', 'custom-url' => 'bianco_custom_url', ); return apply_filters( 'bianco_social_media_array_filter', $social_sites ); } function bianco_social_share_array_filter() { $social_sites = array( 'facebook' => 'bianco_facebook_share', 'twitter' => 'bianco_twitter_share', 'google-plus' => 'bianco_googleplus_share', 'pinterest' => 'bianco_pinterest_share', 'linkedin' => 'bianco_linkedin_share', 'tumblr' => 'bianco_tumblr_share', 'reddit' => 'bianco_reddit_share', 'delicious' => 'bianco_delicious_share', 'stumbleupon' => 'bianco_stumbleupon_share', 'whatsapp' => 'bianco_whatsapp_share', 'mail' => 'bianco_mail_share', ); return apply_filters( 'bianco_social_share_array_filter', $social_sites ); }