| Server IP : 23.94.149.180 / Your IP : 216.73.216.147 Web Server : nginx/1.20.1 System : Linux deadrock 5.14.0-741.22.1.el9_9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 12 15:18:14 UTC 2026 x86_64 User : apache ( 48) PHP Version : 8.6.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /files/webmaint/corey/website/wp-content/plugins/jetpack/extensions/plugins/sharing/ |
Upload File : |
<?php
/**
* Block Editor - Sharing feature.
*
* @package automattic/jetpack
*/
namespace Automattic\Jetpack\Extensions\Sharing;
use Automattic\Jetpack\Modules;
use Jetpack_Gutenberg;
if ( ! defined( 'ABSPATH' ) ) {
exit( 0 );
}
/**
* Register Sharing plugin.
*
* @return void
*/
function register_plugins() {
/*
* The extension is available even when the module is not active,
* so we can display a nudge to activate the module instead of the block.
* We skip that nudge for non-admins, who cannot activate modules, and on block themes,
* where the answer is the Sharing Buttons block in a template rather than the legacy module.
*/
if ( ! ( new Modules() )->is_active( 'sharedaddy' ) && ( ! current_user_can( 'jetpack_activate_modules' ) || wp_is_block_theme() ) ) {
return;
}
Jetpack_Gutenberg::set_extension_available( 'sharing' );
}
add_action( 'jetpack_register_gutenberg_extensions', __NAMESPACE__ . '\register_plugins' );
/**
* The Sharing panel is only displayed for post types that support sharing.
* The sharing module declares support for sharing for all the public post types.
* Let's do the same thing when the module isn't active yet.
*/
add_action(
'rest_api_init',
function () {
if ( ! ( new Modules() )->is_active( 'sharedaddy' ) ) {
$post_types = get_post_types( array( 'public' => true ) );
foreach ( $post_types as $post_type ) {
register_rest_field(
$post_type,
'jetpack_sharing_enabled',
array(
'get_callback' => function ( array $post ) {
if ( ! isset( $post['id'] ) ) {
return false;
}
return ! get_post_meta( $post['id'], 'sharing_disabled', true );
},
'schema' => array(
'description' => __( 'Are sharing buttons enabled?', 'jetpack' ),
'type' => 'boolean',
),
)
);
add_post_type_support( $post_type, 'jetpack-sharing-buttons' );
}
}
}
);