Няма описание

module-extras.php 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Load module code that is needed even when a module isn't active.
  4. * For example, if a module shouldn't be activatable unless certain conditions are met,
  5. * the code belongs in this file.
  6. *
  7. * @package automattic/jetpack
  8. */
  9. /**
  10. * Features available all the time:
  11. * - When in offline mode.
  12. * - When connected to WordPress.com.
  13. */
  14. $tools = array(
  15. // Always loaded, but only registered if theme supports it.
  16. 'custom-post-types/comics.php',
  17. 'custom-post-types/testimonial.php',
  18. 'custom-post-types/nova.php',
  19. 'geo-location.php',
  20. // Those oEmbed providers are always available.
  21. 'shortcodes/facebook.php',
  22. 'shortcodes/others.php',
  23. // Theme Tools.
  24. 'theme-tools.php',
  25. 'theme-tools/social-links.php',
  26. 'theme-tools/random-redirect.php',
  27. 'theme-tools/featured-content.php',
  28. 'theme-tools/infinite-scroll.php',
  29. 'theme-tools/responsive-videos.php',
  30. 'theme-tools/site-logo.php',
  31. 'theme-tools/site-breadcrumbs.php',
  32. 'theme-tools/social-menu.php',
  33. 'theme-tools/content-options.php',
  34. 'theme-tools/devicepx.php',
  35. // Needed for VideoPress, so videos keep working in existing posts/pages when the module is deactivated.
  36. 'videopress/utility-functions.php',
  37. 'videopress/class.videopress-gutenberg.php',
  38. );
  39. // Some features are only available when connected to WordPress.com.
  40. $connected_tools = array(
  41. 'calypsoify/class-jetpack-calypsoify.php',
  42. 'cloudflare-analytics/cloudflare-analytics.php',
  43. 'plugin-search.php',
  44. 'scan/scan.php', // Shows Jetpack Scan alerts in the admin bar if threats found.
  45. 'simple-payments/simple-payments.php',
  46. 'wpcom-block-editor/class-jetpack-wpcom-block-editor.php',
  47. 'wpcom-tos/wpcom-tos.php',
  48. // These oEmbed providers are available when connected to WordPress.com.
  49. // Starting from 2020-10-24, they need an authentication token, and that token is stored on WordPress.com.
  50. // More information: https://developers.facebook.com/docs/instagram/oembed/.
  51. 'shortcodes/instagram.php',
  52. );
  53. // Add connected features to our existing list if the site is currently connected.
  54. if ( Jetpack::is_connection_ready() ) {
  55. $tools = array_merge( $tools, $connected_tools );
  56. }
  57. /**
  58. * Filter extra tools (not modules) to include.
  59. *
  60. * @since 2.4.0
  61. * @since 5.4.0 can be used in multisite when Jetpack is not connected to WordPress.com and not in offline mode.
  62. *
  63. * @param array $tools Array of extra tools to include.
  64. */
  65. $jetpack_tools_to_include = apply_filters( 'jetpack_tools_to_include', $tools );
  66. if ( ! empty( $jetpack_tools_to_include ) ) {
  67. foreach ( $jetpack_tools_to_include as $tool ) {
  68. if ( file_exists( JETPACK__PLUGIN_DIR . '/modules/' . $tool ) ) {
  69. require_once JETPACK__PLUGIN_DIR . '/modules/' . $tool;
  70. }
  71. }
  72. }
  73. /**
  74. * Add the "(Jetpack)" suffix to the widget names
  75. *
  76. * @param string $widget_name Widget name.
  77. */
  78. function jetpack_widgets_add_suffix( $widget_name ) {
  79. return sprintf(
  80. /* Translators: Placeholder is the name of a widget. */
  81. __( '%s (Jetpack)', 'jetpack' ),
  82. $widget_name
  83. );
  84. }
  85. add_filter( 'jetpack_widget_name', 'jetpack_widgets_add_suffix' );