Exemplo n.º 1
0
 function customizer_compile_css($skinedSocial = false)
 {
     global $post;
     $options = get_option(EasySocialShareButtons::$plugin_settings_name);
     $is_active = isset($options['customizer_is_active']) ? $options['customizer_is_active'] : 'false';
     if (isset($post)) {
         $post_activate_customizer = get_post_meta($post->ID, 'essb_activate_customizer', true);
         if ($post_activate_customizer != '') {
             if ($post_activate_customizer == "yes") {
                 $is_active = "true";
             } else {
                 $is_active = "false";
             }
         }
     }
     if ($is_active == "true") {
         $this->custom_css_builder_executed = true;
         $global_bgcolor = isset($options['customizer_bgcolor']) ? $options['customizer_bgcolor'] : '';
         $global_textcolor = isset($options['customizer_textcolor']) ? $options['customizer_textcolor'] : '';
         $global_hovercolor = isset($options['customizer_hovercolor']) ? $options['customizer_hovercolor'] : '';
         $global_hovertextcolor = isset($options['customizer_hovertextcolor']) ? $options['customizer_hovertextcolor'] : '';
         $global_remove_bg_effects = isset($options['customizer_remove_bg_hover_effects']) ? $options['customizer_remove_bg_hover_effects'] : '';
         $css = "";
         // @since 2.0
         $customizer_totalbgcolor = ESSBOptionsHelper::optionsValue($options, 'customizer_totalbgcolor');
         $customizer_totalcolor = ESSBOptionsHelper::optionsValue($options, 'customizer_totalcolor');
         $customizer_totalnobgcolor = ESSBOptionsHelper::optionsValue($options, 'customizer_totalnobgcolor');
         $customizer_totalfontsize = ESSBOptionsHelper::optionsValue($options, 'customizer_totalfontsize');
         $customizer_totalfontsize_after = ESSBOptionsHelper::optionsValue($options, 'customizer_totalfontsize_after');
         if ($customizer_totalbgcolor != '') {
             $this->add_rule('.essb_totalcount { background: ' . $customizer_totalbgcolor . ' !important;} ');
         }
         if ($customizer_totalnobgcolor == "true") {
             $this->add_rule('.essb_totalcount { background: none !important;} ');
         }
         if ($customizer_totalcolor != '') {
             $this->add_rule('.essb_totalcount, .essb_totalcount .essb_t_nb:after { color: ' . $customizer_totalcolor . ' !important;} ');
         }
         if ($customizer_totalfontsize != '') {
             $this->add_rule('.essb_totalcount .essb_t_nb { font-size: ' . $customizer_totalfontsize . '!important; line-height:' . $customizer_totalfontsize . '!important;}');
         }
         if ($customizer_totalfontsize_after != '') {
             $this->add_rule('.essb_totalcount .essb_t_nb:after { font-size: ' . $customizer_totalfontsize_after . '!important; }');
         }
         if ($global_remove_bg_effects == "true") {
             $this->add_rule('.essb_links a:hover, .essb_links a:focus { background: none !important; }');
         }
         $essb_networks = $options['networks'];
         if ($global_bgcolor != '' || $global_textcolor != '' || $global_hovercolor != '' || $global_hovertextcolor != '') {
             foreach ($essb_networks as $k => $v) {
                 if ($v[0] == 1 || $v[0] == 0) {
                     $singleCss = "";
                     if ($global_bgcolor != '' || $global_textcolor != '') {
                         $singleCss .= '.essb_links .essb_link_' . $k . ' a { ';
                         if ($global_bgcolor != '') {
                             $singleCss .= 'background-color:' . $global_bgcolor . '!important;';
                         }
                         if ($global_textcolor != '') {
                             $singleCss .= 'color:' . $global_bgcolor . '!important;';
                         }
                         $singleCss .= '}';
                     }
                     if ($global_hovercolor != '' || $global_hovertextcolor != '') {
                         $singleCss .= '.essb_links .essb_link_' . $k . ' a:hover, .essb_links .essb_link_' . $k . ' a:focus { ';
                         if ($global_hovercolor != '') {
                             $singleCss .= 'background-color:' . $global_hovercolor . '!important;';
                         }
                         if ($global_hovertextcolor != '') {
                             $singleCss .= 'color:' . $global_hovertextcolor . '!important;';
                         }
                         $singleCss .= '}';
                     }
                     $this->add_rule($singleCss);
                 }
             }
         }
         // single network color customization
         foreach ($essb_networks as $k => $v) {
             if ($v[0] == 1) {
                 $network_bgcolor = isset($options['customizer_' . $k . '_bgcolor']) ? $options['customizer_' . $k . '_bgcolor'] : '';
                 $network_textcolor = isset($options['customizer_' . $k . '_textcolor']) ? $options['customizer_' . $k . '_textcolor'] : '';
                 $network_hovercolor = isset($options['customizer_' . $k . '_hovercolor']) ? $options['customizer_' . $k . '_hovercolor'] : '';
                 $network_hovertextcolor = isset($options['customizer_' . $k . '_hovertextcolor']) ? $options['customizer_' . $k . '_hovertextcolor'] : '';
                 $network_icon = isset($options['customizer_' . $k . '_icon']) ? $options['customizer_' . $k . '_icon'] : '';
                 $network_hovericon = isset($options['customizer_' . $k . '_hovericon']) ? $options['customizer_' . $k . '_hovericon'] : '';
                 $network_iconbgsize = isset($options['customizer_' . $k . '_iconbgsize']) ? $options['customizer_' . $k . '_iconbgsize'] : '';
                 $network_hovericonbgsize = isset($options['customizer_' . $k . '_hovericonbgsize']) ? $options['customizer_' . $k . '_hovericonbgsize'] : '';
                 $sigleCss = "";
                 if ($network_bgcolor != '' || $network_textcolor != '') {
                     $sigleCss .= '.essb_links .essb_link_' . $k . ' a { ';
                     if ($network_bgcolor != '') {
                         $sigleCss .= 'background-color:' . $network_bgcolor . '!important;';
                     }
                     if ($network_textcolor != '') {
                         $sigleCss .= 'color:' . $network_textcolor . '!important;';
                     }
                     $sigleCss .= '}';
                 }
                 if ($network_hovercolor != '' || $network_hovertextcolor != '') {
                     $sigleCss .= '.essb_links .essb_link_' . $k . ' a:hover, .essb_links .essb_link_' . $k . ' a:focus { ';
                     if ($network_hovercolor != '') {
                         $sigleCss .= 'background-color:' . $network_hovercolor . '!important;';
                     }
                     if ($network_hovertextcolor != '') {
                         $sigleCss .= 'color:' . $network_hovertextcolor . '!important;';
                     }
                     $sigleCss .= '}';
                 }
                 if ($network_icon != '') {
                     $sigleCss .= '.essb_links .essb_link_' . $k . ' .essb_icon { background: url("' . $network_icon . '") !important; }';
                     if ($network_iconbgsize != '') {
                         $sigleCss .= '.essb_links .essb_link_' . $k . ' .essb_icon { background-size: ' . $network_iconbgsize . '!important; }';
                     }
                 }
                 if ($network_hovericon != '') {
                     $sigleCss .= '.essb_links .essb_link_' . $k . ' a:hover .essb_icon { background: url("' . $network_hovericon . '") !important; }';
                     if ($network_hovericonbgsize != '') {
                         $sigleCss .= '.essb_links .essb_link_' . $k . ' a:hover .essb_icon { background-size: ' . $network_hovericonbgsize . '!important; }';
                     }
                 }
                 $this->add_rule($sigleCss);
             }
         }
     }
     $global_user_defined_css = isset($options['customizer_css']) ? $options['customizer_css'] : '';
     $global_user_defined_css = stripslashes($global_user_defined_css);
     if ($global_user_defined_css != '') {
         //$css .= $global_user_defined_css;
         $this->add_rule($global_user_defined_css);
     }
     if ($skinedSocial) {
         //$css .= ESSB_Skinned_Native_Button::generateStyleCustomizerCSS ( $options );
         $this->add_rule(ESSB_Skinned_Native_Button::generateStyleCustomizerCSS($options), 'essb_native_skin');
     }
 }
