Make WordPress Core

Ticket #36506: misc.php.2.patch

File misc.php.2.patch, 1.9 KB (added by WiZZarD_, 8 years ago)
  • src/wp-admin/includes/misc.php

     
    491491        if ( $doc->load($filename) === false )
    492492                return false;
    493493        $xpath = new DOMXPath($doc);
    494         $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
     494        $xpath->registerNamespace('php', 'http://php.net/xpath');
     495        $xpath->registerPhpFunctions('strtolower');
     496        $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(php:functionString("strtolower", @name),\'wordpress\')]');
    495497        if ( $rules->length == 0 )
    496498                return false;
    497499        else
     
    521523        if ( $doc -> load($filename) === false )
    522524                return false;
    523525        $xpath = new DOMXPath($doc);
    524         $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
     526        $xpath->registerNamespace('php', 'http://php.net/xpath');
     527        $xpath->registerPhpFunctions('strtolower');
     528        $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(php:functionString("strtolower", @name),\'wordpress\')]');
    525529        if ( $rules->length > 0 ) {
    526530                $child = $rules->item(0);
    527531                $parent = $child->parentNode;
     
    560564                return false;
    561565
    562566        $xpath = new DOMXPath($doc);
     567        $xpath->registerNamespace('php', 'http://php.net/xpath');
     568        $xpath->registerPhpFunctions('strtolower');
    563569
    564570        // First check if the rule already exists as in that case there is no need to re-add it
    565         $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
     571        $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(php:functionString("strtolower", @name),\'wordpress\')]');
    566572        if ( $wordpress_rules->length > 0 )
    567573                return true;
    568574