← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Compatibilities.php
+34
-35
3.10.3
→
3.11.10
View file →
| @@ -11,8 +11,9 @@ | ||
| 11 | 11 | |
| 12 | 12 | namespace ThemeisleSDK\Modules; |
| 13 | 13 | |
| 14 | 14 | use ThemeisleSDK\Common\Abstract_Module; |
| 15 | +use ThemeisleSDK\Loader; | |
| 15 | 16 | use ThemeisleSDK\Product; |
| 16 | 17 | |
| 17 | 18 | // Exit if accessed directly. |
| 18 | 19 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -52,11 +53,10 @@ | ||
| 52 | 53 | * Registers the hooks. |
| 53 | 54 | * |
| 54 | 55 | * @param Product $product Product to load. |
| 55 | 56 | * |
| 57 | + * @return Compatibilities Module instance. | |
| 56 | 58 | * @throws \Exception If the configuration is invalid. |
| 57 | - * | |
| 58 | - * @return Compatibilities Module instance. | |
| 59 | 59 | */ |
| 60 | 60 | public function load( $product ) { |
| 61 | 61 | |
| 62 | 62 | |
| @@ -120,47 +120,46 @@ | ||
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | if ( $requirement->is_theme() && $screen->id === 'themes' ) { |
| 123 | 123 | ?> |
| 124 | - <script type="text/javascript"> | |
| 125 | - jQuery(document).ready(function ($) { | |
| 126 | - setInterval(checkTheme, 500); | |
| 127 | - function checkTheme() { | |
| 128 | - var theme = jQuery( '.theme.active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]' ); | |
| 129 | - var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>'; | |
| 130 | - var product_name = '<?php echo esc_attr( $product->get_friendly_name() ); ?>'; | |
| 131 | - if (theme.length > 0 && jQuery('#' + notice_id).length === 0) { | |
| 132 | - theme.find('.theme-id-container').prepend('<div style="bottom:100%;top:auto;" id="'+notice_id+'" class="notice notice-warning"><strong>Warning:</strong> This theme has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' plugin.</div>'); | |
| 124 | + <script type="text/javascript"> | |
| 125 | + jQuery(document).ready(function ($) { | |
| 126 | + setInterval(checkTheme, 500); | |
| 127 | + | |
| 128 | + function checkTheme() { | |
| 129 | + var theme = jQuery('.theme.active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]'); | |
| 130 | + var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>'; | |
| 131 | + if (theme.length > 0 && jQuery('#' + notice_id).length === 0) { | |
| 132 | + theme.find('.theme-id-container').prepend('<div style="bottom:100%;top:auto;" id="' + notice_id + '" class="notice notice-warning"><?php echo sprintf( esc_html( Loader::$labels['compatibilities']['notice_theme'] ), '<strong>', '</strong>', esc_attr( $product->get_friendly_name() ) ); ?></div>'); | |
| 133 | + } | |
| 134 | + if (theme.length > 0 && jQuery('#' + notice_id + 'overlay').length === 0) { | |
| 135 | + jQuery('.theme-overlay.active .theme-author').after('<div style="bottom:100%;top:auto;" id="' + notice_id + 'overlay" class="notice notice-warning"><p><?php echo sprintf( esc_html( Loader::$labels['compatibilities']['notice_theme'] ), '<strong>', '</strong>', esc_attr( $product->get_friendly_name() ) ); ?></p></div>'); | |
| 136 | + } | |
| 133 | 137 | } |
| 134 | - if (theme.length > 0 && jQuery('#' + notice_id + 'overlay').length === 0) { | |
| 135 | - jQuery('.theme-overlay.active .theme-author').after('<div style="bottom:100%;top:auto;" id="'+notice_id+'overlay" class="notice notice-warning"><p><strong>Warning:</strong> This theme has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' plugin.</p></div>'); | |
| 136 | - } | |
| 137 | - } | |
| 138 | - }) | |
| 138 | + }) | |
| 139 | 139 | |
| 140 | - </script> | |
| 140 | + </script> | |
| 141 | 141 | <?php |
| 142 | 142 | } |
| 143 | 143 | if ( $requirement->is_plugin() && $screen->id === 'plugins' ) { |
| 144 | 144 | ?> |
| 145 | - <script type="text/javascript"> | |
| 146 | - jQuery(document).ready(function ($) { | |
| 147 | - setInterval(checkPlugin, 500); | |
| 148 | - function checkPlugin() { | |
| 149 | - var plugin = jQuery( '.plugins .active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]' ); | |
| 150 | - var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>'; | |
| 151 | - var product_name = '<?php echo esc_attr( $product->get_friendly_name() ); ?>'; | |
| 152 | - var product_type = '<?php echo ( $product->is_plugin() ? 'plugin' : 'theme' ); ?>'; | |
| 153 | - if (plugin.length > 0 && jQuery('#' + notice_id).length === 0) { | |
| 154 | - plugin.find('.column-description').append('<div style="bottom:100%;top:auto;" id="'+notice_id+'" class="notice notice-warning notice-alt notice-inline"><strong>Warning:</strong> This plugin has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' '+product_type+'.</div>'); | |
| 145 | + <script type="text/javascript"> | |
| 146 | + jQuery(document).ready(function ($) { | |
| 147 | + setInterval(checkPlugin, 500); | |
| 148 | + | |
| 149 | + function checkPlugin() { | |
| 150 | + var plugin = jQuery('.plugins .active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]'); | |
| 151 | + var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>'; | |
| 152 | + if (plugin.length > 0 && jQuery('#' + notice_id).length === 0) { | |
| 153 | + plugin.find('.column-description').append('<div style="bottom:100%;top:auto;" id="' + notice_id + '" class="notice notice-warning notice-alt notice-inline"><?php echo sprintf( esc_html( Loader::$labels['compatibilities']['notice_plugin'] ), '<strong>', '</strong>', esc_attr( $product->get_friendly_name() ), esc_attr( $product->is_plugin() ? Loader::$labels['compatibilities']['plugin'] : Loader::$labels['compatibilities']['theme'] ) ); ?></div>'); | |
| 154 | + } | |
| 155 | 155 | } |
| 156 | - } | |
| 157 | - }) | |
| 156 | + }) | |
| 158 | 157 | |
| 159 | - </script> | |
| 158 | + </script> | |
| 160 | 159 | <?php |
| 161 | 160 | } |
| 162 | - } | |
| 161 | + } | |
| 163 | 162 | ); |
| 164 | 163 | |
| 165 | 164 | } |
| 166 | 165 | |
| @@ -196,15 +195,15 @@ | ||
| 196 | 195 | $should_block = true; |
| 197 | 196 | } |
| 198 | 197 | if ( $should_block ) { |
| 199 | 198 | echo( sprintf( |
| 200 | - '%s update requires a newer version of %s. Please %supdate%s %s %s.', | |
| 199 | + esc_html( Loader::$labels['compatibilities']['notice2'] ), | |
| 201 | 200 | esc_attr( $product->get_friendly_name() ), |
| 202 | 201 | esc_attr( $requirement->get_friendly_name() ), |
| 203 | 202 | '<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">', |
| 204 | 203 | '</a>', |
| 205 | 204 | esc_attr( $requirement->get_friendly_name() ), |
| 206 | - esc_attr( $requirement->is_theme() ? 'theme' : 'plugin' ) | |
| 205 | + esc_attr( $requirement->is_theme() ? Loader::$labels['compatibilities']['theme'] : Loader::$labels['compatibilities']['plugin'] ) | |
| 207 | 206 | ) ); |
| 208 | 207 | $upgrader->maintenance_mode( false ); |
| 209 | 208 | die(); |
| 210 | 209 | } |
| @@ -219,15 +218,15 @@ | ||
| 219 | 218 | 'admin_notices', |
| 220 | 219 | function () use ( $product, $requirement ) { |
| 221 | 220 | echo '<div class="notice notice-error "><p>'; |
| 222 | 221 | echo( sprintf( |
| 223 | - '%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.', | |
| 222 | + esc_html( Loader::$labels['compatibilities']['notice'] ), | |
| 224 | 223 | '<strong>' . esc_attr( $product->get_friendly_name() ) . '</strong>', |
| 225 | 224 | '<strong>' . esc_attr( $requirement->get_friendly_name() ) . '</strong>', |
| 226 | 225 | '<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">', |
| 227 | 226 | '</a>', |
| 228 | 227 | '<strong>' . esc_attr( $requirement->get_friendly_name() ) . '</strong>', |
| 229 | - esc_attr( $requirement->is_theme() ? 'theme' : 'plugin' ) | |
| 228 | + esc_attr( $requirement->is_theme() ? Loader::$labels['compatibilities']['theme'] : Loader::$labels['compatibilities']['plugin'] ) | |
| 230 | 229 | ) ); |
| 231 | 230 | echo '</p></div>'; |
| 232 | 231 | } |
| 233 | 232 | ); |