Make WordPress Core

Ticket #13780: 13780-check-theme-version-from-api.diff

File 13780-check-theme-version-from-api.diff, 861 bytes (added by pdclark, 12 years ago)

Checks theme version when "requires" value sent by theme API.

  • wp-admin/includes/theme.php

    diff --git wp-admin/includes/theme.php wp-admin/includes/theme.php
    index 43cb8cf..8ee8915 100644
    function get_theme_feature_list( $api = true ) { 
    271271 * @return mixed
    272272 */
    273273function themes_api($action, $args = null) {
     274        global $wp_version;
    274275
    275276        if ( is_array($args) )
    276277                $args = (object)$args;
    function themes_api($action, $args = null) { 
    292293                }
    293294        }
    294295
     296        if ( isset( $res->requires ) && version_compare( $wp_version, $res->requires, '<' ) ) {
     297                $res = new WP_Error('themes_api_failed', sprintf( __('The theme %s requires WordPress %s or higher. Please <a href="%s">update WordPress</a>.'), '<strong>' . $res->name . '</strong>', $res->requires, network_admin_url('update-core.php') ) );
     298        }
     299
    295300        return apply_filters('themes_api_result', $res, $action, $args);
    296301}