Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Jetpack_Deprecated often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Jetpack_Deprecated, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 21 | class Jetpack_Deprecated { |
||
| 22 | /** |
||
| 23 | * Map of roles we care about, and their corresponding minimum capabilities. |
||
| 24 | * |
||
| 25 | * @deprecated 7.6 Use Automattic\Jetpack\Roles::$capability_translations instead. |
||
| 26 | * |
||
| 27 | * @access public |
||
| 28 | * @static |
||
| 29 | * |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | public static $capability_translations = array( |
||
| 33 | 'administrator' => 'manage_options', |
||
| 34 | 'editor' => 'edit_others_posts', |
||
| 35 | 'author' => 'publish_posts', |
||
| 36 | 'contributor' => 'edit_posts', |
||
| 37 | 'subscriber' => 'read', |
||
| 38 | ); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Checks if a Jetpack site is both active and not in offline mode. |
||
| 42 | * |
||
| 43 | * This is a DRY function to avoid repeating `Jetpack::is_active && ! Automattic\Jetpack\Status->is_offline_mode`. |
||
| 44 | * |
||
| 45 | * @deprecated 8.8.0 |
||
| 46 | * |
||
| 47 | * @return bool True if Jetpack is active and not in offline mode. |
||
| 48 | */ |
||
| 49 | View Code Duplication | public static function is_active_and_not_development_mode() { |
|
| 56 | |||
| 57 | /** |
||
| 58 | * Deprecated manage functions |
||
| 59 | */ |
||
| 60 | public function prepare_manage_jetpack_notice() { |
||
| 63 | /** |
||
| 64 | * Deprecated manage functions |
||
| 65 | */ |
||
| 66 | public function manage_activate_screen() { |
||
| 69 | /** |
||
| 70 | * Deprecated manage functions |
||
| 71 | */ |
||
| 72 | public function admin_jetpack_manage_notice() { |
||
| 75 | /** |
||
| 76 | * Deprecated manage functions |
||
| 77 | */ |
||
| 78 | public function opt_out_jetpack_manage_url() { |
||
| 81 | /** |
||
| 82 | * Deprecated manage functions |
||
| 83 | */ |
||
| 84 | public function opt_in_jetpack_manage_url() { |
||
| 87 | /** |
||
| 88 | * Deprecated manage functions |
||
| 89 | */ |
||
| 90 | public function opt_in_jetpack_manage_notice() { |
||
| 93 | /** |
||
| 94 | * Deprecated manage functions |
||
| 95 | */ |
||
| 96 | public function can_display_jetpack_manage_notice() { |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Deprecated function |
||
| 102 | * |
||
| 103 | * @deprecated 7.6.0 |
||
| 104 | * |
||
| 105 | * @see Automattic\Jetpack\Sync\Modules\Users::is_function_in_backtrace |
||
| 106 | */ |
||
| 107 | public static function is_function_in_backtrace() { |
||
| 110 | |||
| 111 | /** |
||
| 112 | * Stores and prints out domains to prefetch for page speed optimization. |
||
| 113 | * |
||
| 114 | * @deprecated 8.8.0 Use Jetpack::add_resource_hints. |
||
| 115 | * |
||
| 116 | * @param string|array $urls URLs to hint. |
||
|
|
|||
| 117 | */ |
||
| 118 | public static function dns_prefetch( $urls = null ) { |
||
| 124 | |||
| 125 | /** |
||
| 126 | * Strip http:// or https:// from a url, replaces forward slash with ::, |
||
| 127 | * so we can bring them directly to their site in calypso. |
||
| 128 | * |
||
| 129 | * @deprecated 9.2.0 Use Automattic\Jetpack\Status::get_site_suffix |
||
| 130 | * |
||
| 131 | * @param string $url URL. |
||
| 132 | */ |
||
| 133 | public static function build_raw_urls( $url ) { |
||
| 138 | |||
| 139 | /** |
||
| 140 | * Deprecated. |
||
| 141 | * |
||
| 142 | * @deprecated |
||
| 143 | * @see Automattic\Jetpack\Assets\add_async_script |
||
| 144 | */ |
||
| 145 | public function script_add_async() { |
||
| 148 | |||
| 149 | /** |
||
| 150 | * Checks whether the home and siteurl specifically are allowed. |
||
| 151 | * Written so that we don't have re-check $key and $value params every time |
||
| 152 | * we want to check if this site is allowed, for example in footer.php |
||
| 153 | * |
||
| 154 | * @since 3.8.0 |
||
| 155 | * @return bool True = already allowed False = not on the allowed list. |
||
| 156 | */ |
||
| 157 | public static function is_staging_site() { |
||
| 161 | |||
| 162 | /** |
||
| 163 | * Serve a WordPress.com static resource via a randomized wp.com subdomain. |
||
| 164 | * |
||
| 165 | * @deprecated 9.3.0 Use Assets::staticize_subdomain. |
||
| 166 | * |
||
| 167 | * @param string $url WordPress.com static resource URL. |
||
| 168 | */ |
||
| 169 | public static function staticize_subdomain( $url ) { |
||
| 173 | |||
| 174 | /** |
||
| 175 | * Adds Jetpack-specific options to the output of the XMLRPC options method. |
||
| 176 | * |
||
| 177 | * @deprecated since 7.7.0 |
||
| 178 | * @see Automattic\Jetpack\Connection\Manager::xmlrpc_options() |
||
| 179 | * |
||
| 180 | * @param array $options Standard Core options. |
||
| 181 | * @return array Amended options. |
||
| 182 | */ |
||
| 183 | View Code Duplication | public function xmlrpc_options( $options ) { |
|
| 192 | |||
| 193 | /** |
||
| 194 | * Handles a getOptions XMLRPC method call. |
||
| 195 | * |
||
| 196 | * @deprecated since 7.7.0 |
||
| 197 | * @see Automattic\Jetpack\Connection\Manager::jetpack_getOptions() |
||
| 198 | * |
||
| 199 | * @param array $args method call arguments. |
||
| 200 | * @return array an amended XMLRPC server options array. |
||
| 201 | */ |
||
| 202 | View Code Duplication | public function jetpack_getOptions( $args ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid |
|
| 211 | |||
| 212 | /** |
||
| 213 | * In some setups, $HTTP_RAW_POST_DATA can be emptied during some IXR_Server paths since it is passed by reference to various methods. |
||
| 214 | * Capture it here so we can verify the signature later. |
||
| 215 | * |
||
| 216 | * @deprecated since 7.7.0 |
||
| 217 | * @see Automattic\Jetpack\Connection\Manager::xmlrpc_methods() |
||
| 218 | * |
||
| 219 | * @param array $methods XMLRPC methods. |
||
| 220 | * @return array XMLRPC methods, with the $HTTP_RAW_POST_DATA one. |
||
| 221 | */ |
||
| 222 | View Code Duplication | public function xmlrpc_methods( $methods ) { |
|
| 231 | |||
| 232 | /** |
||
| 233 | * Register additional public XMLRPC methods. |
||
| 234 | * |
||
| 235 | * @deprecated since 7.7.0 |
||
| 236 | * @see Automattic\Jetpack\Connection\Manager::public_xmlrpc_methods() |
||
| 237 | * |
||
| 238 | * @param array $methods Public XMLRPC methods. |
||
| 239 | * @return array Public XMLRPC methods, with the getOptions one. |
||
| 240 | */ |
||
| 241 | View Code Duplication | public function public_xmlrpc_methods( $methods ) { |
|
| 250 | |||
| 251 | /** |
||
| 252 | * Loads the Jetpack XML-RPC client. |
||
| 253 | * No longer necessary, as the XML-RPC client will be automagically loaded. |
||
| 254 | * |
||
| 255 | * @deprecated since 7.7.0 |
||
| 256 | */ |
||
| 257 | public static function load_xml_rpc_client() { |
||
| 260 | |||
| 261 | /** |
||
| 262 | * Resets the saved authentication state in between testing requests. |
||
| 263 | * |
||
| 264 | * @deprecated since 8.9.0 |
||
| 265 | * @see Automattic\Jetpack\Connection\Rest_Authentication::reset_saved_auth_state() |
||
| 266 | */ |
||
| 267 | public function reset_saved_auth_state() { |
||
| 271 | |||
| 272 | /** |
||
| 273 | * Verifies the signature of the current request. |
||
| 274 | * |
||
| 275 | * @deprecated since 7.7.0 |
||
| 276 | * @see Automattic\Jetpack\Connection\Manager::verify_xml_rpc_signature() |
||
| 277 | * |
||
| 278 | * @return false|array |
||
| 279 | */ |
||
| 280 | public function verify_xml_rpc_signature() { |
||
| 284 | |||
| 285 | /** |
||
| 286 | * Verifies the signature of the current request. |
||
| 287 | * |
||
| 288 | * This function has side effects and should not be used. Instead, |
||
| 289 | * use the memoized version `->verify_xml_rpc_signature()`. |
||
| 290 | * |
||
| 291 | * @deprecated since 7.7.0 |
||
| 292 | * @see Automattic\Jetpack\Connection\Manager::internal_verify_xml_rpc_signature() |
||
| 293 | * @internal |
||
| 294 | */ |
||
| 295 | private function internal_verify_xml_rpc_signature() { |
||
| 298 | |||
| 299 | /** |
||
| 300 | * Authenticates XML-RPC and other requests from the Jetpack Server. |
||
| 301 | * |
||
| 302 | * @deprecated since 7.7.0 |
||
| 303 | * @see Automattic\Jetpack\Connection\Manager::authenticate_jetpack() |
||
| 304 | * |
||
| 305 | * @param \WP_User|mixed $user User object if authenticated. |
||
| 306 | * @param string $username Username. |
||
| 307 | * @param string $password Password string. |
||
| 308 | * @return \WP_User|mixed Authenticated user or error. |
||
| 309 | */ |
||
| 310 | View Code Duplication | public function authenticate_jetpack( $user, $username, $password ) { |
|
| 319 | |||
| 320 | /** |
||
| 321 | * Authenticates requests from Jetpack server to WP REST API endpoints. |
||
| 322 | * Uses the existing XMLRPC request signing implementation. |
||
| 323 | * |
||
| 324 | * @deprecated since 8.9.0 |
||
| 325 | * @see Automattic\Jetpack\Connection\Rest_Authentication::wp_rest_authenticate() |
||
| 326 | * |
||
| 327 | * @param mixed $user User. |
||
| 328 | */ |
||
| 329 | public function wp_rest_authenticate( $user ) { |
||
| 333 | |||
| 334 | /** |
||
| 335 | * Report authentication status to the WP REST API. |
||
| 336 | * |
||
| 337 | * @deprecated since 8.9.0 |
||
| 338 | * @see Automattic\Jetpack\Connection\Rest_Authentication::wp_rest_authentication_errors() |
||
| 339 | * |
||
| 340 | * @param WP_Error|mixed $value Error from another authentication handler, null if we should handle it, or another value if not. |
||
| 341 | * |
||
| 342 | * @return WP_Error|boolean|null {@see WP_JSON_Server::check_authentication} |
||
| 343 | */ |
||
| 344 | public function wp_rest_authentication_errors( $value ) { |
||
| 348 | |||
| 349 | /** |
||
| 350 | * Takes the response from the Jetpack register new site endpoint and |
||
| 351 | * verifies it worked properly. |
||
| 352 | * |
||
| 353 | * @since 2.6 |
||
| 354 | * @deprecated since 7.7.0 |
||
| 355 | * @see Automattic\Jetpack\Connection\Manager::validate_remote_register_response() |
||
| 356 | **/ |
||
| 357 | public function validate_remote_register_response() { |
||
| 360 | |||
| 361 | /** |
||
| 362 | * Builds the timeout limit for queries talking with the wpcom servers. |
||
| 363 | * |
||
| 364 | * Based on local php max_execution_time in php.ini |
||
| 365 | * |
||
| 366 | * @since 2.6 |
||
| 367 | * @return int |
||
| 368 | * @deprecated |
||
| 369 | **/ |
||
| 370 | public function get_remote_query_timeout_limit() { |
||
| 374 | |||
| 375 | /** |
||
| 376 | * Deprecated. |
||
| 377 | * |
||
| 378 | * @deprecated 7.5 Use Connection_Manager instead. |
||
| 379 | * |
||
| 380 | * @param string $action Action. |
||
| 381 | * @param mixed $user_id User ID. |
||
| 382 | */ |
||
| 383 | public static function delete_secrets( $action, $user_id ) { |
||
| 386 | |||
| 387 | /** |
||
| 388 | * Returns the Jetpack XML-RPC API |
||
| 389 | * |
||
| 390 | * @deprecated 8.0 Use Connection_Manager instead. |
||
| 391 | * @return string |
||
| 392 | */ |
||
| 393 | public static function xmlrpc_api_url() { |
||
| 397 | |||
| 398 | /** |
||
| 399 | * Deprecated. |
||
| 400 | * |
||
| 401 | * @deprecated 8.0 |
||
| 402 | * |
||
| 403 | * @param string $url URL. |
||
| 404 | */ |
||
| 405 | public static function fix_url_for_bad_hosts( $url ) { |
||
| 409 | |||
| 410 | /** |
||
| 411 | * Returns the requested Jetpack API URL |
||
| 412 | * |
||
| 413 | * @deprecated since 7.7 |
||
| 414 | * |
||
| 415 | * @param string $relative_url Relative URL. |
||
| 416 | * |
||
| 417 | * @return string |
||
| 418 | */ |
||
| 419 | public static function api_url( $relative_url ) { |
||
| 423 | |||
| 424 | /** |
||
| 425 | * Get our assumed site creation date. |
||
| 426 | * Calculated based on the earlier date of either: |
||
| 427 | * - Earliest admin user registration date. |
||
| 428 | * - Earliest date of post of any post type. |
||
| 429 | * |
||
| 430 | * @since 7.2.0 |
||
| 431 | * @deprecated since 7.8.0 |
||
| 432 | * |
||
| 433 | * @return string Assumed site creation date and time. |
||
| 434 | */ |
||
| 435 | public static function get_assumed_site_creation_date() { |
||
| 439 | |||
| 440 | /** |
||
| 441 | * Filters the URL that will process the connection data. It can be different from the URL |
||
| 442 | * that we send the user to after everything is done. |
||
| 443 | * |
||
| 444 | * @param String $processing_url the default redirect URL used by the package. |
||
| 445 | * @return String the modified URL. |
||
| 446 | * |
||
| 447 | * @deprecated since Jetpack 9.5.0 |
||
| 448 | */ |
||
| 449 | public static function filter_connect_processing_url( $processing_url ) { |
||
| 455 | |||
| 456 | /** |
||
| 457 | * Sign a user role with the master access token. |
||
| 458 | * If not specified, will default to the current user. |
||
| 459 | * |
||
| 460 | * @deprecated since 7.7 |
||
| 461 | * @see Automattic\Jetpack\Connection\Manager::sign_role() |
||
| 462 | * |
||
| 463 | * @access public |
||
| 464 | * @static |
||
| 465 | * |
||
| 466 | * @param string $role User role. |
||
| 467 | * @param int $user_id ID of the user. |
||
| 468 | * @return string Signed user role. |
||
| 469 | */ |
||
| 470 | public static function sign_role( $role, $user_id = null ) { |
||
| 474 | |||
| 475 | /** |
||
| 476 | * Get the minimum capability for a role. |
||
| 477 | * |
||
| 478 | * @deprecated 7.6 Use Automattic\Jetpack\Roles::translate_role_to_cap() instead. |
||
| 479 | * |
||
| 480 | * @access public |
||
| 481 | * @static |
||
| 482 | * |
||
| 483 | * @param string $role Role name. |
||
| 484 | * @return string|boolean Capability, false if role isn't mapped to any capabilities. |
||
| 485 | */ |
||
| 486 | public static function translate_role_to_cap( $role ) { |
||
| 492 | |||
| 493 | /** |
||
| 494 | * Get the role of a particular user. |
||
| 495 | * |
||
| 496 | * @deprecated 7.6 Use Automattic\Jetpack\Roles::translate_user_to_role() instead. |
||
| 497 | * |
||
| 498 | * @access public |
||
| 499 | * @static |
||
| 500 | * |
||
| 501 | * @param \WP_User $user User object. |
||
| 502 | * @return string|boolean User's role, false if not enough capabilities for any of the roles. |
||
| 503 | */ |
||
| 504 | public static function translate_user_to_role( $user ) { |
||
| 510 | |||
| 511 | /** |
||
| 512 | * Get the role of the current user. |
||
| 513 | * |
||
| 514 | * @deprecated 7.6 Use Automattic\Jetpack\Roles::translate_current_user_to_role() instead. |
||
| 515 | * |
||
| 516 | * @access public |
||
| 517 | * @static |
||
| 518 | * |
||
| 519 | * @return string|boolean Current user's role, false if not enough capabilities for any of the roles. |
||
| 520 | */ |
||
| 521 | public static function translate_current_user_to_role() { |
||
| 527 | |||
| 528 | /** |
||
| 529 | * Unlinks the current user from the linked WordPress.com user. |
||
| 530 | * |
||
| 531 | * @deprecated since 7.7 |
||
| 532 | * @see Automattic\Jetpack\Connection\Manager::disconnect_user() |
||
| 533 | * |
||
| 534 | * @param Integer $user_id the user identifier. |
||
| 535 | * @return Boolean Whether the disconnection of the user was successful. |
||
| 536 | */ |
||
| 537 | public static function unlink_user( $user_id = null ) { |
||
| 541 | |||
| 542 | /** |
||
| 543 | * Deprecated. |
||
| 544 | */ |
||
| 545 | public function activate_module_actions() { |
||
| 548 | |||
| 549 | /** |
||
| 550 | * Deprecated. |
||
| 551 | * |
||
| 552 | * @deprecated 8.0 Use Automattic\Jetpack\Connection\Utils::update_user_token() instead. |
||
| 553 | * |
||
| 554 | * Enters a user token into the user_tokens option |
||
| 555 | * |
||
| 556 | * @param int $user_id The user id. |
||
| 557 | * @param string $token The user token. |
||
| 558 | * @param bool $is_master_user Whether the user is the master user. |
||
| 559 | * @return bool |
||
| 560 | */ |
||
| 561 | public static function update_user_token( $user_id, $token, $is_master_user ) { |
||
| 565 | |||
| 566 | /** |
||
| 567 | * Deletes the given option. May be passed multiple option names as an array. |
||
| 568 | * Updates jetpack_options and/or deletes jetpack_$name as appropriate. |
||
| 569 | * |
||
| 570 | * @deprecated 3.4 use Jetpack_Options::delete_option() instead. |
||
| 571 | * @param string|array $names Option name(s). |
||
| 572 | */ |
||
| 573 | public static function delete_option( $names ) { |
||
| 577 | |||
| 578 | /** |
||
| 579 | * Updates the multiple given options. Updates jetpack_options and/or jetpack_$name as appropriate. |
||
| 580 | * |
||
| 581 | * @deprecated 3.4 use Jetpack_Options::update_options() instead. |
||
| 582 | * |
||
| 583 | * @param array $array array( option name => option value, ... ). |
||
| 584 | */ |
||
| 585 | public static function update_options( $array ) { |
||
| 589 | |||
| 590 | /** |
||
| 591 | * Updates the single given option. Updates jetpack_options or jetpack_$name as appropriate. |
||
| 592 | * |
||
| 593 | * @deprecated 3.4 use Jetpack_Options::update_option() instead. |
||
| 594 | * @param string $name Option name. |
||
| 595 | * @param mixed $value Option value. |
||
| 596 | */ |
||
| 597 | public static function update_option( $name, $value ) { |
||
| 601 | |||
| 602 | /** |
||
| 603 | * Allows plugins to submit security reports. |
||
| 604 | */ |
||
| 605 | public static function submit_security_report() { |
||
| 608 | |||
| 609 | /** |
||
| 610 | * Synchronize connected user role changes |
||
| 611 | * |
||
| 612 | * @param mixed $user_id User Id. |
||
| 613 | */ |
||
| 614 | public function user_role_change( $user_id ) { |
||
| 618 | |||
| 619 | /** |
||
| 620 | * Whether the current user is the connection owner. |
||
| 621 | * |
||
| 622 | * @deprecated since 7.7 |
||
| 623 | * |
||
| 624 | * @return bool Whether the current user is the connection owner. |
||
| 625 | */ |
||
| 626 | public function current_user_is_connection_owner() { |
||
| 630 | |||
| 631 | /** |
||
| 632 | * Is a given user (or the current user if none is specified) linked to a WordPress.com user? |
||
| 633 | * |
||
| 634 | * @param mixed $user_id User Id. |
||
| 635 | */ |
||
| 636 | public static function is_user_connected( $user_id = false ) { |
||
| 640 | |||
| 641 | /** |
||
| 642 | * Get the wpcom user data of the current|specified connected user. |
||
| 643 | * |
||
| 644 | * @param mixed $user_id User Id. |
||
| 645 | */ |
||
| 646 | public static function get_connected_user_data( $user_id = null ) { |
||
| 650 | |||
| 651 | /** |
||
| 652 | * Determine whether the active plan supports a particular feature |
||
| 653 | * |
||
| 654 | * @deprecated 7.2.0 Use Jetpack_Plan::supports. |
||
| 655 | * |
||
| 656 | * @param string $feature Feature. |
||
| 657 | * |
||
| 658 | * @return bool True if plan supports feature, false if not. |
||
| 659 | */ |
||
| 660 | public static function active_plan_supports( $feature ) { |
||
| 664 | |||
| 665 | /** |
||
| 666 | * Make an API call to WordPress.com for plan status |
||
| 667 | * |
||
| 668 | * @deprecated 7.2.0 Use Jetpack_Plan::refresh_from_wpcom. |
||
| 669 | * |
||
| 670 | * @return bool True if plan is updated, false if no update |
||
| 671 | */ |
||
| 672 | public static function refresh_active_plan_from_wpcom() { |
||
| 676 | |||
| 677 | /** |
||
| 678 | * Get the plan that this Jetpack site is currently using |
||
| 679 | * |
||
| 680 | * @deprecated 7.2.0 Use Jetpack_Plan::get. |
||
| 681 | * @return array Active Jetpack plan details. |
||
| 682 | */ |
||
| 683 | public static function get_active_plan() { |
||
| 687 | |||
| 688 | /** |
||
| 689 | * Deprecated. |
||
| 690 | */ |
||
| 691 | public static function refresh_update_data() { |
||
| 695 | |||
| 696 | /** |
||
| 697 | * Deprecated. |
||
| 698 | */ |
||
| 699 | public static function refresh_theme_data() { |
||
| 702 | |||
| 703 | /** |
||
| 704 | * Wrapper for core's get_avatar_url(). This one is deprecated. |
||
| 705 | * |
||
| 706 | * @deprecated 4.7 use get_avatar_url instead. |
||
| 707 | * @param int|string|object $id_or_email A user ID, email address, or comment object. |
||
| 708 | * @param int $size Size of the avatar image. |
||
| 709 | * @param string $default URL to a default image to use if no avatar is available. |
||
| 710 | * @param bool $force_display Whether to force it to return an avatar even if show_avatars is disabled. |
||
| 711 | * |
||
| 712 | * @return array |
||
| 713 | */ |
||
| 714 | public static function get_avatar_url( $id_or_email, $size = 96, $default = '', $force_display = false ) { |
||
| 725 | |||
| 726 | /** |
||
| 727 | * Finds out if a site is using a version control system. |
||
| 728 | * |
||
| 729 | * @return string ( '1' | '0' ) |
||
| 730 | **/ |
||
| 731 | public static function is_version_controlled() { |
||
| 735 | |||
| 736 | /** |
||
| 737 | * Determines whether the current theme supports featured images or not. |
||
| 738 | * |
||
| 739 | * @return string ( '1' | '0' ) |
||
| 740 | */ |
||
| 741 | public static function featured_images_enabled() { |
||
| 745 | |||
| 746 | /** |
||
| 747 | * Trigger an update to the main_network_site when we update the siteurl of a site. |
||
| 748 | */ |
||
| 749 | public function update_jetpack_main_network_site_option() { |
||
| 752 | /** |
||
| 753 | * Triggered after a user updates the network settings via Network Settings Admin Page |
||
| 754 | */ |
||
| 755 | public function update_jetpack_network_settings() { |
||
| 759 | |||
| 760 | /** |
||
| 761 | * Require a Jetpack authentication. |
||
| 762 | * |
||
| 763 | * @deprecated since 7.7.0 |
||
| 764 | * @see Automattic\Jetpack\Connection\Manager::require_jetpack_authentication() |
||
| 765 | */ |
||
| 766 | View Code Duplication | public function require_jetpack_authentication() { |
|
| 775 | |||
| 776 | /** |
||
| 777 | * The callback for the JITM ajax requests. |
||
| 778 | * |
||
| 779 | * @deprecated since 7.9.0 |
||
| 780 | */ |
||
| 781 | public function jetpack_jitm_ajax_callback() { |
||
| 784 | |||
| 785 | /** |
||
| 786 | * Since a lot of hosts use a hammer approach to "protecting" WordPress sites, |
||
| 787 | * and just blanket block all requests to /xmlrpc.php, or apply other overly-sensitive |
||
| 788 | * security/firewall policies, we provide our own alternate XML RPC API endpoint |
||
| 789 | * which is accessible via a different URI. Most of the below is copied directly |
||
| 790 | * from /xmlrpc.php so that we're replicating it as closely as possible. |
||
| 791 | * |
||
| 792 | * @deprecated since 7.7.0 |
||
| 793 | * @see Automattic\Jetpack\Connection\Manager::alternate_xmlrpc() |
||
| 794 | */ |
||
| 795 | View Code Duplication | public function alternate_xmlrpc() { |
|
| 804 | |||
| 805 | /** |
||
| 806 | * Removes all XML-RPC methods that are not `jetpack.*`. |
||
| 807 | * Only used in our alternate XML-RPC endpoint, where we want to |
||
| 808 | * ensure that Core and other plugins' methods are not exposed. |
||
| 809 | * |
||
| 810 | * @deprecated since 7.7.0 |
||
| 811 | * @see Automattic\Jetpack\Connection\Manager::remove_non_jetpack_xmlrpc_methods() |
||
| 812 | * |
||
| 813 | * @param array $methods A list of registered WordPress XMLRPC methods. |
||
| 814 | * @return array Filtered $methods |
||
| 815 | */ |
||
| 816 | View Code Duplication | public function remove_non_jetpack_xmlrpc_methods( $methods ) { |
|
| 825 | |||
| 826 | /** |
||
| 827 | * Initialize REST API registration connector. |
||
| 828 | * |
||
| 829 | * @deprecated since 7.7.0 |
||
| 830 | * @see Automattic\Jetpack\Connection\Manager::initialize_rest_api_registration_connector() |
||
| 831 | */ |
||
| 832 | View Code Duplication | public function initialize_rest_api_registration_connector() { |
|
| 841 | |||
| 842 | /** |
||
| 843 | * Sets up the XMLRPC request handlers. |
||
| 844 | * |
||
| 845 | * @deprecated since 7.7.0 |
||
| 846 | * @see Automattic\Jetpack\Connection\Manager::setup_xmlrpc_handlers() |
||
| 847 | * |
||
| 848 | * @param array $request_params Incoming request parameters. |
||
| 849 | * @param Boolean $is_active Whether the connection is currently active. |
||
| 850 | * @param Boolean $is_signed Whether the signature check has been successful. |
||
| 851 | * @param Jetpack_XMLRPC_Server $xmlrpc_server (optional) An instance of the server to use instead of instantiating a new one. |
||
| 852 | */ |
||
| 853 | View Code Duplication | public function setup_xmlrpc_handlers( |
|
| 872 | } |
||
| 873 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.