Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/extensio.../plugins/sharing
File: sharing.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Block Editor - Sharing feature.
[2] Fix | Delete
*
[3] Fix | Delete
* @package automattic/jetpack
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
namespace Automattic\Jetpack\Extensions\Sharing;
[7] Fix | Delete
[8] Fix | Delete
use Automattic\Jetpack\Modules;
[9] Fix | Delete
use Jetpack_Gutenberg;
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Register Sharing plugin.
[13] Fix | Delete
*
[14] Fix | Delete
* @return void
[15] Fix | Delete
*/
[16] Fix | Delete
function register_plugins() {
[17] Fix | Delete
/*
[18] Fix | Delete
* The extension is available even when the module is not active,
[19] Fix | Delete
* so we can display a nudge to activate the module instead of the block.
[20] Fix | Delete
* However, since non-admins cannot activate modules, we do not display the empty block for them.
[21] Fix | Delete
*/
[22] Fix | Delete
if ( ! ( new Modules() )->is_active( 'sharedaddy' ) && ! current_user_can( 'jetpack_activate_modules' ) ) {
[23] Fix | Delete
return;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
Jetpack_Gutenberg::set_extension_available( 'sharing' );
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
add_action( 'jetpack_register_gutenberg_extensions', __NAMESPACE__ . '\register_plugins' );
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* The Sharing panel is only displayed for post types that support sharing.
[33] Fix | Delete
* The sharing module declares support for sharing for all the public post types.
[34] Fix | Delete
* Let's do the same thing when the module isn't active yet.
[35] Fix | Delete
*/
[36] Fix | Delete
add_action(
[37] Fix | Delete
'rest_api_init',
[38] Fix | Delete
function () {
[39] Fix | Delete
if ( ! ( new Modules() )->is_active( 'sharedaddy' ) ) {
[40] Fix | Delete
$post_types = get_post_types( array( 'public' => true ) );
[41] Fix | Delete
[42] Fix | Delete
foreach ( $post_types as $post_type ) {
[43] Fix | Delete
register_rest_field(
[44] Fix | Delete
$post_type,
[45] Fix | Delete
'jetpack_sharing_enabled',
[46] Fix | Delete
array(
[47] Fix | Delete
'get_callback' => function ( array $post ) {
[48] Fix | Delete
if ( ! isset( $post['id'] ) ) {
[49] Fix | Delete
return false;
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
return (bool) ! get_post_meta( $post['id'], 'sharing_disabled', true );
[53] Fix | Delete
},
[54] Fix | Delete
'schema' => array(
[55] Fix | Delete
'description' => __( 'Are sharing buttons enabled?', 'jetpack' ),
[56] Fix | Delete
'type' => 'boolean',
[57] Fix | Delete
),
[58] Fix | Delete
)
[59] Fix | Delete
);
[60] Fix | Delete
add_post_type_support( $post_type, 'jetpack-sharing-buttons' );
[61] Fix | Delete
}
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
);
[65] Fix | Delete
[66] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function