| @@ -237,9 +237,9 @@ | ||
| 237 | 237 | // Fetch latest version from Freemius. |
| 238 | 238 | $latest = $this->_fs->_fetch_latest_version( |
| 239 | 239 | $selected_addon->id, |
| 240 | 240 | true, |
| 241 | - WP_FS__TIME_24_HOURS_IN_SEC, | |
| 241 | + FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION, | |
| 242 | 242 | $current_addon_version |
| 243 | 243 | ); |
| 244 | 244 | |
| 245 | 245 | if ( $has_paid_plan ) { |
| @@ -310,8 +310,9 @@ | ||
| 310 | 310 | if ( is_object( $latest ) ) { |
| 311 | 311 | $data->version = $latest->version; |
| 312 | 312 | $data->last_updated = $latest->created; |
| 313 | 313 | $data->requires = $latest->requires_platform_version; |
| 314 | + $data->requires_php = $latest->requires_programming_language_version; | |
| 314 | 315 | $data->tested = $latest->tested_up_to_version; |
| 315 | 316 | } else if ( ! empty( $current_addon_version ) ) { |
| 316 | 317 | $data->version = $current_addon_version; |
| 317 | 318 | } else { |
| @@ -836,14 +837,10 @@ | ||
| 836 | 837 | $action = ( 'install' === $status ) ? |
| 837 | 838 | 'install-plugin' : |
| 838 | 839 | 'upgrade-plugin'; |
| 839 | 840 | |
| 840 | - $query = parse_url( $network_status_url, PHP_URL_QUERY ); | |
| 841 | - if ( empty( $query ) ) { | |
| 842 | - return $network_status_url; | |
| 843 | - } | |
| 841 | + $url_params = fs_parse_url_params( $network_status_url, true ); | |
| 844 | 842 | |
| 845 | - parse_str( html_entity_decode( $query ), $url_params ); | |
| 846 | 843 | if ( empty( $url_params ) || ! isset( $url_params['plugin'] ) ) { |
| 847 | 844 | return $network_status_url; |
| 848 | 845 | } |
| 849 | 846 | |
| @@ -1305,10 +1302,10 @@ | ||
| 1305 | 1302 | </ul> |
| 1306 | 1303 | <?php endif ?> |
| 1307 | 1304 | </div> |
| 1308 | 1305 | </div> |
| 1309 | - </div> | |
| 1310 | 1306 | <?php endforeach ?> |
| 1307 | + </div> | |
| 1311 | 1308 | <?php endif ?> |
| 1312 | 1309 | <?php endif ?> |
| 1313 | 1310 | <div> |
| 1314 | 1311 | <h3><?php fs_echo_inline( 'Details', 'details', $api->slug ) ?></h3> |
| @@ -1343,9 +1340,12 @@ | ||
| 1343 | 1340 | if ( ! empty( $api->requires ) ) { |
| 1344 | 1341 | ?> |
| 1345 | 1342 | <li> |
| 1346 | 1343 | <strong><?php fs_esc_html_echo_inline( 'Requires WordPress Version', 'requires-wordpress-version', $api->slug ) ?> |
| 1347 | - :</strong> <?php echo esc_html( sprintf( fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires ) ) ?> | |
| 1344 | + :</strong> <?php echo esc_html( sprintf( | |
| 1345 | + /* translators: %s: Version number. */ | |
| 1346 | + fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires ) | |
| 1347 | + ) ?> | |
| 1348 | 1348 | </li> |
| 1349 | 1349 | <?php |
| 1350 | 1350 | } |
| 1351 | 1351 | if ( ! empty( $api->tested ) ) { |
| @@ -1355,8 +1355,21 @@ | ||
| 1355 | 1355 | :</strong> <?php echo $api->tested; ?> |
| 1356 | 1356 | </li> |
| 1357 | 1357 | <?php |
| 1358 | 1358 | } |
| 1359 | + if ( ! empty( $api->requires_php ) ) { | |
| 1360 | + ?> | |
| 1361 | + <li> | |
| 1362 | + <strong><?php fs_esc_html_echo_inline( 'Requires PHP Version', 'requires-php-version', $api->slug ); ?>:</strong> | |
| 1363 | + <?php | |
| 1364 | + echo esc_html( sprintf( | |
| 1365 | + /* translators: %s: Version number. */ | |
| 1366 | + fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires_php ) | |
| 1367 | + ); | |
| 1368 | + ?> | |
| 1369 | + </li> | |
| 1370 | + <?php | |
| 1371 | + } | |
| 1359 | 1372 | if ( ! empty( $api->downloaded ) ) { |
| 1360 | 1373 | ?> |
| 1361 | 1374 | <li> |
| 1362 | 1375 | <strong><?php fs_esc_html_echo_inline( 'Downloaded', 'downloaded', $api->slug ) ?> |
| @@ -1484,11 +1497,45 @@ | ||
| 1484 | 1497 | <?php } ?> |
| 1485 | 1498 | </div> |
| 1486 | 1499 | <div id="section-holder" class="wrap"> |
| 1487 | 1500 | <?php |
| 1488 | - if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) { | |
| 1501 | + $requires_php = isset( $api->requires_php ) ? $api->requires_php : null; | |
| 1502 | + $requires_wp = isset( $api->requires ) ? $api->requires : null; | |
| 1503 | + | |
| 1504 | + $compatible_php = empty( $requires_php ) || version_compare( PHP_VERSION, $requires_php, '>=' ); | |
| 1505 | + | |
| 1506 | + // Strip off any -alpha, -RC, -beta, -src suffixes. | |
| 1507 | + list( $wp_version ) = explode( '-', $GLOBALS['wp_version'] ); | |
| 1508 | + | |
| 1509 | + $compatible_wp = empty( $requires_wp ) || version_compare( $wp_version, $requires_wp, '>=' ); | |
| 1510 | + $tested_wp = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) ); | |
| 1511 | + | |
| 1512 | + if ( ! $compatible_php ) { | |
| 1513 | + echo '<div class="notice notice-error notice-alt"><p><strong>' . fs_text_inline( 'Error', 'error', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin requires a newer version of PHP.', 'newer-php-required-error', $api->slug ); | |
| 1514 | + | |
| 1515 | + if ( current_user_can( 'update_php' ) ) { | |
| 1516 | + $wp_get_update_php_url = function_exists( 'wp_get_update_php_url' ) ? | |
| 1517 | + wp_get_update_php_url() : | |
| 1518 | + 'https://wordpress.org/support/update-php/'; | |
| 1519 | + | |
| 1520 | + printf( | |
| 1521 | + /* translators: %s: URL to Update PHP page. */ | |
| 1522 | + ' ' . fs_text_inline( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.', 'php-update-learn-more-link', $api->slug ), | |
| 1523 | + esc_url( $wp_get_update_php_url ) | |
| 1524 | + ); | |
| 1525 | + | |
| 1526 | + if ( function_exists( 'wp_update_php_annotation' ) ) { | |
| 1527 | + wp_update_php_annotation( '</p><p><em>', '</em>' ); | |
| 1528 | + } | |
| 1529 | + } else { | |
| 1530 | + echo '</p>'; | |
| 1531 | + } | |
| 1532 | + echo '</div>'; | |
| 1533 | + } | |
| 1534 | + | |
| 1535 | + if ( ! $tested_wp ) { | |
| 1489 | 1536 | echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been tested with your current version of WordPress.', 'not-tested-warning', $api->slug ) . '</p></div>'; |
| 1490 | - } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { | |
| 1537 | + } else if ( ! $compatible_wp ) { | |
| 1491 | 1538 | echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been marked as compatible with your version of WordPress.', 'not-compatible-warning', $api->slug ) . '</p></div>'; |
| 1492 | 1539 | } |
| 1493 | 1540 | |
| 1494 | 1541 | foreach ( (array) $api->sections as $section_name => $content ) { |