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rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / admin / plugin-updates / class-wc-plugin-updates.php
woocommerce / includes / admin / plugin-updates Last commit date
views 2 years ago class-wc-plugin-updates.php 5 years ago class-wc-plugins-screen-updates.php 5 years ago class-wc-updates-screen-updates.php 5 years ago
class-wc-plugin-updates.php
237 lines
1 <?php
2 /**
3 * Class for displaying plugin warning notifications and determining 3rd party plugin compatibility.
4 *
5 * @package WooCommerce\Admin
6 * @version 3.2.0
7 */
8
9 use Automattic\Jetpack\Constants;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 /**
16 * WC_Admin_Plugin_Updates Class.
17 */
18 class WC_Plugin_Updates {
19
20 /**
21 * This is the header used by extensions to show requirements.
22 *
23 * @var string
24 */
25 const VERSION_REQUIRED_HEADER = 'WC requires at least';
26
27 /**
28 * This is the header used by extensions to show testing.
29 *
30 * @var string
31 */
32 const VERSION_TESTED_HEADER = 'WC tested up to';
33
34 /**
35 * The version for the update to WooCommerce.
36 *
37 * @var string
38 */
39 protected $new_version = '';
40
41 /**
42 * Array of plugins lacking testing with the major version.
43 *
44 * @var array
45 */
46 protected $major_untested_plugins = array();
47
48 /**
49 * Common JS for initializing and managing thickbox-based modals.
50 */
51 protected function generic_modal_js() {
52 ?>
53 <script>
54 ( function( $ ) {
55 // Initialize thickbox.
56 tb_init( '.wc-thickbox' );
57
58 var old_tb_position = false;
59
60 // Make the WC thickboxes look good when opened.
61 $( '.wc-thickbox' ).on( 'click', function( evt ) {
62 var $overlay = $( '#TB_overlay' );
63 if ( ! $overlay.length ) {
64 $( 'body' ).append( '<div id="TB_overlay"></div><div id="TB_window" class="wc_untested_extensions_modal_container"></div>' );
65 } else {
66 $( '#TB_window' ).removeClass( 'thickbox-loading' ).addClass( 'wc_untested_extensions_modal_container' );
67 }
68
69 // WP overrides the tb_position function. We need to use a different tb_position function than that one.
70 // This is based on the original tb_position.
71 if ( ! old_tb_position ) {
72 old_tb_position = tb_position;
73 }
74 tb_position = function() {
75 $( '#TB_window' ).css( { marginLeft: '-' + parseInt( ( TB_WIDTH / 2 ), 10 ) + 'px', width: TB_WIDTH + 'px' } );
76 $( '#TB_window' ).css( { marginTop: '-' + parseInt( ( TB_HEIGHT / 2 ), 10 ) + 'px' } );
77 };
78 });
79
80 // Reset tb_position to WP default when modal is closed.
81 $( 'body' ).on( 'thickbox:removed', function() {
82 if ( old_tb_position ) {
83 tb_position = old_tb_position;
84 }
85 });
86 })( jQuery );
87 </script>
88 <?php
89 }
90
91 /*
92 |--------------------------------------------------------------------------
93 | Message Helpers
94 |--------------------------------------------------------------------------
95 |
96 | Methods for getting messages.
97 */
98
99 /**
100 * Get the inline warning notice for major version updates.
101 *
102 * @return string
103 */
104 protected function get_extensions_inline_warning_major() {
105 $upgrade_type = 'major';
106 $plugins = $this->major_untested_plugins;
107 $version_parts = explode( '.', $this->new_version );
108 $new_version = $version_parts[0] . '.0';
109
110 if ( empty( $plugins ) ) {
111 return;
112 }
113
114 /* translators: %s: version number */
115 $message = sprintf( __( "<strong>Heads up!</strong> The versions of the following plugins you're running haven't been tested with WooCommerce %s. Please update them or confirm compatibility before updating WooCommerce, or you may experience issues:", 'woocommerce' ), $new_version );
116
117 ob_start();
118 include __DIR__ . '/views/html-notice-untested-extensions-inline.php';
119 return ob_get_clean();
120 }
121
122 /**
123 * Get the warning notice for the modal window.
124 *
125 * @return string
126 */
127 protected function get_extensions_modal_warning() {
128 $version_parts = explode( '.', $this->new_version );
129 $new_version = $version_parts[0] . '.0';
130 $plugins = $this->major_untested_plugins;
131
132 ob_start();
133 include __DIR__ . '/views/html-notice-untested-extensions-modal.php';
134 return ob_get_clean();
135 }
136
137 /*
138 |--------------------------------------------------------------------------
139 | Data Helpers
140 |--------------------------------------------------------------------------
141 |
142 | Methods for getting & manipulating data.
143 */
144
145 /**
146 * Get installed plugins that have a tested version lower than the input version.
147 *
148 * In case of testing major version compatibility and if current WC version is >= major version part
149 * of the $new_version, no plugins are returned, even if they don't explicitly declare compatibility
150 * with the $new_version.
151 *
152 * @param string $new_version WooCommerce version to test against.
153 * @param string $release 'major', 'minor', or 'none'.
154 * @return array of plugin info arrays
155 */
156 public function get_untested_plugins( $new_version, $release ) {
157 // Since 5.0 all versions are backwards compatible.
158 if ( 'none' === $release ) {
159 return array();
160 }
161
162 $extensions = array_merge( $this->get_plugins_with_header( self::VERSION_TESTED_HEADER ), $this->get_plugins_for_woocommerce() );
163 $untested = array();
164 $new_version_parts = explode( '.', $new_version );
165 $version = $new_version_parts[0];
166
167 if ( 'minor' === $release ) {
168 $version .= '.' . $new_version_parts[1];
169 }
170
171 foreach ( $extensions as $file => $plugin ) {
172 if ( ! empty( $plugin[ self::VERSION_TESTED_HEADER ] ) ) {
173 $plugin_version_parts = explode( '.', $plugin[ self::VERSION_TESTED_HEADER ] );
174
175 if ( ! is_numeric( $plugin_version_parts[0] )
176 || ( 'minor' === $release && ! isset( $plugin_version_parts[1] ) )
177 || ( 'minor' === $release && ! is_numeric( $plugin_version_parts[1] ) )
178 ) {
179 continue;
180 }
181
182 $plugin_version = $plugin_version_parts[0];
183
184 if ( 'minor' === $release ) {
185 $plugin_version .= '.' . $plugin_version_parts[1];
186 }
187
188 if ( version_compare( $plugin_version, $version, '<' ) ) {
189 $untested[ $file ] = $plugin;
190 }
191 } else {
192 $plugin[ self::VERSION_TESTED_HEADER ] = __( 'unknown', 'woocommerce' );
193 $untested[ $file ] = $plugin;
194 }
195 }
196
197 return $untested;
198 }
199
200 /**
201 * Get plugins that have a valid value for a specific header.
202 *
203 * @param string $header Plugin header to search for.
204 * @return array Array of plugins that contain the searched header.
205 */
206 protected function get_plugins_with_header( $header ) {
207 $plugins = get_plugins();
208 $matches = array();
209
210 foreach ( $plugins as $file => $plugin ) {
211 if ( ! empty( $plugin[ $header ] ) ) {
212 $matches[ $file ] = $plugin;
213 }
214 }
215
216 return apply_filters( 'woocommerce_get_plugins_with_header', $matches, $header, $plugins );
217 }
218
219 /**
220 * Get plugins which "maybe" are for WooCommerce.
221 *
222 * @return array of plugin info arrays
223 */
224 protected function get_plugins_for_woocommerce() {
225 $plugins = get_plugins();
226 $matches = array();
227
228 foreach ( $plugins as $file => $plugin ) {
229 if ( 'WooCommerce' !== $plugin['Name'] && ( stristr( $plugin['Name'], 'woocommerce' ) || stristr( $plugin['Description'], 'woocommerce' ) ) ) {
230 $matches[ $file ] = $plugin;
231 }
232 }
233
234 return apply_filters( 'woocommerce_get_plugins_for_woocommerce', $matches, $plugins );
235 }
236 }
237