Aucune description

load-jetpack.php 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * Load all Jetpack files that do not get loaded via the autoloader.
  4. *
  5. * @package automattic/jetpack
  6. */
  7. /**
  8. * Returns the location of Jetpack's lib directory. This filter is applied
  9. * in require_lib().
  10. *
  11. * @since 4.0.2
  12. *
  13. * @return string Location of Jetpack library directory.
  14. *
  15. * @filter require_lib_dir
  16. */
  17. function jetpack_require_lib_dir() {
  18. return JETPACK__PLUGIN_DIR . '_inc/lib';
  19. }
  20. add_filter( 'jetpack_require_lib_dir', 'jetpack_require_lib_dir' );
  21. /**
  22. * Checks if the code debug mode turned on, and returns false if it is. When Jetpack is in
  23. * code debug mode, it shouldn't use minified assets. Note that this filter is not being used
  24. * in every place where assets are enqueued. The filter is added at priority 9 to be overridden
  25. * by any default priority filter that runs after it.
  26. *
  27. * @since 6.2.0
  28. *
  29. * @return boolean
  30. *
  31. * @filter jetpack_should_use_minified_assets
  32. */
  33. function jetpack_should_use_minified_assets() {
  34. return ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG;
  35. }
  36. add_filter( 'jetpack_should_use_minified_assets', 'jetpack_should_use_minified_assets', 9 );
  37. // @todo: Abstract out the admin functions, and only include them if is_admin()
  38. require_once JETPACK__PLUGIN_DIR . 'class.jetpack.php';
  39. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-network.php';
  40. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-client-server.php';
  41. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-user-agent.php';
  42. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-post-images.php';
  43. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-heartbeat.php';
  44. require_once JETPACK__PLUGIN_DIR . 'class.photon.php';
  45. require_once JETPACK__PLUGIN_DIR . 'functions.photon.php';
  46. require_once JETPACK__PLUGIN_DIR . 'functions.global.php';
  47. require_once JETPACK__PLUGIN_DIR . 'functions.compat.php';
  48. require_once JETPACK__PLUGIN_DIR . 'functions.gallery.php';
  49. require_once JETPACK__PLUGIN_DIR . 'functions.cookies.php';
  50. require_once JETPACK__PLUGIN_DIR . 'require-lib.php';
  51. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-autoupdate.php';
  52. require_once JETPACK__PLUGIN_DIR . 'class.frame-nonce-preview.php';
  53. require_once JETPACK__PLUGIN_DIR . 'modules/module-headings.php';
  54. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-connection-banner.php';
  55. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-plan.php';
  56. // Used by the API endpoints.
  57. require_once JETPACK__PLUGIN_DIR . 'modules/seo-tools/jetpack-seo-utils.php';
  58. require_once JETPACK__PLUGIN_DIR . 'modules/seo-tools/jetpack-seo-titles.php';
  59. require_once JETPACK__PLUGIN_DIR . 'modules/seo-tools/jetpack-seo-posts.php';
  60. require_once JETPACK__PLUGIN_DIR . 'modules/verification-tools/verification-tools-utils.php';
  61. require_once JETPACK__PLUGIN_DIR . 'class-jetpack-xmlrpc-methods.php';
  62. Jetpack_XMLRPC_Methods::init();
  63. require_once JETPACK__PLUGIN_DIR . 'class-jetpack-connection-status.php';
  64. Jetpack_Connection_Status::init();
  65. jetpack_require_lib( 'class-jetpack-recommendations' );
  66. require_once JETPACK__PLUGIN_DIR . 'class-jetpack-recommendations-banner.php';
  67. if ( is_admin() ) {
  68. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-admin.php';
  69. jetpack_require_lib( 'debugger' );
  70. }
  71. // Play nice with https://wp-cli.org/.
  72. if ( defined( 'WP_CLI' ) && WP_CLI ) {
  73. require_once JETPACK__PLUGIN_DIR . 'class.jetpack-cli.php';
  74. }
  75. require_once JETPACK__PLUGIN_DIR . '_inc/lib/class.core-rest-api-endpoints.php';
  76. add_action( 'updating_jetpack_version', array( 'Jetpack', 'do_version_bump' ), 10, 2 );
  77. add_filter( 'is_jetpack_site', '__return_true' );
  78. if ( JETPACK__SANDBOX_DOMAIN ) {
  79. require_once JETPACK__PLUGIN_DIR . '_inc/jetpack-server-sandbox.php';
  80. }
  81. require_once JETPACK__PLUGIN_DIR . '3rd-party/3rd-party.php';
  82. Jetpack::init();