PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 All 502 releases
← All changes | modules/publicize.php +14 -40 12.2.316.2 View file →
@@ -1,8 +1,8 @@
1 1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 2 /**
3 3 * Module Name: Jetpack Social
4 - * Module Description: Jetpack Social makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.
4 + * Module Description: Auto‑share your posts to social networks and track engagement in one place.
5 5 * Sort Order: 10
6 6 * Recommendation Order: 7
7 7 * First Introduced: 2.0
8 8 * Requires Connection: Yes
@@ -9,9 +9,9 @@
9 9 * Requires User Connection: Yes
10 10 * Auto Activate: No
11 11 * Module Tags: Social, Recommended
12 12 * Feature: Engagement
13 - * Additional Search Queries: facebook, jetpack publicize, tumblr, linkedin, social, tweet, connections, sharing, social media, automated, automated sharing, auto publish, auto tweet and like, auto tweet, facebook auto post, facebook posting
13 + * Additional Search Queries: facebook, bluesky, threads, mastodon, instagram, jetpack publicize, tumblr, linkedin, social, tweet, connections, sharing, social media, automated, automated sharing, auto publish, auto tweet and like, auto tweet, facebook auto post, facebook posting
14 14 *
15 15 * @package automattic/jetpack
16 16 */
17 17
@@ -16,43 +16,29 @@
16 16 */
17 17
18 18 // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.
19 19
20 +use Automattic\Jetpack\Status\Host;
21 +
22 +if ( ! defined( 'ABSPATH' ) ) {
23 + exit( 0 );
24 +}
25 +
20 26 /**
21 27 * Class Jetpack_Publicize
28 + *
29 + * @phan-constructor-used-for-side-effects
22 30 */
23 31 class Jetpack_Publicize {
24 32 /**
25 - * Current status about Jetpack modules.
26 - *
27 - * @var Modules
28 - */
29 - public $modules;
30 -
31 - /**
32 - * If Publicize is executing within Jetpack.
33 - *
34 - * @var bool
35 - */
36 - public $in_jetpack = true;
37 -
38 - /**
39 33 * Jetpack_Publicize constructor.
40 34 */
41 35 public function __construct() {
42 36 global $publicize_ui;
43 37
44 - $this->modules = new Automattic\Jetpack\Modules();
45 - $this->in_jetpack = ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'enable_module_configurable' ) ) ? true : false;
46 -
47 - if ( $this->in_jetpack ) {
38 + if ( ! ( new Host() )->is_wpcom_simple() ) {
48 39 Jetpack::enable_module_configurable( __FILE__ );
49 40
50 - // if sharedaddy isn't active, the sharing menu hasn't been added yet.
51 - if ( $this->modules->is_active( 'publicize' ) && ! $this->modules->is_active( 'sharedaddy' ) ) {
52 - add_action( 'admin_menu', array( &$publicize_ui, 'sharing_menu' ) );
53 - }
54 -
55 41 /*
56 42 * The Publicize Options array does not currently have UI since it is being added
57 43 * for a specific purpose and not part of a broader Publicize sprint.
58 44 *
@@ -88,23 +74,11 @@
88 74 } else {
89 75 global $publicize;
90 76 require_once WP_CONTENT_DIR . '/mu-plugins/keyring/keyring.php';
91 77 require_once WP_CONTENT_DIR . '/admin-plugins/publicize/publicize-wpcom.php';
92 - $publicize = new Publicize();
78 + $publicize = new \Publicize();
93 79 $publicize_ui = new Automattic\Jetpack\Publicize\Publicize_UI();
94 80 }
95 -
96 - add_action(
97 - 'jetpack_register_gutenberg_extensions',
98 - function () {
99 - global $publicize;
100 - if ( $publicize->current_user_can_access_publicize_data() ) {
101 - Jetpack_Gutenberg::set_extension_available( 'jetpack/publicize' );
102 - } else {
103 - Jetpack_Gutenberg::set_extension_unavailable( 'jetpack/publicize', 'unauthorized' );
104 - }
105 - }
106 - );
107 81 }
108 82 }
109 83
110 84 // On Jetpack, we instantiate Jetpack_Publicize only if the Publicize module is active.
@@ -113,9 +87,9 @@
113 87
114 88 // None of this should be the case, but we can get here with a broken user connection. If that's the case
115 89 // then we want to stop loading any more of the module code.
116 90 if (
117 - ! ( new Automattic\Jetpack\Modules() )->is_active( 'publicize' )
91 + ! Jetpack::is_module_active( 'publicize' )
118 92 || ! Jetpack::connection()->has_connected_user()
119 93 || ! $publicize
120 94 ) {
121 95 return;
@@ -129,9 +103,9 @@
129 103 * a site. Normally Publicize is only loaded in wp-admin, so there's a little
130 104 * set up that you might need to do if you want to use it on the front end.
131 105 * Just call this function and it returns a Publicize object.
132 106 *
133 - * @return Publicize Object
107 + * @return \Automattic\Jetpack\Publicize\Publicize|\Publicize Object
134 108 */
135 109 function publicize_init() {
136 110 global $publicize;
137 111