Changeset 43436 for trunk/src/wp-admin/includes/plugin-install.php
- Timestamp:
- 07/09/2018 01:44:53 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin-install.php
r43179 r43436 754 754 $wp_version = get_bloginfo( 'version' ); 755 755 756 if ( ! empty( $api->tested ) && version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '>' ) ) { 757 echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.' ) . '</p></div>'; 758 } elseif ( ! empty( $api->requires ) && version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { 759 echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.' ) . '</p></div>'; 756 $compatible_php = ( empty( $api->requires_php ) || version_compare( substr( phpversion(), 0, strlen( $api->requires_php ) ), $api->requires_php, '>=' ) ); 757 $tested_wp = ( empty( $api->tested ) || version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '<=' ) ); 758 $compatible_wp = ( empty( $api->requires ) || version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '>=' ) ); 759 760 if ( ! $compatible_php ) { 761 echo '<div class="notice notice-error notice-alt"><p>'; 762 printf( 763 /* translators: "Updating PHP" page URL */ 764 __( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>, so unfortunately you cannot install it. <a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ), 765 esc_url( __( 'https://wordpress.org/support/upgrade-php/' ) ) 766 ); 767 echo '</p></div>'; 768 } 769 770 if ( ! $tested_wp ) { 771 echo '<div class="notice notice-warning notice-alt"><p>'; 772 _e( '<strong>Warning:</strong> This plugin <strong>has not been tested</strong> with your current version of WordPress.' ); 773 echo '</p></div>'; 774 } elseif ( ! $compatible_wp ) { 775 echo '<div class="notice notice-error notice-alt"><p>'; 776 _e( '<strong>Error:</strong> This plugin <strong>requires a newer version of WordPress</strong>.' ); 777 if ( current_user_can( 'update_core' ) ) { 778 printf( 779 /* translators: %s: "Update WordPress" screen URL */ 780 ' ' . __( '<a href="%s" target="_parent">Click here to update WordPress</a>.' ), 781 self_admin_url( 'update-core.php' ) 782 ); 783 } 784 echo '</p></div>'; 760 785 } 761 786 … … 781 806 case 'install': 782 807 if ( $status['url'] ) { 783 echo '<a data-slug="' . esc_attr( $api->slug ) . '" id="plugin_install_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>'; 808 if ( $compatible_php && $compatible_wp ) { 809 echo '<a data-slug="' . esc_attr( $api->slug ) . '" id="plugin_install_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>'; 810 } else { 811 printf( 812 '<button type="button" class="button button-primary button-disabled right" disabled="disabled">%s</button>', 813 _x( 'Cannot Install', 'plugin' ) 814 ); 815 } 784 816 } 785 817 break;
Note: See TracChangeset
for help on using the changeset viewer.