function sharing_add_footer() { global $jetpack_sharing_counts; if (apply_filters('sharing_js', true)) { if (is_array($jetpack_sharing_counts) && count($jetpack_sharing_counts)) { $sharing_post_urls = array_filter($jetpack_sharing_counts); if ($sharing_post_urls) { ?> <script type="text/javascript"> WPCOM_sharing_counts = <?php echo json_encode(array_flip($sharing_post_urls)); ?> </script> <?php } } wp_enqueue_script('sharing-js'); $recaptcha__options = array('lang' => get_base_recaptcha_lang_code()); wp_localize_script('sharing-js', 'recaptcha_options', $recaptcha__options); } $sharer = new Sharing_Service(); $enabled = $sharer->get_blog_services(); foreach (array_merge($enabled['visible'], $enabled['hidden']) as $service) { $service->display_footer(); } }
function sharing_add_footer() { global $jetpack_sharing_counts; /** * Filter all Javascript output by the sharing module. * * @module sharedaddy * * @since 1.1.0 * * @param bool true Control whether the sharing module should add any Javascript to the site. Default to true. */ if (apply_filters('sharing_js', true) && sharing_maybe_enqueue_scripts()) { /** * Filter the display of sharing counts next to the sharing buttons. * * @module sharedaddy * * @since 3.2.0 * * @param bool true Control the display of counters next to the sharing buttons. Default to true. */ if (apply_filters('jetpack_sharing_counts', true) && is_array($jetpack_sharing_counts) && count($jetpack_sharing_counts)) { $sharing_post_urls = array_filter($jetpack_sharing_counts); if ($sharing_post_urls) { ?> <script type="text/javascript"> window.WPCOM_sharing_counts = <?php echo json_encode(array_flip($sharing_post_urls)); ?> ; </script> <?php } } wp_enqueue_script('sharing-js'); $sharing_js_options = array('lang' => get_base_recaptcha_lang_code(), 'counts' => apply_filters('jetpack_sharing_counts', true)); wp_localize_script('sharing-js', 'sharing_js_options', $sharing_js_options); } $sharer = new Sharing_Service(); $enabled = $sharer->get_blog_services(); foreach (array_merge($enabled['visible'], $enabled['hidden']) as $service) { $service->display_footer(); } }
function sharing_add_footer() { global $jetpack_sharing_counts; /** * Filter all Javascript output by the sharing module. * * @since 1.1.0 * * @param bool true Control whether the sharing module should add any Javascript to the site. Default to true. */ if (apply_filters('sharing_js', true) && sharing_maybe_enqueue_scripts()) { /** * Filter the display of sharing counts next to the sharing buttons. * * @since 3.2.0 * * @param bool true Control the display of counters next to the sharing buttons. Default to true. */ if (apply_filters('jetpack_sharing_counts', true) && is_array($jetpack_sharing_counts) && count($jetpack_sharing_counts)) { $sharing_post_urls = array_filter($jetpack_sharing_counts); if ($sharing_post_urls) { /** * Defines whether a blog is a Jetpack site. * * @since 3.6.0 * * @param bool false Assumption on whether a blog is a Jetpack site. * @param int $blog_id A blog ID to check. */ $is_jetpack = true === apply_filters('is_jetpack_site', false, get_current_blog_id()); $site_id = $is_jetpack ? Jetpack_Options::get_option('id') : get_current_blog_id(); ?> <script type="text/javascript"> window.WPCOM_sharing_counts = <?php echo json_encode(array_flip($sharing_post_urls)); ?> ; window.WPCOM_jetpack = <?php echo var_export($is_jetpack, true); ?> ; <?php if (is_int($site_id)) { ?> window.WPCOM_site_ID = <?php echo $site_id; ?> ; <?php } ?> </script> <?php } } wp_enqueue_script('sharing-js'); $sharing_js_options = array('lang' => get_base_recaptcha_lang_code(), 'counts' => apply_filters('jetpack_sharing_counts', true)); wp_localize_script('sharing-js', 'sharing_js_options', $sharing_js_options); } $sharer = new Sharing_Service(); $enabled = $sharer->get_blog_services(); foreach (array_merge($enabled['visible'], $enabled['hidden']) as $service) { $service->display_footer(); } }