/** * Shortcode for Social Sharing. */ function the_champ_sharing_shortcode($params) { // notify if sharing is disabled if (the_champ_social_sharing_enabled()) { global $theChampSharingOptions; extract(shortcode_atts(array('style' => '', 'type' => 'horizontal', 'left' => '0', 'top' => '100', 'url' => '', 'count' => 0), $params)); if ($type == 'horizontal' && !the_champ_horizontal_sharing_enabled() || $type == 'vertical' && !the_champ_vertical_sharing_enabled()) { return; } global $post; $targetUrl = $url ? $url : get_permalink($post->ID); $html = '<div class="the_champ_sharing_container the_champ_' . $type . '_sharing" super-socializer-data-href="' . $targetUrl . '" '; $verticalOffsets = ''; if ($type == 'vertical') { $verticalOffsets = 'left: ' . $left . 'px; top: ' . $top . 'px;'; } // style if ($style != "" || $verticalOffsets != '') { $html .= 'style="'; if (strpos($style, 'background') === false) { $html .= 'box-shadow: none;'; } $html .= $verticalOffsets; $html .= $style; $html .= '"'; } $html .= '>'; $html .= the_champ_prepare_sharing_html($targetUrl, $type, $count); $html .= '</div>'; if ($count) { $html .= '<script>theChampLoadEvent( function(){ // sharing counts theChampCallAjax(function(){ theChampGetSharingCounts(' . ($type == 'horizontal' ? 1 : 0) . ', ' . ($type == 'vertical' ? 1 : 0) . '); }); } );</script>'; } return $html; } }
/** * Show sharing meta options */ function the_champ_sharing_meta_setup() { global $post; $postType = $post->post_type; $sharingMeta = get_post_meta($post->ID, '_the_champ_meta', true); ?> <p> <label for="the_champ_sharing"> <input type="checkbox" name="_the_champ_meta[sharing]" id="the_champ_sharing" value="1" <?php checked('1', @$sharingMeta['sharing']); ?> /> <?php _e('Disable Horizontal Social Sharing on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_vertical_sharing"> <input type="checkbox" name="_the_champ_meta[vertical_sharing]" id="the_champ_vertical_sharing" value="1" <?php checked('1', @$sharingMeta['vertical_sharing']); ?> /> <?php _e('Disable Vertical Social Sharing on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_counter"> <input type="checkbox" name="_the_champ_meta[counter]" id="the_champ_counter" value="1" <?php checked('1', @$sharingMeta['counter']); ?> /> <?php _e('Disable Horizontal like buttons on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_vertical_counter"> <input type="checkbox" name="_the_champ_meta[vertical_counter]" id="the_champ_vertical_counter" value="1" <?php checked('1', @$sharingMeta['vertical_counter']); ?> /> <?php _e('Disable Vertical like buttons on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_fb_comments"> <input type="checkbox" name="_the_champ_meta[fb_comments]" id="the_champ_fb_comments" value="1" <?php checked('1', @$sharingMeta['fb_comments']); ?> /> <?php _e('Disable Social Commenting on this ' . $postType, 'Super-Socializer'); ?> </label> <?php if (the_champ_social_sharing_enabled()) { global $theChampSharingOptions; $excludedProviders = array('print', 'email', 'yahoo', 'digg', 'float it', 'tumblr', 'xing', 'whatsapp', 'yummly'); if (isset($theChampSharingOptions['hor_enable']) && isset($theChampSharingOptions['horizontal_counts']) && isset($theChampSharingOptions['providers']) && count($theChampSharingOptions['providers']) > 0) { ?> <p> <strong><?php _e('Horizontal sharing', 'Super-Socializer'); ?> </strong> <?php foreach (array_diff($theChampSharingOptions['providers'], $excludedProviders) as $sharingProvider) { ?> <br/> <label for="the_champ_<?php echo $sharingProvider; ?> _horizontal_sharing_count"> <span style="width: 242px; float:left"><?php _e('Starting share count for ' . ucfirst($sharingProvider), 'Super-Socializer'); ?> </span> <input type="text" name="_the_champ_meta[<?php echo $sharingProvider; ?> _horizontal_count]" id="the_champ_<?php echo $sharingProvider; ?> _horizontal_sharing_count" value="<?php echo isset($sharingMeta[$sharingProvider . '_horizontal_count']) ? $sharingMeta[$sharingProvider . '_horizontal_count'] : ''; ?> " /> </label> <?php } ?> </p> <?php } if (isset($theChampSharingOptions['vertical_enable']) && isset($theChampSharingOptions['vertical_counts']) && isset($theChampSharingOptions['vertical_providers']) && count($theChampSharingOptions['vertical_providers']) > 0) { ?> <p> <strong><?php _e('Vertical sharing', 'Super-Socializer'); ?> </strong> <?php foreach (array_diff($theChampSharingOptions['vertical_providers'], $excludedProviders) as $sharingProvider) { ?> <br/> <label for="the_champ_<?php echo $sharingProvider; ?> _vertical_sharing_count"> <span style="width: 242px; float:left"><?php _e('Starting share count for ' . ucfirst($sharingProvider), 'Super-Socializer'); ?> </span> <input type="text" name="_the_champ_meta[<?php echo $sharingProvider; ?> _vertical_count]" id="the_champ_<?php echo $sharingProvider; ?> _vertical_sharing_count" value="<?php echo isset($sharingMeta[$sharingProvider . '_vertical_count']) ? $sharingMeta[$sharingProvider . '_vertical_count'] : ''; ?> " /> </label> <?php } ?> </p> <?php } } ?> </p> <?php echo '<input type="hidden" name="the_champ_meta_nonce" value="' . wp_create_nonce(__FILE__) . '" />'; }
/** * Shortcode for Social Sharing. */ function the_champ_sharing_shortcode($params) { // notify if sharing is disabled if (the_champ_social_sharing_enabled()) { global $theChampSharingOptions; extract(shortcode_atts(array('style' => '', 'type' => 'horizontal', 'left' => '0', 'right' => '0', 'top' => '100', 'url' => '', 'count' => 0, 'align' => 'left', 'title' => '', 'total_shares' => 'OFF'), $params)); if ($type == 'horizontal' && !the_champ_horizontal_sharing_enabled() || $type == 'vertical' && !the_champ_vertical_sharing_enabled()) { return; } global $post; if ($url) { $targetUrl = $url; $postId = 0; } elseif (is_front_page()) { $targetUrl = site_url(); $postId = 0; } elseif (get_permalink($post->ID)) { $targetUrl = get_permalink($post->ID); $postId = $post->ID; } else { $targetUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); $postId = 0; } // if bit.ly url shortener enabled, generate bit.ly short url $shortUrl = ''; if (isset($theChampSharingOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $shortUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($targetUrl, $postId); } $alignmentOffset = 0; if ($left) { $alignmentOffset = $left; } elseif ($right) { $alignmentOffset = $right; } $html = '<div class="the_champ_sharing_container the_champ_' . $type . '_sharing' . ($type == 'vertical' && isset($theChampSharingOptions['hide_mobile_sharing']) ? ' the_champ_hide_sharing' : '') . ($type == 'vertical' && isset($theChampSharingOptions['bottom_mobile_sharing']) ? ' the_champ_bottom_sharing' : '') . '" ss-offset="' . $alignmentOffset . '" super-socializer-data-href="' . $targetUrl . '" '; $verticalOffsets = ''; if ($type == 'vertical') { $verticalOffsets = $align . ': ' . ${$align} . 'px; top: ' . $top . 'px;width:' . ((isset($theChampSharingOptions['vertical_sharing_size']) ? $theChampSharingOptions['vertical_sharing_size'] : '35') + 4) . "px;"; } // style if ($style != "" || $verticalOffsets != '') { $html .= 'style="'; if (strpos($style, 'background') === false) { $html .= '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;'; } $html .= $verticalOffsets; $html .= $style; $html .= '"'; } $html .= '>'; if ($type == 'horizontal' && $title != '') { $html .= '<div style="font-weight:bold">' . ucfirst($title) . '</div>'; } $html .= the_champ_prepare_sharing_html($shortUrl == '' ? $targetUrl : $shortUrl, $type, $count, $total_shares == 'ON' ? 1 : 0, ''); $html .= '</div>'; if ($count || $total_shares == 'ON') { $html .= '<script>theChampLoadEvent( function(){ // sharing counts theChampCallAjax(function(){ theChampGetSharingCounts(); }); } );</script>'; } return $html; } }
/** * The javascript to loaded at front end. */ function the_champ_frontend_scripts() { global $theChampFacebookOptions, $theChampLoginOptions, $theChampSharingOptions; $inFooter = isset($theChampLoginOptions['footer_script']) ? true : false; // general (required) scripts if (!isset($theChampSharingOptions['remove_modernizr'])) { wp_enqueue_script('the_champ_modernizer', plugins_url('js/modernizr.custom.82187.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION); } wp_enqueue_script('the_champ_ss_general_scripts', plugins_url('js/front/social_login/general.js', __FILE__), false, THE_CHAMP_SS_VERSION, $inFooter); $websiteUrl = site_url(); $fbKey = isset($theChampLoginOptions["fb_key"]) && $theChampLoginOptions["fb_key"] != "" ? $theChampLoginOptions["fb_key"] : ""; ?> <script> var theChampSiteUrl = '<?php echo $websiteUrl; ?> '; </script> <?php // scripts used for common Social Login functionality if (the_champ_social_login_enabled() && !is_user_logged_in()) { $loadingImagePath = plugins_url('images/ajax_loader.gif', __FILE__); $theChampAjaxUrl = get_admin_url() . 'admin-ajax.php'; $redirectionUrl = esc_attr(the_champ_get_login_redirection_url()); $regRedirectionUrl = esc_attr(the_champ_get_login_redirection_url('', true)); ?> <script> var theChampLoadingImgPath = '<?php echo $loadingImagePath; ?> '; var theChampAjaxUrl = '<?php echo $theChampAjaxUrl; ?> '; var theChampRedirectionUrl = '<?php echo $redirectionUrl; ?> '; var theChampRegRedirectionUrl = '<?php echo $regRedirectionUrl; ?> '; </script> <?php $userVerified = false; $ajaxUrl = 'admin-ajax.php'; $notification = ''; if (isset($_GET['SuperSocializerVerified']) || isset($_GET['SuperSocializerUnverified'])) { $userVerified = true; $ajaxUrl = esc_url(add_query_arg(array('height' => 60, 'width' => 300, 'action' => 'the_champ_notify', 'message' => urlencode(isset($_GET['SuperSocializerUnverified']) ? __('Please verify your email address to login.', 'Super-Socializer') : __('Your email has been verified. Now you can login to your account', 'Super-Socializer'))), 'admin-ajax.php')); $notification = __('Notification', 'Super-Socializer'); } $emailPopup = false; $emailAjaxUrl = 'admin-ajax.php'; $emailPopupTitle = ''; $emailPopupErrorMessage = ''; $emailPopupUniqueId = ''; $emailPopupVerifyMessage = ''; if (isset($_GET['SuperSocializerEmail']) && isset($_GET['par']) && trim($_GET['par']) != '') { $emailPopup = true; $emailAjaxUrl = esc_url(add_query_arg(array('height' => isset($theChampLoginOptions['popup_height']) && $theChampLoginOptions['popup_height'] != '' ? esc_attr($theChampLoginOptions['popup_height']) : 210, 'width' => 300, 'action' => 'the_champ_ask_email'), 'admin-ajax.php')); $emailPopupTitle = __('Email required', 'Super-Socializer'); $emailPopupErrorMessage = isset($theChampLoginOptions["email_error_message"]) ? $theChampLoginOptions["email_error_message"] : ""; $emailPopupUniqueId = isset($_GET['par']) ? trim(esc_attr($_GET['par'])) : ''; $emailPopupVerifyMessage = __('Please check your email inbox to complete the registration.', 'Super-Socializer'); } ?> <script> var theChampFacebookScope = 'public_profile,email', theChampFBKey = '<?php echo $fbKey; ?> ', theChampVerified = <?php echo intval($userVerified); ?> ; var theChampAjaxUrl = '<?php echo html_entity_decode(admin_url() . $ajaxUrl); ?> '; var theChampPopupTitle = '<?php echo $notification; ?> '; var theChampEmailPopup = <?php echo intval($emailPopup); ?> ; var theChampEmailAjaxUrl = '<?php echo html_entity_decode(admin_url() . $emailAjaxUrl); ?> '; var theChampEmailPopupTitle = '<?php echo $emailPopupTitle; ?> '; var theChampEmailPopupErrorMsg = '<?php echo htmlspecialchars($emailPopupErrorMessage, ENT_QUOTES); ?> '; var theChampEmailPopupUniqueId = '<?php echo $emailPopupUniqueId; ?> '; var theChampEmailPopupVerifyMessage = '<?php echo $emailPopupVerifyMessage; ?> '; var theChampTwitterRedirect = '<?php echo urlencode(the_champ_get_valid_url(html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])))); ?> '; <?php echo isset($theChampLoginOptions['disable_reg']) && isset($theChampLoginOptions['disable_reg_redirect']) && $theChampLoginOptions['disable_reg_redirect'] != '' ? 'var theChampDisableRegRedirect = "' . html_entity_decode(esc_url($theChampLoginOptions['disable_reg_redirect'])) . '";' : ''; ?> </script> <?php wp_enqueue_script('the_champ_sl_common', plugins_url('js/front/social_login/common.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION, $inFooter); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); } // Google+ scripts if (the_champ_social_login_provider_enabled('google') && !is_user_logged_in()) { $googleKey = isset($theChampLoginOptions['google_key']) ? $theChampLoginOptions['google_key'] : ''; ?> <script>var theChampGoogleKey = '<?php echo $googleKey; ?> '; var theChampGoogleErrorMessage = '<?php echo htmlspecialchars(__('Follow steps 11 and 12 at GooglePlus app configuration page, about to open', 'Super-Socializer'), ENT_QUOTES); ?> ' </script> <?php wp_enqueue_script('the_champ_sl_google', plugins_url('js/front/social_login/google.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION, $inFooter); } // Linkedin scripts if (the_champ_social_login_provider_enabled('linkedin') && !is_user_logged_in()) { ?> <script type="text/javascript" src="//platform.linkedin.com/in.js"> api_key: <?php echo isset($theChampLoginOptions['li_key']) ? $theChampLoginOptions['li_key'] : ''; ?> onLoad: theChampLinkedInOnLoad </script> <?php wp_enqueue_script('the_champ_sl_linkedin', plugins_url('js/front/social_login/linkedin.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION, $inFooter); } // Vkontakte scripts if (the_champ_social_login_provider_enabled('vkontakte') && !is_user_logged_in()) { ?> <script> var theChampVkKey = '<?php echo isset($theChampLoginOptions["vk_key"]) && $theChampLoginOptions["vk_key"] != "" ? $theChampLoginOptions["vk_key"] : 0; ?> ' </script> <?php wp_enqueue_script('the_champ_sl_vkontakte', plugins_url('js/front/social_login/vkontakte.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION, $inFooter); } // Instagram scripts if (the_champ_social_login_provider_enabled('instagram')) { ?> <script> var theChampInstaId = '<?php echo isset($theChampLoginOptions["insta_id"]) && $theChampLoginOptions["insta_id"] != "" ? $theChampLoginOptions["insta_id"] : 0; ?> '; var theChampTwitterRedirect = '<?php echo urlencode(the_champ_get_valid_url(html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])))); ?> '; </script> <?php wp_enqueue_script('the_champ_sl_instagram', plugins_url('js/front/social_login/instagram.js', __FILE__), false, THE_CHAMP_SS_VERSION, $inFooter); } // Facebook scripts if (the_champ_facebook_plugin_enabled()) { global $heateor_fcn_options; ?> <script> var theChampFBKey = '<?php echo $fbKey; ?> ', theChampFBLang = '<?php echo isset($theChampFacebookOptions["comment_lang"]) && $theChampFacebookOptions["comment_lang"] != '' ? $theChampFacebookOptions["comment_lang"] : "en_US"; ?> ', theChampFbLikeMycred = <?php echo defined('HEATEOR_SOCIAL_SHARE_MYCRED_INTEGRATION_VERSION') && the_champ_facebook_like_rec_enabled() ? 1 : 0; ?> , theChampSsga = <?php echo defined('HEATEOR_SHARING_GOOGLE_ANALYTICS_VERSION') ? 1 : 0; ?> , theChampCommentNotification = <?php echo isset($heateor_fcn_options) || function_exists('heateor_ss_check_querystring') || function_exists('the_champ_check_querystring') ? 1 : 0; ?> , theChampFbIosLogin = <?php echo !is_user_logged_in() && isset($_GET['code']) && esc_attr($_GET['code']) != '' ? 1 : 0; ?> ; </script> <?php add_action('wp_footer', 'the_champ_fb_root_div'); wp_enqueue_script('the_champ_fb_sdk', plugins_url('js/front/facebook/sdk.js', __FILE__), false, THE_CHAMP_SS_VERSION, $inFooter); } if (the_champ_social_login_provider_enabled('facebook') && !is_user_logged_in()) { wp_enqueue_script('the_champ_sl_facebook', plugins_url('js/front/social_login/facebook.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION, $inFooter); } // Social commenting if (the_champ_social_commenting_enabled()) { global $post; if ($post) { $postMeta = get_post_meta($post->ID, '_the_champ_meta', true); if (isset($theChampFacebookOptions['enable_' . $post->post_type]) && !(isset($postMeta) && isset($postMeta['fb_comments']) && $postMeta['fb_comments'] == 1)) { if (isset($theChampFacebookOptions['urlToComment']) && $theChampFacebookOptions['urlToComment'] != '') { $commentUrl = $theChampFacebookOptions['urlToComment']; } elseif (isset($post->ID) && $post->ID) { $commentUrl = get_permalink($post->ID); } else { $commentUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } $commentingTabsOrder = $theChampFacebookOptions['commenting_order'] != '' ? $theChampFacebookOptions['commenting_order'] : 'wordpress,facebook,googleplus,disqus'; $commentingTabsOrder = explode(',', str_replace('facebook', 'fb', $commentingTabsOrder)); $enabledTabs = array(); foreach ($commentingTabsOrder as $tab) { $tab = trim($tab); if ($tab == 'wordpress') { $enabledTabs[] = 'wordpress'; } elseif (isset($theChampFacebookOptions['enable_' . $tab . 'comments'])) { $enabledTabs[] = $tab; } } $labels = array(); $labels['wordpress'] = $theChampFacebookOptions['label_wordpress_comments'] != '' ? htmlspecialchars($theChampFacebookOptions['label_wordpress_comments'], ENT_QUOTES) : 'Default Comments'; $commentsCount = wp_count_comments($post->ID); $labels['wordpress'] .= ' (' . ($commentsCount && isset($commentsCount->approved) ? $commentsCount->approved : '') . ')'; $labels['fb'] = $theChampFacebookOptions['label_facebook_comments'] != '' ? htmlspecialchars($theChampFacebookOptions['label_facebook_comments'], ENT_QUOTES) : 'Facebook Comments'; $labels['fb'] .= ' (<fb:comments-count href=' . $commentUrl . '></fb:comments-count>)'; $labels['googleplus'] = $theChampFacebookOptions['label_googleplus_comments'] != '' ? htmlspecialchars($theChampFacebookOptions['label_googleplus_comments'], ENT_QUOTES) : 'GooglePlus Comments'; $labels['disqus'] = $theChampFacebookOptions['label_disqus_comments'] != '' ? htmlspecialchars($theChampFacebookOptions['label_disqus_comments'], ENT_QUOTES) : 'Disqus Comments'; ?> <script>var theChampFBCommentUrl = '<?php echo $commentUrl; ?> '; var theChampFBCommentColor = '<?php echo isset($theChampFacebookOptions['comment_color']) && $theChampFacebookOptions['comment_color'] != '' ? $theChampFacebookOptions["comment_color"] : ''; ?> '; var theChampFBCommentNumPosts = '<?php echo isset($theChampFacebookOptions['comment_numposts']) && $theChampFacebookOptions['comment_numposts'] != '' ? $theChampFacebookOptions["comment_numposts"] : ''; ?> '; var theChampFBCommentWidth = '<?php echo isset($theChampFacebookOptions['comment_width']) && $theChampFacebookOptions['comment_width'] != '' ? $theChampFacebookOptions["comment_width"] : '100%'; ?> '; var theChampFBCommentOrderby = '<?php echo isset($theChampFacebookOptions['comment_orderby']) && $theChampFacebookOptions['comment_orderby'] != '' ? $theChampFacebookOptions["comment_orderby"] : ''; ?> '; var theChampCommentingTabs = "<?php echo isset($theChampFacebookOptions['commenting_order']) ? $theChampFacebookOptions['commenting_order'] : ''; ?> ", theChampGpCommentsUrl = '<?php echo isset($theChampFacebookOptions['gpcomments_url']) && $theChampFacebookOptions['gpcomments_url'] != '' ? $theChampFacebookOptions['gpcomments_url'] : $commentUrl; ?> ', theChampDisqusShortname = '<?php echo isset($theChampFacebookOptions['dq_shortname']) ? $theChampFacebookOptions['dq_shortname'] : ''; ?> ', theChampScEnabledTabs = '<?php echo implode(',', $enabledTabs); ?> ', theChampScLabel = '<?php echo $theChampFacebookOptions['commenting_label'] != '' ? htmlspecialchars($theChampFacebookOptions['commenting_label'], ENT_QUOTES) : __('Leave a reply', 'Super-Socializer'); ?> ', theChampScTabLabels = <?php echo json_encode($labels); ?> , theChampGpCommentsWidth = <?php echo isset($theChampFacebookOptions['gpcomments_width']) && $theChampFacebookOptions['gpcomments_width'] != '' ? $theChampFacebookOptions['gpcomments_width'] : 0; ?> , theChampCommentingId = '<?php echo isset($theChampFacebookOptions['commenting_id']) && $theChampFacebookOptions['commenting_id'] != '' ? $theChampFacebookOptions['commenting_id'] : 'respond'; ?> '</script> <?php wp_enqueue_script('the_champ_fb_commenting', plugins_url('js/front/facebook/commenting.js', __FILE__), false, THE_CHAMP_SS_VERSION, $inFooter); } } } // sharing script if (the_champ_social_sharing_enabled() || the_champ_social_counter_enabled() && the_champ_vertical_social_counter_enabled()) { global $theChampSharingOptions, $theChampCounterOptions, $post; ?> <script> var theChampSharingAjaxUrl = '<?php echo get_admin_url(); ?> admin-ajax.php', theChampCloseIconPath = '<?php echo plugins_url('images/close.png', __FILE__); ?> ', theChampPluginIconPath = '<?php echo plugins_url('images/logo.png', __FILE__); ?> ', theChampHorizontalSharingCountEnable = <?php echo isset($theChampSharingOptions['enable']) && isset($theChampSharingOptions['hor_enable']) && (isset($theChampSharingOptions['horizontal_counts']) || isset($theChampSharingOptions['horizontal_total_shares'])) ? 1 : 0; ?> , theChampVerticalSharingCountEnable = <?php echo isset($theChampSharingOptions['enable']) && isset($theChampSharingOptions['vertical_enable']) && (isset($theChampSharingOptions['vertical_counts']) || isset($theChampSharingOptions['vertical_total_shares'])) ? 1 : 0; ?> , theChampSharingOffset = <?php echo isset($theChampSharingOptions['alignment']) && $theChampSharingOptions['alignment'] != '' && isset($theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset']) && $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] != '' ? $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] : 0; ?> , theChampCounterOffset = <?php echo isset($theChampCounterOptions['alignment']) && $theChampCounterOptions['alignment'] != '' && isset($theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset']) && $theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset'] != '' ? $theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset'] : 0; ?> </script> <?php wp_enqueue_script('the_champ_share_counts', plugins_url('js/front/sharing/sharing.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION, $inFooter); } }
/** This is rendered widget content */ function widget($args, $instance) { // return if sharing is disabled if (!the_champ_social_sharing_enabled() || !the_champ_vertical_sharing_enabled()) { return; } extract($args); if ($instance['hide_for_logged_in'] == 1 && is_user_logged_in()) { return; } global $theChampSharingOptions, $post; if (isset($instance['target_url'])) { if ($instance['target_url'] == 'default') { $sharingUrl = is_home() ? site_url() : get_permalink($post->ID); } elseif ($instance['target_url'] == 'homepage') { $sharingUrl = site_url(); } elseif ($instance['target_url'] == 'custom') { $sharingUrl = isset($instance['target_url_custom']) ? trim($instance['target_url_custom']) : get_permalink($post->ID); } } else { $sharingUrl = get_permalink($post->ID); } echo "<div class='the_champ_sharing_container the_champ_vertical_sharing' style='" . (isset($instance['alignment']) && $instance['alignment'] != '' && isset($instance[$instance['alignment'] . '_offset']) ? $instance['alignment'] . ': ' . ($instance[$instance['alignment'] . '_offset'] == '' ? 0 : $instance[$instance['alignment'] . '_offset']) . 'px;' : '') . (isset($instance['top_offset']) ? 'top: ' . ($instance['top_offset'] == '' ? 0 : $instance['top_offset']) . 'px;' : '') . (isset($instance['vertical_bg']) && $instance['vertical_bg'] != '' ? 'background-color: ' . $instance['vertical_bg'] . ';' : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' super-socializer-data-href='" . $sharingUrl . "'>"; // if bit.ly integration enabled, generate bit.ly short url if (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url(site_url()); if ($shortUrl) { $sharingUrl = $shortUrl; } } //echo $before_widget; echo the_champ_prepare_sharing_html($sharingUrl, 'vertical', isset($instance['show_counts'])); echo '</div>'; if (isset($instance['show_counts'])) { echo '<script>theChampLoadEvent( function(){ // sharing counts theChampCallAjax(function(){ theChampGetSharingCounts(0, 1); }); } );</script>'; } //echo $after_widget; }
/** * The javascript to loaded at front end. */ function the_champ_frontend_scripts() { global $theChampFacebookOptions, $theChampLoginOptions; // general (required) scripts wp_enqueue_script('the_champ_ss_general_scripts', plugins_url('js/front/social_login/general.js', __FILE__), false, THE_CHAMP_SS_VERSION); $websiteUrl = site_url(); ?> <script> var theChampSiteUrl = '<?php echo $websiteUrl; ?> '; </script> <?php // scripts used for common Social Login functionality if (the_champ_social_login_enabled() && !is_user_logged_in()) { $loadingImagePath = plugins_url('images/ajax_loader.gif', __FILE__); $theChampAjaxUrl = get_admin_url() . 'admin-ajax.php'; $redirectionUrl = esc_attr(the_champ_get_login_redirection_url()); $regRedirectionUrl = esc_attr(the_champ_get_login_redirection_url('', true)); ?> <script> var theChampLoadingImgPath = '<?php echo $loadingImagePath; ?> '; var theChampAjaxUrl = '<?php echo $theChampAjaxUrl; ?> '; var theChampRedirectionUrl = '<?php echo $redirectionUrl; ?> '; var theChampRegRedirectionUrl = '<?php echo $regRedirectionUrl; ?> '; </script> <?php $userVerified = false; $ajaxUrl = 'admin-ajax.php'; $notification = ''; if (isset($_GET['SuperSocializerVerified']) || isset($_GET['SuperSocializerUnverified'])) { $userVerified = true; $ajaxUrl = add_query_arg(array('height' => 60, 'width' => 300, 'action' => 'the_champ_notify', 'message' => urlencode(isset($_GET['SuperSocializerUnverified']) ? __('Please verify your email address to login.', 'Super-Socializer') : __('Your email has been verified. Now you can login to your account', 'Super-Socializer'))), 'admin-ajax.php'); $notification = __('Notification', 'Super-Socializer'); } $emailPopup = false; $emailAjaxUrl = 'admin-ajax.php'; $emailPopupTitle = ''; $emailPopupErrorMessage = ''; $emailPopupUniqueId = ''; $emailPopupVerifyMessage = ''; if (isset($_GET['SuperSocializerEmail']) && isset($_GET['par']) && trim($_GET['par']) != '') { $emailPopup = true; $emailAjaxUrl = add_query_arg(array('height' => isset($theChampLoginOptions['popup_height']) && $theChampLoginOptions['popup_height'] != '' ? $theChampLoginOptions['popup_height'] : 210, 'width' => 300, 'action' => 'the_champ_ask_email'), 'admin-ajax.php'); $emailPopupTitle = __('Email required', 'Super-Socializer'); $emailPopupErrorMessage = isset($theChampLoginOptions["email_error_message"]) ? $theChampLoginOptions["email_error_message"] : ""; $emailPopupUniqueId = isset($_GET['par']) ? trim(esc_attr($_GET['par'])) : ''; $emailPopupVerifyMessage = __('Please check your email inbox to complete the registration.', 'Super-Socializer'); } ?> <script> var theChampVerified = <?php echo intval($userVerified); ?> ; var theChampAjaxUrl = '<?php echo admin_url() . $ajaxUrl; ?> '; var theChampPopupTitle = '<?php echo $notification; ?> '; var theChampEmailPopup = <?php echo intval($emailPopup); ?> ; var theChampEmailAjaxUrl = '<?php echo admin_url() . $emailAjaxUrl; ?> '; var theChampEmailPopupTitle = '<?php echo $emailPopupTitle; ?> '; var theChampEmailPopupErrorMsg = '<?php echo htmlspecialchars($emailPopupErrorMessage, ENT_QUOTES); ?> '; var theChampEmailPopupUniqueId = '<?php echo $emailPopupUniqueId; ?> '; var theChampEmailPopupVerifyMessage = '<?php echo $emailPopupVerifyMessage; ?> '; var theChampTwitterRedirect = '<?php echo urlencode(the_champ_get_valid_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); ?> '; </script> <?php wp_enqueue_script('the_champ_sl_common', plugins_url('js/front/social_login/common.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); } // Google+ scripts if (the_champ_social_login_provider_enabled('google') && !is_user_logged_in()) { $googleKey = isset($theChampLoginOptions['google_key']) ? $theChampLoginOptions['google_key'] : ''; ?> <script>var theChampGoogleKey = '<?php echo $googleKey; ?> '; var theChampGoogleErrorMessage = '<?php _e('Follow steps 11 and 12 at GooglePlus app configuration page, about to open', 'Super-Socializer'); ?> ' </script> <?php wp_enqueue_script('the_champ_sl_google', plugins_url('js/front/social_login/google.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION); } // Linkedin scripts if (the_champ_social_login_provider_enabled('linkedin') && !is_user_logged_in()) { ?> <script type="text/javascript" src="//platform.linkedin.com/in.js"> api_key: <?php echo isset($theChampLoginOptions['li_key']) ? $theChampLoginOptions['li_key'] : ''; ?> onLoad: theChampLinkedInOnLoad </script> <?php wp_enqueue_script('the_champ_sl_linkedin', plugins_url('js/front/social_login/linkedin.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION); } // Vkontakte scripts if (the_champ_social_login_provider_enabled('vkontakte') && !is_user_logged_in()) { ?> <div id="vk_api_transport"></div> <script> var theChampVkKey = '<?php echo isset($theChampLoginOptions["vk_key"]) && $theChampLoginOptions["vk_key"] != "" ? $theChampLoginOptions["vk_key"] : 0; ?> ' </script> <?php wp_enqueue_script('the_champ_sl_vkontakte', plugins_url('js/front/social_login/vkontakte.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION); } // Instagram scripts if (the_champ_social_login_provider_enabled('instagram')) { ?> <script> var theChampInstaId = '<?php echo isset($theChampLoginOptions["insta_id"]) && $theChampLoginOptions["insta_id"] != "" ? $theChampLoginOptions["insta_id"] : 0; ?> '; var theChampTwitterRedirect = '<?php echo urlencode(the_champ_get_valid_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); ?> '; </script> <?php wp_enqueue_script('the_champ_sl_instagram', plugins_url('js/front/social_login/instagram.js', __FILE__), false, THE_CHAMP_SS_VERSION); } // Facebook scripts if (the_champ_facebook_plugin_enabled()) { ?> <div id="fb-root"></div> <script> var theChampFBKey = '<?php echo isset($theChampLoginOptions["fb_key"]) && $theChampLoginOptions["fb_key"] != "" ? $theChampLoginOptions["fb_key"] : ""; ?> '; var theChampFBLang = '<?php echo isset($theChampFacebookOptions["comment_lang"]) && $theChampFacebookOptions["comment_lang"] != '' ? $theChampFacebookOptions["comment_lang"] : "en_US"; ?> '; </script> <?php wp_enqueue_script('the_champ_fb_sdk', plugins_url('js/front/facebook/sdk.js', __FILE__), false, THE_CHAMP_SS_VERSION); } if (the_champ_social_login_provider_enabled('facebook') && !is_user_logged_in()) { ?> <script> var theChampFacebookScope = 'email<?php echo isset($theChampFacebookOptions["enable_fbfeed"]) && $theChampFacebookOptions["enable_fbfeed"] == 1 ? ", publish_actions" : ""; ?> '; var theChampFBFeedEnabled = <?php echo the_champ_facebook_feed_enabled() ? 'true' : 'false'; ?> ; </script> <?php wp_enqueue_script('the_champ_sl_facebook', plugins_url('js/front/social_login/facebook.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION); } // Facebook commenting if (the_champ_facebook_commenting_enabled()) { global $post; if (isset($theChampFacebookOptions['urlToComment']) && $theChampFacebookOptions['urlToComment'] != '') { $commentUrl = $theChampFacebookOptions['urlToComment']; } elseif (isset($post->ID) && $post->ID) { $commentUrl = get_permalink($post->ID); } else { $commentUrl = esc_attr(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); } if ($post) { $postMeta = get_post_meta($post->ID, '_the_champ_meta', true); } ?> <script>var theChampFBCommentUrl = '<?php echo $commentUrl; ?> '; var theChampFBCommentColor = '<?php echo isset($theChampFacebookOptions['comment_color']) && $theChampFacebookOptions['comment_color'] != '' ? $theChampFacebookOptions["comment_color"] : ''; ?> '; var theChampFBCommentNumPosts = '<?php echo isset($theChampFacebookOptions['comment_numposts']) && $theChampFacebookOptions['comment_numposts'] != '' ? $theChampFacebookOptions["comment_numposts"] : ''; ?> '; var theChampFBCommentWidth = '<?php echo isset($theChampFacebookOptions['comment_width']) && $theChampFacebookOptions['comment_width'] != '' ? $theChampFacebookOptions["comment_width"] : '100%'; ?> '; var theChampFBCommentOrderby = '<?php echo isset($theChampFacebookOptions['comment_orderby']) && $theChampFacebookOptions['comment_orderby'] != '' ? $theChampFacebookOptions["comment_orderby"] : ''; ?> '; var theChampFBCommentMobile = '<?php echo isset($theChampFacebookOptions['comment_mobile']) && $theChampFacebookOptions['comment_mobile'] != '' ? $theChampFacebookOptions["comment_mobile"] : ''; ?> '; var theChampFBAppID = '<?php echo isset($theChampLoginOptions['fb_key']) && $theChampLoginOptions['fb_key'] != '' ? $theChampLoginOptions['fb_key'] : ''; ?> '; var theChampSiteUrl = '<?php echo site_url(); ?> '; var theChampWPCommentingContent = ''; var theChampFBCommentingContent = ''; var theChampCommentingHandle = false; var theChampCommentingDisabled = <?php echo isset($postMeta) && isset($postMeta['fb_comments']) && $postMeta['fb_comments'] == 1 ? 1 : 0; ?> </script> <?php wp_enqueue_script('the_champ_fb_commenting', plugins_url('js/front/facebook/commenting.js', __FILE__), false, THE_CHAMP_SS_VERSION); } // Facebook feed posts if (the_champ_facebook_feed_enabled()) { ?> <script> var theChampFacebookFeedMsg = '<?php echo htmlspecialchars(str_replace("%website-name%", get_option("blogname"), $theChampFacebookOptions['feedMessage']), ENT_QUOTES); ?> '; var theChampFBFeedName = '<?php echo isset($theChampFacebookOptions['feed_name']) && $theChampFacebookOptions['feed_name'] != '' ? htmlspecialchars($theChampFacebookOptions['feed_name'], ENT_QUOTES) : ''; ?> '; var theChampFBFeedDesc = '<?php echo isset($theChampFacebookOptions['feed_description']) && $theChampFacebookOptions['feed_description'] != '' ? htmlspecialchars(trim(preg_replace("/\r?\n/", '\\n', $theChampFacebookOptions['feed_description'])), ENT_QUOTES) : ''; ?> '; var theChampFBFeedLink = '<?php echo isset($theChampFacebookOptions['feed_link']) && $theChampFacebookOptions['feed_link'] != '' ? $theChampFacebookOptions['feed_link'] : ''; ?> '; var theChampFBFeedSource = '<?php echo isset($theChampFacebookOptions['feedSource']) && $theChampFacebookOptions['feedSource'] != '' ? $theChampFacebookOptions['feedSource'] : ''; ?> '; var theChampFBFeedPicture = '<?php echo isset($theChampFacebookOptions['feedPicture']) && $theChampFacebookOptions['feedPicture'] != '' ? $theChampFacebookOptions['feedPicture'] : ''; ?> '; var theChampFBFeedCaption = '<?php echo isset($theChampFacebookOptions['feed_caption']) && $theChampFacebookOptions['feed_caption'] != '' ? htmlspecialchars($theChampFacebookOptions['feed_caption'], ENT_QUOTES) : ''; ?> '; </script> <?php wp_enqueue_script('the_champ_fb_feed', plugins_url('js/front/facebook/feed.js', __FILE__), false, THE_CHAMP_SS_VERSION); } // sharing script if (the_champ_social_sharing_enabled()) { global $theChampSharingOptions, $post; ?> <script> var theChampSharingAjaxUrl = '<?php echo get_admin_url(); ?> admin-ajax.php'; var theChampCloseIconPath = '<?php echo plugins_url('images/close.png', __FILE__); ?> '; var theChampPluginIconPath = '<?php echo plugins_url('images/logo.png', __FILE__); ?> '; var theChampHorizontalSharingCountEnable = <?php echo isset($theChampSharingOptions['horizontal_counts']) ? 1 : 0; ?> ; var theChampVerticalSharingCountEnable = <?php echo isset($theChampSharingOptions['vertical_counts']) ? 1 : 0; ?> ; </script> <?php wp_enqueue_script('the_champ_share_counts', plugins_url('js/front/sharing/sharing.js', __FILE__), array('jquery'), THE_CHAMP_SS_VERSION); } }
/** * Show sharing meta options */ function the_champ_sharing_meta_setup() { global $post; $postType = $post->post_type; $sharingMeta = get_post_meta($post->ID, '_the_champ_meta', true); ?> <p> <label for="the_champ_sharing"> <input type="checkbox" name="_the_champ_meta[sharing]" id="the_champ_sharing" value="1" <?php checked('1', @$sharingMeta['sharing']); ?> /> <?php _e('Disable Standard Social Sharing on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_vertical_sharing"> <input type="checkbox" name="_the_champ_meta[vertical_sharing]" id="the_champ_vertical_sharing" value="1" <?php checked('1', @$sharingMeta['vertical_sharing']); ?> /> <?php _e('Disable Floating Social Sharing on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_counter"> <input type="checkbox" name="_the_champ_meta[counter]" id="the_champ_counter" value="1" <?php checked('1', @$sharingMeta['counter']); ?> /> <?php _e('Disable Standard like buttons on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_vertical_counter"> <input type="checkbox" name="_the_champ_meta[vertical_counter]" id="the_champ_vertical_counter" value="1" <?php checked('1', @$sharingMeta['vertical_counter']); ?> /> <?php _e('Disable Floating like buttons on this ' . $postType, 'Super-Socializer'); ?> </label> <br/> <label for="the_champ_fb_comments"> <input type="checkbox" name="_the_champ_meta[fb_comments]" id="the_champ_fb_comments" value="1" <?php checked('1', @$sharingMeta['fb_comments']); ?> /> <?php _e('Disable Social Commenting on this ' . $postType, 'Super-Socializer'); ?> </label> <?php if (the_champ_social_sharing_enabled()) { global $theChampSharingOptions; $validNetworks = array('facebook', 'twitter', 'linkedin', 'google_plus', 'delicious', 'buffer', 'reddit', 'pinterest', 'stumbleupon', 'vkontakte'); if (isset($theChampSharingOptions['hor_enable']) && isset($theChampSharingOptions['horizontal_counts']) && isset($theChampSharingOptions['horizontal_re_providers']) && count($theChampSharingOptions['horizontal_re_providers']) > 0) { ?> <p> <strong><?php _e('Standard Sharing Interface', 'Super-Socializer'); ?> </strong> <?php foreach (array_intersect($theChampSharingOptions['horizontal_re_providers'], $validNetworks) as $sharingProvider) { ?> <br/> <label for="the_champ_<?php echo $sharingProvider; ?> _horizontal_sharing_count"> <span style="width: 242px; float:left"><?php _e('Starting share count for ' . ucfirst(str_replace('_', ' ', $sharingProvider)), 'Super-Socializer'); ?> </span> <input type="text" name="_the_champ_meta[<?php echo $sharingProvider; ?> _horizontal_count]" id="the_champ_<?php echo $sharingProvider; ?> _horizontal_sharing_count" value="<?php echo isset($sharingMeta[$sharingProvider . '_horizontal_count']) ? $sharingMeta[$sharingProvider . '_horizontal_count'] : ''; ?> " /> </label> <?php } ?> </p> <?php } if (isset($theChampSharingOptions['vertical_enable']) && isset($theChampSharingOptions['vertical_counts']) && isset($theChampSharingOptions['vertical_re_providers']) && count($theChampSharingOptions['vertical_re_providers']) > 0) { ?> <p> <strong><?php _e('Floating Sharing Interface', 'Super-Socializer'); ?> </strong> <?php foreach (array_intersect($theChampSharingOptions['vertical_re_providers'], $validNetworks) as $sharingProvider) { ?> <br/> <label for="the_champ_<?php echo $sharingProvider; ?> _vertical_sharing_count"> <span style="width: 242px; float:left"><?php _e('Starting share count for ' . ucfirst(str_replace('_', ' ', $sharingProvider)), 'Super-Socializer'); ?> </span> <input type="text" name="_the_champ_meta[<?php echo $sharingProvider; ?> _vertical_count]" id="the_champ_<?php echo $sharingProvider; ?> _vertical_sharing_count" value="<?php echo isset($sharingMeta[$sharingProvider . '_vertical_count']) ? $sharingMeta[$sharingProvider . '_vertical_count'] : ''; ?> " /> </label> <?php } ?> </p> <?php } } ?> </p> <?php echo '<input type="hidden" name="the_champ_meta_nonce" value="' . wp_create_nonce(__FILE__) . '" />'; }
/** This is rendered widget content */ public function widget($args, $instance) { // return if sharing is disabled if (!the_champ_social_sharing_enabled() || !the_champ_vertical_sharing_enabled()) { return; } extract($args); if ($instance['hide_for_logged_in'] == 1 && is_user_logged_in()) { return; } global $theChampSharingOptions, $post; $postId = $post->ID; if (isset($instance['target_url'])) { if ($instance['target_url'] == 'default') { if (is_home()) { $sharingUrl = site_url(); $postId = 0; } elseif (get_permalink($post->ID)) { $sharingUrl = get_permalink($post->ID); } else { $sharingUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } } elseif ($instance['target_url'] == 'homepage') { $sharingUrl = site_url(); $postId = 0; } elseif ($instance['target_url'] == 'custom') { $sharingUrl = isset($instance['target_url_custom']) ? trim($instance['target_url_custom']) : get_permalink($post->ID); $postId = 0; } } else { $sharingUrl = get_permalink($post->ID); } $ssOffset = 0; if (isset($instance['alignment']) && isset($instance[$instance['alignment'] . '_offset'])) { $ssOffset = $instance[$instance['alignment'] . '_offset']; } echo "<div class='the_champ_sharing_container the_champ_vertical_sharing" . (isset($theChampSharingOptions['hide_mobile_sharing']) ? ' the_champ_hide_sharing' : '') . (isset($theChampSharingOptions['bottom_mobile_sharing']) ? ' the_champ_bottom_sharing' : '') . "' ss-offset='" . $ssOffset . "' style='width:" . ((isset($theChampSharingOptions['vertical_sharing_size']) ? $theChampSharingOptions['vertical_sharing_size'] : 35) + 4) . "px;" . (isset($instance['alignment']) && $instance['alignment'] != '' && isset($instance[$instance['alignment'] . '_offset']) ? $instance['alignment'] . ': ' . ($instance[$instance['alignment'] . '_offset'] == '' ? 0 : $instance[$instance['alignment'] . '_offset']) . 'px;' : '') . (isset($instance['top_offset']) ? 'top: ' . ($instance['top_offset'] == '' ? 0 : $instance['top_offset']) . 'px;' : '') . (isset($instance['vertical_bg']) && $instance['vertical_bg'] != '' ? 'background-color: ' . $instance['vertical_bg'] . ';' : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' super-socializer-data-href='" . $sharingUrl . "'>"; if (isset($theChampSharingOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $sharingUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($sharingUrl, $postId); if ($shortUrl) { $sharingUrl = $shortUrl; } } //echo $before_widget; echo the_champ_prepare_sharing_html($sharingUrl, 'vertical', isset($instance['show_counts']), isset($instance['total_shares']), ''); echo '</div>'; if (isset($instance['show_counts']) || isset($instance['total_shares'])) { echo '<script>theChampLoadEvent( function(){ // sharing counts theChampCallAjax(function(){ theChampGetSharingCounts(); }); } );</script>'; } //echo $after_widget; }
/** * Register plugin settings and its sanitization callback. */ function the_champ_options_init() { register_setting('the_champ_facebook_options', 'the_champ_facebook', 'the_champ_validate_options'); register_setting('the_champ_login_options', 'the_champ_login', 'the_champ_validate_options'); register_setting('the_champ_sharing_options', 'the_champ_sharing', 'the_champ_validate_options'); register_setting('the_champ_counter_options', 'the_champ_counter', 'the_champ_validate_options'); if (the_champ_social_sharing_enabled() || the_champ_social_counter_enabled()) { // show option to disable sharing on particular page/post foreach (array('post', 'page') as $type) { add_meta_box('the_champ_meta', 'Super Socializer', 'the_champ_sharing_meta_setup', $type); } // save sharing meta on post/page save add_action('save_post', 'the_champ_save_sharing_meta'); } }