PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 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 All 504 releases
← All changes | modules/publicize.php +14 -35 12.0.3 → 16.3-a.1 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, twitter, 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,37 +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 -
25 32 /**
26 - * If Publicize is executing within Jetpack.
27 - *
28 - * @var bool
29 - */
30 - public $in_jetpack = true;
31 -
32 - /**
33 33 * Jetpack_Publicize constructor.
34 34 */
35 35 public function __construct() {
36 36 global $publicize_ui;
37 37
38 - $this->modules = new Automattic\Jetpack\Modules();
39 - $this->in_jetpack = ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'enable_module_configurable' ) ) ? true : false;
40 -
41 - if ( $this->in_jetpack ) {
38 + if ( ! ( new Host() )->is_wpcom_simple() ) {
42 39 Jetpack::enable_module_configurable( __FILE__ );
43 40
44 - // if sharedaddy isn't active, the sharing menu hasn't been added yet.
45 - if ( $this->modules->is_active( 'publicize' ) && ! $this->modules->is_active( 'sharedaddy' ) ) {
46 - add_action( 'admin_menu', array( &$publicize_ui, 'sharing_menu' ) );
47 - }
48 -
49 41 /*
50 42 * The Publicize Options array does not currently have UI since it is being added
51 43 * for a specific purpose and not part of a broader Publicize sprint.
52 44 *
@@ -82,24 +74,11 @@
82 74 } else {
83 75 global $publicize;
84 76 require_once WP_CONTENT_DIR . '/mu-plugins/keyring/keyring.php';
85 77 require_once WP_CONTENT_DIR . '/admin-plugins/publicize/publicize-wpcom.php';
86 - $publicize = new Publicize();
78 + $publicize = new \Publicize();
87 79 $publicize_ui = new Automattic\Jetpack\Publicize\Publicize_UI();
88 80 }
89 -
90 - add_action(
91 - 'jetpack_register_gutenberg_extensions',
92 - function () {
93 - global $publicize;
94 - if ( $publicize->current_user_can_access_publicize_data() ) {
95 - Jetpack_Gutenberg::set_extension_available( 'jetpack/publicize' );
96 - } else {
97 - Jetpack_Gutenberg::set_extension_unavailable( 'jetpack/publicize', 'unauthorized' );
98 - }
99 - }
100 - );
101 - $publicize_ui->in_jetpack = $this->in_jetpack;
102 81 }
103 82 }
104 83
105 84 // On Jetpack, we instantiate Jetpack_Publicize only if the Publicize module is active.
@@ -108,9 +87,9 @@
108 87
109 88 // None of this should be the case, but we can get here with a broken user connection. If that's the case
110 89 // then we want to stop loading any more of the module code.
111 90 if (
112 - ! ( new Automattic\Jetpack\Modules() )->is_active( 'publicize' )
91 + ! Jetpack::is_module_active( 'publicize' )
113 92 || ! Jetpack::connection()->has_connected_user()
114 93 || ! $publicize
115 94 ) {
116 95 return;
@@ -124,9 +103,9 @@
124 103 * a site. Normally Publicize is only loaded in wp-admin, so there's a little
125 104 * set up that you might need to do if you want to use it on the front end.
126 105 * Just call this function and it returns a Publicize object.
127 106 *
128 - * @return Publicize Object
107 + * @return \Automattic\Jetpack\Publicize\Publicize|\Publicize Object
129 108 */
130 109 function publicize_init() {
131 110 global $publicize;
132 111