WordPress.org

Make WordPress Core

Changeset 4495


Ignore:
Timestamp:
11/19/2006 07:56:05 AM (15 years ago)
Author:
ryan
Message:

Remove trailing spaces and convert spaces to tabs. Props Nazgul. fixes #986

Location:
trunk
Files:
99 edited

Legend:

Unmodified
Added
Removed
  • trunk/index.php

    r2303 r4495  
    1 <?php 
     1<?php
    22/* Short and sweet */
    33define('WP_USE_THEMES', true);
  • trunk/wp-admin/admin-ajax.php

    r4424 r4495  
    129129case 'add-cat' : // From Manage->Categories
    130130    if ( !current_user_can( 'manage_categories' ) )
    131                 die('-1');
     131        die('-1');
    132132    if ( !$cat = wp_insert_category( $_POST ) )
    133133        die('0');
  • trunk/wp-admin/admin-db.php

    r4490 r4495  
    4949        if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
    5050            return array($user->id);
    51         else 
     51        else
    5252            return false;
    5353    }
     
    9797
    9898    $cat_name = apply_filters('pre_category_name', $cat_name);
    99    
     99
    100100    if (empty ($category_nicename))
    101101        $category_nicename = sanitize_title($cat_name);
     
    199199        else
    200200            $cats = array_diff($cats, array($cat_ID));
    201         wp_set_post_categories($post_id, $cats); 
     201        wp_set_post_categories($post_id, $cats);
    202202    }
    203203
     
    210210        else
    211211            $cats = array_diff($cats, array($cat_ID));
    212         wp_set_link_cats($link_id, $cats); 
    213     }
    214    
     212        wp_set_link_cats($link_id, $cats);
     213    }
     214
    215215    wp_cache_delete($cat_ID, 'category');
    216216    wp_cache_delete('all_category_ids', 'category');
     
    286286function wp_revoke_user($id) {
    287287    $id = (int) $id;
    288    
     288
    289289    $user = new WP_User($id);
    290     $user->remove_all_caps();   
     290    $user->remove_all_caps();
    291291}
    292292
     
    386386
    387387    // Passed link category list overwrites existing category list if not empty.
    388     if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
     388    if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
    389389             && 0 != count($linkdata['link_category']) )
    390         $link_cats = $linkdata['link_category'];
    391     else
    392         $link_cats = $link['link_category'];
     390        $link_cats = $linkdata['link_category'];
     391    else
     392        $link_cats = $link['link_category'];
    393393
    394394    // Merge old and new fields with new fields overwriting old ones.
    395395    $linkdata = array_merge($link, $linkdata);
    396     $linkdata['link_category'] = $link_cats;
     396    $linkdata['link_category'] = $link_cats;
    397397
    398398    return wp_insert_link($linkdata);
     
    403403
    404404    do_action('delete_link', $link_id);
    405    
     405
    406406    $categories = wp_get_link_cats($link_id);
    407407    if( is_array( $categories ) ) {
     
    419419    global $wpdb;
    420420
    421     $sql = "SELECT category_id 
    422         FROM $wpdb->link2cat 
    423         WHERE link_id = $link_ID 
     421    $sql = "SELECT category_id
     422        FROM $wpdb->link2cat
     423        WHERE link_id = $link_ID
    424424        ORDER BY category_id";
    425425
     
    442442    // First the old categories
    443443    $old_categories = $wpdb->get_col("
    444         SELECT category_id 
    445         FROM $wpdb->link2cat 
     444        SELECT category_id
     445        FROM $wpdb->link2cat
    446446        WHERE link_id = $link_ID");
    447447
     
    458458        foreach ($delete_cats as $del) {
    459459            $wpdb->query("
    460                 DELETE FROM $wpdb->link2cat 
    461                 WHERE category_id = $del 
    462                     AND link_id = $link_ID 
     460                DELETE FROM $wpdb->link2cat
     461                WHERE category_id = $del
     462                    AND link_id = $link_ID
    463463                ");
    464464        }
     
    471471        foreach ($add_cats as $new_cat) {
    472472            $wpdb->query("
    473                 INSERT INTO $wpdb->link2cat (link_id, category_id) 
     473                INSERT INTO $wpdb->link2cat (link_id, category_id)
    474474                VALUES ($link_ID, $new_cat)");
    475475        }
    476476    }
    477    
     477
    478478    // Update category counts.
    479479    $all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
  • trunk/wp-admin/admin-functions.php

    r4492 r4495  
    11401140</select>
    11411141<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/>
    1142 <input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @ 
    1143 <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> : 
    1144 <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> 
    1145 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> 
     1142<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @
     1143<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> :
     1144<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
     1145<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
    11461146<?php
    11471147    if ( $edit ) {
     
    13881388        }
    13891389    }
    1390    
     1390
    13911391    return true;
    13921392}
  • trunk/wp-admin/bookmarklet.php

    r4144 r4495  
    3636    $post->post_title = $popuptitle;
    3737
    38  
     38
    3939$content  = wp_specialchars($_REQUEST['content']);
    4040$popupurl = wp_specialchars($_REQUEST['popupurl']);
    41     if ( !empty($content) ) {
    42         $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
    43     } else {
    44         $post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
    45     }
     41if ( !empty($content) ) {
     42    $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
     43} else {
     44    $post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
     45}
    4646
    47     /* /big funky fixes */
     47/* /big funky fixes */
    4848
    4949?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    7878
    7979#wpbookmarklet .wrap {
    80     border: 0px;
     80    border: 0px;
    8181}
    8282
    8383#wpbookmarklet #postdiv {
    84     margin-bottom: 0.5em;
     84    margin-bottom: 0.5em;
    8585}
    8686
    8787#wpbookmarklet #titlediv {
    88     margin-bottom: 1em;
     88    margin-bottom: 1em;
    8989}
    9090
  • trunk/wp-admin/categories.php

    r4490 r4495  
    4949case 'edit':
    5050
    51     require_once ('admin-header.php');
    52     $cat_ID = (int) $_GET['cat_ID'];
    53     $category = get_category_to_edit($cat_ID);
    54     include('edit-category-form.php');
     51    require_once ('admin-header.php');
     52    $cat_ID = (int) $_GET['cat_ID'];
     53    $category = get_category_to_edit($cat_ID);
     54    include('edit-category-form.php');
    5555
    5656break;
  • trunk/wp-admin/custom-fields.js

    r4187 r4495  
    1515        if ('text' == inputs[i].type) {
    1616            inputs[i].setAttribute('autocomplete', 'off');
    17                 inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
     17            inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
    1818        }
    1919        if ('updatemeta' == inputs[i].className) {
    20                 inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
     20            inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
    2121        }
    2222    }
  • trunk/wp-admin/dbx-admin-key-js.php

    r4424 r4495  
    1010    case 'page.php' :
    1111    case 'page-new.php' :
    12         $man = 'pagemeta'; 
     12        $man = 'pagemeta';
    1313        break;
    1414    case 'link.php' :
  • trunk/wp-admin/edit-category-form.php

    r4482 r4495  
    2323    <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    2424        <tr>
    25           <th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
    26           <td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /></td>
     25            <th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
     26            <td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /></td>
    2727        </tr>
    2828        <tr>
  • trunk/wp-admin/edit-comments.php

    r4480 r4495  
    144144        $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
    145145            $comment_status = wp_get_comment_status($comment->comment_ID);
    146             if ('unapproved' == $comment_status) 
     146            if ('unapproved' == $comment_status)
    147147                $class .= ' unapproved';
    148148            if ($i % 2)
     
    154154<?php comment_text() ?>
    155155
    156 <p><?php comment_date('M j, g:i A');  ?> &#8212; [ 
     156<p><?php comment_date('M j, g:i A');  ?> &#8212; [
    157157<?php
    158158if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
     
    182182        ?>
    183183        <p>
    184         <strong><?php _e('No comments found.') ?></strong></p>
     184            <strong><?php _e('No comments found.') ?></strong></p>
    185185
    186186        <?php
  • trunk/wp-admin/edit-form-advanced.php

    r4349 r4495  
    99
    1010<form name="post" action="post.php" method="post" id="post">
    11 <?php if ( (isset($mode) && 'bookmarklet' == $mode) ||
    12             isset($_GET['popupurl']) ): ?>
     11<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
    1312<input type="hidden" name="mode" value="bookmarklet" />
    1413<?php endif; ?>
     
    122121<div class="dbx-content">
    123122<select name="post_author_override" id="post_author_override">
    124 <?php 
     123<?php
    125124foreach ($authors as $o) :
    126125$o = get_userdata( $o->ID );
     
    141140
    142141<fieldset id="titlediv">
    143   <legend><?php _e('Title') ?></legend>
    144   <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
     142    <legend><?php _e('Title') ?></legend>
     143    <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
    145144</fieldset>
    146145
     
    209208<div class="dbx-content-wrapper">
    210209<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
    211 <?php 
     210<?php
    212211if ( ! empty($pings) )
    213212    echo $pings;
     
    228227<?php
    229228$metadata = has_meta($post_ID);
    230 list_meta($metadata); 
     229list_meta($metadata);
    231230?>
    232231
  • trunk/wp-admin/edit-form-comment.php

    r4437 r4495  
    5555        <th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
    5656        <td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
    57       <label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
    58       <label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
     57        <label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
     58        <label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
    5959    </tr>
    6060
  • trunk/wp-admin/edit-form.php

    r4144 r4495  
    5555    <input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
    5656
    57 <p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" /> 
    58   <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
     57<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
     58    <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
    5959
    6060     <?php if ( current_user_can('edit_posts') ) : ?>
    61   <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
     61    <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
    6262<?php endif; ?>
    6363
    6464<?php if ('bookmarklet' != $mode) {
    65       echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' .  __('Advanced Editing &raquo;') . '" />';
    66   } ?>
    67   <input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" />
     65        echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' .  __('Advanced Editing &raquo;') . '" />';
     66    } ?>
     67    <input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" />
    6868</p>
    6969
  • trunk/wp-admin/edit-link-form.php

    r4144 r4495  
    3131?>
    3232
    33 <div class="wrap"> 
     33<div class="wrap">
    3434<h2><?php echo $heading ?></h2>
    3535<?php echo $form ?>
     
    4949
    5050<fieldset class="dbx-box">
    51 <h3 class="dbx-handle"><?php _e('Target') ?></h3> 
     51<h3 class="dbx-handle"><?php _e('Target') ?></h3>
    5252<div class="dbx-content">
    5353<label for="link_target_blank" class="selectit">
     
    6464
    6565<fieldset class="dbx-box">
    66 <h3 class="dbx-handle"><?php _e('Visible') ?></h3> 
     66<h3 class="dbx-handle"><?php _e('Visible') ?></h3>
    6767<div class="dbx-content">
    6868<label for="link_visible_yes" class="selectit">
  • trunk/wp-admin/edit-page-form.php

    r4397 r4495  
    1717
    1818if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
    19     $sendto = 'redo';
     19    $sendto = 'redo';
    2020$sendto = wp_specialchars( $sendto );
    2121
     
    2828
    2929if (isset($mode) && 'bookmarklet' == $mode) {
    30     echo '<input type="hidden" name="mode" value="bookmarklet" />';
     30    echo '<input type="hidden" name="mode" value="bookmarklet" />';
    3131}
    3232?>
     
    104104<div class="dbx-content">
    105105<select name="post_author_override" id="post_author_override">
    106 <?php 
     106<?php
    107107foreach ($authors as $o) :
    108108$o = get_userdata( $o->ID );
     
    118118
    119119<fieldset id="pageorder" class="dbx-box">
    120 <h3 class="dbx-handle"><?php _e('Page Order') ?></h3> 
     120<h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
    121121<div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div>
    122122</fieldset>
     
    169169<div id="postcustomstuff" class="dbx-content">
    170170<table cellpadding="3">
    171 <?php 
     171<?php
    172172$metadata = has_meta($post_ID);
    173 list_meta($metadata); 
     173list_meta($metadata);
    174174?>
    175175
     
    187187
    188188<?php if ('edit' == $action) :
    189     $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID ); 
     189    $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
    190190    if ( current_user_can('delete_page', $post->ID) ) ?>
    191191        <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
  • trunk/wp-admin/edit-pages.php

    r4480 r4495  
    1111<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p>
    1212
    13 <form name="searchform" action="" method="get"> 
    14   <fieldset>
    15   <legend><?php _e('Search Pages&hellip;') ?></legend>
    16   <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" />
    17   <input type="submit" name="submit" value="<?php _e('Search') ?>"  />
    18   </fieldset>
     13<form name="searchform" action="" method="get">
     14    <fieldset>
     15    <legend><?php _e('Search Pages&hellip;') ?></legend>
     16    <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" />
     17    <input type="submit" name="submit" value="<?php _e('Search') ?>"  />
     18    </fieldset>
    1919</form>
    2020
     
    5454<?php
    5555} // end if ($posts)
    56 ?> 
     56?>
    5757
    5858<h3><a href="page-new.php"><?php _e('Create New Page &raquo;'); ?></a></h3>
     
    6060</div>
    6161
    62 <?php include('admin-footer.php'); ?> 
     62<?php include('admin-footer.php'); ?>
  • trunk/wp-admin/edit.php

    r4491 r4495  
    1313
    1414if ($drafts || $other_drafts) {
    15 ?> 
     15?>
    1616<div class="wrap">
    1717<?php if ($drafts) { ?>
    18     <p><strong><?php _e('Your Drafts:') ?></strong>
    19     <?php
     18    <p><strong><?php _e('Your Drafts:') ?></strong>
     19    <?php
    2020    $i = 0;
    2121    foreach ($drafts as $draft) {
     
    2828        ++$i;
    2929        }
    30     ?> 
    31     .</p>
    32 <?php } ?>
    33 
    34 <?php if ($other_drafts) { ?> 
    35     <p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
    36     <?php
     30    ?>
     31    .</p>
     32<?php } ?>
     33
     34<?php if ($other_drafts) { ?>
     35    <p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
     36    <?php
    3737    $i = 0;
    3838    foreach ($other_drafts as $draft) {
     
    4545        ++$i;
    4646        }
    47     ?> 
    48     .</p>
     47    ?>
     48    .</p>
    4949
    5050<?php } ?>
     
    8989    <fieldset>
    9090    <legend><?php _e('Browse Month&hellip;') ?></legend>
    91     <select name='m'>
     91    <select name='m'>
    9292    <?php
    9393        foreach ($arc_result as $arc_row) {
     
    128128// define the columns to display, the syntax is 'internal name' => 'display name'
    129129$posts_columns = array(
    130   'id'         => __('ID'),
    131   'date'       => __('When'),
    132   'title'      => __('Title'),
    133   'categories' => __('Categories'),
    134   'comments'   => __('Comments'),
    135   'author'     => __('Author')
     130    'id'         => __('ID'),
     131    'date'       => __('When'),
     132    'title'      => __('Title'),
     133    'categories' => __('Categories'),
     134    'comments'   => __('Comments'),
     135    'author'     => __('Author')
    136136);
    137137$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
     
    144144?>
    145145
    146 <table class="widefat"> 
     146<table class="widefat">
    147147    <thead>
    148148    <tr>
     
    161161add_filter('the_title','wp_specialchars');
    162162$class = ('alternate' == $class) ? '' : 'alternate';
    163 ?> 
     163?>
    164164    <tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
    165165
     
    196196    case 'comments':
    197197        ?>
    198         <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1"> 
    199       <?php comments_number(__('0'), __('1'), __('%')) ?>
    200       </a></td>
     198        <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
     199            <?php comments_number(__('0'), __('1'), __('%')) ?>
     200            </a></td>
    201201        <?php
    202202        break;
     
    260260    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
    261261    if ($comments) {
    262     ?> 
    263 <h3 id="comments"><?php _e('Comments') ?></h3> 
    264 <ol id="the-comment-list" class="commentlist"> 
     262    ?>
     263<h3 id="comments"><?php _e('Comments') ?></h3>
     264<ol id="the-comment-list" class="commentlist">
    265265<?php
    266266$i = 0;
     
    270270        $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
    271271            $comment_status = wp_get_comment_status($comment->comment_ID);
    272             if ('unapproved' == $comment_status) 
     272            if ('unapproved' == $comment_status)
    273273                $class .= ' unapproved';
    274274            if ($i % 2)
     
    300300    }//end if comments
    301301    ?>
    302 <?php } ?> 
    303 </div> 
    304 <?php 
     302<?php } ?>
     303</div>
     304<?php
    305305 include('admin-footer.php');
    306 ?> 
     306?>
  • trunk/wp-admin/export.php

    r4485 r4495  
    7373
    7474<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"-->
    75 <rss version="2.0" 
     75<rss version="2.0"
    7676    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    7777    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     
    109109<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
    110110<?php
    111 $postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); 
     111$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
    112112if ( $postmeta ) {
    113113?>
     
    120120<?php } ?>
    121121<?php
    122 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID"); 
     122$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
    123123if ( $comments ) { foreach ( $comments as $c ) { ?>
    124124<wp:comment>
  • trunk/wp-admin/import/blogger.php

    r4369 r4495  
    518518            }
    519519            $output.= "<p>$archivename $status</p>\n";
    520         }
     520        }
    521521        if ( ! $did_one )
    522522            $this->set_next_step(7);
  • trunk/wp-admin/import/blogware.php

    r4424 r4495  
    2121        return strtr($string, $trans_tbl);
    2222    }
    23    
     23
    2424    function greet() {
    2525        echo '<div class="narrow">';
     
    3131    function import_posts() {
    3232        global $wpdb, $current_user;
    33        
     33
    3434        set_magic_quotes_runtime(0);
    3535        $importdata = file($this->file); // Read the file into an array
     
    4040        $posts = $posts[1];
    4141        unset($importdata);
    42         echo '<ol>';       
     42        echo '<ol>';
    4343        foreach ($posts as $post) {
    4444            flush();
     
    103103            preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
    104104            $comments = $comments[1];
    105            
     105
    106106            if ( $comments ) {
    107107                $comment_post_ID = $post_id;
     
    158158        $this->import_posts();
    159159        wp_import_cleanup($file['id']);
    160        
     160
    161161        echo '<h3>';
    162162        printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
     
    171171
    172172        $this->header();
    173        
     173
    174174        switch ($step) {
    175175            case 0 :
     
    180180                break;
    181181        }
    182        
     182
    183183        $this->footer();
    184184    }
    185185
    186186    function BW_Import() {
    187         // Nothing. 
     187        // Nothing.
    188188    }
    189189}
  • trunk/wp-admin/import/dotclear.php

    r4424 r4495  
    1010if(!function_exists('get_catbynicename'))
    1111{
    12     function get_catbynicename($category_nicename) 
     12    function get_catbynicename($category_nicename)
    1313    {
    1414    global $wpdb;
     
    6161//    This cries out for a C-implementation to be included in PHP core
    6262//
    63    function valid_1byte($char) {
    64        if(!is_int($char)) return false;
    65        return ($char & 0x80) == 0x00;
    66    }
    67  
    68    function valid_2byte($char) {
    69        if(!is_int($char)) return false;
    70        return ($char & 0xE0) == 0xC0;
    71    }
    72 
    73    function valid_3byte($char) {
    74        if(!is_int($char)) return false;
    75        return ($char & 0xF0) == 0xE0;
    76    }
    77 
    78    function valid_4byte($char) {
    79        if(!is_int($char)) return false;
    80        return ($char & 0xF8) == 0xF0;
    81    }
    82  
    83    function valid_nextbyte($char) {
    84        if(!is_int($char)) return false;
    85        return ($char & 0xC0) == 0x80;
    86    }
    87  
    88    function valid_utf8($string) {
    89        $len = strlen($string);
    90        $i = 0;   
    91        while( $i < $len ) {
    92            $char = ord(substr($string, $i++, 1));
    93            if(valid_1byte($char)) {    // continue
    94                continue;
    95            } else if(valid_2byte($char)) { // check 1 byte
    96                if(!valid_nextbyte(ord(substr($string, $i++, 1))))
    97                    return false;
    98            } else if(valid_3byte($char)) { // check 2 bytes
    99                if(!valid_nextbyte(ord(substr($string, $i++, 1))))
    100                    return false;
    101                if(!valid_nextbyte(ord(substr($string, $i++, 1))))
    102                    return false;
    103            } else if(valid_4byte($char)) { // check 3 bytes
    104                if(!valid_nextbyte(ord(substr($string, $i++, 1))))
    105                    return false;
    106                if(!valid_nextbyte(ord(substr($string, $i++, 1))))
    107                    return false;
    108                if(!valid_nextbyte(ord(substr($string, $i++, 1))))
    109                    return false;
    110            } // goto next char
    111        }
    112        return true; // done
    113    }
     63
     64function valid_1byte($char) {
     65    if(!is_int($char)) return false;
     66        return ($char & 0x80) == 0x00;
     67}
     68
     69function valid_2byte($char) {
     70    if(!is_int($char)) return false;
     71        return ($char & 0xE0) == 0xC0;
     72}
     73
     74function valid_3byte($char) {
     75    if(!is_int($char)) return false;
     76        return ($char & 0xF0) == 0xE0;
     77}
     78
     79function valid_4byte($char) {
     80    if(!is_int($char)) return false;
     81        return ($char & 0xF8) == 0xF0;
     82}
     83
     84function valid_nextbyte($char) {
     85    if(!is_int($char)) return false;
     86        return ($char & 0xC0) == 0x80;
     87}
     88
     89function valid_utf8($string) {
     90    $len = strlen($string);
     91    $i = 0;
     92    while( $i < $len ) {
     93        $char = ord(substr($string, $i++, 1));
     94        if(valid_1byte($char)) {    // continue
     95            continue;
     96        } else if(valid_2byte($char)) { // check 1 byte
     97            if(!valid_nextbyte(ord(substr($string, $i++, 1))))
     98                return false;
     99        } else if(valid_3byte($char)) { // check 2 bytes
     100            if(!valid_nextbyte(ord(substr($string, $i++, 1))))
     101                return false;
     102            if(!valid_nextbyte(ord(substr($string, $i++, 1))))
     103                return false;
     104        } else if(valid_4byte($char)) { // check 3 bytes
     105            if(!valid_nextbyte(ord(substr($string, $i++, 1))))
     106                return false;
     107            if(!valid_nextbyte(ord(substr($string, $i++, 1))))
     108                return false;
     109            if(!valid_nextbyte(ord(substr($string, $i++, 1))))
     110                return false;
     111        } // goto next char
     112    }
     113    return true; // done
     114}
    114115
    115116function csc ($s) {
     
    152153    }
    153154
    154     function get_dc_cats() 
     155    function get_dc_cats()
    155156    {
    156157        global $wpdb;
     
    187188        return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
    188189                        FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
    189                           ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
     190                        ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
    190191    }
    191192
     
    212213    }
    213214
    214     function cat2wp($categories='') 
     215    function cat2wp($categories='')
    215216    {
    216217        // General Housekeeping
     
    222223        {
    223224            echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
    224             foreach ($categories as $category) 
     225            foreach ($categories as $category)
    225226            {
    226227                $count++;
     
    284285                                );
    285286                }
    286                 else 
     287                else
    287288                {
    288289                    $ret_id = wp_insert_user(array(
     
    385386                            );
    386387                }
    387                 else 
     388                else
    388389                {
    389390                    $ret_id = wp_insert_post(array(
     
    461462                            );
    462463                }
    463                 else 
     464                else
    464465                {
    465466                    // Insert comments
     
    548549    }
    549550
    550     function import_categories() 
     551    function import_categories()
    551552    {
    552553        // Category Import
     
    566567    {
    567568        // User Import
    568         $users = $this->get_dc_users(); 
     569        $users = $this->get_dc_users();
    569570        $this->users2wp($users);
    570571
     
    656657    }
    657658
    658     function dispatch() 
     659    function dispatch()
    659660    {
    660661
     
    665666        $this->header();
    666667
    667         if ( $step > 0 ) 
     668        if ( $step > 0 )
    668669        {
    669670            if($_POST['dbuser'])
     
    690691                if(get_option('dchost'))
    691692                    delete_option('dchost');
    692                 add_option('dchost',$_POST['dbhost']); 
     693                add_option('dchost',$_POST['dbhost']);
    693694            }
    694695            if($_POST['dccharset'])
     
    696697                if(get_option('dccharset'))
    697698                    delete_option('dccharset');
    698                 add_option('dccharset',$_POST['dccharset']); 
     699                add_option('dccharset',$_POST['dccharset']);
    699700            }
    700701            if($_POST['dbprefix'])
     
    702703                if(get_option('dcdbprefix'))
    703704                    delete_option('dcdbprefix');
    704                 add_option('dcdbprefix',$_POST['dbprefix']); 
     705                add_option('dcdbprefix',$_POST['dbprefix']);
    705706            }
    706707
     
    708709        }
    709710
    710         switch ($step) 
     711        switch ($step)
    711712        {
    712713            default:
     
    737738    }
    738739
    739     function Dotclear_Import() 
     740    function Dotclear_Import()
    740741    {
    741742        // Nothing.
  • trunk/wp-admin/import/greymatter.php

    r4165 r4495  
    6767        return($string);
    6868    }
    69    
     69
    7070    function import() {
    7171        global $wpdb;
    72    
     72
    7373        $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
    7474        for ($i=0; $i<count($wpvarstoreset); $i += 1) {
     
    137137
    138138    chdir($archivespath);
    139    
     139
    140140    for($i = 0; $i <= $lastentry; $i = $i + 1) {
    141        
     141
    142142        $entryfile = "";
    143        
     143
    144144        if ($i<10000000) {
    145145            $entryfile .= "0";
     
    195195            $comment_status = 'open';
    196196            $ping_status = 'closed';
    197            
     197
    198198            if ($post_ID = post_exists($post_title, '', $post_date)) {
    199199                echo ' ';
     
    304304
    305305    function GM_Import() {
    306         // Nothing. 
     306        // Nothing.
    307307    }
    308308}
  • trunk/wp-admin/import/mt.php

    r4370 r4495  
    5656        if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
    5757            ++ $this->j;
    58             $this->mtnames[$this->j] = $author; //add that new mt author name to an array 
     58            $this->mtnames[$this->j] = $author; //add that new mt author name to an array
    5959            $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
    60             if (!$user_id) { //banging my head against the desk now. 
     60            if (!$user_id) { //banging my head against the desk now.
    6161                if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
    6262                    $user_id = wp_create_user($author, $pass);
     
    400400    function import() {
    401401        $this->id = (int) $_GET['id'];
    402        
     402
    403403        $this->file = get_attached_file($this->id);
    404404        $this->get_authors_from_post();
  • trunk/wp-admin/import/textpattern.php

    r4349 r4495  
    55if(!function_exists('get_catbynicename'))
    66{
    7     function get_catbynicename($category_nicename) 
     7    function get_catbynicename($category_nicename)
    88    {
    99    global $wpdb;
     
    7171
    7272        // Get Categories
    73         return $txpdb->get_results('SELECT 
    74                                         id,
    75                                         name,
    76                                         title
    77                                      FROM '.$prefix.'txp_category
    78                                      WHERE type = "article"',
    79                                      ARRAY_A);
     73        return $txpdb->get_results('SELECT
     74            id,
     75            name,
     76            title
     77            FROM '.$prefix.'txp_category
     78            WHERE type = "article"',
     79            ARRAY_A);
    8080    }
    8181
     
    9191
    9292        return $txpdb->get_results('SELECT
    93                                         user_id,
    94                                         name,
    95                                         RealName,
    96                                         email,
    97                                         privs
    98                                     FROM '.$prefix.'txp_users', ARRAY_A);
     93            user_id,
     94            name,
     95            RealName,
     96            email,
     97            privs
     98            FROM '.$prefix.'txp_users', ARRAY_A);
    9999    }
    100100
     
    107107
    108108        // Get Posts
    109         return $txpdb->get_results('SELECT 
    110                                         ID,
    111                                         Posted,
    112                                         AuthorID,
    113                                         LastMod,
    114                                         Title,
    115                                         Body,
    116                                         Excerpt,
    117                                         Category1,
    118                                         Category2,
    119                                         Status,
    120                                         Keywords,
    121                                         url_title,
    122                                         comments_count
    123                                     FROM '.$prefix.'textpattern
    124                                     ', ARRAY_A);
     109        return $txpdb->get_results('SELECT
     110            ID,
     111            Posted,
     112            AuthorID,
     113            LastMod,
     114            Title,
     115            Body,
     116            Excerpt,
     117            Category1,
     118            Category2,
     119            Status,
     120            Keywords,
     121            url_title,
     122            comments_count
     123            FROM '.$prefix.'textpattern
     124            ', ARRAY_A);
    125125    }
    126126
     
    144144        $prefix = get_option('tpre');
    145145
    146         return $txpdb->get_results('SELECT 
    147                                         id,
    148                                         date,
    149                                         category,
    150                                         url,
    151                                         linkname,
    152                                         description
    153                                       FROM '.$prefix.'txp_link',
    154                                       ARRAY_A);                       
    155     }
    156 
    157     function cat2wp($categories='') 
     146        return $txpdb->get_results('SELECT
     147            id,
     148            date,
     149            category,
     150            url,
     151            linkname,
     152            description
     153            FROM '.$prefix.'txp_link',
     154            ARRAY_A);
     155    }
     156
     157    function cat2wp($categories='')
    158158    {
    159159        // General Housekeeping
     
    165165        {
    166166            echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
    167             foreach ($categories as $category) 
     167            foreach ($categories as $category)
    168168            {
    169169                $count++;
     
    227227                                );
    228228                }
    229                 else 
     229                else
    230230                {
    231231                    $ret_id = wp_insert_user(array(
     
    303303                {
    304304                    $ret_id = wp_insert_post(array(
    305                             'ID'                => $pinfo,
    306                             'post_date'         => $Posted,
    307                             'post_date_gmt'     => $post_date_gmt,
    308                             'post_author'       => $authorid,
    309                             'post_modified'     => $LastMod,
    310                             'post_modified_gmt' => $post_modified_gmt,
    311                             'post_title'        => $Title,
    312                             'post_content'      => $Body,
    313                             'post_excerpt'      => $Excerpt,
    314                             'post_status'       => $post_status,
    315                             'post_name'         => $url_title,
    316                             'comment_count'     => $comments_count)
    317                             );
    318                 }
    319                 else 
     305                        'ID'                => $pinfo,
     306                        'post_date'         => $Posted,
     307                        'post_date_gmt'     => $post_date_gmt,
     308                        'post_author'       => $authorid,
     309                        'post_modified'     => $LastMod,
     310                        'post_modified_gmt' => $post_modified_gmt,
     311                        'post_title'        => $Title,
     312                        'post_content'      => $Body,
     313                        'post_excerpt'      => $Excerpt,
     314                        'post_status'       => $post_status,
     315                        'post_name'         => $url_title,
     316                        'comment_count'     => $comments_count)
     317                        );
     318                }
     319                else
    320320                {
    321321                    $ret_id = wp_insert_post(array(
    322                             'post_date'         => $Posted,
    323                             'post_date_gmt'     => $post_date_gmt,
    324                             'post_author'       => $authorid,
    325                             'post_modified'     => $LastMod,
    326                             'post_modified_gmt' => $post_modified_gmt,
    327                             'post_title'        => $Title,
    328                             'post_content'      => $Body,
    329                             'post_excerpt'      => $Excerpt,
    330                             'post_status'       => $post_status,
    331                             'post_name'         => $url_title,
    332                             'comment_count'     => $comments_count)
    333                             );
     322                        'post_date'         => $Posted,
     323                        'post_date_gmt'     => $post_date_gmt,
     324                        'post_author'       => $authorid,
     325                        'post_modified'     => $LastMod,
     326                        'post_modified_gmt' => $post_modified_gmt,
     327                        'post_title'        => $Title,
     328                        'post_content'      => $Body,
     329                        'post_excerpt'      => $Excerpt,
     330                        'post_status'       => $post_status,
     331                        'post_name'         => $url_title,
     332                        'comment_count'     => $comments_count)
     333                        );
    334334                }
    335335                $txpposts2wpposts[$ID] = $ret_id;
     
    380380                    // Update comments
    381381                    $ret_id = wp_update_comment(array(
    382                             'comment_ID'            => $cinfo,
    383                             'comment_post_ID'       => $comment_post_ID,
    384                             'comment_author'        => $name,
    385                             'comment_author_email'  => $email,
    386                             'comment_author_url'    => $web,
    387                             'comment_date'          => $posted,
    388                             'comment_content'       => $message,
    389                             'comment_approved'      => $comment_approved)
    390                             );
    391                 }
    392                 else 
     382                        'comment_ID'            => $cinfo,
     383                        'comment_post_ID'       => $comment_post_ID,
     384                        'comment_author'        => $name,
     385                        'comment_author_email'  => $email,
     386                        'comment_author_url'    => $web,
     387                        'comment_date'          => $posted,
     388                        'comment_content'       => $message,
     389                        'comment_approved'      => $comment_approved)
     390                        );
     391                }
     392                else
    393393                {
    394394                    // Insert comments
    395395                    $ret_id = wp_insert_comment(array(
    396                             'comment_post_ID'       => $comment_post_ID,
    397                             'comment_author'        => $name,
    398                             'comment_author_email'  => $email,
    399                             'comment_author_url'    => $web,
    400                             'comment_author_IP'     => $ip,
    401                             'comment_date'          => $posted,
    402                             'comment_content'       => $message,
    403                             'comment_approved'      => $comment_approved)
    404                             );
     396                        'comment_post_ID'       => $comment_post_ID,
     397                        'comment_author'        => $name,
     398                        'comment_author_email'  => $email,
     399                        'comment_author_url'    => $web,
     400                        'comment_author_IP'     => $ip,
     401                        'comment_date'          => $posted,
     402                        'comment_content'       => $message,
     403                        'comment_approved'      => $comment_approved)
     404                        );
    405405                }
    406406                $txpcm2wpcm[$comment_ID] = $ret_id;
     
    451451                                );
    452452                }
    453                 else 
     453                else
    454454                {
    455455                    $ret_id = wp_insert_link(array(
     
    473473    }
    474474
    475     function import_categories() 
     475    function import_categories()
    476476    {
    477477        // Category Import
     
    491491    {
    492492        // User Import
    493         $users = $this->get_txp_users(); 
     493        $users = $this->get_txp_users();
    494494        $this->users2wp($users);
    495495
     
    579579    }
    580580
    581     function dispatch() 
     581    function dispatch()
    582582    {
    583583
     
    588588        $this->header();
    589589
    590         if ( $step > 0 ) 
     590        if ( $step > 0 )
    591591        {
    592592            if($_POST['dbuser'])
     
    613613                if(get_option('txphost'))
    614614                    delete_option('txphost');
    615                 add_option('txphost',$_POST['dbhost']); 
     615                add_option('txphost',$_POST['dbhost']);
    616616            }
    617617            if($_POST['dbprefix'])
     
    619619                if(get_option('tpre'))
    620620                    delete_option('tpre');
    621                 add_option('tpre',$_POST['dbprefix']); 
     621                add_option('tpre',$_POST['dbprefix']);
    622622            }
    623623
     
    625625        }
    626626
    627         switch ($step) 
     627        switch ($step)
    628628        {
    629629            default:
     
    654654    }
    655655
    656     function Textpattern_Import() 
     656    function Textpattern_Import()
    657657    {
    658658        // Nothing.
  • trunk/wp-admin/import/wordpress.php

    r4424 r4495  
    5959        if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
    6060            ++ $this->j;
    61             $this->mtnames[$this->j] = $author; //add that new mt author name to an array 
     61            $this->mtnames[$this->j] = $author; //add that new mt author name to an array
    6262            $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
    63             if (!$user_id) { //banging my head against the desk now. 
     63            if (!$user_id) { //banging my head against the desk now.
    6464                if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
    6565                    $user_id = wp_create_user($author, $pass);
     
    274274    function import() {
    275275        $this->id = (int) $_GET['id'];
    276        
     276
    277277        $this->file = get_attached_file($this->id);
    278278        $this->get_authors_from_post();
  • trunk/wp-admin/index.php

    r4484 r4495  
    4747
    4848<ul>
    49 <?php 
     49<?php
    5050if ( $comments ) {
    5151foreach ($comments as $comment) {
    5252    echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
    53     edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 
     53    edit_comment_link(__("Edit"), ' <small>(', ')</small>');
    5454    echo '</li>';
    5555}
     
    8181<?php
    8282if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) :
    83 ?> 
     83?>
    8484<div>
    8585<h3><?php _e('Scheduled Entries:') ?></h3>
     
    9191    echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&amp;post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') ))  . "</li>";
    9292}
    93 ?> 
     93?>
    9494</ul>
    9595</div>
     
    100100<?php
    101101$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
    102 if (0 < $numposts) $numposts = number_format($numposts); 
     102if (0 < $numposts) $numposts = number_format($numposts);
    103103
    104104$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
  • trunk/wp-admin/install-helper.php

    r1429 r4495  
    1010 */
    1111function maybe_create_table($table_name, $create_ddl) {
    12     global $wpdb;
    13     foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
    14         if ($table == $table_name) {
    15             return true;
    16         }
    17     }
    18     //didn't find it try to create it.
    19     $q = $wpdb->query($create_ddl);
    20     // we cannot directly tell that whether this succeeded!
    21     foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
    22         if ($table == $table_name) {
    23             return true;
    24         }
    25     }
    26     return false;
     12    global $wpdb;
     13    foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
     14        if ($table == $table_name) {
     15            return true;
     16        }
     17    }
     18    //didn't find it try to create it.
     19    $q = $wpdb->query($create_ddl);
     20    // we cannot directly tell that whether this succeeded!
     21    foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
     22        if ($table == $table_name) {
     23            return true;
     24        }
     25    }
     26    return false;
    2727}
    2828
     
    3434 */
    3535function maybe_add_column($table_name, $column_name, $create_ddl) {
    36     global $wpdb, $debug;
    37     foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    38         if ($debug) echo("checking $column == $column_name<br />");
    39         if ($column == $column_name) {
    40             return true;
    41         }
    42     }
    43     //didn't find it try to create it.
    44     $q = $wpdb->query($create_ddl);
    45     // we cannot directly tell that whether this succeeded!
    46     foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    47         if ($column == $column_name) {
    48             return true;
    49         }
    50     }
    51     return false;
     36    global $wpdb, $debug;
     37    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
     38        if ($debug) echo("checking $column == $column_name<br />");
     39            if ($column == $column_name) {
     40                return true;
     41            }
     42    }
     43    //didn't find it try to create it.
     44    $q = $wpdb->query($create_ddl);
     45    // we cannot directly tell that whether this succeeded!
     46    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
     47        if ($column == $column_name) {
     48            return true;
     49        }
     50    }
     51    return false;
    5252}
    5353
     
    6060 */
    6161function maybe_drop_column($table_name, $column_name, $drop_ddl) {
    62     global $wpdb;
    63     foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    64         if ($column == $column_name) {
    65             //found it try to drop it.
    66             $q = $wpdb->query($drop_ddl);
    67             // we cannot directly tell that whether this succeeded!
    68             foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    69                 if ($column == $column_name) {
    70                     return false;
    71                 }
    72             }
    73         }
    74     }
    75     // else didn't find it
    76     return true;
     62    global $wpdb;
     63    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
     64        if ($column == $column_name) {
     65            //found it try to drop it.
     66            $q = $wpdb->query($drop_ddl);
     67            // we cannot directly tell that whether this succeeded!
     68            foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
     69                if ($column == $column_name) {
     70                    return false;
     71                }
     72            }
     73        }
     74    }
     75    // else didn't find it
     76    return true;
    7777}
    7878
     
    9393 */
    9494function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
    95     global $wpdb, $debug;
    96     $diffs = 0;
    97     $results = $wpdb->get_results("DESC $table_name");
    98    
    99     foreach ($results as $row ) {
    100         if ($debug > 1) print_r($row);
    101         if ($row->Field == $col_name) {
    102             // got our column, check the params
    103             if ($debug) echo ("checking $row->Type against $col_type\n");
    104             if (($col_type != null) && ($row->Type != $col_type)) {
    105                 ++$diffs;
    106             }
    107             if (($is_null != null) && ($row->Null != $is_null)) {
    108                 ++$diffs;
    109             }
    110             if (($key != null) && ($row->Key  != $key)) {
    111                 ++$diffs;
    112             }
    113             if (($default != null) && ($row->Default != $default)) {
    114                 ++$diffs;
    115             }
    116             if (($extra != null) && ($row->Extra != $extra)) {
    117                 ++$diffs;
    118             }
    119             if ($diffs > 0) {
    120                 if ($debug) echo ("diffs = $diffs returning false\n");
    121                 return false;
    122             }
    123             return true;
    124         } // end if found our column
    125     }
    126     return false;
     95    global $wpdb, $debug;
     96    $diffs = 0;
     97    $results = $wpdb->get_results("DESC $table_name");
     98
     99    foreach ($results as $row ) {
     100        if ($debug > 1) print_r($row);
     101            if ($row->Field == $col_name) {
     102                // got our column, check the params
     103                if ($debug) echo ("checking $row->Type against $col_type\n");
     104                if (($col_type != null) && ($row->Type != $col_type)) {
     105                    ++$diffs;
     106                }
     107                if (($is_null != null) && ($row->Null != $is_null)) {
     108                    ++$diffs;
     109                }
     110                if (($key != null) && ($row->Key  != $key)) {
     111                    ++$diffs;
     112                }
     113                if (($default != null) && ($row->Default != $default)) {
     114                    ++$diffs;
     115                }
     116                if (($extra != null) && ($row->Extra != $extra)) {
     117                    ++$diffs;
     118                }
     119                if ($diffs > 0) {
     120                    if ($debug) echo ("diffs = $diffs returning false\n");
     121                    return false;
     122                }
     123                return true;
     124            } // end if found our column
     125    }
     126    return false;
    127127}
    128    
     128
    129129/*
    130130echo "<p>testing</p>";
    131131echo "<pre>";
    132132
    133 //check_column('wp_links', 'link_description', 'mediumtext'); 
     133//check_column('wp_links', 'link_description', 'mediumtext');
    134134//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
    135135//    echo "ok\n";
     
    139139if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
    140140{
    141     $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
    142     $q = $wpdb->query($ddl);
     141    $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
     142    $q = $wpdb->query($ddl);
    143143}
    144144if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
    145     $res .= $tablename . ' - ok <br />';
     145    $res .= $tablename . ' - ok <br />';
    146146} else {
    147     $res .= 'There was a problem with ' . $tablename . '<br />';
    148     ++$error_count;
     147    $res .= 'There was a problem with ' . $tablename . '<br />';
     148    ++$error_count;
    149149}
    150150echo "</pre>";
  • trunk/wp-admin/link-add.php

    r4480 r4495  
    88
    99wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
    10                        'description', 'visible', 'target', 'category', 'link_id',
    11                        'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
    12                        'notes', 'linkcheck[]'));
     10    'description', 'visible', 'target', 'category', 'link_id',
     11    'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
     12    'notes', 'linkcheck[]'));
    1313
    1414wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
  • trunk/wp-admin/link-manager.php

    r4480 r4495  
    144144        echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
    145145        ?>
    146         <td>
    147         <?php
     146        <td>
     147        <?php
    148148
    149149        $cat_names = array();
     
    158158        ?>
    159159        </td>
    160         <td><?php echo $link->link_rel; ?></td>
    161         <td align='center'><?php echo $visible; ?></td>
     160        <td><?php echo $link->link_rel; ?></td>
     161        <td align='center'><?php echo $visible; ?></td>
    162162<?php
    163163
  • trunk/wp-admin/link-parse-opml.php

    r3295 r4495  
    55// we need to map XML attribute names to our columns
    66$opml_map = array('URL'         => 'link_url',
    7                   'HTMLURL'     => 'link_url',
    8                   'TEXT'        => 'link_name',
    9                   'TITLE'       => 'link_name',
    10                   'TARGET'      => 'link_target',
    11                   'DESCRIPTION' => 'link_description',
    12                   'XMLURL'      => 'link_rss'
     7    'HTMLURL'     => 'link_url',
     8    'TEXT'        => 'link_name',
     9    'TITLE'       => 'link_name',
     10    'TARGET'      => 'link_target',
     11    'DESCRIPTION' => 'link_description',
     12    'XMLURL'      => 'link_rss'
    1313);
    1414
     
    2121function startElement($parser, $tagName, $attrs) {
    2222    global $updated_timestamp, $all_links, $map;
    23     global $names, $urls, $targets, $descriptions, $feeds;
     23    global $names, $urls, $targets, $descriptions, $feeds;
    2424
    2525    if ($tagName == 'OUTLINE') {
    26         foreach (array_keys($map) as $key) {
    27             if (isset($attrs[$key])) {
    28                 $$map[$key] = $attrs[$key];
    29             }
    30         }
     26        foreach (array_keys($map) as $key) {
     27            if (isset($attrs[$key])) {
     28                $$map[$key] = $attrs[$key];
     29            }
     30        }
    3131
    32         //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
     32        //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
    3333
    34         // save the data away.
    35         $names[] = $link_name;
    36         $urls[] = $link_url;
    37         $targets[] = $link_target;
     34        // save the data away.
     35        $names[] = $link_name;
     36        $urls[] = $link_url;
     37        $targets[] = $link_target;
    3838        $feeds[] = $link_rss;
    39         $descriptions[] = $link_description;
    40     } // end if outline
     39        $descriptions[] = $link_description;
     40    } // end if outline
    4141}
    4242
     
    5656
    5757if (!xml_parse($xml_parser, $opml, true)) {
    58     echo(sprintf(__('XML error: %1$s at line %2$s'),
    59                    xml_error_string(xml_get_error_code($xml_parser)),
    60                    xml_get_current_line_number($xml_parser)));
     58    echo(sprintf(__('XML error: %1$s at line %2$s'),
     59    xml_error_string(xml_get_error_code($xml_parser)),
     60    xml_get_current_line_number($xml_parser)));
    6161}
    6262
  • trunk/wp-admin/link.php

    r4468 r4495  
    3030        foreach ($linkcheck as $link_id) {
    3131            $link_id = (int) $link_id;
    32            
     32
    3333            if ( wp_delete_link($link_id) )
    3434                $deleted++;
  • trunk/wp-admin/menu-header.php

    r4481 r4495  
    3535?>
    3636<ul id="submenu">
    37 <?php 
    38 foreach ($submenu["$parent_file"] as $item) : 
     37<?php
     38foreach ($submenu["$parent_file"] as $item) :
    3939     if ( !current_user_can($item[1]) )
    4040         continue;
     
    6666<?php
    6767
    68 endif; 
     68endif;
    6969
    7070do_action('admin_notices');
  • trunk/wp-admin/menu.php

    r4480 r4495  
    8484        }
    8585    }
    86    
     86
    8787    if ( empty($submenu[$parent]) )
    8888        unset($submenu[$parent]);
     
    9191// Loop over the top-level menu.
    9292// Menus for which the original parent is not acessible due to lack of privs will have the next
    93 // submenu in line be assigned as the new menu parent. 
     93// submenu in line be assigned as the new menu parent.
    9494foreach ( $menu as $id => $data ) {
    9595    if ( empty($submenu[$data[2]]) )
  • trunk/wp-admin/moderation.php

    r4480 r4495  
    3232    if ($feelinglucky && 'later' == $value)
    3333        $value = 'delete';
    34         switch($value) {
     34        switch($value) {
    3535            case 'later':
    3636                // do nothing with that comment
     
    4242                ++$item_deleted;
    4343                break;
    44             case 'spam':
    45                 wp_set_comment_status($key, 'spam');
    46                 ++$item_spam;
    47                 break;
     44            case 'spam':
     45                wp_set_comment_status($key, 'spam');
     46                ++$item_spam;
     47                break;
    4848            case 'approve':
    4949                wp_set_comment_status($key, 'approve');
     
    5353                ++$item_approved;
    5454                break;
    55         }
     55        }
    5656    }
    5757
     
    8686        }
    8787    }
    88     if ($spam) {
    89         if ('1' == $spam) {
     88    if ($spam) {
     89        if ('1' == $spam) {
    9090            echo __("1 comment marked as spam") . " <br/>\n";
    91         } else {
    92             echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
    93         }
    94     }
     91        } else {
     92            echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
     93        }
     94    }
    9595    if ($ignored) {
    9696        if ('1' == $ignored) {
     
    152152    </li>
    153153<?php
    154     }
    155 ?>
    156     </ol>
     154    }
     155?>
     156    </ol>
    157157
    158158<div id="ajax-response"></div>
    159159
    160     <p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments &raquo;') ?>" /></p>
     160<p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments &raquo;') ?>" /></p>
    161161<script type="text/javascript">
    162162// <![CDATA[
     
    198198    </p>
    199199</noscript>
    200     </form>
     200</form>
    201201<?php
    202202} else {
    203     // nothing to approve
     203    // nothing to approve
    204204    echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
    205205}
  • trunk/wp-admin/options-misc.php

    r4480 r4495  
    88
    99?>
    10  
    11 <div class="wrap"> 
    12 <h2><?php _e('Miscellaneous Options') ?></h2> 
     10
     11<div class="wrap">
     12<h2><?php _e('Miscellaneous Options') ?></h2>
    1313<form method="post" action="options.php">
    1414<?php wp_nonce_field('update-options') ?>
     
    4444<p class="submit">
    4545<input type="hidden" name="action" value="update" />
    46 <input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" /> 
     46<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
    4747<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
    4848</p>
    49 </form> 
     49</form>
    5050</div>
    5151
  • trunk/wp-admin/options-permalink.php

    r4480 r4495  
    145145checked="checked"
    146146<?php } ?>
    147  /> 
     147 />
    148148<?php _e('Custom, specify below'); ?>
    149149</label>
  • trunk/wp-admin/options-privacy.php

    r4480 r4495  
    77include('./admin-header.php');
    88?>
    9  
     9
    1010<div class="wrap">
    1111<h2><?php _e('Privacy Options') ?></h2>
    12 <form method="post" action="options.php"> 
     12<form method="post" action="options.php">
    1313<?php wp_nonce_field('update-options') ?>
    14 <table class="optiontable"> 
    15 <tr valign="top"> 
    16 <th scope="row"><?php _e('Blog visibility:') ?> </th> 
     14<table class="optiontable">
     15<tr valign="top">
     16<th scope="row"><?php _e('Blog visibility:') ?> </th>
    1717<td>
    1818<p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
     
    2121<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
    2222<?php do_action('blog_privacy_selector'); ?>
    23 </td> 
     23</td>
    2424</tr>
    25 </table> 
     25</table>
    2626
    2727<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
    28 <input type="hidden" name="action" value="update" /> 
    29 <input type="hidden" name="page_options" value="blog_public" /> 
     28<input type="hidden" name="action" value="update" />
     29<input type="hidden" name="page_options" value="blog_public" />
    3030</p>
    3131</form>
    3232
    33 </div> 
     33</div>
    3434
    3535<?php include('./admin-footer.php') ?>
  • trunk/wp-admin/options-writing.php

    r4480 r4495  
    6666<th scope="row"><?php _e('Mail server:') ?></th>
    6767<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" />
    68 <label for="mailserver_port"><?php _e('Port:') ?></label> 
     68<label for="mailserver_port"><?php _e('Port:') ?></label>
    6969<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" />
    7070</td>
     
    114114
    115115<p class="submit">
    116 <input type="hidden" name="action" value="update" /> 
    117 <input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" /> 
    118 <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /> 
     116<input type="hidden" name="action" value="update" />
     117<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" />
     118<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
    119119</p>
    120 </form> 
    121 </div> 
     120</form>
     121</div>
    122122
    123123<?php include('./admin-footer.php') ?>
  • trunk/wp-admin/plugin-editor.php

    r4480 r4495  
    6262 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
    6363<?php endif; ?>
    64  <div class="wrap"> 
    65   <?php
     64 <div class="wrap">
     65    <?php
    6666    if (is_writeable($real_file)) {
    6767        echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
     
    7676if ($plugin_files) :
    7777?>
    78   <ul>
    79 <?php foreach($plugin_files as $plugin_file) : ?>
     78    <ul>
     79    <?php foreach($plugin_files as $plugin_file) : ?>
    8080         <li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
    81 <?php endforeach; ?>
    82   </ul>
     81    <?php endforeach; ?>
     82    </ul>
    8383<?php endif; ?>
    8484</div>
    85     <?php   if (!$error) { ?>
    86   <form name="template" id="template" action="plugin-editor.php" method="post">
    87   <?php wp_nonce_field('edit-plugin_' . $file) ?>
    88          <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
    89      <input type="hidden" name="action" value="update" />
    90      <input type="hidden" name="file" value="<?php echo $file ?>" />
     85<?php   if (!$error) { ?>
     86    <form name="template" id="template" action="plugin-editor.php" method="post">
     87    <?php wp_nonce_field('edit-plugin_' . $file) ?>
     88        <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
     89        <input type="hidden" name="action" value="update" />
     90        <input type="hidden" name="file" value="<?php echo $file ?>" />
    9191        </div>
    9292<?php if ( is_writeable($real_file) ) : ?>
    93      <p class="submit">
     93    <p class="submit">
     94    <?php
     95        echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
     96    ?>
     97    </p>
     98<?php else : ?>
     99    <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
     100<?php endif; ?>
     101 </form>
    94102<?php
    95     echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
    96 ?>
    97 </p>
    98 <?php else : ?>
    99 <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
    100 <?php endif; ?>
    101    </form>
    102   <?php
    103103    } else {
    104104        echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
    105105    }
    106     ?>
     106?>
    107107<div class="clear"> &nbsp; </div>
    108 </div> 
     108</div>
    109109<?php
    110110break;
    111111}
    112112
    113 include("admin-footer.php") ?> 
     113include("admin-footer.php") ?>
  • trunk/wp-admin/post.php

    r4349 r4495  
    1616    $submenu_file = 'post-new.php';
    1717    check_admin_referer('add-post');
    18    
     18
    1919    $post_ID = 'post' == $action ? write_post() : edit_post();
    2020
     
    9090    $post_ID = (int) $_POST['post_ID'];
    9191    check_admin_referer('update-post_' . $post_ID);
    92    
     92
    9393    $post_ID = edit_post();
    9494
  • trunk/wp-admin/profile.php

    r4480 r4495  
    1 <?php 
     1<?php
    22require_once('admin.php');
    33
     
    122122<br clear="all" />
    123123
    124   <table width="99%"  border="0" cellspacing="2" cellpadding="3" class="editform">
    125     <?php
    126     if(count($profileuser->caps) > count($profileuser->roles)):
    127     ?>
    128     <tr>
    129       <th scope="row"><?php _e('Additional Capabilities:') ?></th>
    130       <td><?php
     124    <table width="99%"  border="0" cellspacing="2" cellpadding="3" class="editform">
     125        <?php
     126        if(count($profileuser->caps) > count($profileuser->roles)):
     127        ?>
     128        <tr>
     129            <th scope="row"><?php _e('Additional Capabilities:') ?></th>
     130            <td><?php
    131131            $output = '';
    132132            foreach($profileuser->caps as $cap => $value) {
  • trunk/wp-admin/setup-config.php

    r3673 r4495  
    33
    44if (!file_exists('../wp-config-sample.php'))
    5     die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
     5    die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
    66
    77$configFile = file('../wp-config-sample.php');
     
    8383switch($step) {
    8484    case 0:
    85 ?> 
     85?>
    8686
    87 <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> 
    88 <ol> 
    89   <li>Database name</li>
    90   <li>Database username</li>
    91   <li>Database password</li>
    92   <li>Database host</li>
    93   <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
    94 </ol> 
     87<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
     88<ol>
     89    <li>Database name</li>
     90    <li>Database username</li>
     91    <li>Database password</li>
     92    <li>Database host</li>
     93    <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
     94</ol>
    9595<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
    9696<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready, <a href="setup-config.php?step=1">let&#8217;s go</a>! </p>
     
    9999
    100100    case 1:
    101     ?> 
    102 </p> 
     101    ?>
     102</p>
    103103<form method="post" action="setup-config.php?step=2">
    104   <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
    105   <table>
    106     <tr>
    107       <th scope="row">Database Name</th>
    108       <td><input name="dbname" type="text" size="25" value="wordpress" /></td>
    109       <td>The name of the database you want to run WP in. </td>
    110     </tr>
    111     <tr>
    112       <th scope="row">User Name</th>
    113       <td><input name="uname" type="text" size="25" value="username" /></td>
    114       <td>Your MySQL username</td>
    115     </tr>
    116     <tr>
    117       <th scope="row">Password</th>
    118       <td><input name="pwd" type="text" size="25" value="password" /></td>
    119       <td>...and MySQL password.</td>
    120     </tr>
    121     <tr>
    122       <th scope="row">Database Host</th>
    123       <td><input name="dbhost" type="text" size="25" value="localhost" /></td>
    124       <td>99% chance you won't need to change this value.</td>
    125     </tr>
    126     <tr>
    127       <th scope="row">Table Prefix</th>
    128       <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
    129       <td>If you want to run multiple WordPress installations in a single database, change this.</td>
    130     </tr>
    131   </table>
    132   <h2 class="step">
    133   <input name="submit" type="submit" value="Submit" />
    134   </h2>
    135 </form> 
     104    <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
     105    <table>
     106        <tr>
     107            <th scope="row">Database Name</th>
     108            <td><input name="dbname" type="text" size="25" value="wordpress" /></td>
     109            <td>The name of the database you want to run WP in. </td>
     110        </tr>
     111        <tr>
     112            <th scope="row">User Name</th>
     113            <td><input name="uname" type="text" size="25" value="username" /></td>
     114            <td>Your MySQL username</td>
     115        </tr>
     116        <tr>
     117            <th scope="row">Password</th>
     118            <td><input name="pwd" type="text" size="25" value="password" /></td>
     119            <td>...and MySQL password.</td>
     120        </tr>
     121        <tr>
     122            <th scope="row">Database Host</th>
     123            <td><input name="dbhost" type="text" size="25" value="localhost" /></td>
     124            <td>99% chance you won't need to change this value.</td>
     125        </tr>
     126        <tr>
     127            <th scope="row">Table Prefix</th>
     128            <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
     129            <td>If you want to run multiple WordPress installations in a single database, change this.</td>
     130        </tr>
     131    </table>
     132    <h2 class="step">
     133    <input name="submit" type="submit" value="Submit" />
     134    </h2>
     135</form>
    136136<?php
    137137    break;
     
    139139    case 2:
    140140    $dbname  = trim($_POST['dbname']);
    141     $uname   = trim($_POST['uname']);
    142     $passwrd = trim($_POST['pwd']);
    143     $dbhost  = trim($_POST['dbhost']);
     141    $uname   = trim($_POST['uname']);
     142    $passwrd = trim($_POST['pwd']);
     143    $dbhost  = trim($_POST['dbhost']);
    144144    $prefix  = trim($_POST['prefix']);
    145145    if (empty($prefix)) $prefix = 'wp_';
    146146
    147     // Test the db connection.
    148     define('DB_NAME', $dbname);
    149     define('DB_USER', $uname);
    150     define('DB_PASSWORD', $passwrd);
    151     define('DB_HOST', $dbhost);
     147    // Test the db connection.
     148    define('DB_NAME', $dbname);
     149    define('DB_USER', $uname);
     150    define('DB_PASSWORD', $passwrd);
     151    define('DB_HOST', $dbhost);
    152152
    153     // We'll fail here if the values are no good.
    154     require_once('../wp-includes/wp-db.php');
     153    // We'll fail here if the values are no good.
     154    require_once('../wp-includes/wp-db.php');
    155155    $handle = fopen('../wp-config.php', 'w');
    156156
    157     foreach ($configFile as $line_num => $line) {
    158         switch (substr($line,0,16)) {
    159             case "define('DB_NAME'":
    160                 fwrite($handle, str_replace("wordpress", $dbname, $line));
    161                 break;
    162             case "define('DB_USER'":
    163                 fwrite($handle, str_replace("'username'", "'$uname'", $line));
    164                 break;
    165             case "define('DB_PASSW":
    166                 fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
    167                 break;
    168             case "define('DB_HOST'":
    169                 fwrite($handle, str_replace("localhost", $dbhost, $line));
    170                 break;
     157    foreach ($configFile as $line_num => $line) {
     158        switch (substr($line,0,16)) {
     159            case "define('DB_NAME'":
     160                fwrite($handle, str_replace("wordpress", $dbname, $line));
     161                break;
     162            case "define('DB_USER'":
     163                fwrite($handle, str_replace("'username'", "'$uname'", $line));
     164                break;
     165            case "define('DB_PASSW":
     166                fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
     167                break;
     168            case "define('DB_HOST'":
     169                fwrite($handle, str_replace("localhost", $dbhost, $line));
     170                break;
    171171            case '$table_prefix  =':
    172172                fwrite($handle, str_replace('wp_', $prefix, $line));
    173173                break;
    174             default:
    175                 fwrite($handle, $line);
    176         }
    177     }
    178     fclose($handle);
     174            default:
     175                fwrite($handle, $line);
     176        }
     177    }
     178    fclose($handle);
    179179    chmod('../wp-config.php', 0666);
    180 ?> 
    181 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> 
     180?>
     181<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>
    182182<?php
    183183    break;
  • trunk/wp-admin/sidebar.php

    r4006 r4495  
    3535}
    3636.sidebar-categories {
    37     display: block;
    38     height: 6.6em;
    39     overflow: auto;
    40     background-color: #f4f4f4;
     37    display: block;
     38    height: 6.6em;
     39    overflow: auto;
     40    background-color: #f4f4f4;
    4141}
    4242.sidebar-categories label {
    4343    font-size: 10px;
    44     display: block;
    45     width: 90%;
     44    display: block;
     45    width: 90%;
    4646}
    4747</style>
     
    6666</p>
    6767<p>
    68     <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
     68    <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
    6969<?php if ( current_user_can('publish_posts') ) : ?>
    70     <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
     70    <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
    7171<?php endif; ?>
    7272</p>
  • trunk/wp-admin/templates.php

    r4480 r4495  
    8383    <?php endif; ?>
    8484<?php endif; ?>
    85  <div class="wrap"> 
     85 <div class="wrap">
    8686<?php
    8787if (is_writeable($real_file)) {
     
    9292?>
    9393<div id="templateside">
    94 <?php 
    95 if ( $recents ) : 
     94<?php
     95if ( $recents ) :
    9696?>
    9797<h3><?php _e('Recent'); ?></h3>
     
    111111         $common_files[] = $old_file;
    112112 } ?>
    113   <ul>
    114      <?php foreach ($common_files as $common_file) : ?>
    115       <li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
    116      <?php endforeach; ?>
    117   </ul>
     113<ul>
     114    <?php foreach ($common_files as $common_file) : ?>
     115        <li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
     116    <?php endforeach; ?>
     117</ul>
    118118</div>
    119119<?php if (!$error) { ?>
    120   <form name="template" id="template" action="templates.php" method="post">
    121   <?php wp_nonce_field('edit-file_' . $file) ?>
    122      <div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
    123      <input type="hidden" name="action" value="update" />
    124      <input type="hidden" name="file" value="<?php echo $file ?>" />
    125 </div>
     120    <form name="template" id="template" action="templates.php" method="post">
     121    <?php wp_nonce_field('edit-file_' . $file) ?>
     122        <div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
     123        <input type="hidden" name="action" value="update" />
     124        <input type="hidden" name="file" value="<?php echo $file ?>" />
     125        </div>
    126126<?php if ( is_writeable($real_file) ) : ?>
    127      <p class="submit">
     127    <p class="submit">
    128128<?php
    129129    echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
     
    133133<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
    134134<?php endif; ?>
    135    </form>
    136   <?php
     135    </form>
     136    <?php
    137137    } else {
    138138        echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
     
    144144<h2><?php _e('Other Files') ?></h2>
    145145
    146   <p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
    147   <form name="file" action="templates.php" method="get">
    148     <input type="text" name="file" />
    149     <input type="submit" name="submit"  value="<?php _e('Edit file &raquo;') ?>" />
    150   </form>
     146    <p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
     147    <form name="file" action="templates.php" method="get">
     148        <input type="text" name="file" />
     149        <input type="submit" name="submit"  value="<?php _e('Edit file &raquo;') ?>" />
     150    </form>
    151151
    152   <p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don&#8217;t have access to a text editor or FTP client.') ?></p>
    153 </div> 
     152    <p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don&#8217;t have access to a text editor or FTP client.') ?></p>
     153</div>
    154154<?php
    155155
  • trunk/wp-admin/theme-editor.php

    r4480 r4495  
    8181<?php endif; ?>
    8282 <div class="wrap">
    83   <form name="theme" action="theme-editor.php" method="post">
     83    <form name="theme" action="theme-editor.php" method="post">
    8484        <?php _e('Select theme to edit:') ?>
    8585        <select name="theme" id="theme">
     
    107107    ?>
    108108    <div id="templateside">
    109   <h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
     109    <h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
    110110
    111111<?php
    112112if ($allowed_files) :
    113113?>
    114   <ul>
     114    <ul>
    115115<?php foreach($allowed_files as $allowed_file) : ?>
    116116         <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
    117117<?php endforeach; ?>
    118   </ul>
     118    </ul>
    119119<?php endif; ?>
    120 </div> 
     120</div>
    121121    <?php
    122122    if (!$error) {
    123     ?> 
    124   <form name="template" id="template" action="theme-editor.php" method="post">
    125   <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
    126          <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> 
    127      <input type="hidden" name="action" value="update" />
    128      <input type="hidden" name="file" value="<?php echo $file ?>" />
    129     <input type="hidden" name="theme" value="<?php echo $theme ?>" />
     123    ?>
     124    <form name="template" id="template" action="theme-editor.php" method="post">
     125    <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
     126         <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
     127         <input type="hidden" name="action" value="update" />
     128         <input type="hidden" name="file" value="<?php echo $file ?>" />
     129        <input type="hidden" name="theme" value="<?php echo $theme ?>" />
    130130         </div>
    131131<?php if ( is_writeable($real_file) ) : ?>
    132      <p class="submit">
     132    <p class="submit">
    133133<?php
    134134    echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
     
    138138<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
    139139<?php endif; ?>
    140    </form>
    141   <?php
     140    </form>
     141    <?php
    142142    } else {
    143143        echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
     
    145145    ?>
    146146<div class="clear"> &nbsp; </div>
    147 </div> 
     147</div>
    148148<?php
    149149break;
    150150}
    151151
    152 include("admin-footer.php") ?> 
     152include("admin-footer.php") ?>
  • trunk/wp-admin/themes.php

    r4480 r4495  
    113113        $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
    114114        echo "
    115       <tr $theme>
    116         <td>$title</td>
    117         <td>$description</td>
    118       </tr>";
     115        <tr $theme>
     116            <td>$title</td>
     117            <td>$description</td>
     118        </tr>";
    119119    }
    120120?>
  • trunk/wp-admin/update-links.php

    r4144 r4495  
    2929        $response .= fgets($fs, 1160); // One TCP-IP packet
    3030    fclose($fs);
    31    
     31
    3232    $response = explode("\r\n\r\n", $response, 2);
    3333    $body = trim( $response[1] );
    3434    $body = str_replace(array("\r\n", "\r"), "\n", $body);
    35    
     35
    3636    $returns = explode("\n", $body);
    37    
     37
    3838    foreach ($returns as $return) :
    3939        $time = $wpdb->escape( substr($return, 0, 19) );
  • trunk/wp-admin/upgrade-functions.php

    r4366 r4495  
    121121"), $blog_url, $name, $password);
    122122
    123     @wp_mail($email, __('New WordPress Blog'), $message, $message_headers); 
     123    @wp_mail($email, __('New WordPress Blog'), $message, $message_headers);
    124124}
    125125endif;
     
    138138    make_db_current_silent();
    139139    upgrade_all();
    140     wp_cache_flush();   
     140    wp_cache_flush();
    141141}
    142142endif;
     
    188188    if ($posts) {
    189189        foreach($posts as $post) {
    190             if ('' == $post->post_name) { 
     190            if ('' == $post->post_name) {
    191191                $newtitle = sanitize_title($post->post_title);
    192192                $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
     
    197197    $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
    198198    foreach ($categories as $category) {
    199         if ('' == $category->category_nicename) { 
     199        if ('' == $category->category_nicename) {
    200200            $newtitle = sanitize_title($category->cat_name);
    201201            $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
     
    252252    global $wpdb;
    253253
    254     // Set user_nicename.
     254    // Set user_nicename.
    255255    $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
    256     foreach ($users as $user) {
    257         if ('' == $user->user_nicename) {
    258             $newname = sanitize_title($user->user_nickname);
    259             $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
    260         }
    261     }
     256    foreach ($users as $user) {
     257        if ('' == $user->user_nicename) {
     258            $newname = sanitize_title($user->user_nickname);
     259            $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
     260        }
     261    }
    262262
    263263    $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
    264264    foreach ($users as $row) {
    265265        if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
    266                $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
     266            $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
    267267        }
    268268    }
     
    306306
    307307function upgrade_130() {
    308     global $wpdb;
    309 
    310     // Remove extraneous backslashes.
     308    global $wpdb;
     309
     310    // Remove extraneous backslashes.
    311311    $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
    312312    if ($posts) {
    313313        foreach($posts as $post) {
    314             $post_content = addslashes(deslash($post->post_content));
    315             $post_title = addslashes(deslash($post->post_title));
    316             $post_excerpt = addslashes(deslash($post->post_excerpt));
     314            $post_content = addslashes(deslash($post->post_content));
     315            $post_title = addslashes(deslash($post->post_title));
     316            $post_excerpt = addslashes(deslash($post->post_excerpt));
    317317            if ( empty($post->guid) )
    318318                $guid = get_permalink($post->ID);
     
    320320                $guid = $post->guid;
    321321
    322             $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
    323         }
    324     }
    325 
    326     // Remove extraneous backslashes.
     322            $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
     323        }
     324    }
     325
     326    // Remove extraneous backslashes.
    327327    $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
    328328    if ($comments) {
    329329        foreach($comments as $comment) {
    330             $comment_content = addslashes(deslash($comment->comment_content));
    331             $comment_author = addslashes(deslash($comment->comment_author));
    332             $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
    333         }
    334     }
    335 
    336     // Remove extraneous backslashes.
     330            $comment_content = addslashes(deslash($comment->comment_content));
     331            $comment_author = addslashes(deslash($comment->comment_author));
     332            $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
     333        }
     334    }
     335
     336    // Remove extraneous backslashes.
    337337    $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
    338338    if ($links) {
    339339        foreach($links as $link) {
    340             $link_name = addslashes(deslash($link->link_name));
    341             $link_description = addslashes(deslash($link->link_description));
    342             $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
    343         }
    344     }
    345 
    346     // The "paged" option for what_to_show is no more.
    347     if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
    348         $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
    349     }
    350 
    351         $active_plugins = __get_option('active_plugins');
    352 
    353         // If plugins are not stored in an array, they're stored in the old
    354         // newline separated format.  Convert to new format.
    355         if ( !is_array( $active_plugins ) ) {
    356             $active_plugins = explode("\n", trim($active_plugins));
    357             update_option('active_plugins', $active_plugins);
    358         }
     340            $link_name = addslashes(deslash($link->link_name));
     341            $link_description = addslashes(deslash($link->link_description));
     342            $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
     343        }
     344    }
     345
     346    // The "paged" option for what_to_show is no more.
     347    if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
     348        $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
     349    }
     350
     351    $active_plugins = __get_option('active_plugins');
     352
     353    // If plugins are not stored in an array, they're stored in the old
     354    // newline separated format.  Convert to new format.
     355    if ( !is_array( $active_plugins ) ) {
     356        $active_plugins = explode("\n", trim($active_plugins));
     357        update_option('active_plugins', $active_plugins);
     358    }
    359359
    360360    // Obsolete tables
     
    500500        $now = gmdate('Y-m-d H:i:59');
    501501        $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
    502        
     502
    503503        $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
    504504        if ( !empty($posts) )
     
    509509        // Create categories for link categories if a category with the same
    510510        // name doesn't exist.  Create a map of link cat IDs to cat IDs.
    511         $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories"); 
     511        $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    512512        foreach ( $link_cats as $link_cat) {
    513513            if ( $cat_id = category_exists($link_cat->cat_name) ) {
     
    528528                $wpdb->query("INSERT INTO $wpdb->link2cat (link_id, category_id)
    529529                    VALUES ('$link->link_id', '$link_cat')");
    530             }           
    531         }
    532        
     530            }
     531        }
     532
    533533        // Set default to the last category we grabbed during the upgrade loop.
    534534        update_option('default_link_category', $default_link_cat);
     
    549549// General
    550550function maybe_create_table($table_name, $create_ddl) {
    551     global $wpdb;
    552     foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
    553         if ($table == $table_name) {
    554             return true;
    555         }
    556     }
    557     //didn't find it try to create it.
    558     $q = $wpdb->query($create_ddl);
    559     // we cannot directly tell that whether this succeeded!
    560     foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
    561         if ($table == $table_name) {
    562             return true;
    563         }
    564     }
    565     return false;
     551    global $wpdb;
     552    foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
     553        if ($table == $table_name) {
     554            return true;
     555        }
     556    }
     557    //didn't find it try to create it.
     558    $q = $wpdb->query($create_ddl);
     559    // we cannot directly tell that whether this succeeded!
     560    foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
     561        if ($table == $table_name) {
     562            return true;
     563        }
     564    }
     565    return false;
    566566}
    567567
     
    592592 */
    593593function maybe_add_column($table_name, $column_name, $create_ddl) {
    594     global $wpdb, $debug;
    595     foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
    596         if ($debug) echo("checking $column == $column_name<br />");
    597         if ($column == $column_name) {
    598             return true;
    599         }
    600     }
    601     //didn't find it try to create it.
    602     $q = $wpdb->query($create_ddl);
    603     // we cannot directly tell that whether this succeeded!
    604     foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
    605         if ($column == $column_name) {
    606             return true;
    607         }
    608     }
    609     return false;
     594    global $wpdb, $debug;
     595    foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
     596        if ($debug) echo("checking $column == $column_name<br />");
     597        if ($column == $column_name) {
     598            return true;
     599        }
     600    }
     601    //didn't find it try to create it.
     602    $q = $wpdb->query($create_ddl);
     603    // we cannot directly tell that whether this succeeded!
     604    foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
     605        if ($column == $column_name) {
     606            return true;
     607        }
     608    }
     609    return false;
    610610}
    611611
     
    616616    if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
    617617        foreach ($options as $option) {
    618             // "When trying to design a foolproof system, 
     618            // "When trying to design a foolproof system,
    619619            //  never underestimate the ingenuity of the fools :)" -- Dougal
    620620            if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
     
    647647
    648648function deslash($content) {
    649     // Note: \\\ inside a regex denotes a single backslash.
    650 
    651     // Replace one or more backslashes followed by a single quote with
    652     // a single quote.
    653     $content = preg_replace("/\\\+'/", "'", $content);
    654 
    655     // Replace one or more backslashes followed by a double quote with
    656     // a double quote.
    657     $content = preg_replace('/\\\+"/', '"', $content);
    658 
    659     // Replace one or more backslashes with one backslash.
    660     $content = preg_replace("/\\\+/", "\\", $content);
    661 
    662     return $content;
     649    // Note: \\\ inside a regex denotes a single backslash.
     650
     651    // Replace one or more backslashes followed by a single quote with
     652    // a single quote.
     653    $content = preg_replace("/\\\+'/", "'", $content);
     654
     655    // Replace one or more backslashes followed by a double quote with
     656    // a double quote.
     657    $content = preg_replace('/\\\+"/', '"', $content);
     658
     659    // Replace one or more backslashes with one backslash.
     660    $content = preg_replace("/\\\+/", "\\", $content);
     661
     662    return $content;
    663663}
    664664
     
    827827                            }
    828828                        }
    829                         // Add the column list to the index create string 
     829                        // Add the column list to the index create string
    830830                        $index_string .= ' ('.$index_columns.')';
    831831
  • trunk/wp-admin/upgrade-schema.php

    r4334 r4495  
    224224        add_option('upload_path', 'wp-content/uploads');
    225225    }
    226    
     226
    227227    // 2.0.3
    228228    add_option('secret', md5(uniqid(microtime())));
  • trunk/wp-admin/upgrade.php

    r4259 r4495  
    5757        break;
    5858}
    59 ?> 
     59?>
    6060</body>
    6161</html>
  • trunk/wp-admin/user-edit.php

    r4480 r4495  
    187187
    188188<br clear="all" />
    189   <table width="99%"  border="0" cellspacing="2" cellpadding="3" class="editform">
    190     <?php
    191     if(count($profileuser->caps) > count($profileuser->roles)):
    192     ?>
    193     <tr>
    194       <th scope="row"><?php _e('Additional Capabilities:') ?></th>
    195       <td><?php
     189    <table width="99%"  border="0" cellspacing="2" cellpadding="3" class="editform">
     190        <?php
     191        if(count($profileuser->caps) > count($profileuser->roles)):
     192        ?>
     193        <tr>
     194            <th scope="row"><?php _e('Additional Capabilities:') ?></th>
     195            <td><?php
    196196            $output = '';
    197197            foreach($profileuser->caps as $cap => $value) {
     
    203203            echo $output;
    204204            ?></td>
    205     </tr>
    206     <?php
    207     endif;
    208     ?>
    209   </table>
     205        </tr>
     206        <?php
     207        endif;
     208        ?>
     209    </table>
    210210<p class="submit">
    211211    <input type="hidden" name="action" value="update" />
    212212    <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
    213     <input type="submit" value="<?php _e('Update User &raquo;') ?>" name="submit" />
     213    <input type="submit" value="<?php _e('Update User &raquo;') ?>" name="submit" />
    214214 </p>
    215215</form>
  • trunk/wp-admin/wp-admin.css

    r4466 r4495  
    284284
    285285.commentlist li {
    286     border-bottom: 1px solid #ccc; 
     286    border-bottom: 1px solid #ccc;
    287287    padding: 1em 1em .2em;
    288288    margin: 0;
     
    955955
    956956/* A handy div class for hiding controls.
    957    Some browsers will disable them when you
    958    set display:none; */
     957Some browsers will disable them when you
     958set display:none; */
    959959.zerosize {
    960960    height: 0px;
     
    996996
    997997/****************************************************************
    998   avoid padding, margins or borders on dbx-box,
    999   to reduce visual discrepancies between it and the clone. 
    1000   overall, dbx-box is best left as visually unstyled as possible
     998avoid padding, margins or borders on dbx-box,
     999to reduce visual discrepancies between it and the clone.
     1000overall, dbx-box is best left as visually unstyled as possible
    10011001*****************************************************************/
    10021002.dbx-box {
  • trunk/wp-admin/xfn.js

    r3517 r4495  
    1111
    1212function meChecked() {
    13   var undefined;
    14   var eMe = document.getElementById('me');
    15   if (eMe == undefined) return false;
    16   else return eMe.checked;
     13    var undefined;
     14    var eMe = document.getElementById('me');
     15    if (eMe == undefined) return false;
     16    else return eMe.checked;
    1717}
    1818
  • trunk/wp-atom.php

    r4465 r4495  
    1212<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    1313<feed version="0.3"
    14   xmlns="http://purl.org/atom/ns#"
    15   xmlns:dc="http://purl.org/dc/elements/1.1/"
    16   xml:lang="<?php echo get_option('rss_language'); ?>"
    17   <?php do_action('atom_ns'); ?>
    18   >
     14    xmlns="http://purl.org/atom/ns#"
     15    xmlns:dc="http://purl.org/dc/elements/1.1/"
     16    xml:lang="<?php echo get_option('rss_language'); ?>"
     17    <?php do_action('atom_ns'); ?>
     18>
    1919    <title><?php bloginfo_rss('name') ?></title>
    2020    <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
     
    2626    <?php while (have_posts()) : the_post(); ?>
    2727    <entry>
    28         <author>
     28        <author>
    2929            <name><?php the_author() ?></name>
    3030        </author>
     
    3434        <modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified>
    3535        <issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued>
    36         <?php the_category_rss('rdf') ?> 
     36        <?php the_category_rss('rdf') ?>
    3737        <summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
    3838<?php if ( !get_option('rss_use_excerpt') ) : ?>
  • trunk/wp-commentsrss2.php

    r4462 r4495  
    1 <?php 
     1<?php
    22
    33if (empty($wp)) {
     
    6565        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
    6666        <guid><?php comment_link() ?></guid>
    67             <?php 
     67            <?php
    6868            if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
    6969            ?>
     
    7575        <description><?php comment_text_rss() ?></description>
    7676        <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
    77             <?php 
    78             } // close check for password 
     77            <?php
     78            } // close check for password
    7979            ?>
    8080    </item>
    81 <?php 
    82             } 
     81<?php
     82            }
    8383        }
    8484    }
  • trunk/wp-content/themes/classic/comments-popup.php

    r4465 r4495  
    1 <?php 
     1<?php
    22/* Don't remove these lines. */
    33add_filter('comment_text', 'popuplinks');
     
    9898
    9999<!-- // this is just the end of the motor - don't touch that line either :) -->
    100 <?php //} ?> 
     100<?php //} ?>
    101101<p class="credit"><?php timer_stop(1); ?> <?php echo sprintf(__("<cite>Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>Wordpress</strong></a></cite>"),__("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></p>
    102102<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
  • trunk/wp-content/themes/classic/comments.php

    r4133 r4495  
    33<?php return; endif; ?>
    44
    5 <h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?> 
     5<h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
    66<?php if ( comments_open() ) : ?>
    77    <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
     
    2626<?php endif; ?>
    2727
    28 <p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?> 
     28<p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
    2929<?php if ( pings_open() ) : ?>
    3030    <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a>
  • trunk/wp-content/themes/classic/header.php

    r3517 r4495  
    1818
    1919    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    20     <?php wp_get_archives('type=monthly&format=link'); ?>
     20    <?php wp_get_archives('type=monthly&format=link'); ?>
    2121    <?php //comments_popup_script(); // off by default ?>
    2222    <?php wp_head(); ?>
  • trunk/wp-content/themes/classic/index.php

    r3517 r4495  
    1 <?php 
     1<?php
    22get_header();
    33?>
     
    1616
    1717    <div class="feedback">
    18             <?php wp_link_pages(); ?>
    19             <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
     18        <?php wp_link_pages(); ?>
     19        <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    2020    </div>
    2121
  • trunk/wp-content/themes/classic/sidebar.php

    r4152 r4495  
    1717 </li>
    1818 <li id="archives"><?php _e('Archives:'); ?>
    19     <ul>
     19    <ul>
    2020     <?php wp_get_archives('type=monthly'); ?>
    21     </ul>
     21    </ul>
    2222 </li>
    2323 <li id="meta"><?php _e('Meta:'); ?>
    24     <ul>
     24    <ul>
    2525        <?php wp_register(); ?>
    2626        <li><?php wp_loginout(); ?></li>
  • trunk/wp-content/themes/default/archive.php

    r4166 r4495  
    4141                </div>
    4242
    43                 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> 
     43                <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
    4444
    4545            </div>
  • trunk/wp-content/themes/default/archives.php

    r3706 r4495  
    1212
    1313<h2>Archives by Month:</h2>
    14   <ul>
    15     <?php wp_get_archives('type=monthly'); ?>
    16   </ul>
     14    <ul>
     15        <?php wp_get_archives('type=monthly'); ?>
     16    </ul>
    1717
    1818<h2>Archives by Subject:</h2>
    19   <ul>
    20     <?php wp_list_categories(); ?>
    21   </ul>
     19    <ul>
     20        <?php wp_list_categories(); ?>
     21    </ul>
    2222
    2323</div>
  • trunk/wp-content/themes/default/comments-popup.php

    r4465 r4495  
    1 <?php 
     1<?php
    22/* Don't remove these lines. */
    33add_filter('comment_text', 'popuplinks');
     
    9898
    9999<!-- // this is just the end of the motor - don't touch that line either :) -->
    100 <?php //} ?> 
     100<?php //} ?>
    101101<p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>Wordpress</strong></a></cite></p>
    102102<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
  • trunk/wp-content/themes/default/comments.php

    r3517 r4495  
    33        die ('Please do not load this page directly. Thanks!');
    44
    5         if (!empty($post->post_password)) { // if there's a password
    6             if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
    7                 ?>
     5    if (!empty($post->post_password)) { // if there's a password
     6        if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
     7            ?>
    88
    9                 <p class="nocomments">This post is password protected. Enter the password to view comments.<p>
     9            <p class="nocomments">This post is password protected. Enter the password to view comments.<p>
    1010
    11                 <?php
    12                 return;
    13             }
    14         }
     11            <?php
     12            return;
     13        }
     14    }
    1515
    16         /* This variable is for alternating comment background */
    17         $oddcomment = 'alt';
     16    /* This variable is for alternating comment background */
     17    $oddcomment = 'alt';
    1818?>
    1919
     
    2121
    2222<?php if ($comments) : ?>
    23     <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3> 
     23    <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
    2424
    2525    <ol class="commentlist">
     
    5151 <?php else : // this is displayed if there are no comments so far ?>
    5252
    53   <?php if ('open' == $post->comment_status) : ?>
     53    <?php if ('open' == $post->comment_status) : ?>
    5454        <!-- If comments are open, but there are no comments. -->
    5555
  • trunk/wp-content/themes/default/footer.php

    r3924 r4495  
    44<!-- If you'd like to support WordPress, having the "powered by" link someone on your blog is the best way, it's our only promotion or advertising. -->
    55    <p>
    6         <?php bloginfo('name'); ?> is proudly powered by 
     6        <?php bloginfo('name'); ?> is proudly powered by
    77        <a href="http://wordpress.org/">WordPress</a>
    88        <br /><a href="feed:<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a>
  • trunk/wp-content/themes/default/header.php

    r4144 r4495  
    1515<style type="text/css" media="screen">
    1616
    17 <?php 
     17<?php
    1818// Checks to see whether it needs a sidebar or not
    19 if ( !$withcomments && !is_single() ) { 
     19if ( !$withcomments && !is_single() ) {
    2020?>
    2121    #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; }
    2222<?php } else { // No sidebar ?>
    23     #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } 
     23    #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
    2424<?php } ?>
    2525
  • trunk/wp-content/themes/default/page.php

    r4264 r4495  
    33    <div id="content" class="narrowcolumn">
    44
    5     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     5        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    66        <div class="post" id="post-<?php the_ID(); ?>">
    77        <h2><?php the_title(); ?></h2>
     
    1313            </div>
    1414        </div>
    15       <?php endwhile; endif; ?>
     15        <?php endwhile; endif; ?>
    1616    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    1717    </div>
  • trunk/wp-content/themes/default/sidebar.php

    r4171 r4495  
    2525            for <?php the_time('F, Y'); ?>.</p>
    2626
    27       <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
     27            <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    2828            <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
    2929            for the year <?php the_time('Y'); ?>.</p>
    3030
    31          <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
     31            <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
    3232            <p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
    3333            for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
  • trunk/wp-content/themes/default/single.php

    r4264 r4495  
    33    <div id="content" class="widecolumn">
    44
    5   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     5    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    66
    77        <div class="navigation">
     
    2424                            You'll need to download this plugin, and follow the instructions:
    2525                            http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
    26                             /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?> 
     26                            /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
    2727                        on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    2828                        and is filed under <?php the_category(', ') ?>.
    29                         You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. 
     29                        You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
    3030
    3131                        <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
  • trunk/wp-feed.php

    r3638 r4495  
    22
    33if (empty($doing_rss)) {
    4     $doing_rss = 1;
    5     require(dirname(__FILE__) . '/wp-blog-header.php');
     4    $doing_rss = 1;
     5    require(dirname(__FILE__) . '/wp-blog-header.php');
    66}
    77
  • trunk/wp-includes/bookmark-template.php

    r4444 r4495  
    147147
    148148function get_linkrating($link) {
    149     return apply_filters('link_rating', $link->link_rating);
     149    return apply_filters('link_rating', $link->link_rating);
    150150}
    151151
  • trunk/wp-includes/bookmark.php

    r4219 r4495  
    2020// Deprecate
    2121function get_link($bookmark_id, $output = OBJECT) {
    22     return get_bookmark($bookmark_id, $output); 
     22    return get_bookmark($bookmark_id, $output);
    2323}
    2424
     
    5151        }
    5252    }
    53     if (!empty($inclusions)) 
     53    if (!empty($inclusions))
    5454        $inclusions .= ')';
    5555
     
    6666        }
    6767    }
    68     if (!empty($exclusions)) 
     68    if (!empty($exclusions))
    6969        $exclusions .= ')';
    70        
     70
    7171    if ( ! empty($category_name) ) {
    7272        if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
     
    8888    }
    8989    if (!empty($category_query)) {
    90         $category_query .= ')'; 
     90        $category_query .= ')';
    9191        $join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) ";
    9292    }
  • trunk/wp-includes/cache.php

    r4486 r4495  
    6666
    6767    function acquire_lock() {
    68         // Acquire a write lock. 
     68        // Acquire a write lock.
    6969        $this->mutex = @fopen($this->cache_dir.$this->flock_filename, 'w');
    7070        if ( false == $this->mutex)
     
    238238            # Get indexed directory from stack
    239239            $dir = $stack[$index];
    240      
     240
    241241            $dh = @ opendir($dir);
    242242            if (!$dh)
    243243                return false;
    244      
     244
    245245            while (($file = @ readdir($dh)) !== false) {
    246246                if ($file == '.' or $file == '..')
  • trunk/wp-includes/capabilities.php

    r4158 r4495  
    222222
    223223    function level_reduction($max, $item) {
    224         if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
    225             $level = intval($matches[1]);
    226             return max($max, $level);
    227         } else {
    228             return $max;
    229         }
     224        if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
     225            $level = intval($matches[1]);
     226            return max($max, $level);
     227        } else {
     228            return $max;
     229        }
    230230    }
    231231
    232232    function update_user_level_from_caps() {
    233         global $wpdb;
    234         $this->user_level = array_reduce(array_keys($this->allcaps),    array(&$this, 'level_reduction'), 0);
    235         update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level);
     233        global $wpdb;
     234        $this->user_level = array_reduce(array_keys($this->allcaps),    array(&$this, 'level_reduction'), 0);
     235        update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level);
    236236    }
    237237
     
    299299        if ( 'page' == $post->post_type ) {
    300300            $args = array_merge(array('delete_page', $user_id), $args);
    301             return call_user_func_array('map_meta_cap', $args); 
     301            return call_user_func_array('map_meta_cap', $args);
    302302        }
    303303        $post_author_data = get_userdata($post->post_author);
     
    353353        if ( 'page' == $post->post_type ) {
    354354            $args = array_merge(array('edit_page', $user_id), $args);
    355             return call_user_func_array('map_meta_cap', $args); 
     355            return call_user_func_array('map_meta_cap', $args);
    356356        }
    357357        $post_author_data = get_userdata($post->post_author);
     
    403403        if ( 'page' == $post->post_type ) {
    404404            $args = array_merge(array('read_page', $user_id), $args);
    405             return call_user_func_array('map_meta_cap', $args); 
     405            return call_user_func_array('map_meta_cap', $args);
    406406        }
    407407
  • trunk/wp-includes/category-template.php

    r4277 r4495  
    188188        }
    189189
    190         if ( $show_option_none) { 
    191             $show_option_none = apply_filters('list_cats', $show_option_none);     
     190        if ( $show_option_none) {
     191            $show_option_none = apply_filters('list_cats', $show_option_none);
    192192            $output .= "\t<option value='-1'>$show_option_none</option>\n";
    193193        }
     
    227227
    228228    $categories = get_categories($r);
    229    
     229
    230230    $output = '';
    231231    if ( $title_li && 'list' == $style )
     
    250250    if ( $title_li && 'list' == $style )
    251251        $output .= '</ul></li>';
    252            
     252
    253253    echo apply_filters('list_cats', $output);
    254254}
  • trunk/wp-includes/classes.php

    r4483 r4495  
    1313    var $matched_query;
    1414    var $did_permalink = false;
    15    
     15
    1616    function add_query_var($qv) {
    1717        $this->public_query_vars[] = $qv;
     
    9797                    // Got a match.
    9898                    $this->matched_rule = $match;
    99                    
     99
    100100                    // Trim the query of everything up to the '?'.
    101101                    $query = preg_replace("!^.+\?!", '', $query);
     
    191191            )
    192192                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
    193             else 
     193            else
    194194                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
    195195            $wp_etag = '"' . md5($wp_last_modified) . '"';
     
    198198
    199199            // Support for Conditional GET
    200             if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 
     200            if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
    201201                $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
    202202            else $client_etag = false;
     
    322322            return '';
    323323
    324         return $codes[0];   
     324        return $codes[0];
    325325    }
    326326
     
    338338            return $this->errors[$code];
    339339        else
    340             return array(); 
     340            return array();
    341341    }
    342342
     
    382382// A class for displaying various tree-like structures. Extend the Walker class to use it, see examples at the bottom
    383383
    384 class Walker { 
     384class Walker {
    385385    var $tree_type;
    386386    var $db_fields;
    387    
     387
    388388    //abstract callbacks
    389389    function start_lvl($output) { return $output; }
     
    391391    function start_el($output)  { return $output; }
    392392    function end_el($output)    { return $output; }
    393    
     393
    394394    function walk($elements, $to_depth) {
    395395        $args = array_slice(func_get_args(), 2); $parents = array(); $depth = 1; $previous_element = ''; $output = '';
    396    
     396
    397397        //padding at the end
    398398        $last_element->post_parent = 0;
    399399        $last_element->post_id = 0;
    400400        $elements[] = $last_element;
    401    
     401
    402402        $id_field = $this->db_fields['id'];
    403403        $parent_field = $this->db_fields['parent'];
    404    
     404
    405405        $flat = ($to_depth == -1) ? true : false;
    406    
     406
    407407        foreach ( $elements as $element ) {
    408408            // If flat, start and end the element and skip the level checks.
     
    444444                    $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
    445445                }
    446    
     446
    447447                while ( $parent = array_shift($parents) ) {
    448448                    $depth--;
     
    464464                }
    465465            }
    466    
     466
    467467            // Start the element.
    468468            if ( !$to_depth || ($depth <= $to_depth) ) {
     
    472472                }
    473473            }
    474    
     474
    475475            $previous_element = $element;
    476476        }
    477        
     477
    478478        return $output;
    479479    }
     
    483483    var $tree_type = 'page';
    484484    var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
    485    
     485
    486486    function start_lvl($output, $depth) {
    487487        $indent = str_repeat("\t", $depth);
     
    489489        return $output;
    490490    }
    491    
     491
    492492    function end_lvl($output, $depth) {
    493493        $indent = str_repeat("\t", $depth);
     
    495495        return $output;
    496496    }
    497    
     497
    498498    function start_el($output, $page, $depth, $current_page, $show_date, $date_format) {
    499499        if ( $depth )
     
    531531
    532532    function start_el($output, $page, $depth, $args) {
    533         $pad = str_repeat('&nbsp;', $depth * 3);
    534 
    535         $output .= "\t<option value=\"$page->ID\"";
    536         if ( $page->ID == $args['selected'] )
    537                 $output .= ' selected="selected"';
    538         $output .= '>';
    539         $title = wp_specialchars($page->post_title);
    540         $output .= "$pad$title";
    541         $output .= "</option>\n";
    542 
    543         return $output;
     533                $pad = str_repeat('&nbsp;', $depth * 3);
     534
     535                $output .= "\t<option value=\"$page->ID\"";
     536                if ( $page->ID == $args['selected'] )
     537                                $output .= ' selected="selected"';
     538                $output .= '>';
     539                $title = wp_specialchars($page->post_title);
     540                $output .= "$pad$title";
     541                $output .= "</option>\n";
     542
     543                return $output;
    544544    }
    545545}
     
    548548    var $tree_type = 'category';
    549549    var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
    550    
     550
    551551    function start_lvl($output, $depth, $args) {
    552552        if ( 'list' != $args['style'] )
    553553            return $output;
    554    
     554
    555555        $indent = str_repeat("\t", $depth);
    556556        $output .= "$indent<ul class='children'>\n";
    557557        return $output;
    558558    }
    559    
     559
    560560    function end_lvl($output, $depth, $args) {
    561561        if ( 'list' != $args['style'] )
    562562            return $output;
    563    
     563
    564564        $indent = str_repeat("\t", $depth);
    565565        $output .= "$indent</ul>\n";
    566566        return $output;
    567567    }
    568    
     568
    569569    function start_el($output, $category, $depth, $args) {
    570570        extract($args);
    571    
     571
    572572        $link = '<a href="' . get_category_link($category->cat_ID) . '" ';
    573573        if ( $use_desc_for_title == 0 || empty($category->category_description) )
     
    577577        $link .= '>';
    578578        $link .= apply_filters('list_cats', $category->cat_name, $category).'</a>';
    579    
     579
    580580        if ( (! empty($feed_image)) || (! empty($feed)) ) {
    581581            $link .= ' ';
    582    
     582
    583583            if ( empty($feed_image) )
    584584                $link .= '(';
    585    
     585
    586586            $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';
    587    
     587
    588588            if ( !empty($feed) ) {
    589589                $title = ' title="' . $feed . '"';
     
    592592                $link .= $title;
    593593            }
    594    
     594
    595595            $link .= '>';
    596    
     596
    597597            if ( !empty($feed_image) )
    598598                $link .= "<img src='$feed_image' $alt$title" . ' />';
     
    619619            $output .= "\t$link<br />\n";
    620620        }
    621    
    622         return $output;
    623     }
    624    
     621
     622        return $output;
     623    }
     624
    625625    function end_el($output, $page, $depth, $args) {
    626626        if ( 'list' != $args['style'] )
    627627            return $output;
    628    
     628
    629629        $output .= "</li>\n";
    630630        return $output;
     
    636636    var $tree_type = 'category';
    637637    var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
    638    
    639     function start_el($output, $category, $depth, $args) { 
     638
     639    function start_el($output, $category, $depth, $args) {
    640640        $pad = str_repeat('&nbsp;', $depth * 3);
    641        
     641
    642642        $cat_name = apply_filters('list_cats', $category->cat_name, $category);
    643643        $output .= "\t<option value=\"".$category->cat_ID."\"";
     
    653653        }
    654654        $output .= "</option>\n";
    655        
     655
    656656        return $output;
    657657    }
  • trunk/wp-includes/comment-template.php

    r4494 r4495  
    143143
    144144function comments_link( $file = '', $echo = true ) {
    145     echo get_comments_link();
     145        echo get_comments_link();
    146146}
    147147
     
    241241    global $id;
    242242    if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
    243     echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    244         xmlns:dc="http://purl.org/dc/elements/1.1/"
    245         xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
     243    echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     244            xmlns:dc="http://purl.org/dc/elements/1.1/"
     245            xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
    246246        <rdf:Description rdf:about="';
    247247    the_permalink();
     
    266266function pings_open() {
    267267    global $post;
    268     if ( 'open' == $post->ping_status ) 
     268    if ( 'open' == $post->ping_status )
    269269        return true;
    270270    else
     
    300300
    301301function comments_popup_script($width=400, $height=400, $file='') {
    302     global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
     302        global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
    303303
    304304        if (empty ($file)) {
     
    308308        }
    309309
    310     $wpcommentsjavascript = 1;
    311     $javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n    window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
    312     echo $javascript;
     310        $wpcommentsjavascript = 1;
     311        $javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n    window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
     312        echo $javascript;
    313313}
    314314
  • trunk/wp-includes/comment.php

    r4299 r4495  
    1919            if (empty($word)) { continue; }
    2020
    21             // Do some escaping magic so that '#' chars in the 
     21            // Do some escaping magic so that '#' chars in the
    2222            // spam words don't break things:
    2323            $word = preg_quote($word, '#');
    2424
    25             $pattern = "#$word#i"; 
     25            $pattern = "#$word#i";
    2626            if ( preg_match($pattern, $author) ) return false;
    2727            if ( preg_match($pattern, $email) ) return false;
     
    104104        $query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
    105105        if (false == $include_unapproved) {
    106             $query .= " AND comment_approved = '1'";
    107         }
    108             $myrow = $wpdb->get_row($query, ARRAY_A);
     106                $query .= " AND comment_approved = '1'";
     107        }
     108                $myrow = $wpdb->get_row($query, ARRAY_A);
    109109    } else {
    110110        $myrow['comment_ID'] = $postc->comment_ID;
     
    158158        $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
    159159        $comment_author_email = stripslashes($comment_author_email);
    160         $comment_author_email = wp_specialchars($comment_author_email, true);   
     160        $comment_author_email = wp_specialchars($comment_author_email, true);
    161161        $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
    162162    }
     
    244244        if ( empty($word) ) { continue; }
    245245
    246         // Do some escaping magic so that '#' chars in the 
     246        // Do some escaping magic so that '#' chars in the
    247247        // spam words don't break things:
    248248        $word = preg_quote($word, '#');
    249249
    250         $pattern = "#$word#i"; 
     250        $pattern = "#$word#i";
    251251        if ( preg_match($pattern, $author    ) ) return true;
    252252        if ( preg_match($pattern, $email     ) ) return true;
     
    329329        $user_id = 0;
    330330
    331     $result = $wpdb->query("INSERT INTO $wpdb->comments 
     331    $result = $wpdb->query("INSERT INTO $wpdb->comments
    332332    (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
    333     VALUES 
     333    VALUES
    334334    ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
    335335    ");
     
    398398
    399399function wp_set_comment_status($comment_id, $comment_status) {
    400     global $wpdb;
    401 
    402     switch($comment_status) {
     400        global $wpdb;
     401
     402        switch($comment_status) {
    403403        case 'hold':
    404404            $query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
     
    407407            $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
    408408        break;
    409         case 'spam':
    410             $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
    411         break;
     409        case 'spam':
     410            $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
     411        break;
    412412        case 'delete':
    413413            return wp_delete_comment($comment_id);
     
    415415        default:
    416416            return false;
    417     }
    418    
    419     if ($wpdb->query($query)) {
     417        }
     418
     419        if ($wpdb->query($query)) {
    420420        do_action('wp_set_comment_status', $comment_id, $comment_status);
    421421
     
    426426            $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
    427427        return true;
    428     } else {
     428        } else {
    429429        return false;
    430     }
     430        }
    431431}
    432432
     
    583583        pingback($ping->post_content, $ping->ID);
    584584    }
    585    
     585
    586586    // Do Enclosures
    587587    while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
     
    706706
    707707        if ($pingback_server_url) {
    708             @ set_time_limit( 60 ); 
     708            @ set_time_limit( 60 );
    709709             // Now, the RPC call
    710710            debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
  • trunk/wp-includes/compat.php

    r3901 r4495  
    3737
    3838function printr($var, $do_not_echo = false) {
    39     // from php.net/print_r user contributed notes 
     39    // from php.net/print_r user contributed notes
    4040    ob_start();
    4141    print_r($var);
     
    4343    ob_clean();
    4444    if (!$do_not_echo) {
    45       echo "<pre>$code</pre>";
     45        echo "<pre>$code</pre>";
    4646    }
    4747    ob_end_clean();
     
    5858
    5959if (!defined('CASE_LOWER')) {
    60     define('CASE_LOWER', 0);
     60        define('CASE_LOWER', 0);
    6161}
    6262
    6363if (!defined('CASE_UPPER')) {
    64     define('CASE_UPPER', 1);
     64        define('CASE_UPPER', 1);
    6565}
    6666
     
    7979 */
    8080if (!function_exists('array_change_key_case')) {
    81     function array_change_key_case($input, $case = CASE_LOWER)
    82     {
    83         if (!is_array($input)) {
    84             user_error('array_change_key_case(): The argument should be an array',
    85                 E_USER_WARNING);
    86             return false;
    87         }
     81        function array_change_key_case($input, $case = CASE_LOWER)
     82        {
     83                if (!is_array($input)) {
     84                        user_error('array_change_key_case(): The argument should be an array',
     85                                E_USER_WARNING);
     86                        return false;
     87                }
    8888
    89         $output   = array ();
    90         $keys     = array_keys($input);
    91         $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
     89                $output   = array ();
     90                $keys     = array_keys($input);
     91                $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
    9292
    93         foreach ($keys as $key) {
    94             $output[$casefunc($key)] = $input[$key];
    95         }
     93                foreach ($keys as $key) {
     94                        $output[$casefunc($key)] = $input[$key];
     95                }
    9696
    97         return $output;
    98     }
     97                return $output;
     98        }
    9999}
    100100
    101101// From php.net
    102102if(!function_exists('http_build_query')) {
    103   function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
    104       $res = array();
    105       foreach ((array)$formdata as $k=>$v) {
    106           $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
    107           if ($key) $tmp_key = $key.'['.$tmp_key.']';
    108           $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
    109       }
    110       $separator = ini_get('arg_separator.output');
    111       return implode($separator, $res);
    112   }
     103    function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
     104            $res = array();
     105            foreach ((array)$formdata as $k=>$v) {
     106                    $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
     107                    if ($key) $tmp_key = $key.'['.$tmp_key.']';
     108                    $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
     109            }
     110            $separator = ini_get('arg_separator.output');
     111            return implode($separator, $res);
     112    }
    113113}
    114114
  • trunk/wp-includes/deprecated.php

    r4145 r4495  
    130130
    131131    if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' &&  $author_data->user_level < 2))
    132         || ($author_data->user_level > $post_author_data->user_level)
    133         || ($author_data->user_level >= 10) ) {
     132            || ($author_data->user_level > $post_author_data->user_level)
     133            || ($author_data->user_level >= 10) ) {
    134134        return true;
    135135    } else {
     
    200200 */
    201201function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
    202                         $between = " ", $show_images = true, $orderby = 'id',
    203                         $show_description = true, $show_rating = false,
    204                         $limit = -1, $show_updated = 0) {
    205     global $wpdb;
    206     $cat_id = -1;
    207     $results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
    208     if ($results) {
    209         foreach ($results as $result) {
    210             $cat_id = $result->cat_ID;
    211         }
    212     }
    213     get_links($cat_id, $before, $after, $between, $show_images, $orderby,
    214               $show_description, $show_rating, $limit, $show_updated);
     202                                                $between = " ", $show_images = true, $orderby = 'id',
     203                                                $show_description = true, $show_rating = false,
     204                                                $limit = -1, $show_updated = 0) {
     205        global $wpdb;
     206        $cat_id = -1;
     207        $results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
     208        if ($results) {
     209                foreach ($results as $result) {
     210                        $cat_id = $result->cat_ID;
     211                }
     212        }
     213        get_links($cat_id, $before, $after, $between, $show_images, $orderby,
     214                            $show_description, $show_rating, $limit, $show_updated);
    215215}
    216216
     
    253253// Deprecate in favor of get_linkz().
    254254function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
    255     global $wpdb;
    256     $cat_id = -1;
    257     //$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
    258     // TODO: Fix me.
    259     if ($results) {
    260         foreach ($results as $result) {
    261             $cat_id = $result->cat_id;
    262         }
    263     }
    264     return get_linkobjects($cat_id, $orderby, $limit);
     255        global $wpdb;
     256        $cat_id = -1;
     257        //$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
     258        // TODO: Fix me.
     259        if ($results) {
     260                foreach ($results as $result) {
     261                        $cat_id = $result->cat_id;
     262                }
     263        }
     264        return get_linkobjects($cat_id, $orderby, $limit);
    265265}
    266266
     
    302302// Deprecate in favor of get_linkz().
    303303function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
    304     global $wpdb;
    305 
    306     $sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
    307     if ($category != -1) {
    308         $sql .= " AND link_category = $category ";
    309     }
    310     if ($orderby == '')
    311         $orderby = 'id';
    312     if (substr($orderby,0,1) == '_') {
    313         $direction = ' DESC';
    314         $orderby = substr($orderby,1);
    315     }
    316     if (strcasecmp('rand',$orderby) == 0) {
    317         $orderby = 'rand()';
    318     } else {
    319         $orderby = " link_" . $orderby;
    320     }
    321     $sql .= ' ORDER BY ' . $orderby;
    322     $sql .= $direction;
    323     /* The next 2 lines implement LIMIT TO processing */
    324     if ($limit != -1)
    325         $sql .= " LIMIT $limit";
    326 
    327     $results = $wpdb->get_results($sql);
    328     if ($results) {
    329         foreach ($results as $result) {
    330             $result->link_url         = $result->link_url;
    331             $result->link_name        = $result->link_name;
    332             $result->link_description = $result->link_description;
    333             $result->link_notes       = $result->link_notes;
    334             $newresults[] = $result;
    335         }
    336     }
    337     return $newresults;
     304        global $wpdb;
     305
     306        $sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
     307        if ($category != -1) {
     308                $sql .= " AND link_category = $category ";
     309        }
     310        if ($orderby == '')
     311                $orderby = 'id';
     312        if (substr($orderby,0,1) == '_') {
     313                $direction = ' DESC';
     314                $orderby = substr($orderby,1);
     315        }
     316        if (strcasecmp('rand',$orderby) == 0) {
     317                $orderby = 'rand()';
     318        } else {
     319                $orderby = " link_" . $orderby;
     320        }
     321        $sql .= ' ORDER BY ' . $orderby;
     322        $sql .= $direction;
     323        /* The next 2 lines implement LIMIT TO processing */
     324        if ($limit != -1)
     325                $sql .= " LIMIT $limit";
     326
     327        $results = $wpdb->get_results($sql);
     328        if ($results) {
     329                foreach ($results as $result) {
     330                        $result->link_url         = $result->link_url;
     331                        $result->link_name        = $result->link_name;
     332                        $result->link_description = $result->link_description;
     333                        $result->link_notes       = $result->link_notes;
     334                        $newresults[] = $result;
     335                }
     336        }
     337        return $newresults;
    338338}
    339339
     
    360360 */
    361361function get_linksbyname_withrating($cat_name = "noname", $before = '',
    362                                     $after = '<br />', $between = " ",
    363                                     $show_images = true, $orderby = 'id',
    364                                     $show_description = true, $limit = -1, $show_updated = 0) {
    365 
    366     get_linksbyname($cat_name, $before, $after, $between, $show_images,
    367                     $orderby, $show_description, true, $limit, $show_updated);
     362                                                                        $after = '<br />', $between = " ",
     363                                                                        $show_images = true, $orderby = 'id',
     364                                                                        $show_description = true, $limit = -1, $show_updated = 0) {
     365
     366        get_linksbyname($cat_name, $before, $after, $between, $show_images,
     367                                        $orderby, $show_description, true, $limit, $show_updated);
    368368}
    369369
     
    390390 */
    391391function get_links_withrating($category = -1, $before = '', $after = '<br />',
    392                               $between = " ", $show_images = true,
    393                               $orderby = 'id', $show_description = true,
    394                               $limit = -1, $show_updated = 0) {
    395 
    396     get_links($category, $before, $after, $between, $show_images, $orderby,
    397               $show_description, true, $limit, $show_updated);
     392                                                            $between = " ", $show_images = true,
     393                                                            $orderby = 'id', $show_description = true,
     394                                                            $limit = -1, $show_updated = 0) {
     395
     396        get_links($category, $before, $after, $between, $show_images, $orderby,
     397                            $show_description, true, $limit, $show_updated);
    398398}
    399399
     
    404404 */
    405405function get_autotoggle($id = 0) {
    406     return 0; 
     406    return 0;
    407407}
    408408
     
    434434    $r['title_li'] = '';
    435435
    436     return wp_list_categories($r); 
     436    return wp_list_categories($r);
    437437}
    438438
  • trunk/wp-includes/formatting.php

    r4451 r4495  
    6666    $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
    6767    // Space things out a little
    68     $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee); 
     68    $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
    6969    $pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee);
    70     $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 
     70    $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
    7171    $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
    72     $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 
    73     $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 
     72    $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
     73    $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
    7474    $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
    7575    $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
     
    7777    $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
    7878    $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
    79     $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); 
     79    $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
    8080    if ($br) {
    8181        $pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "<WPPreserveNewline />", "\\0")', $pee);
     
    8787    $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' ", $pee);
    8888
    89     return $pee; 
     89    return $pee;
    9090}
    9191
     
    127127
    128128function utf8_uri_encode( $utf8_string ) {
    129   $unicode = '';       
    130   $values = array();
    131   $num_octets = 1;
    132        
    133   for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
    134 
    135     $value = ord( $utf8_string[ $i ] );
    136            
    137     if ( $value < 128 ) {
    138       $unicode .= chr($value);
    139     } else {
    140       if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
    141                
    142       $values[] = $value;
    143      
    144       if ( count( $values ) == $num_octets ) {
    145     if ($num_octets == 3) {
    146       $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
    147     } else {
    148       $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
    149     }
    150 
     129    $unicode = '';
    151130    $values = array();
    152131    $num_octets = 1;
    153       }
    154     }
    155   }
    156 
    157   return $unicode;   
     132
     133    for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
     134
     135        $value = ord( $utf8_string[ $i ] );
     136
     137        if ( $value < 128 ) {
     138            $unicode .= chr($value);
     139        } else {
     140            if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
     141
     142            $values[] = $value;
     143
     144            if ( count( $values ) == $num_octets ) {
     145    if ($num_octets == 3) {
     146        $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
     147    } else {
     148        $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
     149    }
     150
     151    $values = array();
     152    $num_octets = 1;
     153            }
     154        }
     155    }
     156
     157    return $unicode;
    158158}
    159159
     
    340340}
    341341
    342 function convert_chars($content, $flag = 'obsolete') { 
     342function convert_chars($content, $flag = 'obsolete') {
    343343    // Translation of invalid Unicode references range to valid range
    344344    $wp_htmltranswinuni = array(
     
    406406/*
    407407 balanceTags
    408  
     408
    409409 Balances Tags of string using a modified stack.
    410  
     410
    411411 @param text      Text to be balanced
    412412 @return          Returns balanced text
     
    415415 @date            November 4, 2001
    416416 @license         GPL v2.0
    417  @notes           
    418  @changelog       
     417 @notes
     418 @changelog
    419419 ---  Modified by Scott Reilly (coffee2code) 02 Aug 2004
    420             1.2  ***TODO*** Make better - change loop condition to $text
    421             1.1  Fixed handling of append/stack pop order of end text
    422                   Added Cleaning Hooks
    423             1.0  First Version
     420                        1.2  ***TODO*** Make better - change loop condition to $text
     421                        1.1  Fixed handling of append/stack pop order of end text
     422                                    Added Cleaning Hooks
     423                        1.0  First Version
    424424*/
    425425function balanceTags($text, $is_comment = 0, $force = false) {
     
    447447            $tag = strtolower(substr($regex[1],1));
    448448            // if too many closing tags
    449             if($stacksize <= 0) { 
     449            if($stacksize <= 0) {
    450450                $tag = '';
    451451                //or close to be safe $tag = '/' . $tag;
     
    504504        $newtext .= substr($text,0,$i) . $tag;
    505505        $text = substr($text,$i+$l);
    506     } 
     506    }
    507507
    508508    // Clear Tag Queue
     
    553553
    554554function trailingslashit($string) {
    555     if ( '/' != substr($string, -1)) {
    556         $string .= '/';
    557     }
    558     return $string;
     555        if ( '/' != substr($string, -1)) {
     556                $string .= '/';
     557        }
     558        return $string;
    559559}
    560560
     
    572572function stripslashes_deep($value)
    573573{
    574   $value = is_array($value) ?
    575               array_map('stripslashes_deep', $value) :
    576               stripslashes($value);
    577 
    578   return $value;
     574    $value = is_array($value) ?
     575                            array_map('stripslashes_deep', $value) :
     576                            stripslashes($value);
     577
     578    return $value;
    579579}
    580580
     
    732732}
    733733
    734 function human_time_diff( $from, $to = '' ) {     
     734function human_time_diff( $from, $to = '' ) {
    735735    if ( empty($to) )
    736736        $to = time();
     
    746746        if ($hours <= 1)
    747747            $since = __('1 hour');
    748         else 
     748        else
    749749            $since = sprintf( __('%s hours'), $hours );
    750750    } elseif ($diff >= 86400) {
  • trunk/wp-includes/functions.php

    r4483 r4495  
    1313    if( 'U' == $dateformatstring )
    1414        return $i;
    15    
     15
    1616    if ( -1 == $i || false == $i )
    1717        $i = 0;
     
    463463
    464464    if ( $red > 5 )
    465       return false;
     465        return false;
    466466
    467467    $parts = parse_url( $url );
     
    492492    $headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
    493493
    494     $code = $headers['response'];
    495     if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
    496         return wp_get_http_headers( $headers['location'], ++$red );
     494        $code = $headers['response'];
     495        if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
     496                return wp_get_http_headers( $headers['location'], ++$red );
    497497
    498498    return $headers;
     
    802802
    803803function bool_from_yn($yn) {
    804     if ($yn == 'Y') return 1;
    805     return 0;
     804        if ($yn == 'Y') return 1;
     805        return 0;
    806806}
    807807
     
    958958    }
    959959
    960     $uploads = array('path' => $dir, 'url' => $url, 'error' => false);
     960        $uploads = array('path' => $dir, 'url' => $url, 'error' => false);
    961961    return apply_filters('upload_dir', $uploads);
    962962}
  • trunk/wp-includes/general-template.php

    r4476 r4495  
    472472        WHERE post_date >   '$thisyear-$thismonth-01'
    473473        AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
    474         AND post_type = 'post' AND post_status = 'publish' 
     474        AND post_type = 'post' AND post_status = 'publish'
    475475            ORDER   BY post_date ASC
    476476            LIMIT 1");
  • trunk/wp-includes/l10n.php

    r4202 r4495  
    1818}
    1919
    20 // Return a translated string.   
     20// Return a translated string.
    2121function __($text, $domain = 'default') {
    2222    global $l10n;
  • trunk/wp-includes/link-template.php

    r4475 r4495  
    6464        $author = $authordata->user_nicename;
    6565        $date = explode(" ",date('Y m d H i s', $unixtime));
    66         $rewritereplace = 
     66        $rewritereplace =
    6767        array(
    6868            $date[0],
     
    283283            $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
    284284        }
    285         $join .= ')'; 
     285        $join .= ')';
    286286    }
    287287
     
    316316            $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
    317317        }
    318         $join .= ')'; 
     318        $join .= ')';
    319319    }
    320320
     
    351351    $format = str_replace('%link', $link, $format);
    352352
    353     echo $format;       
     353    echo $format;
    354354}
    355355
     
    366366    $format = str_replace('%link', $link, $format);
    367367
    368     echo $format;       
     368    echo $format;
    369369}
    370370
     
    374374    $qstr = wp_specialchars($_SERVER['REQUEST_URI']);
    375375
    376     $page_querystring = "paged"; 
     376    $page_querystring = "paged";
    377377    $page_modstring = "page/";
    378378    $page_modregex = "page/?";
     
    493493        $max_num_pages = $wp_query->max_num_pages;
    494494        $paged = get_query_var('paged');
    495        
     495
    496496        //only have sep if there's both prev and next results
    497497        if ($paged < 2 || $paged >= $max_num_pages) {
  • trunk/wp-includes/pluggable.php

    r4432 r4495  
    4747        return;
    4848
    49     if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 
     49    if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) ||
    5050        !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) {
    5151        wp_set_current_user(0);
     
    213213function auth_redirect() {
    214214    // Checks if a user is logged in, if not redirects them to the login page
    215     if ( (!empty($_COOKIE[USER_COOKIE]) && 
     215    if ( (!empty($_COOKIE[USER_COOKIE]) &&
    216216                !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
    217217             (empty($_COOKIE[USER_COOKIE])) ) {
     
    332332function wp_notify_postauthor($comment_id, $comment_type='') {
    333333    global $wpdb;
    334    
     334
    335335    $comment = get_comment($comment_id);
    336336    $post    = get_post($comment->comment_post_ID);
     
    379379        if ( '' != $comment->comment_author_email )
    380380            $reply_to = "Reply-To: $comment->comment_author_email";
    381     } else {
     381    } else {
    382382        $from = "From: \"$comment->comment_author\" <$wp_email>";
    383383        if ( '' != $comment->comment_author_email )
    384384            $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
    385     }
     385    }
    386386
    387387    $message_headers = "MIME-Version: 1.0\n"
     
    440440
    441441    @wp_mail($admin_email, $subject, $notify_message);
    442    
     442
    443443    return true;
    444444}
     
    490490
    491491    $i = ceil(time() / 43200);
    492    
     492
    493493    return substr(wp_hash($i . $action . $uid), -12, 10);
    494494}
  • trunk/wp-includes/post.php

    r4425 r4495  
    167167    if ( !empty($include) ) {
    168168        $offset = 0;    //ignore offset, category, exclude, meta_key, and meta_value params if using include
    169         $category = ''; 
    170         $exclude = ''; 
     169        $category = '';
     170        $exclude = '';
    171171        $meta_key = '';
    172172        $meta_value = '';
     
    182182        }
    183183    }
    184     if (!empty($inclusions)) 
    185         $inclusions .= ')'; 
     184    if (!empty($inclusions))
     185        $inclusions .= ')';
    186186
    187187    $exclusions = '';
     
    197197        }
    198198    }
    199     if (!empty($exclusions)) 
     199    if (!empty($exclusions))
    200200        $exclusions .= ')';
    201201
    202202    $query ="SELECT DISTINCT * FROM $wpdb->posts " ;
    203     $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ; 
    204     $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 
     203    $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ;
     204    $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
    205205    $query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions " ;
    206206    $query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ) ;
     
    401401    $post_ID = (int) $post_ID;
    402402
    403     $sql = "SELECT category_id 
    404         FROM $wpdb->post2cat 
    405         WHERE post_id = '$post_ID' 
     403    $sql = "SELECT category_id
     404        FROM $wpdb->post2cat
     405        WHERE post_id = '$post_ID'
    406406        ORDER BY category_id";
    407407
     
    436436    if($mode == OBJECT) {
    437437        $post->post_category = wp_get_post_categories($postid);
    438     } 
     438    }
    439439    else {
    440440        $post['post_category'] = wp_get_post_categories($postid);
     
    636636            if ( $post_pingback )
    637637                $result = $wpdb->query("
    638                     INSERT INTO $wpdb->postmeta 
    639                     (post_id,meta_key,meta_value) 
     638                    INSERT INTO $wpdb->postmeta
     639                    (post_id,meta_key,meta_value)
    640640                    VALUES ('$post_ID','_pingme','1')
    641641                ");
    642642            $result = $wpdb->query("
    643                 INSERT INTO $wpdb->postmeta 
    644                 (post_id,meta_key,meta_value) 
     643                INSERT INTO $wpdb->postmeta
     644                (post_id,meta_key,meta_value)
    645645                VALUES ('$post_ID','_encloseme','1')
    646646            ");
     
    654654            if ( ! update_post_meta($post_ID, '_wp_page_template',  $page_template))
    655655                add_post_meta($post_ID, '_wp_page_template',  $page_template, true);
    656                
     656
    657657        if ( $post_status == 'publish' )
    658658            do_action('publish_page', $post_ID);
     
    685685
    686686    // Passed post category list overwrites existing category list if not empty.
    687     if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
     687    if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
    688688             && 0 != count($postarr['post_category']) )
    689         $post_cats = $postarr['post_category'];
    690     else
    691         $post_cats = $post['post_category'];
     689        $post_cats = $postarr['post_category'];
     690    else
     691        $post_cats = $post['post_category'];
    692692
    693693    // Drafts shouldn't be assigned a date unless explicitly done so by the user
    694     if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) && 
    695         ('0000-00-00 00:00:00' == $post['post_date']) )
     694    if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
     695            ('0000-00-00 00:00:00' == $post['post_date']) )
    696696        $clear_date = true;
    697697    else
    698698        $clear_date = false;
    699699
    700     // Merge old and new fields with new fields overwriting old ones.
    701     $postarr = array_merge($post, $postarr);
    702     $postarr['post_category'] = $post_cats;
     700    // Merge old and new fields with new fields overwriting old ones.
     701    $postarr = array_merge($post, $postarr);
     702    $postarr['post_category'] = $post_cats;
    703703    if ( $clear_date ) {
    704704        $postarr['post_date'] = '';
     
    734734    // First the old categories
    735735    $old_categories = $wpdb->get_col("
    736         SELECT category_id 
    737         FROM $wpdb->post2cat 
     736        SELECT category_id
     737        FROM $wpdb->post2cat
    738738        WHERE post_id = $post_ID");
    739739
     
    750750        foreach ($delete_cats as $del) {
    751751            $wpdb->query("
    752                 DELETE FROM $wpdb->post2cat 
    753                 WHERE category_id = $del 
    754                     AND post_id = $post_ID 
     752                DELETE FROM $wpdb->post2cat
     753                WHERE category_id = $del
     754                    AND post_id = $post_ID
    755755                ");
    756756        }
     
    849849        $trackback_urls = explode(',', $tb_list);
    850850        foreach($trackback_urls as $tb_url) {
    851             $tb_url = trim($tb_url);
    852             trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
    853         }
    854     }
     851                $tb_url = trim($tb_url);
     852                trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
     853        }
     854        }
    855855}
    856856
     
    929929    $pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path' AND post_type='page'");
    930930
    931     if ( empty($pages) ) 
     931    if ( empty($pages) )
    932932        return NULL;
    933933
     
    10191019    $inclusions = '';
    10201020    if ( !empty($include) ) {
    1021         $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include 
    1022         $exclude = ''; 
     1021        $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
     1022        $exclude = '';
    10231023        $meta_key = '';
    10241024        $meta_value = '';
     
    10331033        }
    10341034    }
    1035     if (!empty($inclusions)) 
    1036         $inclusions .= ')'; 
     1035    if (!empty($inclusions))
     1036        $inclusions .= ')';
    10371037
    10381038    $exclusions = '';
     
    11971197    if (empty($post_date))
    11981198        $post_date = current_time('mysql');
    1199     if (empty($post_date_gmt)) 
     1199    if (empty($post_date_gmt))
    12001200        $post_date_gmt = current_time('mysql', 1);
    12011201
  • trunk/wp-includes/query.php

    r4488 r4495  
    44 * The Big Query.
    55 */
    6  
     6
    77function get_query_var($var) {
    88    global $wp_query;
     
    225225 * The Loop.  Post loop control.
    226226 */
    227  
     227
    228228function have_posts() {
    229229    global $wp_query;
     
    417417            $this->is_single = true;
    418418        } elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
    419             // If year, month, day, hour, minute, and second are set, a single 
    420             // post is being queried.       
     419            // If year, month, day, hour, minute, and second are set, a single
     420            // post is being queried.
    421421            $this->is_single = true;
    422422        } elseif ('' != $qv['static'] || '' != $qv['pagename'] || (int) $qv['page_id']) {
     
    494494                $this->is_category = true;
    495495            }
    496            
     496
    497497            if ((empty($qv['author'])) || ($qv['author'] == '0')) {
    498498                $this->is_author = false;
     
    772772        // Category stuff
    773773
    774         if ((empty($q['cat'])) || ($q['cat'] == '0') || 
     774        if ((empty($q['cat'])) || ($q['cat'] == '0') ||
    775775                // Bypass cat checks if fetching specific posts
    776776                ( $this->is_single || $this->is_page )) {
     
    789789                    $in_cats .= "$cat, " . get_category_children($cat, '', ', ');
    790790                else
    791                     $out_cats .= "$cat, " . get_category_children($cat, '', ', ');             
     791                    $out_cats .= "$cat, " . get_category_children($cat, '', ', ');
    792792            }
    793793            $in_cats = substr($in_cats, 0, -2);
     
    832832
    833833            $q['cat'] = $reqcat;
    834                
     834
    835835            $tables = ", $wpdb->post2cat, $wpdb->categories";
    836836            $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
     
    923923            if ( is_admin() )
    924924                $where .= " OR post_status = 'future' OR post_status = 'draft'";
    925    
     925
    926926            if ( is_user_logged_in() ) {
    927927                if ( 'post' == $post_type )
     
    10251025
    10261026    function next_post() {
    1027        
     1027
    10281028        $this->current_post++;
    10291029
     
    10611061        }
    10621062    }
    1063    
     1063
    10641064    function &query($query) {
    10651065        $this->parse_query($query);
  • trunk/wp-includes/registration.php

    r4144 r4495  
    8686        $user_id = $ID;
    8787    } else {
    88         $query = "INSERT INTO $wpdb->users 
     88        $query = "INSERT INTO $wpdb->users
    8989        (user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)
    90     VALUES 
     90    VALUES
    9191        ('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')";
    9292        $query = apply_filters('create_user_query', $query);
  • trunk/wp-includes/rewrite.php

    r4279 r4495  
    1717        return;
    1818    }
    19    
     19
    2020    $qv = trim($tagname, '%');
    21    
     21
    2222    global $wp_rewrite, $wp;
    2323    $wp->add_query_var($qv);
     
    2525}
    2626
    27 //Add a new feed type like /atom1/ 
     27//Add a new feed type like /atom1/
    2828function add_feed($feedname, $function) {
    2929    global $wp_rewrite;
     
    170170    var $endpoints;
    171171    var $use_verbose_rules = false;
    172     var $rewritecode = 
     172    var $rewritecode =
    173173        array(
    174174                    '%year%',
     
    186186                    );
    187187
    188     var $rewritereplace = 
     188    var $rewritereplace =
    189189        array(
    190190                    '([0-9]{4})',
     
    202202                    );
    203203
    204     var $queryreplace = 
     204    var $queryreplace =
    205205        array (
    206206                    'year=',
     
    219219
    220220    var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    221    
     221
    222222    function using_permalinks() {
    223223        if (empty($this->permalink_structure))
     
    236236            return true;
    237237        }
    238    
     238
    239239        return false;
    240240    }
     
    252252
    253253        if (! empty($this->matches)) {
    254             $match_prefix = '$' . $this->matches . '['; 
     254            $match_prefix = '$' . $this->matches . '[';
    255255            $match_suffix = ']';
    256         }       
    257 
    258         return "$match_prefix$number$match_suffix";       
     256        }
     257
     258        return "$match_prefix$number$match_suffix";
    259259    }
    260260
     
    302302                break;
    303303            }
    304         } 
     304        }
    305305
    306306        if ( empty($date_endian) )
     
    308308
    309309        // Do not allow the date tags and %post_id% to overlap in the permalink
    310         // structure. If they do, move the date tags to $front/date/. 
     310        // structure. If they do, move the date tags to $front/date/.
    311311        $front = $this->front;
    312312        preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
     
    483483        $trackbackregex = 'trackback/?$';
    484484        $pageregex = 'page/?([0-9]{1,})/?$';
    485        
     485
    486486        //build up an array of endpoint regexes to append => queries to append
    487487        if ($endpoints) {
    488488            $ep_query_append = array ();
    489             foreach ($this->endpoints as $endpoint) { 
     489            foreach ($this->endpoints as $endpoint) {
    490490                //match everything after the endpoint name, but allow for nothing to appear there
    491491                $epmatch = $endpoint[1] . '(/(.*))?/?$';
     
    512512                $queries[$i] = $queries[$i - 1] . '&';
    513513            }
    514              
     514
    515515            $query_token = str_replace($this->rewritecode, $this->queryreplace, $tokens[0][$i]) . $this->preg_index($i+1);
    516516            $queries[$i] .= $query_token;
     
    549549            //get the 'tagname=$matches[i]'
    550550            $query = $queries[$num_toks - 1];
    551            
     551
    552552            //set up $ep_mask_specific which is used to match more specific URL types
    553553            switch ($dirs[$j]) {
     
    581581            if ($paged) //...and /page/xx ones
    582582                $rewrite = array_merge($rewrite, array($pagematch => $pagequery));
    583            
     583
    584584            //if we've got some tags in this dir
    585585            if ($num_toks) {
    586586                $post = false;
    587587                $page = false;
    588                
    589                 //check to see if this dir is permalink-level: i.e. the structure specifies an 
     588
     589                //check to see if this dir is permalink-level: i.e. the structure specifies an
    590590                //individual post. Do this by checking it contains at least one of 1) post name,
    591                 //2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and 
     591                //2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
    592592                //minute all present). Set these flags now as we need them for the endpoints.
    593593                if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
     
    598598                        $page = true;
    599599                }
    600                
     600
    601601                //do endpoints
    602602                if ($endpoints) {
     
    608608                    }
    609609                }
    610                
     610
    611611                //if we're creating rules for a permalink, do all the endpoints like attachments etc
    612612                if ($post) {
     
    619619                    //get rid of brackets
    620620                    $submatchbase = str_replace(array('(',')'),'',$match);
    621                    
     621
    622622                    //add a rule for at attachments, which take the form of <permalink>/some-text
    623623                    $sub1 = $submatchbase . '/([^/]+)/';
     
    627627                    //add an ? as we don't have to match that last slash, and finally a $ so we
    628628                    //match to the end of the URL
    629                    
     629
    630630                    //add another rule to match attachments in the explicit form:
    631631                    //<permalink>/attachment/some-text
     
    634634                    $sub2feed = $sub2 . $feedregex;    //feeds, <permalink>/attachment/feed/(atom|...)
    635635                    $sub2feed2 = $sub2 . $feedregex2;  //and feeds again on to this <permalink>/attachment/(feed|atom...)
    636                    
     636
    637637                    //create queries for these extra tag-ons we've just dealt with
    638638                    $subquery = $index . '?attachment=' . $this->preg_index(1);
    639639                    $subtbquery = $subquery . '&tb=1';
    640640                    $subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
    641                    
     641
    642642                    //do endpoints for attachments
    643643                    if ($endpoint) { foreach ($ep_query_append as $regex => $ep) {
     
    647647                        }
    648648