PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 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 All 506 releases
jetpack / jetpack_vendor / automattic / jetpack-backup / actions.php

actions.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.5, at jetpack_vendor/automattic/jetpack-backup/actions.php

52 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Action Hooks for Jetpack Backup module.
4 *
5 * @package automattic/jetpack-backup
6 */
7
8 // If WordPress's plugin API is available already, use it. If not,
9 // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`.
10 if ( function_exists( 'add_filter' ) ) {
11 $add_filter = 'add_filter';
12 $add_action = 'add_action';
13 } else {
14 $add_filter = function ( $name, $cb, $priority = 10, $accepted_args = 1 ) {
15 global $wp_filter;
16 // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
17 $wp_filter[ $name ][ $priority ][] = array(
18 'accepted_args' => $accepted_args,
19 'function' => $cb,
20 );
21 };
22 $add_action = $add_filter;
23 }
24
25 // Clean up expired Helper Scripts from a scheduled event.
26 $add_action( 'jetpack_backup_cleanup_helper_scripts', array( 'Automattic\\Jetpack\\Backup\\V0005\\Helper_Script_Manager', 'cleanup_expired_helper_scripts' ) );
27
28 // Register REST routes.
29 $add_action( 'rest_api_init', array( 'Automattic\\Jetpack\\Backup\\V0005\\REST_Controller', 'register_rest_routes' ) );
30
31 // Set up package version hook.
32 $add_filter( 'jetpack_package_versions', 'Automattic\\Jetpack\\Backup\\Package_Version::send_package_version_to_tracker' );
33
34 // Register Jetpack Backup abilities with the WordPress Abilities API at autoload
35 // time so the surface is available in any consumer that loads this package
36 // (both the standalone Jetpack Backup plugin and the Jetpack plugin). The
37 // `jetpack_wp_abilities_enabled` filter (default false) gates registration,
38 // so this is a no-op until a site opts in.
39 $add_action(
40 'plugins_loaded',
41 static function () {
42 if ( ! apply_filters( 'jetpack_wp_abilities_enabled', false ) ) {
43 return;
44 }
45 if ( ! class_exists( \Automattic\Jetpack\Backup\V0005\Abilities\Backup_Abilities::class ) ) {
46 return;
47 }
48 \Automattic\Jetpack\Backup\V0005\Abilities\Backup_Abilities::init();
49 },
50 20
51 );
52