diff options
Diffstat (limited to 'plugins/jetpack/modules/sharedaddy/sharing-service.php')
-rw-r--r-- | plugins/jetpack/modules/sharedaddy/sharing-service.php | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-service.php b/plugins/jetpack/modules/sharedaddy/sharing-service.php index ec7bb0b6..3f86053e 100644 --- a/plugins/jetpack/modules/sharedaddy/sharing-service.php +++ b/plugins/jetpack/modules/sharedaddy/sharing-service.php @@ -41,7 +41,6 @@ class Sharing_Service { * Gets a list of all available service names and classes */ public function get_all_services( $include_custom = true ) { - global $wp_version; // Default services // if you update this list, please update the REST API tests // in bin/tests/api/suites/SharingTest.php @@ -51,13 +50,15 @@ class Sharing_Service { 'linkedin' => 'Share_LinkedIn', 'reddit' => 'Share_Reddit', 'twitter' => 'Share_Twitter', - 'google-plus-1' => 'Share_GooglePlus1', 'tumblr' => 'Share_Tumblr', 'pinterest' => 'Share_Pinterest', 'pocket' => 'Share_Pocket', 'telegram' => 'Share_Telegram', 'jetpack-whatsapp' => 'Jetpack_Share_WhatsApp', 'skype' => 'Share_Skype', + + // Deprecated + 'google-plus-1' => 'Share_GooglePlus1', ); /** @@ -74,7 +75,7 @@ class Sharing_Service { $services['email'] = 'Share_Email'; } - if ( is_multisite() && ( version_compare( $wp_version, '4.9-RC1-42107', '<' ) || is_plugin_active( 'press-this/press-this-plugin.php' ) ) ) { + if ( is_multisite() && is_plugin_active( 'press-this/press-this-plugin.php' ) ) { $services['press-this'] = 'Share_PressThis'; } @@ -577,6 +578,10 @@ function sharing_maybe_enqueue_scripts() { } function sharing_add_footer() { + if ( Jetpack_AMP_Support::is_amp_request() ) { + return; + } + global $jetpack_sharing_counts; /** @@ -792,8 +797,15 @@ function sharing_display( $text = '', $echo = false ) { // Visible items $visible = ''; foreach ( $enabled['visible'] as $id => $service ) { + $klasses = array( 'share-' . $service->get_class() ); + if ( $service->is_deprecated() ) { + if ( ! current_user_can( 'manage_options' ) ) { + continue; + } + $klasses[] = 'share-deprecated'; + } // Individual HTML for sharing service - $visible .= '<li class="share-' . $service->get_class() . '">' . $service->get_display( $post ) . '</li>'; + $visible .= '<li class="' . implode( ' ', $klasses ) . '">' . $service->get_display( $post ) . '</li>'; } $parts = array(); @@ -832,7 +844,14 @@ function sharing_display( $text = '', $echo = false ) { $count = 1; foreach ( $enabled['hidden'] as $id => $service ) { // Individual HTML for sharing service - $sharing_content .= '<li class="share-' . $service->get_class() . '">'; + $klasses = array( 'share-' . $service->get_class() ); + if ( $service->is_deprecated() ) { + if ( ! current_user_can( 'manage_options' ) ) { + continue; + } + $klasses[] = 'share-deprecated'; + } + $sharing_content .= '<li class="' . implode( ' ', $klasses ) . '">'; $sharing_content .= $service->get_display( $post ); $sharing_content .= '</li>'; |