Make WordPress Core


Ignore:
Timestamp:
05/24/2009 11:47:49 PM (15 years ago)
Author:
ryan
Message:

Trim tailing whitespace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/misc.php

    r11350 r11450  
    139139 * Updates the IIS web.config file with the current rules if it is writable.
    140140 * If the permalinks do not require rewrite rules then the rules are deleted from the web.config file.
    141  * 
     141 *
    142142 * @since 2.8.0
    143  * 
     143 *
    144144 * @return bool True if web.config was updated successfully
    145145 */
    146146function iis7_save_url_rewrite_rules(){
    147147    global $wp_rewrite;
    148    
     148
    149149    $home_path = get_home_path();
    150150    $web_config_file = $home_path . 'web.config';
    151151
    152     // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP 
     152    // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP
    153153    if ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) {
    154154        if ( iis7_supports_permalinks() ) {
     
    402402/**
    403403 * Check if IIS 7 supports pretty permalinks
    404  * 
     404 *
    405405 * @since 2.8.0
    406  * 
     406 *
    407407 * @return bool
    408408 */
     
    410410    global $is_iis7;
    411411
    412     $supports_permalinks = false;   
     412    $supports_permalinks = false;
    413413    if ( $is_iis7 ) {
    414414        /* First we check if the DOMDocument class exists. If it does not exist,
     
    419419         * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
    420420         * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
    421          * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs 
     421         * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
    422422         * via ISAPI then pretty permalinks will not work.
    423423         */
    424424        $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );
    425425    }
    426        
     426
    427427    return apply_filters('iis7_supports_permalinks', $supports_permalinks);
    428428}
     
    430430/**
    431431 * Check if rewrite rule for WordPress already exists in the IIS 7 configuration file
    432  * 
     432 *
    433433 * @since 2.8.0
    434  * 
     434 *
    435435 * @return bool
    436436 * @param string $filename The file path to the configuration file
    437437 */
    438 function iis7_rewrite_rule_exists($filename) { 
     438function iis7_rewrite_rule_exists($filename) {
    439439    if ( ! file_exists($filename) )
    440         return false;   
     440        return false;
    441441    if ( ! class_exists('DOMDocument') )
    442442        return false;
    443    
     443
    444444    $doc = new DOMDocument();
    445445    if ( $doc->load($filename) === false )
     
    450450        return false;
    451451    else
    452         return true;   
     452        return true;
    453453}
    454454
     
    456456 * Delete WordPress rewrite rule from web.config file if it exists there
    457457 *
    458  * @since 2.8.0 
     458 * @since 2.8.0
    459459 *
    460460 * @param string $filename Name of the configuration file
    461461 * @return bool
    462462 */
    463 function iis7_delete_rewrite_rule($filename) { 
     463function iis7_delete_rewrite_rule($filename) {
    464464    // If configuration file does not exist then rules also do not exist so there is nothing to delete
    465465    if ( ! file_exists($filename) )
    466466        return true;
    467    
     467
    468468    if ( ! class_exists('DOMDocument') )
    469469        return false;
    470    
     470
    471471    $doc = new DOMDocument();
    472472    $doc->preserveWhiteSpace = false;
     
    488488/**
    489489 * Add WordPress rewrite rule to the IIS 7 configuration file.
    490  * 
     490 *
    491491 * @since 2.8.0
    492  * 
     492 *
    493493 * @param string $filename The file path to the configuration file
    494494 * @param string $rewrite_rule The XML fragment with URL Rewrite rule
    495495 * @return bool
    496496 */
    497 function iis7_add_rewrite_rule($filename, $rewrite_rule) { 
     497function iis7_add_rewrite_rule($filename, $rewrite_rule) {
    498498    if ( ! class_exists('DOMDocument') )
    499499        return false;
    500    
     500
    501501    // If configuration file does not exist then we create one.
    502502    if ( ! file_exists($filename) ) {
     
    505505        fclose($fp);
    506506    }
    507    
     507
    508508    $doc = new DOMDocument();
    509509    $doc->preserveWhiteSpace = false;
     
    511511    if ( $doc->load($filename) === false )
    512512        return false;
    513    
     513
    514514    $xpath = new DOMXPath($doc);
    515515
     
    525525    } else {
    526526        $rules_node = $doc->createElement('rules');
    527        
     527
    528528        $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite');
    529529        if ( $xmlnodes->length > 0 ) {
     
    541541                $system_webServer_node = $doc->createElement('system.webServer');
    542542                $system_webServer_node->appendChild($rewrite_node);
    543        
     543
    544544                $xmlnodes = $xpath->query('/configuration');
    545545                if ( $xmlnodes->length > 0 ) {
     
    554554        }
    555555    }
    556    
     556
    557557    $rule_fragment = $doc->createDocumentFragment();
    558558    $rule_fragment->appendXML($rewrite_rule);
    559559    $rules_node->appendChild($rule_fragment);
    560560
    561     $doc->formatOutput = true; 
     561    $doc->formatOutput = true;
    562562    saveDomDocument($doc, $filename);
    563563
    564     return true;   
     564    return true;
    565565}
    566566
    567567/**
    568568 * Saves the XML document into a file
    569  * 
     569 *
    570570 * @since 2.8.0
    571571 *
Note: See TracChangeset for help on using the changeset viewer.