| @@ -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 ) { |
| @@ -259,16 +259,22 @@ | ||
| 259 | 259 | |
| 260 | 260 | if ( $has_valid_blog_id ) { |
| 261 | 261 | restore_current_blog(); |
| 262 | 262 | } |
| 263 | + } | |
| 263 | 264 | |
| 264 | - if ( is_object( $fs_addon ) ) { | |
| 265 | - $data->has_purchased_license = $fs_addon->has_active_valid_license(); | |
| 266 | - } else { | |
| 267 | - $account_addons = $this->_fs->get_account_addons(); | |
| 268 | - if ( ! empty( $account_addons ) && in_array( $selected_addon->id, $account_addons ) ) { | |
| 269 | - $data->has_purchased_license = true; | |
| 270 | - } | |
| 265 | + /** | |
| 266 | + * Check if there's a purchased license in case the add-on can only be installed/downloaded as part of a purchased bundle. | |
| 267 | + * | |
| 268 | + * @author Leo Fajardo (@leorw) | |
| 269 | + * @since 2.4.1 | |
| 270 | + */ | |
| 271 | + if ( is_object( $fs_addon ) ) { | |
| 272 | + $data->has_purchased_license = $fs_addon->has_active_valid_license(); | |
| 273 | + } else { | |
| 274 | + $account_addons = $this->_fs->get_account_addons(); | |
| 275 | + if ( ! empty( $account_addons ) && in_array( $selected_addon->id, $account_addons ) ) { | |
| 276 | + $data->has_purchased_license = true; | |
| 271 | 277 | } |
| 272 | 278 | } |
| 273 | 279 | |
| 274 | 280 | if ( $has_free_plan || $data->has_purchased_license ) { |
| @@ -304,8 +310,9 @@ | ||
| 304 | 310 | if ( is_object( $latest ) ) { |
| 305 | 311 | $data->version = $latest->version; |
| 306 | 312 | $data->last_updated = $latest->created; |
| 307 | 313 | $data->requires = $latest->requires_platform_version; |
| 314 | + $data->requires_php = $latest->requires_programming_language_version; | |
| 308 | 315 | $data->tested = $latest->tested_up_to_version; |
| 309 | 316 | } else if ( ! empty( $current_addon_version ) ) { |
| 310 | 317 | $data->version = $current_addon_version; |
| 311 | 318 | } else { |
| @@ -576,9 +583,9 @@ | ||
| 576 | 583 | $is_premium_installed = null; |
| 577 | 584 | |
| 578 | 585 | $has_installed_version = ( 'install' !== $this->status['status'] ); |
| 579 | 586 | |
| 580 | - if ( ! $api->has_paid_plan ) { | |
| 587 | + if ( ! $api->has_paid_plan && ! $api->has_purchased_license ) { | |
| 581 | 588 | /** |
| 582 | 589 | * Free-only add-on. |
| 583 | 590 | * |
| 584 | 591 | * @author Leo Fajardo (@leorw) |
| @@ -830,14 +837,10 @@ | ||
| 830 | 837 | $action = ( 'install' === $status ) ? |
| 831 | 838 | 'install-plugin' : |
| 832 | 839 | 'upgrade-plugin'; |
| 833 | 840 | |
| 834 | - $query = parse_url( $network_status_url, PHP_URL_QUERY ); | |
| 835 | - if ( empty( $query ) ) { | |
| 836 | - return $network_status_url; | |
| 837 | - } | |
| 841 | + $url_params = fs_parse_url_params( $network_status_url, true ); | |
| 838 | 842 | |
| 839 | - parse_str( html_entity_decode( $query ), $url_params ); | |
| 840 | 843 | if ( empty( $url_params ) || ! isset( $url_params['plugin'] ) ) { |
| 841 | 844 | return $network_status_url; |
| 842 | 845 | } |
| 843 | 846 | |
| @@ -879,11 +882,13 @@ | ||
| 879 | 882 | if ( $is_disabled ) { |
| 880 | 883 | $classes[] = 'disabled'; |
| 881 | 884 | } |
| 882 | 885 | |
| 886 | + $rel = ( '_blank' === $target ) ? ' rel="noopener noreferrer"' : ''; | |
| 887 | + | |
| 883 | 888 | return sprintf( |
| 884 | 889 | '<a %s class="button %s">%s</a>', |
| 885 | - empty( $href ) ? '' : 'href="' . $href . '" target="' . $target . '"', | |
| 890 | + empty( $href ) ? '' : 'href="' . $href . '" target="' . $target . '"' . $rel, | |
| 886 | 891 | implode( ' ', $classes ), |
| 887 | 892 | $label |
| 888 | 893 | ); |
| 889 | 894 | } |
| @@ -1200,9 +1205,9 @@ | ||
| 1200 | 1205 | }; |
| 1201 | 1206 | |
| 1202 | 1207 | $(document).ready(function () { |
| 1203 | 1208 | var $plan = $('.plugin-information-pricing .fs-plan[data-plan-id=<?php echo $plan->id ?>]'); |
| 1204 | - $plan.find('input[type=radio]').live('click', function () { | |
| 1209 | + $plan.find('input[type=radio]').on('click', function () { | |
| 1205 | 1210 | _updateCtaUrl( |
| 1206 | 1211 | $plan.attr('data-plan-id'), |
| 1207 | 1212 | $(this).val(), |
| 1208 | 1213 | $plan.find('.nav-tab-active').attr('data-billing-cycle') |
| @@ -1297,10 +1302,10 @@ | ||
| 1297 | 1302 | </ul> |
| 1298 | 1303 | <?php endif ?> |
| 1299 | 1304 | </div> |
| 1300 | 1305 | </div> |
| 1301 | - </div> | |
| 1302 | 1306 | <?php endforeach ?> |
| 1307 | + </div> | |
| 1303 | 1308 | <?php endif ?> |
| 1304 | 1309 | <?php endif ?> |
| 1305 | 1310 | <div> |
| 1306 | 1311 | <h3><?php fs_echo_inline( 'Details', 'details', $api->slug ) ?></h3> |
| @@ -1335,9 +1340,12 @@ | ||
| 1335 | 1340 | if ( ! empty( $api->requires ) ) { |
| 1336 | 1341 | ?> |
| 1337 | 1342 | <li> |
| 1338 | 1343 | <strong><?php fs_esc_html_echo_inline( 'Requires WordPress Version', 'requires-wordpress-version', $api->slug ) ?> |
| 1339 | - :</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 | + ) ?> | |
| 1340 | 1348 | </li> |
| 1341 | 1349 | <?php |
| 1342 | 1350 | } |
| 1343 | 1351 | if ( ! empty( $api->tested ) ) { |
| @@ -1347,8 +1355,21 @@ | ||
| 1347 | 1355 | :</strong> <?php echo $api->tested; ?> |
| 1348 | 1356 | </li> |
| 1349 | 1357 | <?php |
| 1350 | 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 | + } | |
| 1351 | 1372 | if ( ! empty( $api->downloaded ) ) { |
| 1352 | 1373 | ?> |
| 1353 | 1374 | <li> |
| 1354 | 1375 | <strong><?php fs_esc_html_echo_inline( 'Downloaded', 'downloaded', $api->slug ) ?> |
| @@ -1366,8 +1387,9 @@ | ||
| 1366 | 1387 | } |
| 1367 | 1388 | if ( ! empty( $api->slug ) && true == $api->is_wp_org_compliant ) { |
| 1368 | 1389 | ?> |
| 1369 | 1390 | <li><a target="_blank" |
| 1391 | + rel="noopener noreferrer" | |
| 1370 | 1392 | href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php fs_esc_html_echo_inline( 'WordPress.org Plugin Page', 'wp-org-plugin-page', $api->slug ) ?> |
| 1371 | 1393 | »</a> |
| 1372 | 1394 | </li> |
| 1373 | 1395 | <?php |
| @@ -1374,8 +1396,9 @@ | ||
| 1374 | 1396 | } |
| 1375 | 1397 | if ( ! empty( $api->homepage ) ) { |
| 1376 | 1398 | ?> |
| 1377 | 1399 | <li><a target="_blank" |
| 1400 | + rel="noopener noreferrer" | |
| 1378 | 1401 | href="<?php echo esc_url( $api->homepage ); ?>"><?php fs_esc_html_echo_inline( 'Plugin Homepage', 'plugin-homepage', $api->slug ) ?> |
| 1379 | 1402 | »</a> |
| 1380 | 1403 | </li> |
| 1381 | 1404 | <?php |
| @@ -1382,8 +1405,9 @@ | ||
| 1382 | 1405 | } |
| 1383 | 1406 | if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) { |
| 1384 | 1407 | ?> |
| 1385 | 1408 | <li><a target="_blank" |
| 1409 | + rel="noopener noreferrer" | |
| 1386 | 1410 | href="<?php echo esc_url( $api->donate_link ); ?>"><?php fs_esc_html_echo_inline( 'Donate to this plugin', 'donate-to-plugin', $api->slug ) ?> |
| 1387 | 1411 | »</a> |
| 1388 | 1412 | </li> |
| 1389 | 1413 | <?php } ?> |
| @@ -1425,20 +1449,21 @@ | ||
| 1425 | 1449 | number_format_i18n( $key ) |
| 1426 | 1450 | ); |
| 1427 | 1451 | ?> |
| 1428 | 1452 | <div class="counter-container"> |
| 1429 | - <span class="counter-label"><a | |
| 1430 | - href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>" | |
| 1431 | - target="_blank" | |
| 1432 | - title="<?php echo esc_attr( sprintf( | |
| 1433 | - /* translators: %s: # of stars (e.g. 5 stars) */ | |
| 1434 | - fs_text_inline( 'Click to see reviews that provided a rating of %s', 'click-to-reviews', $api->slug ), | |
| 1435 | - $stars_label | |
| 1436 | - ) ) ?>"><?php echo $stars_label ?></a></span> | |
| 1453 | + <span class="counter-label"><a | |
| 1454 | + href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>" | |
| 1455 | + target="_blank" | |
| 1456 | + rel="noopener noreferrer" | |
| 1457 | + title="<?php echo esc_attr( sprintf( | |
| 1458 | + /* translators: %s: # of stars (e.g. 5 stars) */ | |
| 1459 | + fs_text_inline( 'Click to see reviews that provided a rating of %s', 'click-to-reviews', $api->slug ), | |
| 1460 | + $stars_label | |
| 1461 | + ) ) ?>"><?php echo $stars_label ?></a></span> | |
| 1437 | 1462 | <span class="counter-back"> |
| 1438 | - <span class="counter-bar" style="width: <?php echo absint(92 * $_rating); ?>px;"></span> | |
| 1439 | - </span> | |
| 1440 | - <span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span> | |
| 1463 | + <span class="counter-bar" style="width: <?php echo absint(92 * $_rating); ?>px;"></span> | |
| 1464 | + </span> | |
| 1465 | + <span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span> | |
| 1441 | 1466 | </div> |
| 1442 | 1467 | <?php |
| 1443 | 1468 | } |
| 1444 | 1469 | } |
| @@ -1457,9 +1482,9 @@ | ||
| 1457 | 1482 | $contrib_username = sanitize_user( $contrib_username ); |
| 1458 | 1483 | if ( empty( $contrib_profile ) ) { |
| 1459 | 1484 | echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>"; |
| 1460 | 1485 | } else { |
| 1461 | - echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>"; | |
| 1486 | + echo "<li><a href='{$contrib_profile}' target='_blank' rel='noopener noreferrer'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>"; | |
| 1462 | 1487 | } |
| 1463 | 1488 | } |
| 1464 | 1489 | ?> |
| 1465 | 1490 | </ul> |
| @@ -1464,8 +1489,9 @@ | ||
| 1464 | 1489 | ?> |
| 1465 | 1490 | </ul> |
| 1466 | 1491 | <?php if ( ! empty( $api->donate_link ) ) { ?> |
| 1467 | 1492 | <a target="_blank" |
| 1493 | + rel="noopener noreferrer" | |
| 1468 | 1494 | href="<?php echo esc_url( $api->donate_link ); ?>"><?php fs_echo_inline( 'Donate to this plugin', 'donate-to-plugin', $api->slug ) ?> |
| 1469 | 1495 | »</a> |
| 1470 | 1496 | <?php } ?> |
| 1471 | 1497 | <?php } ?> |
| @@ -1471,11 +1497,45 @@ | ||
| 1471 | 1497 | <?php } ?> |
| 1472 | 1498 | </div> |
| 1473 | 1499 | <div id="section-holder" class="wrap"> |
| 1474 | 1500 | <?php |
| 1475 | - 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 ) { | |
| 1476 | 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>'; |
| 1477 | - } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { | |
| 1537 | + } else if ( ! $compatible_wp ) { | |
| 1478 | 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>'; |
| 1479 | 1539 | } |
| 1480 | 1540 | |
| 1481 | 1541 | foreach ( (array) $api->sections as $section_name => $content ) { |
| @@ -1627,5 +1687,5 @@ | ||
| 1627 | 1687 | <?php |
| 1628 | 1688 | iframe_footer(); |
| 1629 | 1689 | exit; |
| 1630 | 1690 | } |
| 1631 | - } | |
| 1691 | + } | |