Нет описания

actions.php 1.2KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Action Hooks for Jetpack Backup module.
  4. *
  5. * @package automattic/jetpack-backup
  6. */
  7. // If WordPress's plugin API is available already, use it. If not,
  8. // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`.
  9. if ( function_exists( 'add_filter' ) ) {
  10. $add_filter = 'add_filter';
  11. $add_action = 'add_action';
  12. } else {
  13. $add_filter = function ( $name, $cb, $priority = 10, $accepted_args = 1 ) {
  14. global $wp_filter;
  15. // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
  16. $wp_filter[ $name ][ $priority ][] = array(
  17. 'accepted_args' => $accepted_args,
  18. 'function' => $cb,
  19. );
  20. };
  21. $add_action = $add_filter;
  22. }
  23. // Clean up expired Helper Scripts from a scheduled event.
  24. $add_action( 'jetpack_backup_cleanup_helper_scripts', array( 'Automattic\\Jetpack\\Backup\\Helper_Script_Manager', 'cleanup_expired_helper_scripts' ) );
  25. // Register REST routes.
  26. $add_action( 'rest_api_init', array( 'Automattic\\Jetpack\\Backup\\REST_Controller', 'register_rest_routes' ) );
  27. // Set up package version hook.
  28. $add_filter( 'jetpack_package_versions', 'Automattic\\Jetpack\\Backup\\Package_Version::send_package_version_to_tracker' );