Exemplo n.º 2
0
 function handle_essb_like_buttons_shortcode($atts)
 {
     global $post;
     $atts = shortcode_atts(array('facebook' => 'false', 'facebook_url' => '', 'facebook_width' => '', 'facebook_skinned_text' => '', 'facebook_skinned_width' => '', 'facebook_follow' => 'false', 'facebook_follow_url' => '', 'facebook_follow_width' => '', 'facebook_follow_skinned_text' => '', 'facebook_follow_skinned_width' => '', 'twitter_follow' => 'false', 'twitter_follow_user' => '', 'twitter_follow_skinned_text' => '', 'twitter_follow_skinned_width' => '', 'twitter_tweet' => 'false', 'twitter_tweet_message' => '', 'twitter_tweet_skinned_text' => '', 'twitter_tweet_skinned_width' => '', 'google' => 'false', 'google_url' => '', 'google_skinned_text' => '', 'google_skinned_width' => '', 'google_follow' => 'false', 'google_follow_url' => '', 'google_follow_skinned_text' => '', 'google_follow_skinned_width' => '', 'vk' => 'false', 'vk_skinned_text' => '', 'vk_skinned_width' => '', 'youtube' => 'false', 'youtube_chanel' => '', 'youtube_skinned_text' => '', 'youtube_skinned_width' => '', 'linkedin' => 'false', 'linkedin_company' => '', 'linkedin_skinned_text' => '', 'linkedin_skinned_width' => '', 'pinterest_pin' => 'false', 'pinterest_pin_skinned_text' => '', 'pinterest_pin_skinned_width' => '', 'pinterest_follow' => 'false', 'pinterest_follow_display' => '', 'pinterest_follow_url' => '', 'pinterest_follow_skinned_text' => '', 'pinterest_follow_skinned_width' => '', 'skinned' => 'false', 'skin' => 'flat', 'message' => '', 'align' => '', 'counters' => 'false', 'hide_mobile' => 'false', 'order' => ''), $atts);
     $hide_mobile = isset($atts['hide_mobile']) ? $atts['hide_mobile'] : '';
     $hide_mobile = EasySocialShareButtons_ShortcodeHelper::unified_true($hide_mobile);
     if ($hide_mobile == "true" && $this->isMobile()) {
         return "";
     }
     $order = isset($atts['order']) ? $atts['order'] : '';
     // @ since 2.0 order of buttons
     if ($order == '') {
         $order = 'facebook,facebook_follow,twitter_follow,twitter_tweet,google,google_follow,vk,youtube,linkedin,pinterest_pin,pinterest_follow';
     }
     $align = isset($atts['align']) ? $atts['align'] : '';
     $facebook = isset($atts['facebook']) ? $atts['facebook'] : '';
     $facebook_url = isset($atts['facebook_url']) ? $atts['facebook_url'] : '';
     $facebook_width = isset($atts['facebook_width']) ? $atts['facebook_width'] : '';
     $facebook_skinned_text = isset($atts['facebook_skinned_text']) ? $atts['facebook_skinned_text'] : '';
     $facebook_skinned_width = isset($atts['facebook_skinned_width']) ? $atts['facebook_skinned_width'] : '';
     $facebook_follow = isset($atts['facebook_follow']) ? $atts['facebook_follow'] : '';
     $facebook_follow_url = isset($atts['facebook_follow_url']) ? $atts['facebook_follow_url'] : '';
     $facebook_follow_width = isset($atts['facebook_follow_width']) ? $atts['facebook_follow_width'] : '';
     $facebook_follow_skinned_text = isset($atts['facebook_follow_skinned_text']) ? $atts['facebook_follow_skinned_text'] : '';
     $facebook_follow_skinned_width = isset($atts['facebook_follow_skinned_width']) ? $atts['facebook_follow_skinned_width'] : '';
     $twitter_follow = isset($atts['twitter_follow']) ? $atts['twitter_follow'] : '';
     $twitter_follow_user = isset($atts['twitter_follow_user']) ? $atts['twitter_follow_user'] : '';
     $twitter_follow_skinned_text = isset($atts['twitter_follow_skinned_text']) ? $atts['twitter_follow_skinned_text'] : '';
     $twitter_follow_skinned_width = isset($atts['twitter_follow_skinned_width']) ? $atts['twitter_follow_skinned_width'] : '';
     $twitter_tweet = isset($atts['twitter_tweet']) ? $atts['twitter_tweet'] : '';
     $twitter_tweet_message = isset($atts['twitter_tweet_message']) ? $atts['twitter_tweet_message'] : '';
     $twitter_tweet_skinned_text = isset($atts['twitter_tweet_skinned_text']) ? $atts['twitter_tweet_skinned_text'] : '';
     $twitter_tweet_skinned_width = isset($atts['twitter_tweet_skinned_width']) ? $atts['twitter_tweet_skinned_width'] : '';
     $google = isset($atts['google']) ? $atts['google'] : '';
     $google_url = isset($atts['google_url']) ? $atts['google_url'] : '';
     $google_skinned_text = isset($atts['google_skinned_text']) ? $atts['google_skinned_text'] : '';
     $google_skinned_width = isset($atts['google_skinned_width']) ? $atts['google_skinned_width'] : '';
     $google_follow = isset($atts['google_follow']) ? $atts['google_follow'] : '';
     $google_follow_url = isset($atts['google_follow_url']) ? $atts['google_follow_url'] : '';
     $google_follow_skinned_text = isset($atts['google_follow_skinned_text']) ? $atts['google_follow_skinned_text'] : '';
     $google_follow_skinned_width = isset($atts['google_follow_skinned_width']) ? $atts['google_follow_skinned_width'] : '';
     $vk = isset($atts['vk']) ? $atts['vk'] : '';
     $vk_skinned_text = isset($atts['vk_skinned_text']) ? $atts['vk_skinned_text'] : '';
     $vk_skinned_width = isset($atts['vk_skinned_width']) ? $atts['vk_skinned_width'] : '';
     $youtube = isset($atts['youtube']) ? $atts['youtube'] : '';
     $youtube_chanel = isset($atts['youtube_chanel']) ? $atts['youtube_chanel'] : '';
     $youtube_skinned_text = isset($atts['youtube_skinned_text']) ? $atts['youtube_skinned_text'] : '';
     $youtube_skinned_width = isset($atts['youtube_skinned_width']) ? $atts['youtube_skinned_width'] : '';
     $linkedin = isset($atts['linkedin']) ? $atts['linkedin'] : '';
     $linkedin_comapny = isset($atts['linkedin_company']) ? $atts['linkedin_company'] : '';
     $linkedin_skinned_text = isset($atts['linkedin_skinned_text']) ? $atts['linkedin_skinned_text'] : '';
     $linkedin_skinned_width = isset($atts['linkedin_skinned_width']) ? $atts['linkedin_skinned_width'] : '';
     $pinterest_pin = isset($atts['pinterest_pin']) ? $atts['pinterest_pin'] : '';
     $pinterest_pin_skinned_text = isset($atts['pinterest_pin_skinned_text']) ? $atts['pinterest_pin_skinned_text'] : '';
     $pinterest_pin_skinned_width = isset($atts['pinterest_pin_skinned_width']) ? $atts['pinterest_pin_skinned_width'] : '';
     $pinterest_follow = isset($atts['pinterest_follow']) ? $atts['pinterest_follow'] : '';
     $pinterest_follow_display = isset($atts['pinterest_follow_display']) ? $atts['pinterest_follow_display'] : '';
     $pinterest_follow_url = isset($atts['pinterest_follow_url']) ? $atts['pinterest_follow_url'] : '';
     $pinterest_follow_skinned_text = isset($atts['pinterest_follow_skinned_text']) ? $atts['pinterest_follow_skinned_text'] : '';
     $pinterest_follow_skinned_width = isset($atts['pinterest_follow_skinned_width']) ? $atts['pinterest_follow_skinned_width'] : '';
     $skinned = isset($atts['skinned']) ? $atts['skinned'] : 'false';
     $skin = isset($atts['skin']) ? $atts['skin'] : '';
     $message = isset($atts['message']) ? $atts['message'] : '';
     $counters = isset($atts['counters']) ? $atts['counters'] : 'false';
     // init global options
     $options = $this->options;
     $native_lang = isset($options['native_social_language']) ? $options['native_social_language'] : "en";
     $css_class_align = "";
     $css_class_noskin = $skinned != 'true' ? ' essb-noskin' : '';
     $current_state_skinned = $this->skinned_social;
     $current_state_selected_skin = $this->skinned_social_selected_skin;
     if ($skinned != 'true') {
         $this->skinned_social = false;
     } else {
         $this->skinned_social = true;
         $this->skinned_social_selected_skin = $skin;
     }
     if (!$current_state_skinned && $skinned == 'true') {
         ESSB_Skinned_Native_Button::registerCSS();
     }
     $text = esc_attr(urlencode($post->post_title));
     $url = $post ? get_permalink() : ESSBOptionsHelper::get_current_url('raw');
     if ($this->avoid_next_page) {
         $url = $post ? get_permalink($post->ID) : ESSBOptionsHelper::get_current_url('raw');
     }
     if ($align == "right" || $align == "center") {
         $css_class_align = $align;
     }
     if (!$this->shortcode_like_css_included) {
         $this->shortcode_like_css_included = true;
         wp_enqueue_style('essb-social-like', ESSB_PLUGIN_URL . '/assets/css/essb-social-like-buttons.css', false, $this->version, 'all');
     }
     $output = "";
     $output .= '<div class="essb-like ' . $css_class_align . '">';
     if ($message != '') {
         $output .= '<div class="essb-message">' . $message . '</div>';
     }
     $networks = preg_split('#[\\s+,\\s+]#', $order);
     foreach ($networks as $network) {
         if ($network == "facebook") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($facebook) == 'true') {
                 if ($facebook_url == "") {
                     $facebook_url = $url;
                 }
                 $output .= '<div class="essb-like-facebook essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_fb_likebutton($facebook_url, $counters, $facebook_width, $facebook_skinned_text, $facebook_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "facebook_follow") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($facebook_follow) == 'true') {
                 $output .= '<div class="essb-like-facebook essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_fb_followbutton($facebook_follow_url, $counters, $facebook_follow_width, $facebook_follow_skinned_text, $facebook_follow_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "twitter_tweet") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($twitter_tweet) == 'true') {
                 $output .= '<div class="essb-like-twitter essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_twitter_tweet_button($twitter_follow_user, $counters, $native_lang, $twitter_tweet_message, $twitter_tweet_skinned_text, $twitter_tweet_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "twitter_follow") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($twitter_follow) == 'true') {
                 $output .= '<div class="essb-like-twitter-follow essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_twitter_follow_button($twitter_follow_user, $counters, $native_lang, $twitter_follow_skinned_text, $twitter_follow_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "google") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($google) == 'true') {
                 if ($google_url == "") {
                     $google_url = $url;
                 }
                 $output .= '<div class="essb-like-google essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_plusone_button($google_url, $counters, $native_lang, $google_skinned_text, $google_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "google_follow") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($google_follow) == 'true') {
                 $output .= '<div class="essb-like-google essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_plusfollow_button($google_follow_url, $counters, $native_lang, $google_follow_skinned_text, $google_follow_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "vk") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($vk) == 'true') {
                 $output .= '<div class="essb-like-vk essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_vklike_button($url, $counters, $vk_skinned_text, $vk_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "youtube") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($youtube) == 'true') {
                 $output .= '<div class="essb-like-youtube essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_youtube_button($youtube_chanel, $counters, $youtube_skinned_text, $youtube_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "pinterest_pin") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($pinterest_pin) == 'true') {
                 $output .= '<div class="essb-like-pin essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_pinterest_follow($pinterest_follow_display, $pinterest_follow_url, 'pin', $pinterest_pin_skinned_text, $pinterest_pin_skinned_width);
                 $output .= '</div>';
             }
         }
         if ($network == "pinterest_follow") {
             if (EasySocialShareButtons_ShortcodeHelper::unified_true($pinterest_follow) == 'true') {
                 $output .= '<div class="essb-like-pin-follow essb-block' . $css_class_noskin . '">';
                 $output .= $this->print_pinterest_follow($pinterest_follow_display, $pinterest_follow_url, 'follow', $pinterest_follow_skinned_text, $pinterest_follow_skinned_width);
                 $output .= '</div>';
             }
         }
     }
     $output .= '</div>';
     $this->skinned_social = $current_state_skinned;
     $this->skinned_social_selected_skin = $current_state_selected_skin;
     return $output;
 }