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 | class.jetpack-client-server.php +26 -29 12.2.316.2 View file →
@@ -5,10 +5,8 @@
5 5 *
6 6 * @package automattic/jetpack
7 7 */
8 8
9 -use Automattic\Jetpack\Connection\Webhooks;
10 -
11 9 /**
12 10 * Client = Plugin
13 11 * Client Server = API Methods the Plugin must respond to
14 12 */
@@ -14,8 +12,30 @@
14 12 */
15 13 class Jetpack_Client_Server {
16 14
17 15 /**
16 + * Whether the class has been initialized.
17 + *
18 + * @var bool
19 + */
20 + private static $did_init = false;
21 +
22 + /**
23 + * Initialize the hooks, but only once.
24 + *
25 + * @return void
26 + */
27 + public static function init() {
28 + if ( static::$did_init ) {
29 + return;
30 + }
31 +
32 + add_filter( 'jetpack_rest_connection_check_response', array( static::class, 'connection_check' ) );
33 +
34 + static::$did_init = true;
35 + }
36 +
37 + /**
18 38 * Handle the client authorization error.
19 39 *
20 40 * @param WP_Error $error The error object.
21 41 */
@@ -52,19 +72,8 @@
52 72 return Jetpack::admin_url();
53 73 }
54 74
55 75 /**
56 - * Authorization handler.
57 - *
58 - * @deprecated since Jetpack 9.5.0
59 - * @see Webhooks::handle_authorize()
60 - */
61 - public function client_authorize() {
62 - _deprecated_function( __METHOD__, 'jetpack-9.5.0', 'Automattic\\Jetpack\\Connection\\Webhooks::handle_authorize' );
63 - ( new Webhooks() )->handle_authorize();
64 - }
65 -
66 - /**
67 76 * Deactivate a plugin.
68 77 *
69 78 * @param string $probable_file Expected plugin file.
70 79 * @param string $probable_title Expected plugin title.
@@ -90,24 +99,12 @@
90 99 return 0;
91 100 }
92 101
93 102 /**
94 - * Get the Jetpack instance.
103 + * Filters the result of test_connection REST method
95 104 *
96 - * @deprecated since Jetpack 9.5.0
97 - * @see Jetpack::init()
105 + * @return string The current Jetpack version number
98 106 */
99 - public function get_jetpack() {
100 - _deprecated_function( __METHOD__, 'jetpack-9.5.0', 'Jetpack::init' );
101 - return Jetpack::init();
102 - }
103 -
104 - /**
105 - * No longer used.
106 - *
107 - * @deprecated since Jetpack 9.5.0
108 - */
109 - public function do_exit() {
110 - _deprecated_function( __METHOD__, 'jetpack-9.5.0' );
111 - exit;
107 + public static function connection_check() {
108 + return JETPACK__VERSION;
112 109 }
113 110 }