wp_get_update_php_url example

$mysql_compat  = version_compare( $mysql_version$required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );

$version_url = sprintf(
    /* translators: %s: WordPress version. */
    esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
    sanitize_title( $wp_version )
);

$php_update_message = '</p><p>' . sprintf(
    /* translators: %s: URL to Update PHP page. */
    __( '<a href="%s">Learn more about updating PHP</a>.' ),
    esc_url( wp_get_update_php_url() )
);

$annotation = wp_get_update_php_annotation();

if ( $annotation ) {
    $php_update_message .= '</p><p><em>' . $annotation . '</em>';
}

if ( ! $mysql_compat && ! $php_compat ) {
    $compat = sprintf(
        /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */
        
'<div class="update-message notice inline notice-error notice-alt"><p>',
                esc_attr( $this->get_column_count() )
            );

            if ( ! $compatible_php && ! $compatible_wp ) {
                _e( 'This plugin does not work with your versions of WordPress and PHP.' );
                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
                    printf(
                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
                        self_admin_url( 'update-core.php' ),
                        esc_url( wp_get_update_php_url() )
                    );
                    wp_update_php_annotation( '</p><p><em>', '</em>' );
                } elseif ( current_user_can( 'update_core' ) ) {
                    printf(
                        /* translators: %s: URL to WordPress Updates screen. */
                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
                        self_admin_url( 'update-core.php' )
                    );
                } elseif ( current_user_can( 'update_php' ) ) {
                    printf(
                        /* translators: %s: URL to Update PHP page. */
                        
<?php                                         printf(
                                            /* translators: %s: Theme name. */
                                            __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
                                            '{{{ data.name }}}'
                                        );
                                        if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
                                            printf(
                                                /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
                                                ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
                                                self_admin_url( 'update-core.php' ),
                                                esc_url( wp_get_update_php_url() )
                                            );
                                            wp_update_php_annotation( '</p><p><em>', '</em>' );
                                        } elseif ( current_user_can( 'update_core' ) ) {
                                            printf(
                                                /* translators: %s: URL to WordPress Updates screen. */
                                                ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
                                                self_admin_url( 'update-core.php' )
                                            );
                                        } elseif ( current_user_can( 'update_php' ) ) {
                                            printf(
                                                /* translators: %s: URL to Update PHP page. */
                                                
$compatible_php = is_php_version_compatible( $requires_php );
    $compatible_wp  = is_wp_version_compatible( $requires_wp );
    $tested_wp      = ( empty( $api->tested ) || version_compare( get_bloginfo( 'version' )$api->tested, '<=' ) );

    if ( ! $compatible_php ) {
        echo '<div class="notice notice-error notice-alt"><p>';
        _e( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>.' );
        if ( current_user_can( 'update_php' ) ) {
            printf(
                /* translators: %s: URL to Update PHP page. */
                ' ' . __( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ),
                esc_url( wp_get_update_php_url() )
            );

            wp_update_php_annotation( '</p><p><em>', '</em>' );
        } else {
            echo '</p>';
        }
        echo '</div>';
    }

    if ( ! $tested_wp ) {
        echo '<div class="notice notice-warning notice-alt"><p>';
        
$requirements = array(
        'requires'     => ! empty( $plugin_headers['RequiresWP'] ) ? $plugin_headers['RequiresWP'] : '',
        'requires_php' => ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : '',
    );

    $compatible_wp  = is_wp_version_compatible( $requirements['requires'] );
    $compatible_php = is_php_version_compatible( $requirements['requires_php'] );

    $php_update_message = '</p><p>' . sprintf(
        /* translators: %s: URL to Update PHP page. */
        __( '<a href="%s">Learn more about updating PHP</a>.' ),
        esc_url( wp_get_update_php_url() )
    );

    $annotation = wp_get_update_php_annotation();

    if ( $annotation ) {
        $php_update_message .= '</p><p><em>' . $annotation . '</em>';
    }

    if ( ! $compatible_wp && ! $compatible_php ) {
        return new WP_Error(
            'plugin_wp_php_incompatible',
            


            $version_url = sprintf(
                /* translators: %s: WordPress version. */
                esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
                sanitize_title( $update->current )
            );

            $php_update_message = '</p><p>' . sprintf(
                /* translators: %s: URL to Update PHP page. */
                __( '<a href="%s">Learn more about updating PHP</a>.' ),
                esc_url( wp_get_update_php_url() )
            );

            $annotation = wp_get_update_php_annotation();

            if ( $annotation ) {
                $php_update_message .= '</p><p><em>' . $annotation . '</em>';
            }

            if ( ! $mysql_compat && ! $php_compat ) {
                $message = sprintf(
                    /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */
                    
<?php                 _e( 'This theme does not work with your versions of WordPress and PHP.' );
                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
                    printf(
                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
                        self_admin_url( 'update-core.php' ),
                        esc_url( wp_get_update_php_url() )
                    );
                    wp_update_php_annotation( '</p><p><em>', '</em>' );
                } elseif ( current_user_can( 'update_core' ) ) {
                    printf(
                        /* translators: %s: URL to WordPress Updates screen. */
                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
                        self_admin_url( 'update-core.php' )
                    );
                } elseif ( current_user_can( 'update_php' ) ) {
                    printf(
                        /* translators: %s: URL to Update PHP page. */
                        
                if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
                    printf(
                        /* translators: %s: Theme name. */
                        __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
                        $theme['name']
                    );
                    if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
                        printf(
                            /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
                            ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
                            self_admin_url( 'update-core.php' ),
                            esc_url( wp_get_update_php_url() )
                        );
                        wp_update_php_annotation( '</p><p><em>', '</em>' );
                    } elseif ( current_user_can( 'update_core' ) ) {
                        printf(
                            /* translators: %s: URL to WordPress Updates screen. */
                            ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
                            self_admin_url( 'update-core.php' )
                        );
                    } elseif ( current_user_can( 'update_php' ) ) {
                        printf(
                            /* translators: %s: URL to Update PHP page. */
                            
<?php elseif ( ! $php_compat || ! $mysql_compat ) :
    $version_url = sprintf(
        /* translators: %s: WordPress version. */
        esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
        sanitize_title( $wp_version )
    );

    $php_update_message = '</p><p>' . sprintf(
        /* translators: %s: URL to Update PHP page. */
        __( '<a href="%s">Learn more about updating PHP</a>.' ),
        esc_url( wp_get_update_php_url() )
    );

    $annotation = wp_get_update_php_annotation();

    if ( $annotation ) {
        $php_update_message .= '</p><p><em>' . $annotation . '</em>';
    }

    if ( ! $mysql_compat && ! $php_compat ) {
        $message = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */
            
__( 'The minimum recommended version of PHP is %s.' ),
                $response['recommended_version']
            );
        }
        ?> </p> <p class="button-container"> <?php         printf(
            '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
            esc_url( wp_get_update_php_url() ),
            __( 'Learn more about updating PHP' ),
            /* translators: Hidden accessibility text. */
            __( '(opens in a new tab)' )
        );
        ?> </p> <?php
    wp_update_php_annotation();
    wp_direct_php_update_button();
}

/** * Returns the default annotation for the web hosting altering the "Update PHP" page URL. * * This function is to be used after {@see wp_get_update_php_url()} to return a consistent * annotation if the web host has altered the default "Update PHP" page URL. * * @since 5.2.0 * * @return string Update PHP page annotation. An empty string if no custom URLs are provided. */
function wp_get_update_php_annotation() {
    $update_url  = wp_get_update_php_url();
    $default_url = wp_get_default_update_php_url();

    if ( $update_url === $default_url ) {
        return '';
    }

    $annotation = sprintf(
        /* translators: %s: Default Update PHP page URL. */
        __( 'This resource is provided by your web host, and is specific to your site. For more information, <a href="%s" target="_blank">see the official WordPress documentation</a>.' ),
        esc_url( $default_url )
    );

    
<div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> <?php             if ( ! $compatible_php || ! $compatible_wp ) {
                echo '<div class="notice inline notice-error notice-alt"><p>';
                if ( ! $compatible_php && ! $compatible_wp ) {
                    _e( 'This plugin does not work with your versions of WordPress and PHP.' );
                    if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
                        printf(
                            /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
                            ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
                            self_admin_url( 'update-core.php' ),
                            esc_url( wp_get_update_php_url() )
                        );
                        wp_update_php_annotation( '</p><p><em>', '</em>' );
                    } elseif ( current_user_can( 'update_core' ) ) {
                        printf(
                            /* translators: %s: URL to WordPress Updates screen. */
                            ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
                            self_admin_url( 'update-core.php' )
                        );
                    } elseif ( current_user_can( 'update_php' ) ) {
                        printf(
                            /* translators: %s: URL to Update PHP page. */
                            
if ( ! $mysql_compat || ! $php_compat ) {
        $wp_filesystem->delete( $from, true );
    }

    $php_update_message = '';

    if ( function_exists( 'wp_get_update_php_url' ) ) {
        $php_update_message = '</p><p>' . sprintf(
            /* translators: %s: URL to Update PHP page. */
            __( '<a href="%s">Learn more about updating PHP</a>.' ),
            esc_url( wp_get_update_php_url() )
        );

        if ( function_exists( 'wp_get_update_php_annotation' ) ) {
            $annotation = wp_get_update_php_annotation();

            if ( $annotation ) {
                $php_update_message .= '</p><p><em>' . $annotation . '</em>';
            }
        }
    }

    
<?php                                 printf(
                                    /* translators: %s: Theme name. */
                                    __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
                                    '{{{ data.theme.name }}}'
                                );
                                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
                                    printf(
                                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
                                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
                                        self_admin_url( 'update-core.php' ),
                                        esc_url( wp_get_update_php_url() )
                                    );
                                    wp_update_php_annotation( '</p><p><em>', '</em>' );
                                } elseif ( current_user_can( 'update_core' ) ) {
                                    printf(
                                        /* translators: %s: URL to WordPress Updates screen. */
                                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
                                        self_admin_url( 'update-core.php' )
                                    );
                                } elseif ( current_user_can( 'update_php' ) ) {
                                    printf(
                                        /* translators: %s: URL to Update PHP page. */
                                        
printf(
                    /* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number 5: URL to Update PHP page. */
                    __( 'There is a new version of %1$s available, but it does not work with your version of PHP. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.' ),
                    $plugin_name,
                    esc_url( $details_url ),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Plugin name, 2: Version number. */
                        esc_attr( sprintf( __( 'View %1$s version %2$s details' )$plugin_name$response->new_version ) )
                    ),
                    esc_attr( $response->new_version ),
                    esc_url( wp_get_update_php_url() )
                );
                wp_update_php_annotation( '<br><em>', '</em>' );
            }
        }

        /** * Fires at the end of the update message container in each * row of the plugins list table. * * The dynamic portion of the hook name, `$file`, refers to the path * of the plugin's primary file relative to the plugins directory. * * @since 2.8.0 * * @param array $plugin_data An array of plugin metadata. See get_plugin_data() * and the {@see 'plugin_row_meta'} filter for the list * of possible values. * @param object $response { * An object of metadata about the available plugin update. * * @type string $id Plugin ID, e.g. `w.org/plugins/[plugin-name]`. * @type string $slug Plugin slug. * @type string $plugin Plugin basename. * @type string $new_version New plugin version. * @type string $url Plugin URL. * @type string $package Plugin update package URL. * @type string[] $icons An array of plugin icon URLs. * @type string[] $banners An array of plugin banner URLs. * @type string[] $banners_rtl An array of plugin RTL banner URLs. * @type string $requires The version of WordPress which the plugin requires. * @type string $tested The version of WordPress the plugin is tested against. * @type string $requires_php The version of PHP which the plugin requires. * } */
Home | Imprint | This part of the site doesn't use cookies.