@@ -28,38 +28,38 @@ |
||
| 28 | 28 | |
| 29 | 29 | if ( ! function_exists( 'action_scheduler_register_3_dot_4_dot_0' ) && function_exists( 'add_action' ) ) { |
| 30 | 30 | |
| 31 | - if ( ! class_exists( 'ActionScheduler_Versions', false ) ) { |
|
| 32 | - require_once __DIR__ . '/classes/ActionScheduler_Versions.php'; |
|
| 33 | - add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 ); |
|
| 34 | - } |
|
| 31 | + if ( ! class_exists( 'ActionScheduler_Versions', false ) ) { |
|
| 32 | + require_once __DIR__ . '/classes/ActionScheduler_Versions.php'; |
|
| 33 | + add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 ); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_4_dot_0', 0, 0 ); |
|
| 36 | + add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_4_dot_0', 0, 0 ); |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Registers this version of Action Scheduler. |
|
| 40 | - */ |
|
| 41 | - function action_scheduler_register_3_dot_4_dot_0() { |
|
| 42 | - $versions = ActionScheduler_Versions::instance(); |
|
| 43 | - $versions->register( '3.4.0', 'action_scheduler_initialize_3_dot_4_dot_0' ); |
|
| 44 | - } |
|
| 38 | + /** |
|
| 39 | + * Registers this version of Action Scheduler. |
|
| 40 | + */ |
|
| 41 | + function action_scheduler_register_3_dot_4_dot_0() { |
|
| 42 | + $versions = ActionScheduler_Versions::instance(); |
|
| 43 | + $versions->register( '3.4.0', 'action_scheduler_initialize_3_dot_4_dot_0' ); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Initializes this version of Action Scheduler. |
|
| 48 | - */ |
|
| 49 | - function action_scheduler_initialize_3_dot_4_dot_0() { |
|
| 50 | - // A final safety check is required even here, because historic versions of Action Scheduler |
|
| 51 | - // followed a different pattern (in some unusual cases, we could reach this point and the |
|
| 52 | - // ActionScheduler class is already defined—so we need to guard against that). |
|
| 53 | - if ( ! class_exists( 'ActionScheduler', false ) ) { |
|
| 54 | - require_once __DIR__ . '/classes/abstracts/ActionScheduler.php'; |
|
| 55 | - ActionScheduler::init( __FILE__ ); |
|
| 56 | - } |
|
| 57 | - } |
|
| 46 | + /** |
|
| 47 | + * Initializes this version of Action Scheduler. |
|
| 48 | + */ |
|
| 49 | + function action_scheduler_initialize_3_dot_4_dot_0() { |
|
| 50 | + // A final safety check is required even here, because historic versions of Action Scheduler |
|
| 51 | + // followed a different pattern (in some unusual cases, we could reach this point and the |
|
| 52 | + // ActionScheduler class is already defined—so we need to guard against that). |
|
| 53 | + if ( ! class_exists( 'ActionScheduler', false ) ) { |
|
| 54 | + require_once __DIR__ . '/classes/abstracts/ActionScheduler.php'; |
|
| 55 | + ActionScheduler::init( __FILE__ ); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - // Support usage in themes - load this version if no plugin has loaded a version yet. |
|
| 60 | - if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) { |
|
| 61 | - action_scheduler_initialize_3_dot_4_dot_0(); |
|
| 62 | - do_action( 'action_scheduler_pre_theme_init' ); |
|
| 63 | - ActionScheduler_Versions::initialize_latest_version(); |
|
| 64 | - } |
|
| 59 | + // Support usage in themes - load this version if no plugin has loaded a version yet. |
|
| 60 | + if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) { |
|
| 61 | + action_scheduler_initialize_3_dot_4_dot_0(); |
|
| 62 | + do_action( 'action_scheduler_pre_theme_init' ); |
|
| 63 | + ActionScheduler_Versions::initialize_latest_version(); |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $minimum_wp_version = '5.9'; |
| 22 | 22 | |
| 23 | 23 | if ( ! defined( 'WC_BLOCKS_IS_FEATURE_PLUGIN' ) ) { |
| 24 | - define( 'WC_BLOCKS_IS_FEATURE_PLUGIN', true ); |
|
| 24 | + define( 'WC_BLOCKS_IS_FEATURE_PLUGIN', true ); |
|
| 25 | 25 | } |
| 26 | 26 | /** |
| 27 | 27 | * Whether notices must be displayed in the current page (plugins and WooCommerce pages). |
@@ -29,39 +29,39 @@ discard block |
||
| 29 | 29 | * @since 2.5.0 |
| 30 | 30 | */ |
| 31 | 31 | function should_display_compatibility_notices() { |
| 32 | - $current_screen = get_current_screen(); |
|
| 32 | + $current_screen = get_current_screen(); |
|
| 33 | 33 | |
| 34 | - if ( ! isset( $current_screen ) ) { |
|
| 35 | - return false; |
|
| 36 | - } |
|
| 34 | + if ( ! isset( $current_screen ) ) { |
|
| 35 | + return false; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - $is_plugins_page = |
|
| 39 | - property_exists( $current_screen, 'id' ) && |
|
| 40 | - 'plugins' === $current_screen->id; |
|
| 41 | - $is_woocommerce_page = |
|
| 42 | - property_exists( $current_screen, 'parent_base' ) && |
|
| 43 | - 'woocommerce' === $current_screen->parent_base; |
|
| 38 | + $is_plugins_page = |
|
| 39 | + property_exists( $current_screen, 'id' ) && |
|
| 40 | + 'plugins' === $current_screen->id; |
|
| 41 | + $is_woocommerce_page = |
|
| 42 | + property_exists( $current_screen, 'parent_base' ) && |
|
| 43 | + 'woocommerce' === $current_screen->parent_base; |
|
| 44 | 44 | |
| 45 | - return $is_plugins_page || $is_woocommerce_page; |
|
| 45 | + return $is_plugins_page || $is_woocommerce_page; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | if ( version_compare( $GLOBALS['wp_version'], $minimum_wp_version, '<' ) ) { |
| 49 | - /** |
|
| 50 | - * Outputs for an admin notice about running WooCommerce Blocks on outdated WordPress. |
|
| 51 | - * |
|
| 52 | - * @since 2.5.0 |
|
| 53 | - */ |
|
| 54 | - function woocommerce_blocks_admin_unsupported_wp_notice() { |
|
| 55 | - if ( should_display_compatibility_notices() ) { |
|
| 56 | - ?> |
|
| 49 | + /** |
|
| 50 | + * Outputs for an admin notice about running WooCommerce Blocks on outdated WordPress. |
|
| 51 | + * |
|
| 52 | + * @since 2.5.0 |
|
| 53 | + */ |
|
| 54 | + function woocommerce_blocks_admin_unsupported_wp_notice() { |
|
| 55 | + if ( should_display_compatibility_notices() ) { |
|
| 56 | + ?> |
|
| 57 | 57 | <div class="notice notice-error"> |
| 58 | 58 | <p><?php esc_html_e( 'The WooCommerce Blocks feature plugin requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying WooCommerce Blocks.', 'woocommerce' ); ?></p> |
| 59 | 59 | </div> |
| 60 | 60 | <?php |
| 61 | - } |
|
| 62 | - } |
|
| 63 | - add_action( 'admin_notices', 'woocommerce_blocks_admin_unsupported_wp_notice' ); |
|
| 64 | - return; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + add_action( 'admin_notices', 'woocommerce_blocks_admin_unsupported_wp_notice' ); |
|
| 64 | + return; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -73,32 +73,32 @@ discard block |
||
| 73 | 73 | * @return bool True means the current version is a development version. |
| 74 | 74 | */ |
| 75 | 75 | function woocommerce_blocks_is_development_version() { |
| 76 | - $composer_file = __DIR__ . '/composer.json'; |
|
| 77 | - if ( ! is_readable( $composer_file ) ) { |
|
| 78 | - return false; |
|
| 79 | - } |
|
| 80 | - // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- including local file |
|
| 81 | - $composer_config = json_decode( file_get_contents( $composer_file ), true ); |
|
| 82 | - return ! isset( $composer_config['version'] ); |
|
| 76 | + $composer_file = __DIR__ . '/composer.json'; |
|
| 77 | + if ( ! is_readable( $composer_file ) ) { |
|
| 78 | + return false; |
|
| 79 | + } |
|
| 80 | + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- including local file |
|
| 81 | + $composer_config = json_decode( file_get_contents( $composer_file ), true ); |
|
| 82 | + return ! isset( $composer_config['version'] ); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * If development version is detected and the Jetpack constant is not defined, show a notice. |
| 87 | 87 | */ |
| 88 | 88 | if ( woocommerce_blocks_is_development_version() && ! defined( 'JETPACK_AUTOLOAD_DEV' ) ) { |
| 89 | - add_action( |
|
| 90 | - 'admin_notices', |
|
| 91 | - function() { |
|
| 92 | - echo '<div class="error"><p>'; |
|
| 93 | - printf( |
|
| 94 | - /* translators: %1$s is referring to a php constant name, %2$s is referring to the wp-config.php file. */ |
|
| 95 | - esc_html__( 'WooCommerce Blocks development mode requires the %1$s constant to be defined and true in your %2$s file. Otherwise you are loading the blocks package from WooCommerce core.', 'woocommerce' ), |
|
| 96 | - 'JETPACK_AUTOLOAD_DEV', |
|
| 97 | - 'wp-config.php' |
|
| 98 | - ); |
|
| 99 | - echo '</p></div>'; |
|
| 100 | - } |
|
| 101 | - ); |
|
| 89 | + add_action( |
|
| 90 | + 'admin_notices', |
|
| 91 | + function() { |
|
| 92 | + echo '<div class="error"><p>'; |
|
| 93 | + printf( |
|
| 94 | + /* translators: %1$s is referring to a php constant name, %2$s is referring to the wp-config.php file. */ |
|
| 95 | + esc_html__( 'WooCommerce Blocks development mode requires the %1$s constant to be defined and true in your %2$s file. Otherwise you are loading the blocks package from WooCommerce core.', 'woocommerce' ), |
|
| 96 | + 'JETPACK_AUTOLOAD_DEV', |
|
| 97 | + 'wp-config.php' |
|
| 98 | + ); |
|
| 99 | + echo '</p></div>'; |
|
| 100 | + } |
|
| 101 | + ); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -113,41 +113,41 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | $autoloader = __DIR__ . '/vendor/autoload_packages.php'; |
| 115 | 115 | if ( is_readable( $autoloader ) ) { |
| 116 | - require $autoloader; |
|
| 116 | + require $autoloader; |
|
| 117 | 117 | } else { |
| 118 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 119 | - error_log( // phpcs:ignore |
|
| 120 | - sprintf( |
|
| 121 | - /* translators: 1: composer command. 2: plugin directory */ |
|
| 122 | - esc_html__( 'Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce' ), |
|
| 123 | - '`composer install`', |
|
| 124 | - '`' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '`' |
|
| 125 | - ) |
|
| 126 | - ); |
|
| 127 | - } |
|
| 128 | - /** |
|
| 129 | - * Outputs an admin notice if composer install has not been ran. |
|
| 130 | - */ |
|
| 131 | - add_action( |
|
| 132 | - 'admin_notices', |
|
| 133 | - function() { |
|
| 134 | - ?> |
|
| 118 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 119 | + error_log( // phpcs:ignore |
|
| 120 | + sprintf( |
|
| 121 | + /* translators: 1: composer command. 2: plugin directory */ |
|
| 122 | + esc_html__( 'Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce' ), |
|
| 123 | + '`composer install`', |
|
| 124 | + '`' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '`' |
|
| 125 | + ) |
|
| 126 | + ); |
|
| 127 | + } |
|
| 128 | + /** |
|
| 129 | + * Outputs an admin notice if composer install has not been ran. |
|
| 130 | + */ |
|
| 131 | + add_action( |
|
| 132 | + 'admin_notices', |
|
| 133 | + function() { |
|
| 134 | + ?> |
|
| 135 | 135 | <div class="notice notice-error"> |
| 136 | 136 | <p> |
| 137 | 137 | <?php |
| 138 | - printf( |
|
| 139 | - /* translators: 1: composer command. 2: plugin directory */ |
|
| 140 | - esc_html__( 'Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce' ), |
|
| 141 | - '<code>composer install</code>', |
|
| 142 | - '<code>' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '</code>' |
|
| 143 | - ); |
|
| 144 | - ?> |
|
| 138 | + printf( |
|
| 139 | + /* translators: 1: composer command. 2: plugin directory */ |
|
| 140 | + esc_html__( 'Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce' ), |
|
| 141 | + '<code>composer install</code>', |
|
| 142 | + '<code>' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '</code>' |
|
| 143 | + ); |
|
| 144 | + ?> |
|
| 145 | 145 | </p> |
| 146 | 146 | </div> |
| 147 | 147 | <?php |
| 148 | - } |
|
| 149 | - ); |
|
| 150 | - return; |
|
| 148 | + } |
|
| 149 | + ); |
|
| 150 | + return; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | add_action( 'plugins_loaded', array( '\Automattic\WooCommerce\Blocks\Package', 'init' ) ); |
@@ -168,49 +168,49 @@ discard block |
||
| 168 | 168 | * @return string|false Path to the translation file to load. False if there isn't one. |
| 169 | 169 | */ |
| 170 | 170 | function load_woocommerce_core_json_translation( $file, $handle, $domain ) { |
| 171 | - if ( 'woo-gutenberg-products-block' !== $domain ) { |
|
| 172 | - return $file; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - $lang_dir = WP_LANG_DIR . '/plugins'; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * We only care about the translation file of the feature plugin in the |
|
| 179 | - * wp-content/languages folder. |
|
| 180 | - */ |
|
| 181 | - if ( false === strpos( $file, $lang_dir ) ) { |
|
| 182 | - return $file; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - // If the translation file for feature plugin exist, use it. |
|
| 186 | - if ( is_readable( $file ) ) { |
|
| 187 | - return $file; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - global $wp_scripts; |
|
| 191 | - |
|
| 192 | - if ( ! isset( $wp_scripts->registered[ $handle ], $wp_scripts->registered[ $handle ]->src ) ) { |
|
| 193 | - return $file; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - $handle_src = explode( '/build/', $wp_scripts->registered[ $handle ]->src ); |
|
| 197 | - $handle_filename = $handle_src[1]; |
|
| 198 | - $locale = determine_locale(); |
|
| 199 | - $lang_dir = WP_LANG_DIR . '/plugins'; |
|
| 200 | - |
|
| 201 | - // Translations are always based on the unminified filename. |
|
| 202 | - if ( substr( $handle_filename, -7 ) === '.min.js' ) { |
|
| 203 | - $handle_filename = substr( $handle_filename, 0, -7 ) . '.js'; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - $core_path_md5 = md5( 'packages/woocommerce-blocks/build/' . $handle_filename ); |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * Return file path of the corresponding translation file in the WC Core is |
|
| 210 | - * enough because `load_script_translations()` will check for its existence |
|
| 211 | - * before loading it. |
|
| 212 | - */ |
|
| 213 | - return $lang_dir . '/woocommerce-' . $locale . '-' . $core_path_md5 . '.json'; |
|
| 171 | + if ( 'woo-gutenberg-products-block' !== $domain ) { |
|
| 172 | + return $file; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + $lang_dir = WP_LANG_DIR . '/plugins'; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * We only care about the translation file of the feature plugin in the |
|
| 179 | + * wp-content/languages folder. |
|
| 180 | + */ |
|
| 181 | + if ( false === strpos( $file, $lang_dir ) ) { |
|
| 182 | + return $file; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + // If the translation file for feature plugin exist, use it. |
|
| 186 | + if ( is_readable( $file ) ) { |
|
| 187 | + return $file; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + global $wp_scripts; |
|
| 191 | + |
|
| 192 | + if ( ! isset( $wp_scripts->registered[ $handle ], $wp_scripts->registered[ $handle ]->src ) ) { |
|
| 193 | + return $file; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + $handle_src = explode( '/build/', $wp_scripts->registered[ $handle ]->src ); |
|
| 197 | + $handle_filename = $handle_src[1]; |
|
| 198 | + $locale = determine_locale(); |
|
| 199 | + $lang_dir = WP_LANG_DIR . '/plugins'; |
|
| 200 | + |
|
| 201 | + // Translations are always based on the unminified filename. |
|
| 202 | + if ( substr( $handle_filename, -7 ) === '.min.js' ) { |
|
| 203 | + $handle_filename = substr( $handle_filename, 0, -7 ) . '.js'; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + $core_path_md5 = md5( 'packages/woocommerce-blocks/build/' . $handle_filename ); |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * Return file path of the corresponding translation file in the WC Core is |
|
| 210 | + * enough because `load_script_translations()` will check for its existence |
|
| 211 | + * before loading it. |
|
| 212 | + */ |
|
| 213 | + return $lang_dir . '/woocommerce-' . $locale . '-' . $core_path_md5 . '.json'; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | add_filter( 'load_script_translation_file', 'load_woocommerce_core_json_translation', 10, 3 ); |
@@ -225,16 +225,16 @@ discard block |
||
| 225 | 225 | * @return string WC Blocks translation. In case it's the same as $text, Core translation. |
| 226 | 226 | */ |
| 227 | 227 | function woocommerce_blocks_get_php_translation_from_core( $translation, $text, $domain ) { |
| 228 | - if ( 'woo-gutenberg-products-block' !== $domain ) { |
|
| 229 | - return $translation; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - // When translation is the same, that could mean the string is not translated. |
|
| 233 | - // In that case, load it from core. |
|
| 234 | - if ( $translation === $text ) { |
|
| 235 | - return translate( $text, 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction, WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.TextDomainMismatch |
|
| 236 | - } |
|
| 237 | - return $translation; |
|
| 228 | + if ( 'woo-gutenberg-products-block' !== $domain ) { |
|
| 229 | + return $translation; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + // When translation is the same, that could mean the string is not translated. |
|
| 233 | + // In that case, load it from core. |
|
| 234 | + if ( $translation === $text ) { |
|
| 235 | + return translate( $text, 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction, WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.TextDomainMismatch |
|
| 236 | + } |
|
| 237 | + return $translation; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | add_filter( 'gettext', 'woocommerce_blocks_get_php_translation_from_core', 10, 3 ); |
@@ -245,33 +245,33 @@ discard block |
||
| 245 | 245 | * @see https://github.com/woocommerce/woocommerce-blocks/issues/5587 |
| 246 | 246 | */ |
| 247 | 247 | function woocommerce_blocks_plugin_outdated_notice() { |
| 248 | - $is_active = |
|
| 249 | - is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) || |
|
| 250 | - is_plugin_active( 'woocommerce-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) || |
|
| 251 | - is_plugin_active( 'woocommerce-blocks/woocommerce-gutenberg-products-block.php' ); |
|
| 252 | - |
|
| 253 | - if ( ! $is_active ) { |
|
| 254 | - return; |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - $woocommerce_blocks_path = \Automattic\WooCommerce\Blocks\Package::get_path(); |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * Check the current WC Blocks path. If the WC Blocks plugin is active but |
|
| 261 | - * the current path is from the WC Core, we can consider the plugin is |
|
| 262 | - * outdated because Jetpack Autoloader always loads the newer package. |
|
| 263 | - */ |
|
| 264 | - if ( ! strpos( $woocommerce_blocks_path, 'packages/woocommerce-blocks' ) ) { |
|
| 265 | - return; |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - if ( should_display_compatibility_notices() ) { |
|
| 269 | - ?> |
|
| 248 | + $is_active = |
|
| 249 | + is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) || |
|
| 250 | + is_plugin_active( 'woocommerce-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) || |
|
| 251 | + is_plugin_active( 'woocommerce-blocks/woocommerce-gutenberg-products-block.php' ); |
|
| 252 | + |
|
| 253 | + if ( ! $is_active ) { |
|
| 254 | + return; |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + $woocommerce_blocks_path = \Automattic\WooCommerce\Blocks\Package::get_path(); |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * Check the current WC Blocks path. If the WC Blocks plugin is active but |
|
| 261 | + * the current path is from the WC Core, we can consider the plugin is |
|
| 262 | + * outdated because Jetpack Autoloader always loads the newer package. |
|
| 263 | + */ |
|
| 264 | + if ( ! strpos( $woocommerce_blocks_path, 'packages/woocommerce-blocks' ) ) { |
|
| 265 | + return; |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + if ( should_display_compatibility_notices() ) { |
|
| 269 | + ?> |
|
| 270 | 270 | <div class="notice notice-warning"> |
| 271 | 271 | <p><?php esc_html_e( 'You have WooCommerce Blocks installed, but the WooCommerce bundled version is running because it is more up-to-date. This may cause unexpected compatibility issues. Please update the WooCommerce Blocks plugin.', 'woocommerce' ); ?></p> |
| 272 | 272 | </div> |
| 273 | 273 | <?php |
| 274 | - } |
|
| 274 | + } |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | add_action( 'admin_notices', 'woocommerce_blocks_plugin_outdated_notice' ); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | |
| 8 | 8 | namespace Automattic\Jetpack\Autoloader\jp526c9128fcc85a1cd942451999a66eb0; |
| 9 | 9 | |
| 10 | - // phpcs:ignore |
|
| 10 | + // phpcs:ignore |
|
| 11 | 11 | |
| 12 | 12 | require_once __DIR__ . '/jetpack-autoloader/class-autoloader.php'; |
| 13 | 13 | Autoloader::init(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php return array ( |
| 2 | - 'root' => |
|
| 3 | - array ( |
|
| 2 | + 'root' => |
|
| 3 | + array ( |
|
| 4 | 4 | 'pretty_version' => 'dev-trunk', |
| 5 | 5 | 'version' => 'dev-trunk', |
| 6 | 6 | 'aliases' => |
@@ -8,49 +8,49 @@ discard block |
||
| 8 | 8 | ), |
| 9 | 9 | 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
| 10 | 10 | 'name' => 'woocommerce/woocommerce-blocks', |
| 11 | - ), |
|
| 12 | - 'versions' => |
|
| 13 | - array ( |
|
| 11 | + ), |
|
| 12 | + 'versions' => |
|
| 13 | + array ( |
|
| 14 | 14 | 'automattic/jetpack-autoloader' => |
| 15 | 15 | array ( |
| 16 | - 'pretty_version' => 'v2.10.7', |
|
| 17 | - 'version' => '2.10.7.0', |
|
| 18 | - 'aliases' => |
|
| 19 | - array ( |
|
| 20 | - ), |
|
| 21 | - 'reference' => 'e3dfa1a2679e4b8e380bc37b722081875c84a381', |
|
| 16 | + 'pretty_version' => 'v2.10.7', |
|
| 17 | + 'version' => '2.10.7.0', |
|
| 18 | + 'aliases' => |
|
| 19 | + array ( |
|
| 20 | + ), |
|
| 21 | + 'reference' => 'e3dfa1a2679e4b8e380bc37b722081875c84a381', |
|
| 22 | 22 | ), |
| 23 | 23 | 'composer/installers' => |
| 24 | 24 | array ( |
| 25 | - 'pretty_version' => 'v1.12.0', |
|
| 26 | - 'version' => '1.12.0.0', |
|
| 27 | - 'aliases' => |
|
| 28 | - array ( |
|
| 29 | - ), |
|
| 30 | - 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', |
|
| 25 | + 'pretty_version' => 'v1.12.0', |
|
| 26 | + 'version' => '1.12.0.0', |
|
| 27 | + 'aliases' => |
|
| 28 | + array ( |
|
| 29 | + ), |
|
| 30 | + 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', |
|
| 31 | 31 | ), |
| 32 | 32 | 'roundcube/plugin-installer' => |
| 33 | 33 | array ( |
| 34 | - 'replaced' => |
|
| 35 | - array ( |
|
| 34 | + 'replaced' => |
|
| 35 | + array ( |
|
| 36 | 36 | 0 => '*', |
| 37 | - ), |
|
| 37 | + ), |
|
| 38 | 38 | ), |
| 39 | 39 | 'shama/baton' => |
| 40 | 40 | array ( |
| 41 | - 'replaced' => |
|
| 42 | - array ( |
|
| 41 | + 'replaced' => |
|
| 42 | + array ( |
|
| 43 | 43 | 0 => '*', |
| 44 | - ), |
|
| 44 | + ), |
|
| 45 | 45 | ), |
| 46 | 46 | 'woocommerce/woocommerce-blocks' => |
| 47 | 47 | array ( |
| 48 | - 'pretty_version' => 'dev-trunk', |
|
| 49 | - 'version' => 'dev-trunk', |
|
| 50 | - 'aliases' => |
|
| 51 | - array ( |
|
| 52 | - ), |
|
| 53 | - 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
|
| 48 | + 'pretty_version' => 'dev-trunk', |
|
| 49 | + 'version' => 'dev-trunk', |
|
| 50 | + 'aliases' => |
|
| 51 | + array ( |
|
| 52 | + ), |
|
| 53 | + 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
|
| 54 | + ), |
|
| 54 | 55 | ), |
| 55 | - ), |
|
| 56 | 56 | ); |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | |
| 4 | 4 | class ClanCatsFrameworkInstaller extends BaseInstaller |
| 5 | 5 | { |
| 6 | - protected $locations = array( |
|
| 7 | - 'ship' => 'CCF/orbit/{$name}/', |
|
| 8 | - 'theme' => 'CCF/app/themes/{$name}/', |
|
| 9 | - ); |
|
| 6 | + protected $locations = array( |
|
| 7 | + 'ship' => 'CCF/orbit/{$name}/', |
|
| 8 | + 'theme' => 'CCF/app/themes/{$name}/', |
|
| 9 | + ); |
|
| 10 | 10 | } |
| 11 | 11 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class OxidInstaller extends BaseInstaller |
| 7 | 7 | { |
| 8 | - const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/'; |
|
| 8 | + const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/'; |
|
| 9 | 9 | |
| 10 | 10 | protected $locations = array( |
| 11 | 11 | 'module' => 'modules/{$name}/', |
@@ -13,47 +13,47 @@ discard block |
||
| 13 | 13 | 'out' => 'out/{$name}/', |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * getInstallPath |
|
| 18 | - * |
|
| 19 | - * @param PackageInterface $package |
|
| 20 | - * @param string $frameworkType |
|
| 21 | - * @return string |
|
| 22 | - */ |
|
| 23 | - public function getInstallPath(PackageInterface $package, $frameworkType = '') |
|
| 24 | - { |
|
| 25 | - $installPath = parent::getInstallPath($package, $frameworkType); |
|
| 26 | - $type = $this->package->getType(); |
|
| 27 | - if ($type === 'oxid-module') { |
|
| 28 | - $this->prepareVendorDirectory($installPath); |
|
| 29 | - } |
|
| 30 | - return $installPath; |
|
| 31 | - } |
|
| 16 | + /** |
|
| 17 | + * getInstallPath |
|
| 18 | + * |
|
| 19 | + * @param PackageInterface $package |
|
| 20 | + * @param string $frameworkType |
|
| 21 | + * @return string |
|
| 22 | + */ |
|
| 23 | + public function getInstallPath(PackageInterface $package, $frameworkType = '') |
|
| 24 | + { |
|
| 25 | + $installPath = parent::getInstallPath($package, $frameworkType); |
|
| 26 | + $type = $this->package->getType(); |
|
| 27 | + if ($type === 'oxid-module') { |
|
| 28 | + $this->prepareVendorDirectory($installPath); |
|
| 29 | + } |
|
| 30 | + return $installPath; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * prepareVendorDirectory |
|
| 35 | - * |
|
| 36 | - * Makes sure there is a vendormetadata.php file inside |
|
| 37 | - * the vendor folder if there is a vendor folder. |
|
| 38 | - * |
|
| 39 | - * @param string $installPath |
|
| 40 | - * @return void |
|
| 41 | - */ |
|
| 42 | - protected function prepareVendorDirectory($installPath) |
|
| 43 | - { |
|
| 44 | - $matches = ''; |
|
| 45 | - $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); |
|
| 46 | - if (!$hasVendorDirectory) { |
|
| 47 | - return; |
|
| 48 | - } |
|
| 33 | + /** |
|
| 34 | + * prepareVendorDirectory |
|
| 35 | + * |
|
| 36 | + * Makes sure there is a vendormetadata.php file inside |
|
| 37 | + * the vendor folder if there is a vendor folder. |
|
| 38 | + * |
|
| 39 | + * @param string $installPath |
|
| 40 | + * @return void |
|
| 41 | + */ |
|
| 42 | + protected function prepareVendorDirectory($installPath) |
|
| 43 | + { |
|
| 44 | + $matches = ''; |
|
| 45 | + $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); |
|
| 46 | + if (!$hasVendorDirectory) { |
|
| 47 | + return; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $vendorDirectory = $matches['vendor']; |
|
| 51 | - $vendorPath = getcwd() . '/modules/' . $vendorDirectory; |
|
| 52 | - if (!file_exists($vendorPath)) { |
|
| 53 | - mkdir($vendorPath, 0755, true); |
|
| 54 | - } |
|
| 50 | + $vendorDirectory = $matches['vendor']; |
|
| 51 | + $vendorPath = getcwd() . '/modules/' . $vendorDirectory; |
|
| 52 | + if (!file_exists($vendorPath)) { |
|
| 53 | + mkdir($vendorPath, 0755, true); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; |
|
| 57 | - touch($vendorMetaDataPath); |
|
| 58 | - } |
|
| 56 | + $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; |
|
| 57 | + touch($vendorMetaDataPath); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array( |
|
| 10 | - 'version' => '2.10.7.0', |
|
| 11 | - 'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php' |
|
| 12 | - ), |
|
| 9 | + 'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array( |
|
| 10 | + 'version' => '2.10.7.0', |
|
| 11 | + 'path' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php' |
|
| 12 | + ), |
|
| 13 | 13 | ); |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | class InstalledVersions |
| 26 | 26 | { |
| 27 | 27 | private static $installed = array ( |
| 28 | - 'root' => |
|
| 29 | - array ( |
|
| 28 | + 'root' => |
|
| 29 | + array ( |
|
| 30 | 30 | 'pretty_version' => 'dev-trunk', |
| 31 | 31 | 'version' => 'dev-trunk', |
| 32 | 32 | 'aliases' => |
@@ -34,51 +34,51 @@ discard block |
||
| 34 | 34 | ), |
| 35 | 35 | 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
| 36 | 36 | 'name' => 'woocommerce/woocommerce-blocks', |
| 37 | - ), |
|
| 38 | - 'versions' => |
|
| 39 | - array ( |
|
| 37 | + ), |
|
| 38 | + 'versions' => |
|
| 39 | + array ( |
|
| 40 | 40 | 'automattic/jetpack-autoloader' => |
| 41 | 41 | array ( |
| 42 | - 'pretty_version' => 'v2.10.7', |
|
| 43 | - 'version' => '2.10.7.0', |
|
| 44 | - 'aliases' => |
|
| 45 | - array ( |
|
| 46 | - ), |
|
| 47 | - 'reference' => 'e3dfa1a2679e4b8e380bc37b722081875c84a381', |
|
| 42 | + 'pretty_version' => 'v2.10.7', |
|
| 43 | + 'version' => '2.10.7.0', |
|
| 44 | + 'aliases' => |
|
| 45 | + array ( |
|
| 46 | + ), |
|
| 47 | + 'reference' => 'e3dfa1a2679e4b8e380bc37b722081875c84a381', |
|
| 48 | 48 | ), |
| 49 | 49 | 'composer/installers' => |
| 50 | 50 | array ( |
| 51 | - 'pretty_version' => 'v1.12.0', |
|
| 52 | - 'version' => '1.12.0.0', |
|
| 53 | - 'aliases' => |
|
| 54 | - array ( |
|
| 55 | - ), |
|
| 56 | - 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', |
|
| 51 | + 'pretty_version' => 'v1.12.0', |
|
| 52 | + 'version' => '1.12.0.0', |
|
| 53 | + 'aliases' => |
|
| 54 | + array ( |
|
| 55 | + ), |
|
| 56 | + 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', |
|
| 57 | 57 | ), |
| 58 | 58 | 'roundcube/plugin-installer' => |
| 59 | 59 | array ( |
| 60 | - 'replaced' => |
|
| 61 | - array ( |
|
| 60 | + 'replaced' => |
|
| 61 | + array ( |
|
| 62 | 62 | 0 => '*', |
| 63 | - ), |
|
| 63 | + ), |
|
| 64 | 64 | ), |
| 65 | 65 | 'shama/baton' => |
| 66 | 66 | array ( |
| 67 | - 'replaced' => |
|
| 68 | - array ( |
|
| 67 | + 'replaced' => |
|
| 68 | + array ( |
|
| 69 | 69 | 0 => '*', |
| 70 | - ), |
|
| 70 | + ), |
|
| 71 | 71 | ), |
| 72 | 72 | 'woocommerce/woocommerce-blocks' => |
| 73 | 73 | array ( |
| 74 | - 'pretty_version' => 'dev-trunk', |
|
| 75 | - 'version' => 'dev-trunk', |
|
| 76 | - 'aliases' => |
|
| 77 | - array ( |
|
| 78 | - ), |
|
| 79 | - 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
|
| 74 | + 'pretty_version' => 'dev-trunk', |
|
| 75 | + 'version' => 'dev-trunk', |
|
| 76 | + 'aliases' => |
|
| 77 | + array ( |
|
| 78 | + ), |
|
| 79 | + 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
|
| 80 | + ), |
|
| 80 | 81 | ), |
| 81 | - ), |
|
| 82 | 82 | ); |
| 83 | 83 | private static $canGetVendors; |
| 84 | 84 | private static $installedByVendor = array(); |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'fcd5d7d87e03ff4f5b5a66c2b8968671' => array( |
|
| 10 | - 'version' => '8.0.0.0', |
|
| 11 | - 'path' => $baseDir . '/src/StoreApi/deprecated.php' |
|
| 12 | - ), |
|
| 13 | - 'd0f16a186498c2ba04f1d0064fecf9cf' => array( |
|
| 14 | - 'version' => '8.0.0.0', |
|
| 15 | - 'path' => $baseDir . '/src/StoreApi/functions.php' |
|
| 16 | - ), |
|
| 9 | + 'fcd5d7d87e03ff4f5b5a66c2b8968671' => array( |
|
| 10 | + 'version' => '8.0.0.0', |
|
| 11 | + 'path' => $baseDir . '/src/StoreApi/deprecated.php' |
|
| 12 | + ), |
|
| 13 | + 'd0f16a186498c2ba04f1d0064fecf9cf' => array( |
|
| 14 | + 'version' => '8.0.0.0', |
|
| 15 | + 'path' => $baseDir . '/src/StoreApi/functions.php' |
|
| 16 | + ), |
|
| 17 | 17 | ); |