WordPress.org

Make WordPress Core

Changeset 8103


Ignore:
Timestamp:
06/16/2008 09:08:49 PM (11 years ago)
Author:
mdawaffe
Message:

crazyhorse: merge with trunk [8072:8102]

Location:
branches/crazyhorse
Files:
34 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/crazyhorse/wp-admin/categories.php

    r7883 r8103  
    135135
    136136<div class="tablenav">
     137
     138<?php
     139$pagenum = absint( $_GET['pagenum'] );
     140if ( empty($pagenum) )
     141    $pagenum = 1;
     142if( !$catsperpage || $catsperpage < 0 )
     143    $catsperpage = 20;
     144
     145$page_links = paginate_links( array(
     146    'base' => add_query_arg( 'pagenum', '%#%' ),
     147    'format' => '',
     148    'total' => ceil(wp_count_terms('category') / $catsperpage),
     149    'current' => $pagenum
     150));
     151
     152if ( $page_links )
     153    echo "<div class='tablenav-pages'>$page_links</div>";
     154?>
    137155
    138156<div class="alignleft">
     
    157175    <tbody id="the-list" class="list:cat">
    158176<?php
    159 cat_rows();
     177cat_rows(0, 0, 0, $pagenum, $catsperpage);
    160178?>
    161179    </tbody>
     
    164182
    165183<div class="tablenav">
     184
     185<?php
     186if ( $page_links )
     187    echo "<div class='tablenav-pages'>$page_links</div>";
     188?>
    166189<br class="clear" />
    167190</div>
  • branches/crazyhorse/wp-admin/css/press-this.css

    r8071 r8103  
    450450    padding-bottom: 2px;
    451451}
     452#photo_saving {
     453margin-bottom: 8px;
     454}
  • branches/crazyhorse/wp-admin/edit-pages.php

    r7998 r8103  
    118118
    119119<div class="tablenav">
     120
     121<?php
     122$pagenum = absint( $_GET['pagenum'] );
     123if ( empty($pagenum) )
     124    $pagenum = 1;
     125if( !$per_page || $pre_page < 0 )
     126    $per_page = 20;
     127
     128$num_pages = ceil(count($posts) / $per_page);
     129$page_links = paginate_links( array(
     130    'base' => add_query_arg( 'pagenum', '%#%' ),
     131    'format' => '',
     132    'total' => $num_pages,
     133    'current' => $pagenum
     134));
     135
     136if ( $page_links )
     137    echo "<div class='tablenav-pages'>$page_links</div>";
     138?>
    120139
    121140<div class="alignleft">
     
    152171  </thead>
    153172  <tbody>
    154   <?php page_rows($posts); ?>
     173  <?php page_rows($posts, $pagenum, $per_page); ?>
    155174  </tbody>
    156175</table>
     
    170189
    171190<div class="tablenav">
     191<?php
     192if ( $page_links )
     193    echo "<div class='tablenav-pages'>$page_links</div>";
     194?>
    172195<br class="clear" />
    173196</div>
  • branches/crazyhorse/wp-admin/gears-manifest.php

    r8066 r8103  
    8888{
    8989"betaManifestVersion" : 1,
    90 "version" : "<?php echo $man_version; ?>_20080606",
     90"version" : "<?php echo $man_version; ?>_20080613",
    9191"entries" : [
    9292<?php echo $defaults; ?>
     
    178178{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=3091" },
    179179{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=3091" },
     180{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=3091" },
    180181{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=3091" },
    181182
  • branches/crazyhorse/wp-admin/import/wp-cat2tag.php

    r7897 r8103  
    2525
    2626    function populate_cats() {
    27         global $wpdb;
    2827
    2928        $categories = get_categories('get=all');
    3029        foreach ( $categories as $category ) {
    3130            $this->all_categories[] = $category;
    32             if ( tag_exists( $wpdb->escape($category->name) ) )
     31            if ( is_term( $category->slug, 'post_tag' ) )
    3332                $this->hybrids_ids[] = $category->term_id;
    3433        }
     
    3635
    3736    function populate_tags() {
    38         global $wpdb;
    3937
    4038        $tags = get_terms( array('post_tag'), 'get=all' );
    4139        foreach ( $tags as $tag ) {
    4240            $this->all_tags[] = $tag;
    43             if ( $this->_category_exists($tag->term_id) )
     41            if ( is_term( $tag->slug, 'category' ) )
    4442                $this->hybrids_ids[] = $tag->term_id;
    4543        }
     
    5351
    5452        if ( $cat_num > 0 ) {
    55             echo '<h2>Convert Categories (' . $cat_num . ') to Tags.</h2>';
     53            echo '<h2>' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
    5654            echo '<div class="narrow">';
    5755            echo '<p>' . __('Hey there. Here you can selectively converts existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
     
    5957
    6058            $this->categories_form();
    61         } elseif ( $hyb_num > 0 ) {
    62              echo '<p>' . __('You have no categories that can be converted. However some of your categories are both a tag and a category.') . '</p>';
    6359        } else {
    6460            echo '<p>'.__('You have no categories to convert!').'</p>';
     
    9389
    9490<form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
    95 <p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()">
     91<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()" />
    9692<?php wp_nonce_field('import-cat2tag'); ?></p>
    9793<ul style="list-style:none">
    98 <?php
    99         $hier = _get_term_hierarchy('category');
     94
     95<?php   $hier = _get_term_hierarchy('category');
    10096
    10197        foreach ($this->all_categories as $category) {
    10298            $category = sanitize_term( $category, 'category', 'display' );
    10399
    104             if ( (int) $category->parent == 0 ) {
    105                 if ( in_array( intval($category->term_id),  $this->hybrids_ids ) ) {
    106 ?>
    107     <li style="color:#777;padding-left:1.3em;"><?php echo $category->name . ' (' . $category->count . ') *'; ?></li>
    108 <?php
    109                 } else {
    110 ?>
     100            if ( (int) $category->parent == 0 ) { ?>
     101
    111102    <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php
    112103
    113                     if ( isset($hier[$category->term_id]) )
    114                         $this->_category_children($category, $hier);
    115 ?></li>
    116 <?php
    117                 }
    118             }
    119         }
    120 ?>
     104                 if ( in_array( intval($category->term_id),  $this->hybrids_ids ) )
     105                    echo ' <a href="#note"> * </a>';
     106               
     107                if ( isset($hier[$category->term_id]) )
     108                    $this->_category_children($category, $hier); ?></li>
     109<?php       }
     110        } ?>
    121111</ul>
    122112
    123 <?php
    124         if ( ! empty($this->hybrids_ids) ) {
    125             echo '<p>' . __('* This category is also a tag. It cannot be convert again.') . '</p>';
    126         }
    127 ?>
     113<?php   if ( ! empty($this->hybrids_ids) )
     114            echo '<p><a name="note"></a>' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '</p>'; ?>
     115
    128116<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
    129117</form>
    130118
    131 <?php
    132     }
     119<?php }
    133120
    134121    function tags_tab() {
     
    139126
    140127        if ( $tags_num > 0 ) {
    141             echo '<h2>Convert Tags (' . $tags_num . ') to Categories.</h2>';
     128            echo '<h2>' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
    142129            echo '<div class="narrow">';
    143130            echo '<p>' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
    144131            echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
    145            
    146            
     132
    147133            $this->tags_form();
    148         } elseif ( $hyb_num > 0 ) {
    149              echo '<p>' . __('You have no tags that can be converted. However some of your tags are both a tag and a category.') . '</p>';
    150134        } else {
    151135            echo '<p>'.__('You have no tags to convert!').'</p>';
     
    180164
    181165<form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
    182 <p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()">
     166<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
    183167<?php wp_nonce_field('import-cat2tag'); ?></p>
    184168<ul style="list-style:none">
    185 <?php
    186         foreach ( $this->all_tags as $tag ) {
    187             if ( in_array( intval($tag->term_id),  $this->hybrids_ids ) ) {
    188 ?>
    189     <li style="color:#777;padding-left:1.3em;"><?php echo attribute_escape($tag->name) . ' (' . $tag->count . ') *'; ?></li>
    190 <?php
    191             } else {
    192 ?>
    193     <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label></li>
    194 
    195 <?php
    196             }
    197         }
    198 ?>
     169
     170<?php   foreach ( $this->all_tags as $tag ) { ?>
     171    <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id),  $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>
     172
     173<?php   } ?>
    199174</ul>
    200175
    201 <?php   
    202         if ( ! empty($this->hybrids_ids) )
    203             echo '<p>' . __('* This tag is also a category. It cannot be converted again.') . '</p>';
    204 ?>
     176<?php   if ( ! empty($this->hybrids_ids) )
     177            echo '<p><a name="note"></a>' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '</p>'; ?>
    205178
    206179<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php _e('Convert Tags to Categories'); ?>" /></p>
    207180</form>
    208181
    209 <?php
    210     }
    211 
    212     function _category_children($parent, $hier) {
    213 ?>
     182<?php }
     183
     184    function _category_children($parent, $hier) { ?>
    214185
    215186        <ul style="list-style:none">
    216 <?php
    217         foreach ($hier[$parent->term_id] as $child_id) {
    218             $child =& get_category($child_id);
    219            
    220             if ( in_array( intval($child->term_id), $this->hybrids_ids ) ) {
    221 ?>
    222         <li style="color:#777;padding-left:1.3em;"><?php echo $child->name . ' (' . $child->count . ') *'; ?></li>
    223 <?php
    224             } else {
    225 ?>
    226         <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label>
    227 <?php
     187<?php   foreach ($hier[$parent->term_id] as $child_id) {
     188            $child =& get_category($child_id); ?>
     189        <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label><?php
     190
     191            if ( in_array( intval($child->term_id), $this->hybrids_ids ) )
     192                echo ' <a href="#note"> * </a>';
    228193
    229194            if ( isset($hier[$child->term_id]) )
    230                 $this->_category_children($child, $hier);
    231 ?>      </li>
    232 <?php
    233             }
    234         }
    235 ?>
    236         </ul>
    237 <?php
     195                $this->_category_children($child, $hier); ?></li>
     196<?php   } ?>
     197        </ul><?php
    238198    }
    239199
     
    253213        global $wpdb;
    254214
    255         if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) {
    256             echo '<div class="narrow">';
    257             echo '<p>' . sprintf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';
    258             echo '</div>';
    259             return;
     215        if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) { ?>
     216            <div class="narrow">
     217            <p><?php printf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag'); ?></p>
     218            </div>
     219<?php       return;
    260220        }
    261221
    262222        if ( empty($this->categories_to_convert) )
    263223            $this->categories_to_convert = $_POST['cats_to_convert'];
     224
    264225        $hier = _get_term_hierarchy('category');
     226        $hybrid_cats = $clear_parents = $parents = false;
     227        $clean_term_cache = $clean_cat_cache = array();
     228        $default_cat = get_option('default_category');
    265229
    266230        echo '<ul>';
     
    269233            $cat_id = (int) $cat_id;
    270234
    271             echo '<li>' . sprintf(__('Converting category #%s ... '),  $cat_id);
    272 
    273             if (!$this->_category_exists($cat_id)) {
    274                 _e('Category doesn\'t exist!');
     235            if ( ! $this->_category_exists($cat_id) ) {
     236                echo '<li>' . sprintf( __('Category %s doesn\'t exist!'),  $cat_id ) . "</li>\n";
    275237            } else {
    276238                $category =& get_category($cat_id);
    277 
    278                 if ( tag_exists($wpdb->escape($category->name)) ) {
    279                     _e('Category is already a tag.');
    280                     echo '</li>';
     239                echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '),  $category->name);
     240
     241                // If the category is the default, leave category in place and create tag.
     242                if ( $default_cat == $category->term_id ) {
     243
     244                    if ( ! ($id = is_term( $category->slug, 'post_tag' ) ) )
     245                        $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
     246                   
     247                    $id = $id['term_taxonomy_id'];
     248                    $posts = get_objects_in_term($category->term_id, 'category');
     249                    $term_order = 0;
     250
     251                    foreach ( $posts as $post ) {
     252                        $values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
     253                        clean_post_cache($post);
     254                    }
     255                   
     256                    if ( $values ) {
     257                        $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
     258
     259                        $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $category->count, $category->term_id) );
     260                    }
     261
     262                    echo __('Converted successfully.') . "</li>\n";
    281263                    continue;
    282264                }
    283 
    284                 // If the category is the default, leave category in place and create tag.
    285                 if ( get_option('default_category') == $category->term_id ) {
    286                     $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
    287                     $id = $id['term_taxonomy_id'];
    288                     $posts = get_objects_in_term($category->term_id, 'category');
    289                     foreach ( $posts as $post ) {
    290                         if ( !$wpdb->get_var( $wpdb->prepare("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $post, $id) ) )
    291                             $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES (%d, %d)", $post, $id) );
     265               
     266                // if tag already exists, add it to all posts in the category
     267                if ( $tag_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $category->term_id) ) ) {
     268                    $objects_ids = get_objects_in_term($category->term_id, 'category');
     269                    $tag_ttid = (int) $tag_ttid;
     270                    $term_order = 0;
     271
     272                    foreach ( $objects_ids as $object_id )
     273                        $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tag_ttid, $term_order);
     274
     275                    if ( $values ) {
     276                        $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
     277
     278                        $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag_ttid) );
     279                        $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $count, $category->term_id) );
     280                    }
     281                    echo __('Tag added to all posts in this category.') . " *</li>\n";
     282
     283                    $hybrid_cats = true;
     284                    $clean_term_cache[] = $category->term_id;
     285                    $clean_cat_cache[] = $category->term_id;
     286
     287                    continue;
     288                }
     289
     290                $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
     291                if ( $tt_ids ) {
     292                    $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
     293                    foreach ( (array) $posts as $post )
    292294                        clean_post_cache($post);
    293                     }
    294                 } else {
    295                     $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
    296                     if ( $tt_ids ) {
    297                         $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
    298                         foreach ( (array) $posts as $post )
    299                             clean_post_cache($post);
    300                     }
    301 
    302                     // Change the category to a tag.
    303                     $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
    304 
    305                     $terms = $wpdb->get_col( $wpdb->prepare("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
    306                     foreach ( (array) $terms as $term )
    307                         clean_category_cache($term);
    308 
    309                     // Set all parents to 0 (root-level) if their parent was the converted tag
    310                     $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
    311295                }
    312                 // Clean the cache
    313                 clean_category_cache($category->term_id);
    314 
    315                 _e('Converted successfully.');
     296
     297                // Change the category to a tag.
     298                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
     299
     300                // Set all parents to 0 (root-level) if their parent was the converted tag
     301                $parents = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
     302
     303                if ( $parents ) $clear_parents = true;
     304                $clean_cat_cache[] = $category->term_id;
     305                echo __('Converted successfully.') . "</li>\n";
    316306            }
    317 
    318             echo '</li>';
    319         }
    320 
     307        }
    321308        echo '</ul>';
     309
     310        if ( ! empty($clean_term_cache) ) {
     311            $clean_term_cache = array_unique(array_values($clean_term_cache));
     312            foreach ( $clean_term_cache as $id )
     313                wp_cache_delete($id, 'post_tag');
     314        }
     315
     316        if ( ! empty($clean_cat_cache) ) {
     317            $clean_cat_cache = array_unique(array_values($clean_cat_cache));
     318            foreach ( $clean_cat_cache as $id )
     319                wp_cache_delete($id, 'category');
     320        }
     321
     322        if ( $clear_parents ) delete_option('category_children');
     323
     324        if ( $hybrid_cats )
     325            echo '<p>' . sprintf( __('* This category is also a tag. The converter has added that tag to all posts currently in the category. If you want to remove it, please confirm that all tags were added successfully, then delete it from the <a href="%s">Manage Categories</a> page.'), 'categories.php') . '</p>';
    322326        echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag' ) . '</p>';
    323327    }
     
    333337        }
    334338
    335         if ( empty($this->categories_to_convert) )
     339        if ( empty($this->tags_to_convert) )
    336340            $this->tags_to_convert = $_POST['tags_to_convert'];
    337341
    338         $clean_cache = array();
     342        $hybrid_tags = $clear_parents = false;
     343        $clean_cat_cache = $clean_term_cache = array();
     344        $default_cat = get_option('default_category');
    339345        echo '<ul>';
    340346
     
    342348            $tag_id = (int) $tag_id;
    343349
    344             echo '<li>' . sprintf(__('Converting tag #%s ... '),  $tag_id);
    345 
    346             if ( ! is_term($tag_id, 'post_tag') ) {
    347                 _e('Tag doesn\'t exist!');
    348             } else {
    349 
    350                 if ( is_term($tag_id, 'category') ) {
    351                     _e('This Tag is already a Category.');
    352                     echo '</li>';
     350            if ( $tag = get_term( $tag_id, 'post_tag' ) ) {
     351                printf('<li>' . __('Converting tag <strong>%s</strong> ... '),  $tag->name);
     352
     353                if ( $cat_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $tag->term_id) ) ) {
     354                    $objects_ids = get_objects_in_term($tag->term_id, 'post_tag');
     355                    $cat_ttid = (int) $cat_ttid;
     356                    $term_order = 0;
     357
     358                    foreach ( $objects_ids as $object_id ) {
     359                        $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $cat_ttid, $term_order);
     360                        clean_post_cache($object_id);
     361                    }
     362
     363                    if ( $values ) {
     364                        $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
     365
     366                        if ( $default_cat != $tag->term_id ) {
     367                            $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag->term_id) );
     368                            $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'category'", $count, $tag->term_id) );
     369                        }
     370                    }
     371
     372                    $hybrid_tags = true;
     373                    $clean_term_cache[] = $tag->term_id;
     374                    $clean_cat_cache[] = $tag->term_id;
     375                    echo __('All posts were added to the category with the same name.') . " *</li>\n";
     376
    353377                    continue;
    354378                }
    355379
    356                 $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
    357                 if ( $tt_ids ) {
    358                         $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
    359                     foreach ( (array) $posts as $post )
    360                         clean_post_cache($post);
    361                 }
    362 
    363380                // Change the tag to a category.
    364                 $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
    365                 if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) )
     381                $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
     382                if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) ) {
    366383                    $reset_parent = '';
    367                 else $reset_parent = ", parent = '0'";
    368 
    369                 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
    370 
    371                 // Clean the cache
    372                 $clean_cache[] = $tag_id;
    373 
    374                 _e('Converted successfully.');
     384                    $clear_parents = true;
     385                } else
     386                    $reset_parent = ", parent = '0'";
     387
     388                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
     389
     390                $clean_term_cache[] = $tag->term_id;
     391                $clean_cat_cache[] = $cat['term_id'];
     392                echo __('Converted successfully.') . "</li>\n";
     393
     394            } else {
     395                printf( '<li>' . __('Tag #%s doesn\'t exist!') . "</li>\n",  $tag_id );
    375396            }
    376 
    377             echo '</li>';
    378         }
    379 
    380         clean_term_cache( $clean_cache, 'post_tag' );
    381         delete_option('category_children');
    382        
     397        }
     398
     399        if ( ! empty($clean_term_cache) ) {
     400            $clean_term_cache = array_unique(array_values($clean_term_cache));
     401            foreach ( $clean_term_cache as $id )
     402                wp_cache_delete($id, 'post_tag');
     403        }
     404
     405        if ( ! empty($clean_cat_cache) ) {
     406            $clean_cat_cache = array_unique(array_values($clean_cat_cache));
     407            foreach ( $clean_cat_cache as $id )
     408                wp_cache_delete($id, 'category');
     409        }
     410
     411        if ( $clear_parents ) delete_option('category_children');
     412
    383413        echo '</ul>';
     414        if ( $hybrid_tags )
     415            echo '<p>' . sprintf( __('* This tag is also a category. The converter has added all posts from it to the category. If you want to remove it, please confirm that all posts were added successfully, then delete it from the <a href="%s">Manage Tags</a> page.'), 'edit-tags.php') . '</p>';
    384416        echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3' ) . '</p>';
    385417    }
     
    402434                    $this->convert_categories();
    403435                break;
    404                
     436
    405437                case 3 :
    406438                    $this->tags_tab();
    407439                break;
    408                
     440
    409441                case 4 :
    410442                    check_admin_referer('import-cat2tag');
  • branches/crazyhorse/wp-admin/includes/dashboard.php

    r8016 r8103  
    316316    @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
    317317    $rss = @fetch_rss( $url );
    318     if ( isset($rss->items) && 1 < count($rss->items) )  {// Technorati returns a 1-item feed when it has no results
     318    if ( isset($rss->items) && 0 < count($rss->items) )  {
    319319
    320320        echo "<ul>\n";
  • branches/crazyhorse/wp-admin/includes/file.php

    r8053 r8103  
    4141
    4242    return $real_file;
     43}
     44//$folder = Full path to folder
     45//$levels = Levels of folders to follow, Default: 100 (PHP Loop limit)
     46function list_files( $folder = '', $levels = 100 ) {
     47    if( empty($folder) )
     48        return false;
     49
     50    if( ! $levels )
     51        return false;
     52
     53    $files = array();
     54    if ( $dir = @opendir( $folder ) ) {
     55        while (($file = readdir( $dir ) ) !== false ) {
     56            if ( in_array($file, array('.', '..') ) )
     57                continue;
     58            if ( is_dir( $folder . '/' . $file ) ) {
     59                $files2 = list_files( $folder . '/' . $file, $levels - 1);
     60                if( $files2 )
     61                    $files = array_merge($files, $files2 );
     62                else
     63                    $files[] = $folder . '/' . $file . '/';
     64            } else {
     65                $files[] = $folder . '/' . $file;
     66            }
     67        }
     68    }
     69    @closedir( $dir );
     70    return $files;
    4371}
    4472
  • branches/crazyhorse/wp-admin/includes/plugin.php

    r8068 r8103  
    137137}
    138138
    139 //Replaces reactivate_all_plugins() / deactivate_all_plugins()  = 'deactivated_plugins' is now useless
    140139function activate_plugins($plugins, $redirect = '') {
    141140    if ( !is_array($plugins) )
     
    168167
    169168    ob_start();
    170     $url = wp_nonce_url('plugins.php?action=delete-selected&' . implode('&', $checked), 'mass-manage-plugins');
     169    $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-manage-plugins');
    171170    if ( false === ($credentials = request_filesystem_credentials($url)) ) {
    172171        $data = ob_get_contents();
     
    244243    // plugins.
    245244    foreach ( $check_plugins as $check_plugin ) {
    246         if ( !file_exists(WP_PLUGIN_DIR . '/' . $check_plugin) ) {
    247             $current = get_option('active_plugins');
    248             $key = array_search($check_plugin, $current);
    249             if ( false !== $key && NULL !== $key ) {
    250                 unset($current[$key]);
    251                 update_option('active_plugins', $current);
    252             }
     245        $result = validate_plugin($check_plugin);
     246        if ( is_wp_error( $result ) ) {
     247            deactivate_plugins( $check_plugin, true);
    253248        }
    254249    }
  • branches/crazyhorse/wp-admin/includes/template.php

    r7956 r8103  
    55//
    66
    7 // Dandy new recursive multiple category stuff.
    8 function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
    9     if ( !$categories ) {
     7// Ugly recursive category stuff.
     8function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
     9    $count = 0;
     10    _cat_rows($categories, $count, $parent, $level, $page, $per_page);
     11}
     12
     13function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
     14    if ( empty($categories) ) {
    1015        $args = array('hide_empty' => 0);
    1116        if ( !empty($_GET['s']) )
     
    1419    }
    1520
     21    if ( !$categories )
     22        return false;
     23
    1624    $children = _get_term_hierarchy('category');
    1725
    18     if ( $categories ) {
    19         ob_start();
    20         foreach ( $categories as $category ) {
    21             if ( $category->parent == $parent) {
    22                 echo "\t" . _cat_row( $category, $level );
    23                 if ( isset($children[$category->term_id]) )
    24                     cat_rows( $category->term_id, $level +1, $categories );
     26    $start = ($page - 1) * $per_page;
     27    $end = $start + $per_page;
     28    $i = -1;
     29    ob_start();
     30    foreach ( $categories as $category ) {
     31        if ( $count >= $end )
     32            break;
     33
     34        $i++;
     35
     36        if ( $category->parent != $parent )
     37            continue;
     38
     39        // If the page starts in a subtree, print the parents.
     40        if ( $count == $start && $category->parent > 0 ) {
     41            $my_parents = array();
     42            $my_parent = $category->parent;
     43            while ( $my_parent) {
     44                $my_parent = get_category($my_parent);
     45                $my_parents[] = $my_parent;
     46                if ( !$my_parent->parent )
     47                    break;
     48                $my_parent = $my_parent->parent;
    2549            }
    26         }
    27         $output = ob_get_contents();
    28         ob_end_clean();
    29 
    30         $output = apply_filters('cat_rows', $output);
    31 
    32         echo $output;
    33     } else {
    34         return false;
    35     }
     50            $num_parents = count($my_parents);
     51            while( $my_parent = array_pop($my_parents) ) {
     52                echo "\t" . _cat_row( $my_parent, $level - $num_parents );
     53                $num_parents--;
     54            }
     55        }
     56
     57        if ( $count >= $start )
     58            echo "\t" . _cat_row( $category, $level );
     59
     60        unset($categories[$i]); // Prune the working set       
     61        $count++;
     62
     63        if ( isset($children[$category->term_id]) )
     64            _cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
     65
     66    }
     67
     68    $output = ob_get_contents();
     69    ob_end_clean();
     70
     71    $output = apply_filters('cat_rows', $output);
     72
     73    echo $output;
    3674}
    3775
     
    361399 * otherwise, display the row and its children in subsequent rows
    362400 */
    363 function display_page_row( $page, &$children_pages, $level = 0 ) {
     401function display_page_row( $page, $level = 0 ) {
    364402    global $post;
    365403    static $class;
     
    485523
    486524<?php
    487 
    488     if ( ! $children_pages )
    489         return true;
    490 
    491     for ( $i = 0; $i < count($children_pages); $i++ ) {
    492 
    493         $child = $children_pages[$i];
    494 
    495         if ( $child->post_parent == $id ) {
    496             array_splice($children_pages, $i, 1);
    497             display_page_row($child, $children_pages, $level+1);
    498             $i = -1; //as numeric keys in $children_pages are not preserved after splice
    499         }
    500     }
    501525}
    502526
     
    504528 * displays pages in hierarchical order
    505529 */
    506 function page_rows( $pages ) {
    507     if ( ! $pages )
     530
     531function page_rows($pages, $pagenum = 1, $per_page = 20) {
     532    $level = 0;
     533
     534    if ( ! $pages ) {
    508535        $pages = get_pages( array('sort_column' => 'menu_order') );
    509536
    510     if ( ! $pages )
    511         return false;
     537        if ( ! $pages )
     538            return false;
     539    }
    512540
    513541    // splice pages into two parts: those without parent and those with parent
    514 
    515542    $top_level_pages = array();
    516543    $children_pages  = array();
    517544
     545    // If searching, ignore hierarchy and treat everything as top level, otherwise split
     546    // into top level and children
     547    if ( empty($_GET['s']) )  {
     548        foreach ( $pages as $page ) {
     549            // catch and repair bad pages
     550            if ( $page->post_parent == $page->ID ) {
     551                $page->post_parent = 0;
     552                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
     553                clean_page_cache( $page->ID );
     554            }
     555   
     556            if ( 0 == $page->post_parent )
     557                $top_level_pages[] = $page;
     558            else
     559                $children_pages[] = $page;
     560        }
     561
     562        $pages = &$top_level_pages;
     563    }
     564
     565    $count = 0;
     566    $start = ($pagenum - 1) * $per_page;
     567    $end = $start + $per_page;
    518568    foreach ( $pages as $page ) {
    519 
    520         // catch and repair bad pages
    521         if ( $page->post_parent == $page->ID ) {
    522             $page->post_parent = 0;
    523             $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
    524             clean_page_cache( $page->ID );
    525         }
    526 
    527         if ( 0 == $page->post_parent )
    528             $top_level_pages[] = $page;
    529         else
    530             $children_pages[] = $page;
    531     }
    532 
    533     foreach ( $top_level_pages as $page )
    534         display_page_row($page, $children_pages, 0);
    535 
    536     /*
    537      * display the remaining children_pages which are orphans
    538      * having orphan requires parental attention
    539      */
    540      if ( count($children_pages) > 0 ) {
    541         $empty_array = array();
    542         foreach ( $children_pages as $orphan_page ) {
    543             clean_page_cache( $orphan_page->ID);
    544             display_page_row( $orphan_page, $empty_array, 0 );
    545         }
    546      }
     569        if ( $count >= $end )
     570            break;
     571
     572        $i++;
     573
     574        if ( $count >= $start )
     575            echo "\t" . display_page_row( $page, $level );
     576
     577        $count++;
     578
     579        if ( isset($children_pages) )
     580            _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
     581    }
     582}
     583
     584function _page_rows( $pages, &$count, $parent, $level, $pagenum, $per_page ) {
     585    $start = ($pagenum - 1) * $per_page;
     586    $end = $start + $per_page;
     587    $i = -1;
     588    foreach ( $pages as $page ) {
     589        if ( $count >= $end )
     590            break;
     591
     592        $i++;
     593
     594        if ( $page->post_parent != $parent )
     595            continue;
     596
     597        // If the page starts in a subtree, print the parents.
     598        if ( $count == $start && $page->post_parent > 0 ) {
     599            $my_parents = array();
     600            $my_parent = $page->post_parent;
     601            while ( $my_parent) {
     602                $my_parent = get_post($my_parent);
     603                $my_parents[] = $my_parent;
     604                if ( !$my_parent->post_parent )
     605                    break;
     606                $my_parent = $my_parent->post_parent;
     607            }
     608            $num_parents = count($my_parents);
     609            while( $my_parent = array_pop($my_parents) ) {
     610                echo "\t" . display_page_row( $my_parent, $level - $num_parents );
     611                $num_parents--;
     612            }
     613        }
     614
     615        if ( $count >= $start )
     616            echo "\t" . display_page_row( $page, $level );
     617
     618        unset($pages[$i]); // Prune the working set     
     619        $count++;
     620
     621        _page_rows( $pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
     622    }
    547623}
    548624
  • branches/crazyhorse/wp-admin/plugins.php

    r8068 r8103  
    3131            break;
    3232        case 'activate-selected':
    33             check_admin_referer('mass-manage-plugins');
     33            check_admin_referer('bulk-manage-plugins');
    3434            activate_plugins($_POST['checked'], 'plugins.php?error=true');
    3535
     
    6363            break;
    6464        case 'deactivate-selected':
    65             check_admin_referer('mass-manage-plugins');
     65            check_admin_referer('bulk-manage-plugins');
    6666            deactivate_plugins($_POST['checked']);
    6767            $deactivated = array();
     
    7575            if( ! current_user_can('delete_plugins') )
    7676                wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
    77             check_admin_referer('mass-manage-plugins');
    78             $plugins = $_REQUEST['checked'];
     77           
     78            check_admin_referer('bulk-manage-plugins');
     79           
     80            $plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
    7981            include(ABSPATH . 'wp-admin/update.php');
    8082
    8183            $title = __('Delete Plugin');
    8284            $parent_file = 'plugins.php';
    83 
     85           
     86            if( ! isset($_REQUEST['verify-delete']) ) {
     87                wp_enqueue_script('jquery');
     88                require_once('admin-header.php');
     89                ?>
     90            <div class="wrap">
     91                <h2><?php _e('Delete Plugin(s)'); ?></h2>       
     92                <?php
     93                    $files_to_delete = $plugin_info = array();
     94                    foreach( (array) $plugins as $plugin ) {
     95                        if( '.' == dirname($plugin) ) {
     96                            $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
     97                            if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
     98                                $plugin_info[ $plugin ] = $data;
     99                        } else {
     100                            //Locate all the files in that folder:
     101                            $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
     102                            if( $files ) {
     103                                $files_to_delete = array_merge($files_to_delete, $files);
     104                            }
     105                            //Get plugins list from that folder
     106                            if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
     107                                $plugin_info = array_merge($plugin_info, $folder_plugins);
     108                        }
     109                    }
     110                ?>
     111                <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
     112                <p>
     113                    <ul>
     114                        <?php
     115                        foreach( $plugin_info as $plugin )
     116                            echo '<li>', $plugin['Title'], ' ', __('By'), ' ', $plugin['Author'], '</li>';
     117                        ?>
     118                    </ul>
     119                </p>
     120                <p><?php _e('Are you sure you wish to delete these files?') ?></p>
     121                <form method="post" action="<?php echo clean_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
     122                    <input type="hidden" name="verify-delete" value="1" />
     123                    <input type="hidden" name="delete-selected" value="1" />
     124                    <?php
     125                        foreach( (array)$plugins as $plugin ) {
     126                            $plugin = attribute_escape($plugin);
     127                            echo "<input type='hidden' name='checked[]' value='$plugin' />";
     128                        }
     129                    ?>
     130                    <?php wp_nonce_field('bulk-manage-plugins') ?>
     131                    <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
     132                </form>
     133                <form method="post" action="<?php echo clean_url(wp_get_referer()); ?>" style="display:inline;">
     134                    <input type="submit" name="submit" value="<?php _e('No, Return me to the plugin list') ?>" class="button" />
     135                </form>
     136
     137                <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
     138                <div id="files-list" style="display:none;">
     139                    <ul>
     140                    <?php
     141                        foreach( (array)$files_to_delete as $file ) {
     142                            $file = str_replace(ABSPATH, '', $file);
     143                            echo "<li>$file</li>";
     144                        }
     145                    ?>
     146                    </ul>
     147                </div>             
     148            </div>
     149                <?php
     150                require_once('admin-footer.php');
     151                exit;
     152            }
    84153            $delete_result = delete_plugins($plugins);
    85154
     
    87156
    88157            break;
    89         default:
    90             var_dump("Unknown Action $action");
    91158    }
    92159}
     
    225292<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
    226293<form method="post" action="<?php echo admin_url('plugins.php') ?>">
    227 <?php wp_nonce_field('mass-manage-plugins') ?>
     294<?php wp_nonce_field('bulk-manage-plugins') ?>
    228295
    229296<div class="tablenav">
     
    241308<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
    242309<form method="post" action="<?php echo admin_url('plugins.php') ?>">
    243 <?php wp_nonce_field('mass-manage-plugins') ?>
     310<?php wp_nonce_field('bulk-manage-plugins') ?>
    244311
    245312<div class="tablenav">
     
    258325<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3>
    259326<form method="post" action="<?php echo admin_url('plugins.php') ?>">
    260 <?php wp_nonce_field('mass-manage-plugins') ?>
    261 
     327<?php wp_nonce_field('bulk-manage-plugins') ?>
     328
     329<?php if ( ! empty($available_plugins) ) : ?>
    262330<div class="tablenav">
    263331    <div class="alignleft">
     
    271339<?php print_plugins_table($available_plugins, 'available') ?>
    272340</form>
     341<?php endif; ?>
    273342
    274343<h2><?php _e('Get More Plugins'); ?></h2>
  • branches/crazyhorse/wp-admin/press-this.php

    r8071 r8103  
    7777            <p class="submit">         
    7878            <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
    79             <img src="images/loading.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
     79            <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>
    8080            </p>
    8181        </div> 
     
    155155
    156156if($_REQUEST['ajax'] == 'photo_images') {
    157 $url = urldecode($url);
    158 $url = str_replace(' ', '%20', $url);
    159 
     157    error_log('photo images');
    160158    function get_images_from_uri($uri) {
    161         if(preg_match('/\.(jpg|png|gif)/', $uri)) return "'".$uri."'";
     159        if(preg_match('/\.(jpg|png|gif)/', $uri))
     160            return "'".$uri."'";
     161       
    162162        $content = wp_remote_fopen($uri);
    163163        $host = parse_url($uri);
     164       
    164165        if ( false === $content ) return '';
    165 
    166         $pattern = '/<img[^>]+src=[\'"]([^\'" >]+?)[\'" >]/is';
     166       
     167        $pattern = '/<img ([^>]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is';
    167168        preg_match_all($pattern, $content, $matches);
    168         if ( empty($matches[1]) ) return '';
    169    
     169        if ( empty($matches[1]) ) { error_log('empty'); return ''; };
    170170        $sources = array();
    171171
    172         foreach ($matches[1] as $src) {
    173             if ( false !== strpos($src, '&') ) continue;
     172        foreach ($matches[3] as $src) {
     173            error_log($src);
     174            #if ( false !== strpos($src, '&') ) continue;
    174175                if(strpos($src, 'http') === false) {
    175176                    if(strpos($src, '../') === false && strpos($src, './') === false) {
     
    179180                    }
    180181                }
     182               
    181183                $sources[] = $src;
    182184        }
     
    184186    }
    185187   
    186        
     188    $url = urldecode($url);
     189    $url = str_replace(' ', '%20', $url);
    187190    echo 'new Array('.get_images_from_uri($url).')';
    188191die;       
     
    367370                set_menu('text');
    368371                set_title('<?php _e('Text') ?>');
    369                 set_editor("<?php echo $selection; ?>");
     372                <?php if($selection) { ?>
     373                set_editor('<?php echo '<p><a href="'.$url.'">'.$selection.'</a> </p> '; ?>');
     374                <?php } else { ?>
     375                set_editor('<?php echo '<p><a href="'.$url.'">'.$title.'</a> </p> '; ?>');
     376                <?php } ?>
    370377                return false;
    371378            break;
     
    376383                set_menu('quote');
    377384                set_title('<?php _e('Quote') ?>');
    378                 set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo ''; ?>'><?php echo ''; ?></a></cite> </p></blockquote>");
     385                set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?></a></cite> </p></blockquote>");
    379386
    380387                return false;
     
    422429                <?php if($selection) { ?>
    423430                    set_editor("<?php echo $selection; ?>");
    424                 <?php } else { ?>
    425                     set_editor('')
    426431                <?php } ?>
    427432                jQuery('#extra_fields').show();
    428                 jQuery('#extra_fields').prepend('<h2 id="waiting"><img src="images/loading.gif" alt="" /> Loading...</h2>');
     433                jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /> Loading...</h2>');
    429434                jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&u='.attribute_escape($url); ?>');
    430435                jQuery.ajax({
     
    435440                    dataType : "script",
    436441                    success : function() {
    437                         jQuery('#waiting').innerHTML('');
     442                        jQuery('#waiting').remove();
    438443                    }
    439444                });
     
    490495                    <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
    491496                    <div class="editor-container">
    492                         <textarea name="content" id="content" style="width:100%;" class="mceEditor">
    493                         <?php echo $selection; ?>
    494                         </textarea>
     497                        <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if($selection) { ?><a href='<?php echo $url ?>'><?php echo $selection ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea>
    495498                    </div>
    496499                    </div>
  • branches/crazyhorse/wp-admin/wp-admin.css

    r8066 r8103  
    601601}
    602602
    603 #wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a {
     603#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a, #taglist a, #catlist a {
    604604    text-decoration: none;
    605605}
  • branches/crazyhorse/wp-includes/atomlib.php

    r6440 r8103  
    11<?php
    2 /*
     2/**
    33 * Atom Syndication Format PHP Library
    44 *
  • branches/crazyhorse/wp-includes/category.php

    r6655 r8103  
    11<?php
    2 
     2/**
     3 * WordPress Category API
     4 *
     5 * @package WordPress
     6 */
     7
     8/**
     9 * Retrieves all category IDs.
     10 *
     11 * @since 2.0.0
     12 * @link http://codex.wordpress.org/Function_Reference/get_all_category_ids
     13 *
     14 * @return object List of all of the category IDs.
     15 */
    316function get_all_category_ids() {
    417    if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
     
    1023}
    1124
     25/**
     26 * Retrieve list of category objects.
     27 *
     28 * If you change the type to 'link' in the arguments, then the link categories
     29 * will be returned instead. Also all categories will be updated to be backwards
     30 * compatible with pre-2.3 plugins and themes.
     31 *
     32 * @since 2.1.0
     33 * @see get_terms() Type of arguments that can be changed.
     34 * @link http://codex.wordpress.org/Function_Reference/get_categories
     35 *
     36 * @param string|array $args Optional. Change the defaults retrieving categories.
     37 * @return array List of categories.
     38 */
    1239function &get_categories($args = '') {
    1340    $defaults = array('type' => 'category');
     
    2552}
    2653
    27 // Retrieves category data given a category ID or category object.
    28 // Handles category caching.
     54/**
     55 * Retrieves category data given a category ID or category object.
     56 *
     57 * If you pass the $category parameter an object, which is assumed to be the
     58 * category row object retrieved the database. It will cache the category data.
     59 *
     60 * If you pass $category an integer of the category ID, then that category will
     61 * be retrieved from the database, if it isn't already cached, and pass it back.
     62 *
     63 * If you look at get_term(), then both types will be passed through several
     64 * filters and finally sanitized based on the $filter parameter value.
     65 *
     66 * The category will converted to maintain backwards compatibility.
     67 *
     68 * @since 2.1.0
     69 * @uses get_term() Used to get the category data from the taxonomy.
     70 *
     71 * @param int|object $category Category ID or Category row object
     72 * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
     73 * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
     74 * @return mixed Category data in type defined by $output parameter.
     75 */
    2976function &get_category($category, $output = OBJECT, $filter = 'raw') {
    3077    $category = get_term($category, 'category', $output, $filter);
     
    3784}
    3885
     86/**
     87 * Retrieve category based on URL containing the category slug.
     88 *
     89 * Breaks the $category_path parameter up to get the category slug.
     90 *
     91 * Tries to find the child path and will return it. If it doesn't find a
     92 * match, then it will return the first category matching slug, if $full_match,
     93 * is set to false. If it does not, then it will return null.
     94 *
     95 * It is also possible that it will return a WP_Error object on failure. Check
     96 * for it when using this function.
     97 *
     98 * @since 2.1.0
     99 *
     100 * @param string $category_path URL containing category slugs.
     101 * @param bool $full_match Optional. Whether should match full path or not.
     102 * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
     103 * @return null|object|array Null on failure. Type is based on $output value.
     104 */
    39105function get_category_by_path($category_path, $full_match = true, $output = OBJECT) {
    40106    $category_path = rawurlencode(urldecode($category_path));
     
    51117
    52118    if ( empty($categories) )
    53         return NULL;
     119        return null;
    54120
    55121    foreach ($categories as $category) {
     
    71137        return get_category($categories[0]->term_id, $output);
    72138
    73     return NULL;
    74 }
    75 
     139    return null;
     140}
     141
     142/**
     143 * Retrieve category object by category slug.
     144 *
     145 * @since 2.3.0
     146 *
     147 * @param string $slug The category slug.
     148 * @return object Category data object
     149 */
    76150function get_category_by_slug( $slug  ) {
    77151    $category = get_term_by('slug', $slug, 'category');
     
    82156}
    83157
    84 // Get the ID of a category from its name
     158
     159/**
     160 * Retrieve the ID of a category from its name.
     161 *
     162 * @since 1.0.0
     163 *
     164 * @param string $cat_name Optional. Default is 'General' and can be any category name.
     165 * @return int 0, if failure and ID of category on success.
     166 */
    85167function get_cat_ID($cat_name='General') {
    86168    $cat = get_term_by('name', $cat_name, 'category');
     
    90172}
    91173
    92 // Deprecate
     174
     175/**
     176 * Retrieve the category name by the category ID.
     177 *
     178 * @since 0.71
     179 * @deprecated Use get_cat_name()
     180 * @see get_cat_name() get_catname() is deprecated in favor of get_cat_name().
     181 *
     182 * @param int $cat_ID Category ID
     183 * @return string category name
     184 */
    93185function get_catname($cat_ID) {
    94186    return get_cat_name($cat_ID);
    95187}
    96188
    97 // Get the name of a category from its ID
     189
     190/**
     191 * Retrieve the name of a category from its ID.
     192 *
     193 * @since 1.0.0
     194 *
     195 * @param int $cat_id Category ID
     196 * @return string Category name
     197 */
    98198function get_cat_name($cat_id) {
    99199    $cat_id = (int) $cat_id;
     
    102202}
    103203
     204
     205/**
     206 * Check if a category is an ancestor of another category.
     207 *
     208 * You can use either an id or the category object for both parameters. If you
     209 * use an integer the category will be retrieved.
     210 *
     211 * @since 2.1.0
     212 *
     213 * @param int|object $cat1 ID or object to check if this is the parent category.
     214 * @param int|object $cat2 The child category.
     215 * @return bool Whether $cat2 is child of $cat1
     216 */
    104217function cat_is_ancestor_of($cat1, $cat2) {
    105218    if ( is_int($cat1) )
     
    117230}
    118231
     232
     233/**
     234 * Sanitizes category data based on context.
     235 *
     236 * @since 2.3.0
     237 * @uses sanitize_term() See this function for what context are supported.
     238 *
     239 * @param object|array $category Category data
     240 * @param string $context Optional. Default is 'display'.
     241 * @return object|array Same type as $category with sanitized data for safe use.
     242 */
    119243function sanitize_category($category, $context = 'display') {
    120244    return sanitize_term($category, 'category', $context);
    121245}
    122246
     247
     248/**
     249 * Sanitizes data in single category key field.
     250 *
     251 * @since 2.3.0
     252 * @uses sanitize_term_field() See function for more details.
     253 *
     254 * @param string $field Category key to sanitize
     255 * @param mixed $value Category value to sanitize
     256 * @param int $cat_id Category ID
     257 * @param string $context What filter to use, 'raw', 'display', etc.
     258 * @return mixed Same type as $value after $value has been sanitized.
     259 */
    123260function sanitize_category_field($field, $value, $cat_id, $context) {
    124261    return sanitize_term_field($field, $value, $cat_id, 'category', $context);
    125262}
    126263
    127 // Tags
    128 
     264/* Tags */
     265
     266
     267/**
     268 * Retrieves all post tags.
     269 *
     270 * @since 2.3.0
     271 * @see get_terms() For list of arguments to pass.
     272 * @uses apply_filters() Calls 'get_tags' hook on array of tags and with $args.
     273 *
     274 * @param string|array $args Tag arguments to use when retrieving tags.
     275 * @return array List of tags.
     276 */
    129277function &get_tags($args = '') {
    130278    $tags = get_terms('post_tag', $args);
     
    137285}
    138286
     287
     288/**
     289 * Retrieve post tag by tag ID or tag object.
     290 *
     291 * If you pass the $tag parameter an object, which is assumed to be the tag row
     292 * object retrieved the database. It will cache the tag data.
     293 *
     294 * If you pass $tag an integer of the tag ID, then that tag will
     295 * be retrieved from the database, if it isn't already cached, and pass it back.
     296 *
     297 * If you look at get_term(), then both types will be passed through several
     298 * filters and finally sanitized based on the $filter parameter value.
     299 *
     300 * @since 2.3.0
     301 *
     302 * @param int|object $tag
     303 * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
     304 * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
     305 * @return object|array Return type based on $output value.
     306 */
    139307function &get_tag($tag, $output = OBJECT, $filter = 'raw') {
    140308    return get_term($tag, 'post_tag', $output, $filter);
    141309}
    142310
    143 //
    144 // Cache
    145 //
    146 
     311
     312/* Cache */
     313
     314
     315/**
     316 * Update the categories cache.
     317 *
     318 * This function does not appear to be used anymore or does not appear to be
     319 * needed. It might be a legacy function left over from when there was a need
     320 * for updating the category cache.
     321 *
     322 * @since 1.5.0
     323 *
     324 * @return bool Always return True
     325 */
    147326function update_category_cache() {
    148327    return true;
    149328}
    150329
     330
     331/**
     332 * Remove the category cache data based on ID.
     333 *
     334 * @since 2.1.0
     335 * @uses clean_term_cache() Clears the cache for the category based on ID
     336 *
     337 * @param int $id Category ID
     338 */
    151339function clean_category_cache($id) {
    152340    clean_term_cache($id, 'category');
    153341}
    154342
    155 //
    156 // Private helpers
    157 //
    158 
     343
     344/**
     345 * Update category structure to old pre 2.3 from new taxonomy structure.
     346 *
     347 * This function was added for the taxonomy support to update the new category
     348 * structure with the old category one. This will maintain compatibility with
     349 * plugins and themes which depend on the old key or property names.
     350 *
     351 * The parameter should only be passed a variable and not create the array or
     352 * object inline to the parameter. The reason for this is that parameter is
     353 * passed by reference and PHP will fail unless it has the variable.
     354 *
     355 * There is no return value, because everything is updated on the variable you
     356 * pass to it. This is one of the features with using pass by reference in PHP.
     357 *
     358 * @since 2.3.0
     359 * @access private
     360 *
     361 * @param array|object $category Category Row object or array
     362 */
    159363function _make_cat_compat( &$category) {
    160364    if ( is_object($category) ) {
     
    175379}
    176380
     381
    177382?>
  • branches/crazyhorse/wp-includes/class-IXR.php

    r7615 r8103  
    1414 */
    1515
     16/**
     17 * IXR_Value
     18 *
     19 * @package IXR
     20 * @since 1.5
     21 */
    1622class IXR_Value {
    1723    var $data;
     
    121127}
    122128
    123 
     129/**
     130 * IXR_Message
     131 *
     132 * @package IXR
     133 * @since 1.5
     134 */
    124135class IXR_Message {
    125136    var $message;
     
    264275}
    265276
    266 
     277/**
     278 * IXR_Server
     279 *
     280 * @package IXR
     281 * @since 1.5
     282 */
    267283class IXR_Server {
    268284    var $data;
     
    425441}
    426442
     443/**
     444 * IXR_Request
     445 *
     446 * @package IXR
     447 * @since 1.5
     448 */
    427449class IXR_Request {
    428450    var $method;
     
    455477}
    456478
    457 
     479/**
     480 * IXR_Client
     481 *
     482 * @package IXR
     483 * @since 1.5
     484 */
    458485class IXR_Client {
    459486    var $server;
     
    566593}
    567594
    568 
     595/**
     596 * IXR_Error
     597 *
     598 * @package IXR
     599 * @since 1.5
     600 */
    569601class IXR_Error {
    570602    var $code;
     
    598630}
    599631
    600 
     632/**
     633 * IXR_Date
     634 *
     635 * @package IXR
     636 * @since 1.5
     637 */
    601638class IXR_Date {
    602639    var $year;
     
    642679}
    643680
    644 
     681/**
     682 * IXR_Base64
     683 *
     684 * @package IXR
     685 * @since 1.5
     686 */
    645687class IXR_Base64 {
    646688    var $data;
     
    653695}
    654696
    655 
     697/**
     698 * IXR_IntrospectionServer
     699 *
     700 * @package IXR
     701 * @since 1.5
     702 */
    656703class IXR_IntrospectionServer extends IXR_Server {
    657704    var $signatures;
     
    797844}
    798845
    799 
     846/**
     847 * IXR_ClientMulticall
     848 *
     849 * @package IXR
     850 * @since 1.5
     851 */
    800852class IXR_ClientMulticall extends IXR_Client {
    801853    var $calls = array();
  • branches/crazyhorse/wp-includes/class-phpass.php

    r7421 r8103  
    99
    1010#
    11 # Portable PHP password hashing framework.
    12 #
    13 # Version 0.1 / genuine.
    14 #
    1511# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
    1612# the public domain.
    1713#
    1814# There's absolutely no warranty.
    19 #
    20 # The homepage URL for this framework is:
    21 #
    22 #   http://www.openwall.com/phpass/
    2315#
    2416# Please be sure to update the Version line if you edit this file in any way.
     
    3325# requirements (there can be none), but merely suggestions.
    3426#
     27
     28/**
     29 * Portable PHP password hashing framework.
     30 *
     31 * @package phpass
     32 * @version 0.1 / genuine
     33 * @link http://www.openwall.com/phpass/
     34 * @since 2.5
     35 */
    3536class PasswordHash {
    3637    var $itoa64;
  • branches/crazyhorse/wp-includes/class-phpmailer.php

    r7451 r8103  
    11<?php
    2 ////////////////////////////////////////////////////
    3 // PHPMailer - PHP email class
    4 //
    5 // Class for sending email using either
    6 // sendmail, PHP mail(), or SMTP.  Methods are
    7 // based upon the standard AspEmail(tm) classes.
    8 //
    9 // Copyright (C) 2001 - 2003  Brent R. Matzelle
    10 //
    11 // License: LGPL, see LICENSE
    12 ////////////////////////////////////////////////////
     2/**
     3 * PHPMailer - PHP email class
     4 *
     5 * Class for sending email using either sendmail, PHP mail(), or SMTP. Methods
     6 * are based upon the standard AspEmail(tm) classes.
     7 *
     8 * @copyright 2001 - 2003 Brent R. Matzelle
     9 * @license LGPL
     10 * @package PHPMailer
     11 */
    1312
    1413/**
  • branches/crazyhorse/wp-includes/class-pop3.php

    r6440 r8103  
    1818 */
    1919
     20/**
     21 * POP3
     22 *
     23 * @package SquirrelMail
     24 */
    2025class POP3 {
    2126    var $ERROR      = '';       //  Error string.
  • branches/crazyhorse/wp-includes/class-smtp.php

    r5700 r8103  
    11<?php
    2 ////////////////////////////////////////////////////
    3 // SMTP - PHP SMTP class
    4 //
    5 // Version 1.02
    6 //
    7 // Define an SMTP class that can be used to connect
    8 // and communicate with any SMTP server. It implements
    9 // all the SMTP functions defined in RFC821 except TURN.
    10 //
    11 // Author: Chris Ryan
    12 //
    13 // License: LGPL, see LICENSE
    14 ////////////////////////////////////////////////////
     2/**
     3 * SMTP - PHP SMTP class
     4 *
     5 * Define an SMTP class that can be used to connect and communicate with any
     6 * SMTP server. It implements all the SMTP functions defined in RFC821 except
     7 * TURN.
     8 *
     9 * @version 1.02
     10 * @author Chris Ryan
     11 * @license LGPL
     12 * @package PHPMailer
     13 */
    1514
    1615/**
     
    1918 * error. SMTP also provides some utility methods for sending mail
    2019 * to an SMTP server.
     20 *
    2121 * @package PHPMailer
    2222 * @author Chris Ryan
  • branches/crazyhorse/wp-includes/class-snoopy.php

    r6440 r8103  
    99 * @package Snoopy
    1010 */
    11 /*************************************************
    12 
    13 Snoopy - the PHP net client
    14 Author: Monte Ohrt <monte@ispi.net>
    15 Copyright (c): 1999-2000 ispi, all rights reserved
    16 Version: 1.01
    17 
     11
     12if ( !in_array('Snoopy', get_declared_classes() ) ) :
     13/**
     14 * Snoopy - the PHP net client
     15 *
     16 * @author Monte Ohrt <monte@ispi.net>
     17 * @copyright (c): 1999-2000 ispi, all rights reserved
     18 * @version 1.01
     19 *
    1820 * This library is free software; you can redistribute it and/or
    1921 * modify it under the terms of the GNU Lesser General Public
     
    2931 * License along with this library; if not, write to the Free Software
    3032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    31 
    32 You may contact the author of Snoopy by e-mail at:
    33 monte@ispi.net
    34 
    35 Or, write to:
    36 Monte Ohrt
    37 CTO, ispi
    38 237 S. 70th suite 220
    39 Lincoln, NE 68510
    40 
    41 The latest version of Snoopy can be obtained from:
    42 http://snoopy.sourceforge.net/
    43 
    44 *************************************************/
    45 
    46 if ( !in_array('Snoopy', get_declared_classes() ) ) :
     33 *
     34 * You may contact the author of Snoopy by e-mail at:
     35 * monte@ispi.net
     36 *
     37 * Or, write to:
     38 * Monte Ohrt
     39 * CTO, ispi
     40 * 237 S. 70th suite 220
     41 * Lincoln, NE 68510
     42 *
     43 * @link http://snoopy.sourceforge.net/ The latest version of Snoopy can be
     44 *      obtained
     45 */
    4746class Snoopy
    4847{
  • branches/crazyhorse/wp-includes/comment.php

    r8052 r8103  
    77
    88/**
    9  * check_comment() - Checks whether a comment passes internal checks to be allowed to add
    10  *
    11  * {@internal Missing Long Description}}
     9 * Checks whether a comment passes internal checks to be allowed to add.
     10 *
     11 * If comment moderation is set in the administration, then all comments,
     12 * regardless of their type and whitelist will be set to false.
     13 *
     14 * If the number of links exceeds the amount in the administration, then the
     15 * check fails.
     16 *
     17 * If any of the parameter contents match the blacklist of words, then the check
     18 * fails.
     19 *
     20 * If the comment is a trackback and part of the blogroll, then the trackback is
     21 * automatically whitelisted. If the comment author was approved before, then
     22 * the comment is automatically whitelisted.
     23 *
     24 * If none of the checks fail, then the failback is to set the check to pass
     25 * (return true).
    1226 *
    1327 * @since 1.2
    1428 * @uses $wpdb
    1529 *
    16  * @param string $author {@internal Missing Description }}
    17  * @param string $email {@internal Missing Description }}
    18  * @param string $url {@internal Missing Description }}
    19  * @param string $comment {@internal Missing Description }}
    20  * @param string $user_ip {@internal Missing Description }}
    21  * @param string $user_agent {@internal Missing Description }}
    22  * @param string $comment_type {@internal Missing Description }}
    23  * @return bool {@internal Missing Description }}
     30 * @param string $author Comment Author's name
     31 * @param string $email Comment Author's email
     32 * @param string $url Comment Author's URL
     33 * @param string $comment Comment contents
     34 * @param string $user_ip Comment Author's IP address
     35 * @param string $user_agent Comment Author's User Agent
     36 * @param string $comment_type Comment type, either user submitted comment,
     37 *      trackback, or pingback
     38 * @return bool Whether the checks passed (true) and the comments should be
     39 *      displayed or set to moderated
    2440 */
    2541function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
     
    84100
    85101/**
    86  * get_approved_comments() - Returns the approved comments for post $post_id
     102 * Retrieve the approved comments for post $post_id.
    87103 *
    88104 * @since 2.0
     
    98114
    99115/**
    100  * get_comment() - Retrieves comment data given a comment ID or comment object.
    101  *
    102  * {@internal Missing Long Description}}
     116 * Retrieves comment data given a comment ID or comment object.
     117 *
     118 * If an object is passed then the comment data will be cached and then returned
     119 * after being passed through a filter.
     120 *
     121 * If the comment is empty, then the global comment variable will be used, if it
     122 * is set.
    103123 *
    104124 * @since 2.0
    105125 * @uses $wpdb
    106126 *
    107  * @param object|string|int $comment {@internal Missing Description}}
    108  * @param string $output OBJECT or ARRAY_A or ARRAY_N constants
     127 * @param object|string|int $comment Comment to retrieve.
     128 * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants
    109129 * @return object|array|null Depends on $output value.
    110130 */
     
    143163
    144164/**
    145  * get_commentdata() - Returns an array of comment data about comment $comment_ID
    146  *
    147  * get_comment() technically does the same thing as this function. This function also
    148  * appears to reference variables and then not use them or not update them when needed.
    149  * It is advised to switch to get_comment(), since this function might be deprecated in
    150  * favor of using get_comment().
     165 * Retrieve an array of comment data about comment $comment_ID.
     166 *
     167 * get_comment() technically does the same thing as this function. This function
     168 * also appears to reference variables and then not use them or not update them
     169 * when needed. It is advised to switch to get_comment(), since this function
     170 * might be deprecated in favor of using get_comment().
    151171 *
    152172 * @deprecated Use get_comment()
     
    163183 * @return array The comment data
    164184 */
    165 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries
     185function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
    166186    global $postc, $wpdb;
    167187    if ( $no_cache ) {
     
    187207
    188208/**
    189  * get_lastcommentmodified() - The date the last comment was modified
     209 * The date the last comment was modified.
    190210 *
    191211 * {@internal Missing Long Description}}
     
    195215 * @global array $cache_lastcommentmodified
    196216 *
    197  * @param string $timezone Which timezone to use in reference to 'gmt', 'blog', or 'server' locations
     217 * @param string $timezone Which timezone to use in reference to 'gmt', 'blog',
     218 *      or 'server' locations
    198219 * @return string Last comment modified date
    199220 */
     
    224245
    225246/**
    226  * get_comment_count() - The amount of comments in a post or total comments
     247 * The amount of comments in a post or total comments.
    227248 *
    228249 * {@internal Missing Long Description}}
     
    231252 * @uses $wpdb
    232253 *
    233  * @param int $post_id Optional. Comment amount in post if > 0, else total com
    234 ments blog wide
     254 * @param int $post_id Optional. Comment amount in post if > 0, else total comments blog wide
    235255 * @return array The amount of spam, approved, awaiting moderation, and total
    236256 */
     
    282302
    283303/**
    284  * sanitize_comment_cookies() - {@internal Missing Short Description}}
    285  *
    286  * {@internal Missing Long Description}}
     304 * Sanitizes the cookies sent to the user already.
     305 *
     306 * Will only do anything if the cookies have already been created for the user.
     307 * Mostly used after cookies had been sent to use elsewhere.
    287308 *
    288309 * @since 2.0.4
    289  *
    290310 */
    291311function sanitize_comment_cookies() {
     
    312332
    313333/**
    314  * wp_allow_comment() - Validates whether this comment is allowed to be made or not
     334 * Validates whether this comment is allowed to be made or not.
    315335 *
    316336 * {@internal Missing Long Description}}
     
    363383
    364384/**
    365  * check_comment_flood_db() - {@internal Missing Short Description}}
     385 * {@internal Missing Short Description}}
    366386 *
    367387 * {@internal Missing Long Description}}
     
    392412
    393413/**
    394  * wp_blacklist_check() - Does comment contain blacklisted characters or words
     414 * Does comment contain blacklisted characters or words.
    395415 *
    396416 * {@internal Missing Long Description}}
     
    449469}
    450470
     471/**
     472 * {@internal Missing Short Description}}
     473 *
     474 * {@internal Missing Long Description}}
     475 *
     476 * @param unknown_type $post_id
     477 * @return unknown
     478 */
    451479function wp_count_comments( $post_id = 0 ) {
    452480    global $wpdb;
     
    486514
    487515/**
    488  * wp_delete_comment() - Removes comment ID and maybe updates post comment count
    489  *
    490  * The post comment count will be updated if the comment was approved and has a post
    491  * ID available.
     516 * Removes comment ID and maybe updates post comment count.
     517 *
     518 * The post comment count will be updated if the comment was approved and has a
     519 * post ID available.
    492520 *
    493521 * @since 2.0.0
     
    519547
    520548/**
    521  * wp_get_comment_status() - The status of a comment by ID
     549 * The status of a comment by ID.
    522550 *
    523551 * @since 1.0.0
     
    546574
    547575/**
    548  * wp_get_current_commenter() - Get current commenter's name, email, and URL
     576 * Get current commenter's name, email, and URL.
    549577 *
    550578 * Expects cookies content to already be sanitized. User of this function
     
    576604
    577605/**
    578  * wp_insert_comment() - Inserts a comment to the database
     606 * Inserts a comment to the database.
    579607 *
    580608 * {@internal Missing Long Description}}
     
    617645
    618646/**
    619  * wp_filter_comment() - Parses and returns comment information
    620  *
    621  * Sets the comment data 'filtered' field to true when finished. This
    622  * can be checked as to whether the comment should be filtered and to
    623  * keep from filtering the same comment more than once.
     647 * Parses and returns comment information.
     648 *
     649 * Sets the comment data 'filtered' field to true when finished. This can be
     650 * checked as to whether the comment should be filtered and to keep from
     651 * filtering the same comment more than once.
    624652 *
    625653 * @since 2.0.0
     
    648676
    649677/**
    650  * wp_throttle_comment_flood() - {@internal Missing Short Description}}
     678 * {@internal Missing Short Description}}
    651679 *
    652680 * {@internal Missing Long Description}}
     
    668696
    669697/**
    670  * wp_new_comment() - Parses and adds a new comment to the database
     698 * Parses and adds a new comment to the database.
    671699 *
    672700 * {@internal Missing Long Description}}
     
    716744
    717745/**
    718  * wp_set_comment_status() - Sets the status of comment ID
     746 * Sets the status of comment ID.
    719747 *
    720748 * {@internal Missing Long Description}}
     
    763791
    764792/**
    765  * wp_update_comment() - Parses and updates an existing comment in the database
     793 * Parses and updates an existing comment in the database.
    766794 *
    767795 * {@internal Missing Long Description}}
     
    822850
    823851/**
    824  * wp_defer_comment_counting() - Whether to defer comment counting
     852 * Whether to defer comment counting.
    825853 *
    826854 * When setting $defer to true, all post comment counts will not be updated
     
    849877
    850878/**
    851  * wp_update_comment_count() - Updates the comment count for post(s)
    852  *
    853  * When $do_deferred is false (is by default) and the comments have been
    854  * set to be deferred, the post_id will be added to a queue, which will
    855  * be updated at a later date and only updated once per post ID.
    856  *
    857  * If the comments have not be set up to be deferred, then the post will
    858  * be updated. When $do_deferred is set to true, then all previous deferred
    859  * post IDs will be updated along with the current $post_id.
     879 * Updates the comment count for post(s).
     880 *
     881 * When $do_deferred is false (is by default) and the comments have been set to
     882 * be deferred, the post_id will be added to a queue, which will be updated at a
     883 * later date and only updated once per post ID.
     884 *
     885 * If the comments have not be set up to be deferred, then the post will be
     886 * updated. When $do_deferred is set to true, then all previous deferred post
     887 * IDs will be updated along with the current $post_id.
    860888 *
    861889 * @since 2.1.0
     
    888916
    889917/**
    890  * wp_update_comment_count_now() - Updates the comment count for the post
     918 * Updates the comment count for the post.
    891919 *
    892920 * @since 2.5
     
    926954
    927955/**
    928  * discover_pingback_server_uri() - Finds a pingback server URI based on the given URL
     956 * Finds a pingback server URI based on the given URL.
    929957 *
    930958 * {@internal Missing Long Description}}
     
    10221050
    10231051/**
    1024  * do_all_pings() - {@internal Missing Short Description}}
     1052 * {@internal Missing Short Description}}
    10251053 *
    10261054 * {@internal Missing Long Description}}
     
    10551083
    10561084/**
    1057  * do_trackbacks() - {@internal Missing Short Description}}
     1085 * {@internal Missing Short Description}}
    10581086 *
    10591087 * {@internal Missing Long Description}}
     
    10991127
    11001128/**
    1101  * generic_ping() - {@internal Missing Short Description}}
     1129 * {@internal Missing Short Description}}
    11021130 *
    11031131 * {@internal Missing Long Description}}
     
    11221150
    11231151/**
    1124  * pingback() - Pings back the links found in a post
     1152 * Pings back the links found in a post.
    11251153 *
    11261154 * {@internal Missing Long Description}}
     
    11991227
    12001228/**
    1201  * privacy_ping_filter() - {@internal Missing Short Description}}
     1229 * {@internal Missing Short Description}}
    12021230 *
    12031231 * {@internal Missing Long Description}}
     
    12161244
    12171245/**
    1218  * trackback() - Send a Trackback
    1219  *
    1220  * {@internal Missing Long Description}}
     1246 * Send a Trackback.
     1247 *
     1248 * Updates database when sending trackback to prevent duplicates.
    12211249 *
    12221250 * @since 0.71
     
    12241252 * @uses $wp_version WordPress version
    12251253 *
    1226  * @param string $trackback_url {@internal Missing Description}}
    1227  * @param string $title {@internal Missing Description}}
    1228  * @param string $excerpt {@internal Missing Description}}
    1229  * @param int $ID {@internal Missing Description}}
    1230  * @return unknown {@internal Missing Description}}
     1254 * @param string $trackback_url URL to send trackbacks.
     1255 * @param string $title Title of post
     1256 * @param string $excerpt Excerpt of post
     1257 * @param int $ID Post ID
     1258 * @return mixed Database query from update
    12311259 */
    12321260function trackback($trackback_url, $title, $excerpt, $ID) {
     
    12621290
    12631291/**
    1264  * weblog_ping() - {@internal Missing Short Description}}
    1265  *
    1266  * {@internal Missing Long Description}}
     1292 * Send a pingback.
    12671293 *
    12681294 * @since 1.2.0
     
    12701296 * @uses IXR_Client
    12711297 *
    1272  * @param unknown_type $server
    1273  * @param unknown_type $path
     1298 * @param string $server Host of blog to connect to.
     1299 * @param string $path Path to send the ping.
    12741300 */
    12751301function weblog_ping($server = '', $path = '') {
     
    12941320
    12951321/**
    1296  * clean_comment_cache() - Removes comment ID from the comment cache
     1322 * Removes comment ID from the comment cache.
    12971323 *
    12981324 * @since 2.3.0
     
    13071333
    13081334/**
    1309  * update_comment_cache() - Updates the comment cache of given comments
     1335 * Updates the comment cache of given comments.
    13101336 *
    13111337 * Will add the comments in $comments to the cache. If comment ID already
  • branches/crazyhorse/wp-includes/formatting.php

    r8054 r8103  
    11331133    $output = str_replace('&gt;', '&amp;gt;', $output);
    11341134
     1135    // These should be entities too
     1136    $output = str_replace('<', '&lt;', $output);
     1137    $output = str_replace('>', '&gt;', $output);
     1138   
    11351139    return apply_filters('richedit_pre', $output);
    11361140}
  • branches/crazyhorse/wp-includes/functions.php

    r8069 r8103  
    11<?php
    2 
     2/**
     3 * Main WordPress API
     4 *
     5 * @package WordPress
     6 */
     7
     8/**
     9 * Converts MySQL DATETIME field to user specified date format.
     10 *
     11 * If $dateformatstring has 'G' value, then gmmktime() function will be used to
     12 * make the time. If $dateformatstring is set to 'U', then mktime() function
     13 * will be used to make the time.
     14 *
     15 * The $translate will only be used, if it is set to true and it is by default
     16 * and if the $wp_locale object has the month and weekday set.
     17 *
     18 * @since 0.71
     19 *
     20 * @param string $dateformatstring Either 'G', 'U', or php date format.
     21 * @param string $mysqlstring Time from mysql DATETIME field.
     22 * @param bool $translate Optional. Default is true. Will switch format to locale.
     23 * @return string Date formated by $dateformatstring or locale (if available).
     24 */
    325function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
    426    global $wp_locale;
     
    5274}
    5375
    54 
     76/**
     77 * Retrieve the current time based on specified type.
     78 *
     79 * The 'mysql' type will return the time in the format for MySQL DATETIME field.
     80 * The 'timestamp' type will return the current timestamp.
     81 *
     82 * If the $gmt is set to either '1' or 'true', then both types will use the
     83 * GMT offset in the WordPress option to add the GMT offset to the time.
     84 *
     85 * @since 1.0.0
     86 *
     87 * @param string $type Either 'mysql' or 'timestamp'.
     88 * @param int|bool $gmt Optional. Whether to use $gmt offset. Default is false.
     89 * @return unknown
     90 */
    5591function current_time( $type, $gmt = 0 ) {
    5692    switch ( $type ) {
     
    89125}
    90126
    91 
     127/**
     128 * Convert number to format based on the locale.
     129 *
     130 * @since 2.3.0
     131 *
     132 * @param mixed $number The number to convert based on locale.
     133 * @param int $decimals Precision of the number of decimal places.
     134 * @return string Converted number in string format.
     135 */
    92136function number_format_i18n( $number, $decimals = null ) {
    93137    global $wp_locale;
     
    98142}
    99143
    100 
     144/**
     145 * Convert number of bytes largest unit bytes will fit into.
     146 *
     147 * It is easier to read 1kB than 1024 bytes and 1MB than 1048576 bytes. Converts
     148 * number of bytes to human readable number by taking the number of that unit
     149 * that the bytes will go into it. Supports TB value.
     150 *
     151 * Please note that integers in PHP are limited to 32 bits, unless they are on
     152 * 64 bit architecture, then they have 64 bit size. If you need to place the
     153 * larger size then what PHP integer type will hold, then use a string. It will
     154 * be converted to a double, which should always have 64 bit length.
     155 *
     156 * Technically the correct unit names for powers of 1024 are KiB, MiB etc.
     157 * @link http://en.wikipedia.org/wiki/Byte
     158 *
     159 * @since 2.3.0
     160 *
     161 * @param int|string $bytes Number of bytes. Note max integer size for integers.
     162 * @param int $decimals Precision of number of decimal places.
     163 * @return unknown
     164 */
    101165function size_format( $bytes, $decimals = null ) {
    102     // technically the correct unit names for powers of 1024 are KiB, MiB etc
    103     // see http://en.wikipedia.org/wiki/Byte
    104166    $quant = array(
    105167        // ========================= Origin ====
     
    145207}
    146208
    147 
     209/**
     210 * Unserialize value only if it was serialized.
     211 *
     212 * @since 2.0.0
     213 *
     214 * @param string $original Maybe unserialized original, if is needed.
     215 * @return mixed Unserialized data can be any type.
     216 */
    148217function maybe_unserialize( $original ) {
    149218    if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
     
    153222}
    154223
    155 
     224/**
     225 * Check value to find if it was serialized.
     226 *
     227 * If $data is not an string, then returned value will always be false.
     228 * Serialized data is always a string.
     229 *
     230 * @since 2.0.5
     231 *
     232 * @param mixed $data Value to check to see if was serialized.
     233 * @return bool False if not serialized and true if it was.
     234 */
    156235function is_serialized( $data ) {
    157236    // if it isn't a string, it isn't serialized
     
    180259}
    181260
    182 
     261/**
     262 * Check whether serialized data is of string type.
     263 *
     264 * @since 2.0.5
     265 *
     266 * @param mixed $data Serialized data
     267 * @return bool False if not a serialized string, true if it is.
     268 */
    183269function is_serialized_string( $data ) {
    184270    // if it isn't a string, it isn't a serialized string
     
    191277}
    192278
    193 
    194279/* Options functions */
    195280
    196 // expects $setting to already be SQL-escaped
     281/**
     282 * Retrieve option value based on setting name.
     283 *
     284 * {@internal Missing Long Description}}
     285 *
     286 * @since 1.5.0
     287 * @package WordPress
     288 * @subpackage Option
     289 *
     290 * @param string $setting Name of option to retrieve. Should already be SQL-escaped
     291 * @return mixed Value set for the option.
     292 */
    197293function get_option( $setting ) {
    198294    global $wpdb;
     
    244340}
    245341
    246 
     342/**
     343 * Protect WordPress special option from being modified.
     344 *
     345 * Will die if $option is in protected list.
     346 *
     347 * @since 2.2.0
     348 * @package WordPress
     349 * @subpackage Option
     350 *
     351 * @param string $option Option name.
     352 */
    247353function wp_protect_special_option( $option ) {
    248354    $protected = array( 'alloptions', 'notoptions' );
     
    251357}
    252358
     359/**
     360 * Print option value after sanitizing for forms.
     361 *
     362 * @uses attribute_escape Sanitizes value.
     363 * @since 1.5.0
     364 * @package WordPress
     365 * @subpackage Option
     366 *
     367 * @param string $option Option name.
     368 */
    253369function form_option( $option ) {
    254370    echo attribute_escape (get_option( $option ) );
     
    405521function maybe_serialize( $data ) {
    406522    if ( is_string( $data ) )
    407         $data = trim( $data );
     523        return $data;
    408524    elseif ( is_array( $data ) || is_object( $data ) )
    409525        return serialize( $data );
     
    537653}
    538654
    539 // perform a HTTP HEAD or GET request
    540 // if $file_path is a writable filename, this will do a GET request and write the file to that path
    541 // returns a list of HTTP headers
     655/**
     656 * Perform a HTTP HEAD or GET request.
     657 *
     658 * If $file_path is a writable filename, this will do a GET request and write
     659 * the file to that path.
     660 *
     661 * @since unknown
     662 *
     663 * @param string $url
     664 * @param string|bool $file_path Optional. File path to write request to.
     665 * @param int $red Optional. Number of Redirects. Stops at 5 redirects.
     666 * @return bool|string False on failure and string of headers if HEAD request.
     667 */
    542668function wp_get_http( $url, $file_path = false, $red = 1 ) {
    543669    global $wp_version;
     
    611737}
    612738
     739/**
     740 * Retrieve HTTP Headers from URL.
     741 *
     742 * @since 1.5.1
     743 *
     744 * @param string $url
     745 * @param int $red Optional. Number of redirects.
     746 * @return bool|string False on failure, headers on success.
     747 */
    613748function wp_get_http_headers( $url, $red = 1 ) {
    614749    return wp_get_http( $url, false, $red );
    615750}
    616751
    617 
     752/**
     753 * Whether today is a new day.
     754 *
     755 * {@internal Need to find out how this function is used.}}
     756 *
     757 * @since 0.71
     758 * @uses $day Today
     759 * @uses $previousday Previous day
     760 *
     761 * @return int 1 when new day, 0 if not a new day.
     762 */
    618763function is_new_day() {
    619764    global $day, $previousday;
     
    629774}
    630775
    631 
    632 /*
    633 add_query_arg: Returns a modified querystring by adding
    634 a single key & value or an associative array.
    635 Setting a key value to emptystring removes the key.
    636 Omitting oldquery_or_uri uses the $_SERVER value.
    637 
    638 Parameters:
    639 add_query_arg(newkey, newvalue, oldquery_or_uri) or
    640 add_query_arg(associative_array, oldquery_or_uri)
    641 */
     776/**
     777 * Retrieve a modified query string.
     778 *
     779 * {@internal Missing Long Description}}
     780 *
     781 * Adding a single key & value or an associative array.
     782 * Setting a key value to emptystring removes the key.
     783 * Omitting oldquery_or_uri uses the $_SERVER value.
     784 *
     785 * @since 1.5.0
     786 *
     787 * @param mixed $param1 Either newkey or an associative_array
     788 * @param mixed $param2 Either newvalue or oldquery or uri
     789 * @param mixed $param3 Optional. Old query or uri
     790 * @return unknown
     791 */
    642792function add_query_arg() {
    643793    $ret = '';
     
    705855}
    706856
    707 
    708 /*
    709 remove_query_arg: Returns a modified querystring by removing
    710 a single key or an array of keys.
    711 Omitting oldquery_or_uri uses the $_SERVER value.
    712 
    713 Parameters:
    714 remove_query_arg(removekey, [oldquery_or_uri]) or
    715 remove_query_arg(removekeyarray, [oldquery_or_uri])
    716 */
    717 
    718 function remove_query_arg( $key, $query=FALSE ) {
     857/**
     858 * Removes an item or list from the query string.
     859 *
     860 * @since 1.5.0
     861 *
     862 * @param string|array $key Query key or keys to remove.
     863 * @param bool $query When false uses the $_SERVER value.
     864 * @return unknown
     865 */
     866function remove_query_arg( $key, $query=false ) {
    719867    if ( is_array( $key ) ) { // removing multiple keys
    720868        foreach ( (array) $key as $k )
    721             $query = add_query_arg( $k, FALSE, $query );
     869            $query = add_query_arg( $k, false, $query );
    722870        return $query;
    723871    }
    724     return add_query_arg( $key, FALSE, $query );
    725 }
    726 
    727 
     872    return add_query_arg( $key, false, $query );
     873}
     874
     875/**
     876 * Walks the array while sanitizing the contents.
     877 *
     878 * @uses $wpdb Used to sanitize values
     879 *
     880 * @param array $array Array to used to walk while sanitizing contents.
     881 * @return array Sanitized $array.
     882 */
    728883function add_magic_quotes( $array ) {
    729884    global $wpdb;
     
    783938}
    784939
    785 
     940/**
     941 * Retrieve the description for the HTTP status.
     942 *
     943 * @since 2.3.0
     944 *
     945 * @param int $code HTTP status code.
     946 * @return string Empty string if not found, or description if found.
     947 */
    786948function get_status_header_desc( $code ) {
    787949    global $wp_header_to_desc;
     
    8631025}
    8641026
    865 
     1027/**
     1028 * Sets the headers to prevent caching for the different browsers.
     1029 *
     1030 * Different browsers support different nocache headers, so several headers must
     1031 * be sent so that all of them get the point that no caching should occur.
     1032 *
     1033 * @since 2.0.0
     1034 */
    8661035function nocache_headers() {
    8671036    // why are these @-silenced when other header calls aren't?
     
    8721041}
    8731042
    874 
     1043/**
     1044 * Set the headers for caching for 10 days with JavaScript content type.
     1045 *
     1046 * @since 2.1.0
     1047 */
    8751048function cache_javascript_headers() {
    8761049    $expiresOffset = 864000; // 10 days
     
    8801053}
    8811054
    882 
     1055/**
     1056 * Retrieve the number of database queries during the WordPress execution.
     1057 *
     1058 * @since 2.0.0
     1059 *
     1060 * @return int Number of database queries
     1061 */
    8831062function get_num_queries() {
    8841063    global $wpdb;
     
    8861065}
    8871066
    888 
     1067/**
     1068 * Whether input is yes or no. Must be 'y' to be true.
     1069 *
     1070 * @since 1.0.0
     1071 *
     1072 * @param string $yn Character string containing either 'y' or 'n'
     1073 * @return bool True if yes, false on anything else
     1074 */
    8891075function bool_from_yn( $yn ) {
    8901076    return ( strtolower( $yn ) == 'y' );
     
    9121098}
    9131099
    914 
     1100/**
     1101 * Load the RDF RSS 0.91 Feed template.
     1102 *
     1103 * @since 2.1.0
     1104 */
    9151105function do_feed_rdf() {
    9161106    load_template( ABSPATH . WPINC . '/feed-rdf.php' );
    9171107}
    9181108
    919 
     1109/**
     1110 * Load the RSS 1.0 Feed Template
     1111 *
     1112 * @since 2.1.0
     1113 */
    9201114function do_feed_rss() {
    9211115    load_template( ABSPATH . WPINC . '/feed-rss.php' );
    9221116}
    9231117
    924 
     1118/**
     1119 * Load either the RSS2 comment feed or the RSS2 posts feed.
     1120 *
     1121 * @since 2.1.0
     1122 *
     1123 * @param bool $for_comments True for the comment feed, false for normal feed.
     1124 */
    9251125function do_feed_rss2( $for_comments ) {
    9261126    if ( $for_comments )
     
    9301130}
    9311131
    932 
     1132/**
     1133 * Load either Atom comment feed or Atom posts feed.
     1134 *
     1135 * @since 2.1.0
     1136 *
     1137 * @param bool $for_comments True for the comment feed, false for normal feed.
     1138 */
    9331139function do_feed_atom( $for_comments ) {
    9341140    if ($for_comments)
     
    9381144}
    9391145
     1146/**
     1147 * Display the robot.txt file content.
     1148 *
     1149 * The echo content should be with usage of the permalinks or for creating the
     1150 * robot.txt file.
     1151 *
     1152 * @since 2.1.0
     1153 * @uses do_action() Calls 'do_robotstxt' hook for displaying robot.txt rules.
     1154 */
    9401155function do_robots() {
    9411156    header( 'Content-Type: text/plain; charset=utf-8' );
     
    15121727}
    15131728
    1514 
     1729/**
     1730 * Merge user defined arguments into defaults array.
     1731 *
     1732 * This function is used throughout WordPress to allow for both string or array
     1733 * to be merged into another array.
     1734 *
     1735 * @since 2.2.0
     1736 *
     1737 * @param string|array $args Value to merge with $defaults
     1738 * @param array $defaults Array that serves as the defaults.
     1739 * @return array Merged user defined values with defaults.
     1740 */
    15151741function wp_parse_args( $args, $defaults = '' ) {
    15161742    if ( is_object( $args ) )
     
    15261752}
    15271753
    1528 
     1754/**
     1755 * Determines if Widgets library should be loaded.
     1756 *
     1757 * Checks to make sure that the widgets library hasn't already been loaded. If
     1758 * it hasn't, then it will load the widgets library and run an action hook.
     1759 *
     1760 * @since 2.2.0
     1761 * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
     1762 */
    15291763function wp_maybe_load_widgets() {
    15301764    if ( !function_exists( 'dynamic_sidebar' ) ) {
     
    15341768}
    15351769
    1536 
     1770/**
     1771 * Append the Widgets menu to the themes main menu.
     1772 *
     1773 * @since 2.2.0
     1774 * @uses $submenu The administration submenu list.
     1775 */
    15371776function wp_widgets_add_menu() {
    15381777    global $submenu;
     
    15411780}
    15421781
    1543 
    1544 // For PHP 5.2, make sure all output buffers are flushed
    1545 // before our singletons our destroyed.
     1782/**
     1783 * Flush all output buffers for PHP 5.2.
     1784 *
     1785 * Make sure all output buffers are flushed before our singletons our destroyed.
     1786 *
     1787 * @since 2.2.0
     1788 */
    15461789function wp_ob_end_flush_all() {
    15471790    while ( @ob_end_flush() );
     
    15491792
    15501793
    1551 /*
    1552  * require_wp_db() - require_once the correct database class file.
    1553  *
    1554  * This function is used to load the database class file either at runtime or by wp-admin/setup-config.php
    1555  * We must globalise $wpdb to ensure that it is defined globally by the inline code in wp-db.php
    1556  *
    1557  * @global $wpdb
     1794/**
     1795 * Load the correct database class file.
     1796 *
     1797 * This function is used to load the database class file either at runtime or by
     1798 * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is
     1799 * defined globally by the inline code in wp-db.php.
     1800 *
     1801 * @since 2.5
     1802 * @global $wpdb WordPress Database Object
    15581803 */
    15591804function require_wp_db() {
     
    15651810}
    15661811
     1812
     1813/**
     1814 * Load custom DB error or display WordPress DB error.
     1815 *
     1816 * If a file exists in the wp-content directory named db-error.php, then it will
     1817 * be loaded instead of displaying the WordPress DB error. If it is not found,
     1818 * then the WordPress DB error will be displayed instead.
     1819 *
     1820 * The WordPress DB error sets the HTTP status header to 500 to try to prevent
     1821 * search engines from caching the message. Custom DB messages should do the
     1822 * same.
     1823 *
     1824 * @since 2.5
     1825 * @uses $wpdb
     1826 */
    15671827function dead_db() {
    15681828    global $wpdb;
     
    15981858}
    15991859
    1600 /**
    1601  * Converts input to an absolute integer
     1860
     1861/**
     1862 * Converts value to positive integer.
     1863 *
     1864 * @since 2.5
     1865 *
    16021866 * @param mixed $maybeint data you wish to have convered to an absolute integer
    16031867 * @return int an absolute integer
     
    16071871}
    16081872
    1609 /**
    1610  * Determines if the blog can be accessed over SSL
    1611  * @return bool whether of not SSL access is available
     1873
     1874/**
     1875 * Determines if the blog can be accessed over SSL.
     1876 *
     1877 * Determines if blog can be accessed over SSL by using cURL to access the site
     1878 * using the https in the siteurl. Requires cURL extension to work correctly.
     1879 *
     1880 * @since 2.5
     1881 *
     1882 * @return bool Whether or not SSL access is available
    16121883 */
    16131884function url_is_accessable_via_ssl($url)
     
    16341905}
    16351906
     1907
     1908/**
     1909 * Secure URL, if available or the given URL.
     1910 *
     1911 * @since 2.5
     1912 *
     1913 * @param string $url Complete URL path with transport.
     1914 * @return string Secure or regular URL path.
     1915 */
    16361916function atom_service_url_filter($url)
    16371917{
    16381918    if ( url_is_accessable_via_ssl($url) )
    1639         return  preg_replace( '/^http:\/\//', 'https://',  $url );
     1919        return preg_replace( '/^http:\/\//', 'https://',  $url );
    16401920    else
    16411921        return $url;
    16421922}
    16431923
    1644 /**
    1645  * _deprecated_function() - Marks a function as deprecated and informs when it has been used.
    1646  *
    1647  * There is a hook deprecated_function_run that will be called that can be used to get the backtrace
    1648  * up to what file and function called the deprecated function.
    1649  *
    1650  * The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
     1924
     1925/**
     1926 * Marks a function as deprecated and informs when it has been used.
     1927 *
     1928 * There is a hook deprecated_function_run that will be called that can be used
     1929 * to get the backtrace up to what file and function called the deprecated
     1930 * function.
     1931 *
     1932 * The current behavior is to trigger an user error if WP_DEBUG is defined and
     1933 * is true.
    16511934 *
    16521935 * This function is to be used in every function in depreceated.php
     
    16771960}
    16781961
    1679 /**
    1680  * _deprecated_file() - Marks a file as deprecated and informs when it has been used.
    1681  *
    1682  * There is a hook deprecated_file_included that will be called that can be used to get the backtrace
    1683  * up to what file and function included the deprecated file.
    1684  *
    1685  * The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
     1962
     1963/**
     1964 * Marks a file as deprecated and informs when it has been used.
     1965 *
     1966 * There is a hook deprecated_file_included that will be called that can be used
     1967 * to get the backtrace up to what file and function included the deprecated
     1968 * file.
     1969 *
     1970 * The current behavior is to trigger an user error if WP_DEBUG is defined and
     1971 * is true.
    16861972 *
    16871973 * This function is to be used in every file that is depreceated
     
    17121998}
    17131999
    1714 /**
    1715  * is_lighttpd_before_150() - Is the server running earlier than 1.5.0 version of lighttpd
     2000
     2001/**
     2002 * Is the server running earlier than 1.5.0 version of lighttpd
     2003 *
     2004 * @since unknown
    17162005 *
    17172006 * @return bool Whether the server is running lighttpd < 1.5.0
     
    17232012}
    17242013
    1725 /**
    1726  * apache_mod_loaded() - Does the specified module exist in the apache config?
     2014
     2015/**
     2016 * Does the specified module exist in the apache config?
     2017 *
     2018 * @since unknown
    17272019 *
    17282020 * @param string $mod e.g. mod_rewrite
     
    17502042}
    17512043
     2044
     2045/**
     2046 * File validates against allowed set of defined rules.
     2047 *
     2048 * A return value of '1' means that the $file contains either '..' or './'. A
     2049 * return value of '2' means that the $file contains ':' after the first
     2050 * character. A return value of '3' means that the file is not in the allowed
     2051 * files list.
     2052 *
     2053 * @since 2.6
     2054 *
     2055 * @param string $file File path.
     2056 * @param array $allowed_files List of allowed files.
     2057 * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
     2058 */
    17522059function validate_file( $file, $allowed_files = '' ) {
    17532060    if ( false !== strpos( $file, '..' ))
     
    17662073}
    17672074
     2075
     2076/**
     2077 * Determine if SSL is used.
     2078 *
     2079 * @since 2.6
     2080 *
     2081 * @return bool True if SSL, false if not used.
     2082 */
    17682083function is_ssl() {
    17692084    return ( 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
    17702085}
    17712086
     2087
     2088/**
     2089 * Whether SSL login should be forced.
     2090 *
     2091 * @since 2.6
     2092 *
     2093 * @param string|bool $force Optional.
     2094 * @return bool True if forced, false if not forced.
     2095 */
    17722096function force_ssl_login($force = '') {
    17732097    static $forced;
    17742098
    17752099    if ( '' != $force ) {
    1776         $old_forcded = $forced;
     2100        $old_forced = $forced;
    17772101        $forced = $force;
    17782102        return $old_forced;
     
    17822106}
    17832107
     2108
     2109/**
     2110 * Whether to force SSL used for the Administration Panels.
     2111 *
     2112 * @since 2.6
     2113 *
     2114 * @param string|bool $force
     2115 * @return bool True if forced, false if not forced.
     2116 */
    17842117function force_ssl_admin($force = '') {
    17852118    static $forced;
    17862119
    17872120    if ( '' != $force ) {
    1788         $old_forcded = $forced;
     2121        $old_forced = $forced;
    17892122        $forced = $force;
    17902123        return $old_forced;
  • branches/crazyhorse/wp-includes/js/thickbox/thickbox.css

    r7961 r8103  
    117117    position: fixed;
    118118    display:none;
    119     height:13px;
    120     width:208px;
    121119    z-index:103;
    122120    top: 50%;
    123121    left: 50%;
    124     margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
     122    background-color: #E8E8E8;
     123    border: 4px solid #525252;
     124    margin: -45px 0pt 0pt -125px;
     125    padding: 40px 15px 15px;
    125126}
    126127
  • branches/crazyhorse/wp-includes/js/tinymce/langs/wp-langs.php

    r7380 r8103  
    398398wp_page_alt:"' . mce_escape( __('Next page...') ) . '"
    399399});
     400
     401tinyMCE.addI18n("' . $language . '.wpeditimage",{
     402edit_img:"' . mce_escape( __('Edit Image') )  . '",
     403adv_settings:"' . mce_escape( __('Advanced Settings') )  . '",
     404none:"' . mce_escape( __('None') )  . '",
     405size:"' . mce_escape( __('Size') ) . '",
     406thumbnail:"' . mce_escape( __('Thumbnail') ) . '",
     407medium:"' . mce_escape( __('Medium') ) . '",
     408full_size:"' . mce_escape( __('Full Size') ) . '",
     409alt_help:"' . js_escape( __('Alternate text, e.g. "The Mona Lisa"') )  . '",
     410current_link:"' . mce_escape( __('Current Link') ) . '",
     411link_to_img:"' . mce_escape( __('Link to Image') ) . '",
     412link_help:"' . mce_escape( __('Enter a link URL or click above for presets.') ) . '",
     413adv_img_settings:"' . mce_escape( __('Advanced Image Settings') ) . '",
     414source:"' . mce_escape( __('Source') )  . '",
     415width:"' . mce_escape( __('Width') ) . '",
     416height:"' . mce_escape( __('Height') ) . '",
     417orig_size:"' . mce_escape( __('Original Size') ) . '",
     418css:"' . mce_escape( __('CSS Class') ) . '",
     419adv_link_settings:"' . mce_escape( __('Advanced Link Settings') )  . '",
     420link_rel:"' . mce_escape( __('Link Rel') ) . '",
     421height:"' . mce_escape( __('Height') ) . '",
     422orig_size:"' . mce_escape( __('Original Size') ) . '",
     423css:"' . mce_escape( __('CSS Class') ) . '",
     424caption:"' . mce_escape( __('Caption') ) . '"
     425});
    400426';
    401427?>
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css

    r8066 r8103  
    3939}
    4040
     41img.alignright,
    4142.alignright {
    4243    float: right;
    4344}
    4445
     46img.alignleft,
    4547.alignleft {
    4648    float: left;
    4749}
    4850
    49 .aligncenter {
     51img.aligncenter {
    5052    display: block;
    5153    margin-left: auto;
     
    6264
    6365.show-align {
    64     padding: 8px;
    6566    height: 200px;
     67    width: 480px;
     68    float: right;
    6669    background-color: #f1f1f1;
    6770    cursor: default;
     
    7477    border: 1px solid #c0c0c0;
    7578    width: 623px;
    76     margin: 20px auto auto;
     79    margin: 15px auto;
    7780}
    7881
     
    9194
    9295#img_demo {
    93     padding: 0 5px 4px;
     96    padding: 0;
    9497}
    9598
     
    138141
    139142#media-upload h3 {
    140     clear:both;
    141     padding:0pt 0pt 3px;
    142     border-bottom-style:solid;
    143     border-bottom-width:1px;
    144     font-family:Georgia,"Times New Roman",Times,serif;
    145     font-size:20px;
    146     font-weight:normal;
    147     line-height:normal;
    148     margin:20px 0 15px -4px;
    149     padding:0 0 3px 0;
    150     border-bottom-color:#DADADA;
    151     color:#5A5A5A;
     143    clear: both;
     144    padding: 0pt 0pt 3px;
     145    border-bottom-style: solid;
     146    border-bottom-width: 1px;
     147    font-family: Georgia,"Times New Roman",Times,serif;
     148    font-size: 20px;
     149    font-weight: normal;
     150    line-height: normal;
     151    margin: 0 0 10px -4px;
     152    padding: 15px 0 3px;
     153    border-bottom-color: #DADADA;
     154    color: #5A5A5A;
    152155}
    153156
    154157#img_dim #width,
    155 #img_dim #height {
    156     width:40px;
     158#img_dim #height,
     159#img_prop #border,
     160#img_prop #vspace,
     161#img_prop #hspace {
     162    width: 36px;
    157163}
    158164
     
    161167}
    162168
    163 #basic .align .field label {
    164     margin: 0 10px 0 0;
    165     padding: 0 0 0 25px;
     169#show_align_sp {
     170    width: 115px;
    166171}
    167172
     173#img_dim input,
     174#img_prop input {
     175    margin-right: 10px;
     176}
     177
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html

    r8066 r8103  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2 <html xmlns="http://www.w3.org/1999/xhtml"  dir="ltr" lang="en-US">
     2<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
    33<head>
    44<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     
    1010<link rel="stylesheet" href="css/editimage.css?ver=3091" type="text/css" media="all" />
    1111<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-bleeding2" type="text/css" media="all" />
     12<script type="text/javascript">
     13if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
     14    document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=3091" type="text/css" media="all" />');
     15</script>
    1216<base target="_self" />
    1317</head>
     
    1620<div id="media-upload-header">
    1721    <ul id="sidemenu">
    18     <li><a href="javascript:;" id="tab_basic" class="current" onclick="wpImage.setTabs(this);">Edit image</a></li>
    19     <li><a href="javascript:;" id="tab_advanced" onclick="wpImage.setTabs(this);">Advanced settings</a></li>
    20     <li><a href="javascript:;" id="tab_attachment" style="display:none" target="_blanc" onclick="tinyMCEPopup.close();">Edit Attachment</a></li>
     22    <li><a href="javascript:;" id="tab_basic" class="current" onclick="wpImage.setTabs(this);">{#wpeditimage.edit_img}</a></li>
     23    <li><a href="javascript:;" id="tab_advanced" onclick="wpImage.setTabs(this);">{#wpeditimage.adv_settings}</a></li>
    2124    </ul>
    2225</div>
    2326
    2427<div id="img-edit">
    25     <form class="media-upload-form" action="" onsubmit="wpImage.update();">
    26     <div id="div_basic">
    27 
    28     <div class="show-align">
     28<form class="media-upload-form" action="" onsubmit="wpImage.update();">
     29
     30    <label for="show_align">
     31        <span id="show_align_sp" class="alignleft">{#preview.preview_desc}</span>
     32    </label>
     33    <div class="show-align" id="show_align">
    2934        <img id="img_demo" src="img/image.png" alt="" />
    3035        <span id="img_demo_txt">
     
    3237        Ut lorem In penatibus libero id ipsum sagittis nec elit Sed. Condimentum eget Vivamus vel consectetuer lorem molestie turpis amet tellus id. Condimentum vel ridiculus Fusce sed pede Nam nunc sodales eros tempor. Sit lacus magna dictumst Curabitur fringilla auctor id vitae wisi facilisi. Fermentum eget turpis felis velit leo Nunc Proin orci molestie Praesent. Curabitur tellus scelerisque suscipit ut sem amet cursus mi Morbi eu. Donec libero Vestibulum augue et mollis accumsan ornare condimentum In enim. Leo eget ac consectetuer quis condimentum malesuada.
    3338        Condimentum commodo et Lorem fringilla malesuada libero volutpat sem tellus enim. Tincidunt sed at Aenean nec nonummy porttitor Nam Sed Nulla ut. Auctor leo In aliquet Curabitur eros et velit Quisque justo morbi. Et vel mauris sit nulla semper vitae et quis at dui. Id at elit laoreet justo eu mauris Quisque et interdum pharetra. Nullam accumsan interdum Maecenas condimentum quis quis Fusce a sollicitudin Sed. Non Quisque Vivamus congue porttitor non semper ipsum porttitor quis vel. Donec eros lacus volutpat et tincidunt sem convallis id venenatis sit. Consectetuer odio.
    34         Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel. Nullam velit est Curabitur gravida Vestibulum justo.
     39        Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel.
    3540        </span>
    3641    </div>
    3742
    38     <table id="basic" class="describe">
     43    <div id="div_basic">
     44    <table id="basic" class="describe">
    3945        <tbody>
    40         <tr class="">
    41             <th valign="top" scope="row" class="label">
    42                 <label for="img_title">
    43                 <span class="alignleft">Title</span>
    44                 <span class="alignright"><abbr title="required" class="required">*</abbr></span>
    45                 </label>
    46             </th>
    47             <td class="field">
    48                 <input type="text" id="img_title" name="img_title" value="" aria-required="true" size="60" />
    49             </td>
    50         </tr>
    51 
    52         <tr class="post_excerpt">
    53             <th valign="top" scope="row" class="label">
    54                 <label for="img_alt">
    55                 <span class="alignleft">Caption</span>
    56                 </label>
    57             </th>
    58             <td class="field">
    59                 <input type="text" id="img_alt" name="img_alt" value="" size="60" />
    60                 <p class="help">Alternate text, e.g. "The Mona Lisa"</p>
    61             </td>
    62         </tr>
    63 
    64         <tr class="url">
    65             <th valign="top" scope="row" class="label">
    66                 <label for="link_href">
    67                 <span class="alignleft" id="lb_link_href">Link URL</span>
    68                 </label>
    69             </th>
    70             <td class="field">
    71                 <input type="text" id="link_href" name="link_href" value="" /><br />
    72                 <input type="button" class="button" onclick="wpImage.I('link_href').value='';" value="None" />
    73                 <input type="button" class="button" id="img_url_current" onclick="wpImage.img_seturl('current')" value="Current Link" />
    74                 <input type="button" class="button" id="img_url_img" onclick="wpImage.img_seturl('link')" value="Link to Image" />
    75                 <p class="help">Enter a link URL or click above for presets.</p>
    76             </td>
    77         </tr>
    7846
    7947        <tr class="align">
    8048            <th valign="top" scope="row" class="label">
    8149                <label for="img_align_td">
    82                 <span class="alignleft">{#advanced_dlg.image_align}</span>
     50                <span class="alignleft">{#contextmenu.align}</span>
    8351                </label>
    8452            </th>
    8553            <td class="field" id="img_align_td">
    8654                <input type="radio" onclick="wpImage.imgAlignCls('alignnone')" name="img_align" id="alignnone" value="alignnone" />
    87                 <label for="alignnone" class="align image-align-none-label">None</label>
     55                <label for="alignnone" class="align image-align-none-label">{#wpeditimage.none}</label>
    8856
    8957                <input type="radio" onclick="wpImage.imgAlignCls('alignleft')" name="img_align" id="alignleft" value="alignleft" />
    90                 <label for="alignleft" class="align image-align-left-label">{#advanced_dlg.image_align_left}</label>
     58                <label for="alignleft" class="align image-align-left-label">{#contextmenu.left}</label>
    9159
    9260                <input type="radio" onclick="wpImage.imgAlignCls('aligncenter')" name="img_align" id="aligncenter" value="aligncenter" />
    93                 <label for="aligncenter" class="align image-align-center-label">Center</label>
     61                <label for="aligncenter" class="align image-align-center-label">{#contextmenu.center}</label>
    9462
    9563                <input type="radio" onclick="wpImage.imgAlignCls('alignright')" name="img_align" id="alignright" value="alignright" />
    96                 <label for="alignright" class="align image-align-right-label">{#advanced_dlg.image_align_right}</label>
     64                <label for="alignright" class="align image-align-right-label">{#contextmenu.right}</label>
    9765            </td>
    9866        </tr>
     
    10169            <th valign="top" scope="row" class="label">
    10270                <label for="img_size">
    103                 <span class="alignleft">Size</span>
     71                <span class="alignleft">{#wpeditimage.size}</span>
    10472                </label>
    10573            </th>
    10674            <td class="field" id="img_size">
    10775                <input onclick="wpImage.imgEditSize('thumbnail')" type="radio" name="img_size" id="thumbnail" value="thumbnail" />
    108                 <label for="thumbnail" id="lb_sizethumb">Thumbnail</label>
     76                <label for="thumbnail" id="lb_sizethumb">{#wpeditimage.thumbnail}</label>
    10977
    11078                <input onclick="wpImage.imgEditSize('medium')" type="radio" name="img_size" id="medium" value="medium" />
    111                 <label for="medium" id="lb_sizemedium">Medium</label>
     79                <label for="medium" id="lb_sizemedium">{#wpeditimage.medium}</label>
    11280
    11381                <input onclick="wpImage.imgEditSize('full')" type="radio" name="img_size" id="full" value="full" />
    114                 <label for="full" id="lb_sizefull">Full_size</label>
     82                <label for="full" id="lb_sizefull">{#wpeditimage.full_size}</label>
     83            </td>
     84        </tr>
     85
     86        <tr class="">
     87            <th valign="top" scope="row" class="label">
     88                <label for="img_title">
     89                <span class="alignleft">{#advanced_dlg.link_titlefield}</span>
     90                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
     91                </label>
     92            </th>
     93            <td class="field">
     94                <input type="text" id="img_title" name="img_title" value="" aria-required="true" size="60" />
     95            </td>
     96        </tr>
     97
     98        <tr class="post_excerpt">
     99            <th valign="top" scope="row" class="label">
     100                <label for="img_alt">
     101                <span class="alignleft">{#wpeditimage.caption}</span>
     102                </label>
     103            </th>
     104            <td class="field">
     105                <input type="text" id="img_alt" name="img_alt" value="" size="60" />
     106                <p class="help">{#wpeditimage.alt_help}</p>
     107            </td>
     108        </tr>
     109
     110        <tr class="url">
     111            <th valign="top" scope="row" class="label">
     112                <label for="link_href">
     113                <span class="alignleft" id="lb_link_href">{#advanced_dlg.link_url}</span>
     114                </label>
     115            </th>
     116            <td class="field">
     117                <input type="text" id="link_href" name="link_href" value="" /><br />
     118                <input type="button" class="button" onclick="wpImage.I('link_href').value='';" value="{#wpeditimage.none}" />
     119                <input type="button" class="button" id="img_url_current" onclick="wpImage.img_seturl('current')" value="{#wpeditimage.current_link}" />
     120                <input type="button" class="button" id="img_url_img" onclick="wpImage.img_seturl('link')" value="{#wpeditimage.link_to_img}" />
     121                <p class="help">{#wpeditimage.link_help}</p>
    115122            </td>
    116123        </tr>
     
    119126
    120127    <div id="div_advanced" style="display:none;">
    121     <h3>Advanced Image Settings</h3>
    122     <table id="adv_settings_img" class="describe"> 
     128    <h3>{#wpeditimage.adv_img_settings}</h3>
     129    <table id="adv_settings_img" class="describe">
    123130        <tbody>
    124131        <tr>
    125132            <th valign="top" scope="row" class="label">
    126133                <label for="img_src">
    127                 <span class="alignleft">Source</span>
     134                <span class="alignleft">{#wpeditimage.source}</span>
    128135                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
    129136                </label>
    130137            </th>
    131138            <td class="field">
    132                 <input type="text" id="img_src" name="img_src" value="" onblur="wpImage.checkVal(this)" size="60" />
    133             </td>
    134         </tr>
    135 
    136         <tr>
    137             <th valign="top" scope="row" class="label">
    138                 <label for="img_dim">
    139                 <span class="alignleft">Size</span>
    140                 <span class="alignright"></span>
    141                 </label>
    142             </th>
    143             <td class="field" id="img_dim">
    144                 <label for="width">Width</label>
    145                 <input type="text" id="width" name="width" value="" />
    146                
    147                 <label for="height">Height</label>
    148                 <input type="text" id="height" name="height" value="" />
    149                 <input type="button" class="button" id="orig_size" name="orig_size" value="Original Size" onclick="wpImage.origSize();" />
    150                
     139                <input type="text" id="img_src" name="img_src" value="" onblur="wpImage.checkVal(this)" aria-required="true" size="60" />
     140            </td>
     141        </tr>
     142
     143        <tr id="img_dim">
     144            <th valign="top" scope="row" class="label">
     145                <label>
     146                <span class="alignleft">{#wpeditimage.size}</span>
     147                </label>
     148            </th>
     149            <td class="field">
     150                <label for="width">{#wpeditimage.width}</label>
     151                <input type="text" maxlength="5" id="width" name="width"  value="" />
     152
     153                <label for="height">{#wpeditimage.height}</label>
     154                <input type="text" maxlength="5" id="height" name="height" value="" />
     155
     156                <input type="button" class="button" id="orig_size" name="orig_size" value="{#wpeditimage.orig_size}" onclick="wpImage.origSize();" />
    151157            </td>
    152158        </tr>
     
    155161            <th valign="top" scope="row" class="label">
    156162                <label for="img_classes">
    157                 <span class="alignleft">CSS Class</span>
     163                <span class="alignleft">{#wpeditimage.css}</span>
    158164                </label>
    159165            </th>
     
    166172            <th valign="top" scope="row" class="label">
    167173                <label for="img_style">
    168                 <span class="alignleft">Style</span>
    169                 </label>
    170             </th>
    171             <td class="field">
    172                 <input type="text" id="img_style" name="img_style" value="" size="60" />
     174                <span class="alignleft">{#advanced.style_select}</span>
     175                </label>
     176            </th>
     177            <td class="field">
     178                <input type="text" id="img_style" name="img_style" value="" size="60" onblur="wpImage.demoSetStyle();" />
     179            </td>
     180        </tr>
     181
     182        <tr id="img_prop">
     183            <th valign="top" scope="row" class="label">
     184                <label for="img_prop">
     185                    <span class="alignleft">{#advanced.image_props_desc}</span>
     186                </label>
     187            </th>
     188            <td class="field">
     189                <label for="border">{#advanced_dlg.image_border}</label>
     190                <input type="text" maxlength="5" id="border" name="border" value="" onblur="wpImage.updateStyle('border')" />
     191
     192                <label for="vspace">{#advanced_dlg.image_vspace}</label>
     193                <input type="text" maxlength="5" id="vspace" name="vspace" value="" onblur="wpImage.updateStyle('vspace')" />
     194
     195                <label for="hspace">{#advanced_dlg.image_hspace}</label>
     196                <input type="text" maxlength="5" id="hspace" name="hspace" value="" onblur="wpImage.updateStyle('hspace')" />
    173197            </td>
    174198        </tr>
     
    176200    </table>
    177201
    178     <h3>Advanced Link Settings</h3>
    179     <table id="adv_settings_img" class="describe"> 
     202    <h3>{#wpeditimage.adv_link_settings}</h3>
     203    <table id="adv_settings_link" class="describe">
    180204        <tbody>
    181205        <tr>
    182206            <th valign="top" scope="row" class="label">
    183207                <label for="link_title">
    184                 <span class="alignleft">Link Title</span>
     208                <span class="alignleft">{#advanced_dlg.link_titlefield}</span>
    185209                </label>
    186210            </th>
     
    193217            <th valign="top" scope="row" class="label">
    194218                <label for="link_rel">
    195                 <span class="alignleft">Link Rel</span>
     219                <span class="alignleft">{#wpeditimage.link_rel}</span>
    196220                </label>
    197221            </th>
     
    203227        <tr>
    204228            <th valign="top" scope="row" class="label">
    205                 <label for="link_rev">
    206                 <span class="alignleft">Link Rev</span>
    207                 </label>
    208             </th>
    209             <td class="field">
    210                 <input type="text" id="link_rev" name="link_rev" value="" size="60" />
    211             </td>
    212         </tr>
    213 
    214         <tr>
    215             <th valign="top" scope="row" class="label">
    216229                <label for="link_classes">
    217                 <span class="alignleft">CSS Class</span>
     230                <span class="alignleft">{#wpeditimage.css}</span>
    218231                </label>
    219232            </th>
     
    226239            <th valign="top" scope="row" class="label">
    227240                <label for="link_style">
    228                 <span class="alignleft">Style</span>
     241                <span class="alignleft">{#advanced.style_select}</span>
    229242                </label>
    230243            </th>
     
    236249        <tr>
    237250            <th valign="top" scope="row" class="label">
     251                <label>
     252                <span class="alignleft">{#advanced_dlg.link_target}</span>
     253                </label>
     254            </th>
     255            <td class="field">
    238256                <label for="link_target">
    239                 <span class="alignleft">Target</span>
    240                 </label>
    241             </th>
    242             <td class="field">
    243                 <input type="text" id="link_target" name="link_target" value="" size="60" />
     257                {#advanced_dlg.link_target_blank}
     258                </label>
     259                <input type="checkbox" id="link_target" name="link_target" value="_blank" />
    244260            </td>
    245261        </tr>
     
    248264
    249265    <div id="saveeditimg">
    250         <input type="hidden" id="border" name="border" value="" />
    251         <input type="hidden" id="hspace" name="hspace" value="" />
    252         <input type="hidden" id="vspace" name="vspace" value="" />
    253266        <input type="hidden" id="align" name="align" value="" />
    254267
  • branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js

    r8066 r8103  
    9595    link : '',
    9696    link_rel : '',
     97    target_value : '',
    9798
    9899    setTabs : function(tab) {
     
    180181                m = Math.min(W, m);
    181182                f.width.value = m;
    182                 f.height.value = Math.floor((m / W) * H);
     183                f.height.value = Math.round((m / W) * H);
    183184            } else {
    184185                m = Math.min(H, m);
    185186                f.height.value = m;
    186                 f.width.value = Math.floor((m / H) * W);
     187                f.width.value = Math.round((m / H) * W);
    187188            }
    188189
     
    196197        var demo = this.I('img_demo'), f = document.forms[0];
    197198
    198         demo.style.width = f.width.value ? Math.floor(f.width.value * 0.6) + 'px' : '';
    199         demo.style.height = f.height.value ? Math.floor(f.height.value * 0.6) + 'px' : '60%';
     199        demo.width = f.width.value ? Math.floor(f.width.value * 0.5) : '';
     200        demo.height = f.height.value ? Math.floor(f.height.value * 0.5) : '';
     201    },
     202   
     203    demoSetStyle : function() {
     204        var f = document.forms[0], demo = this.I('img_demo');
     205
     206        if (demo)
     207            tinyMCEPopup.editor.dom.setAttrib(demo, 'style', f.img_style.value);
    200208    },
    201209   
     
    218226            h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
    219227
    220         document.dir = ed.getParam('directionality','');
    221228        document.body.innerHTML = ed.translate(h);
    222229        window.setTimeout( function(){wpImage.setup();}, 100 );
     
    224231
    225232    setup : function() {
    226         var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), tr = ed.translate;
    227 
     233        var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom;
     234    document.dir = tinyMCEPopup.editor.getParam('directionality','');
    228235        tinyMCEPopup.restoreSelection();
    229236        el = ed.selection.getNode();
     
    242249        f.img_classes.value = c = ed.dom.getAttrib(el, 'class');
    243250        f.img_style.value = ed.dom.getAttrib(el, 'style');
    244         this.updateStyle();
     251       
     252        // Move attribs to styles
     253        if (dom.getAttrib(el, 'align'))
     254            t.updateStyle('align');
     255
     256        if (dom.getAttrib(el, 'hspace'))
     257            t.updateStyle('hspace');
     258
     259        if (dom.getAttrib(el, 'border'))
     260            t.updateStyle('border');
     261
     262        if (dom.getAttrib(el, 'vspace'))
     263            t.updateStyle('vspace');
    245264
    246265        if (pa = ed.dom.getParent(el, 'A')) {
     
    248267            f.link_title.value = ed.dom.getAttrib(pa, 'title');
    249268            f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
    250             f.link_rev.value = ed.dom.getAttrib(pa, 'rev');
    251269            f.link_style.value = ed.dom.getAttrib(pa, 'style');
    252             f.link_target.value = ed.dom.getAttrib(pa, 'target');
     270            t.target_value = ed.dom.getAttrib(pa, 'target');
    253271            f.link_classes.value = ed.dom.getAttrib(pa, 'class');
    254272        }
    255273
     274        f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : '';
     275       
    256276        fname = link.substring( link.lastIndexOf('/') );
    257277        fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
     
    281301        document.body.style.display = '';
    282302        t.getImageData();
    283 
    284         if ( (id = c.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) {
    285             t.I('tab_attachment').href = tinymce.documentBaseURL + 'media.php?action=edit&attachment_id=' + id[1];
    286             t.I('tab_attachment').style.display = 'inline';
    287         }
     303        t.demoSetStyle();
     304
     305        // Test if is attachment
     306//      if ( (id = c.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) {
     307//          t.I('tab_attachment').href = tinymce.documentBaseURL + 'media.php?action=edit&attachment_id=' + id[1];
     308//          t.I('tab_attachment').style.display = 'inline';
     309//      }
    288310    },
    289311
     
    351373                        title : f.link_title.value,
    352374                        rel : f.link_rel.value,
    353                         rev : f.link_rev.value,
    354                         target : f.link_target.value,
     375                        target : (f.link_target.checked == true) ? '_blank' : '',
    355376                        'class' : f.link_classes.value,
    356377                        style : f.link_style.value
     
    363384                title : f.link_title.value,
    364385                rel : f.link_rel.value,
    365                 rev : f.link_rev.value,
    366                 target : f.link_target.value,
     386                target : (f.link_target.checked == true) ? '_blank' : '',
    367387                'class' : f.link_classes.value,
    368388                style : f.link_style.value
     
    373393        tinyMCEPopup.close();
    374394    },
    375 
    376     updateStyle : function() {
    377         var dom = tinyMCEPopup.dom, st, v, f = document.forms[0];
     395   
     396    updateStyle : function(ty) {
     397        var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
    378398
    379399        if (tinyMCEPopup.editor.settings.inline_styles) {
    380             st = tinyMCEPopup.dom.parseStyle(f.img_style.value);
    381 
    382400            // Handle align
    383             v = f.align.value;
    384             if (v) {
    385                 if (v == 'left' || v == 'right') {
    386                     st['float'] = v;
    387                     delete st['vertical-align'];
    388                 } else {
    389                     st['vertical-align'] = v;
    390                     delete st['float'];
     401            if (ty == 'align') {
     402                dom.setStyle(img, 'float', '');
     403                dom.setStyle(img, 'vertical-align', '');
     404
     405                v = f.align.value;
     406                if (v) {
     407                    if (v == 'left' || v == 'right')
     408                        dom.setStyle(img, 'float', v);
     409                    else
     410                        img.style.verticalAlign = v;
    391411                }
    392             } else {
    393                 delete st['float'];
    394                 delete st['vertical-align'];
    395412            }
    396413
    397414            // Handle border
    398             v = f.border.value;
    399             if (v || v == '0') {
    400                 if (v == '0')
    401                     st['border'] = '0';
    402                 else
    403                     st['border'] = v + 'px solid black';
    404             } else
    405                 delete st['border'];
     415            if (ty == 'border') {
     416                dom.setStyle(img, 'border', '');
     417
     418                v = f.border.value;
     419                if (v || v == '0') {
     420                    if (v == '0')
     421                        img.style.border = '0';
     422                    else
     423                        img.style.border = v + 'px solid black';
     424                }
     425            }
    406426
    407427            // Handle hspace
    408             v = f.hspace.value;
    409             if (v) {
    410                 delete st['margin'];
    411                 st['margin-left'] = v + 'px';
    412                 st['margin-right'] = v + 'px';
    413             } else {
    414                 delete st['margin-left'];
    415                 delete st['margin-right'];
     428            if (ty == 'hspace') {
     429                dom.setStyle(img, 'marginLeft', '');
     430                dom.setStyle(img, 'marginRight', '');
     431
     432                v = f.hspace.value;
     433                if (v) {
     434                    img.style.marginLeft = v + 'px';
     435                    img.style.marginRight = v + 'px';
     436                }
    416437            }
    417438
    418439            // Handle vspace
    419             v = f.vspace.value;
    420             if (v) {
    421                 delete st['margin'];
    422                 st['margin-top'] = v + 'px';
    423                 st['margin-bottom'] = v + 'px';
    424             } else {
    425                 delete st['margin-top'];
    426                 delete st['margin-bottom'];
     440            if (ty == 'vspace') {
     441                dom.setStyle(img, 'marginTop', '');
     442                dom.setStyle(img, 'marginBottom', '');
     443
     444                v = f.vspace.value;
     445                if (v) {
     446                    img.style.marginTop = v + 'px';
     447                    img.style.marginBottom = v + 'px';
     448                }
    427449            }
    428450
    429451            // Merge
    430             st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st));
    431             f.img_style.value = dom.serializeStyle(st);
     452            f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
     453            this.demoSetStyle();
    432454        }
    433455    },
     
    445467        var f = document.forms[0];
    446468
    447         f.width.value = f.height.value = "";   
     469        f.width.value = f.height.value = '';   
    448470    },
    449471
  • branches/crazyhorse/wp-includes/js/tinymce/tiny_mce_config.php

    r8066 r8103  
    227227if ( $disk_cache ) {
    228228
    229     $cacheKey = apply_filters('tiny_mce_version', '20080606');
     229    $cacheKey = apply_filters('tiny_mce_version', '20080613');
    230230
    231231    foreach ( $initArray as $v )
  • branches/crazyhorse/wp-includes/pluggable.php

    r8069 r8103  
    316316                        $content_type = trim( $content );
    317317                    }
     318                } elseif ( 'cc' == strtolower($name) ) {
     319                    $cc = explode(",", $content);
     320                } elseif ( 'bcc' == strtolower($name) ) {
     321                    $bcc = explode(",", $content);
    318322                } else {
    319323                    // Add it to our grand headers array
     
    360364    $phpmailer->Subject = $subject;
    361365    $phpmailer->Body = $message;
     366
     367    // Add any CC and BCC recipients
     368    if ( !empty($cc) ) {
     369        foreach ($cc as $recipient) {
     370            $phpmailer->AddCc( trim($recipient) );
     371        }
     372    }
     373    if ( !empty($bcc) ) {
     374        foreach ($bcc as $recipient) {
     375            $phpmailer->AddBcc( trim($recipient) );
     376        }
     377    }
    362378
    363379    // Set to use PHP's mail()
  • branches/crazyhorse/wp-includes/post.php

    r8058 r8103  
    11<?php
    22/**
    3  * Post functions and post utility function
     3 * Post functions and post utility function.
     4 *
     5 * Warning: The inline documentation for the functions contained
     6 * in this file might be inaccurate, so the documentation is not
     7 * authoritative at the moment.
    48 *
    59 * @package WordPress
     
    751755
    752756/**
    753  * wp_count_posts() - Count number of posts with a given type
    754  *
    755  * {@internal Missing Long Description}}
     757 * Count number of posts of a post type and is permissible.
     758 *
     759 * This function provides an efficient method of finding the amount
     760 * of post's type a blog has. Another method is to count the amount
     761 * of items in get_posts(), but that method has a lot of overhead
     762 * with doing so. Therefore, when developing for 2.5+, use this
     763 * function instead.
     764 *
     765 * The $perm parameter checks for 'readable' value and if the user
     766 * can read private posts, it will display that for the user that
     767 * is signed in.
    756768 *
    757769 * @package WordPress
    758770 * @subpackage Post
    759771 * @since 2.5
    760  *
    761  * @param string $type Post type
    762  * @return array Number of posts for each status
     772 * @link http://codex.wordpress.org/Template_Tags/wp_count_posts
     773 *
     774 * @param string $type Optional. Post type to retrieve count
     775 * @param string $perm Optional. 'readable' or empty.
     776 * @return object Number of posts for each status
    763777 */
    764778function wp_count_posts( $type = 'post', $perm = '' ) {
     
    18141828function get_page_uri($page_id) {
    18151829    $page = get_page($page_id);
    1816     $uri = urldecode($page->post_name);
     1830    $uri = $page->post_name;
    18171831
    18181832    // A page cannot be it's own parent.
     
    18221836    while ($page->post_parent != 0) {
    18231837        $page = get_page($page->post_parent);
    1824         $uri = urldecode($page->post_name) . "/" . $uri;
     1838        $uri = $page->post_name . "/" . $uri;
    18251839    }
    18261840
  • branches/crazyhorse/wp-includes/script-loader.php

    r8066 r8103  
    3636
    3737    // Modify this version when tinyMCE plugins are changed.
    38     $mce_version = apply_filters('tiny_mce_version', '20080606');
     38    $mce_version = apply_filters('tiny_mce_version', '20080613');
    3939    $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
    4040
     
    227227    $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' );
    228228    $styles->add( 'press-this', '/wp-admin/css/press-this.css' );
    229     $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css' );
     229    $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20080613' );
    230230    $styles->add( 'login', '/wp-admin/css/login.css' );
    231231
  • branches/crazyhorse/wp-load.php

    r8070 r8103  
    1010 * wp-config.php file.
    1111 *
    12  * Also made to work in the wp-admin/ folder, because it
    13  * will look in the parent directory if the file is not
    14  * found in the current directory.
     12 * Will also search for wp-config.php in WordPress' parent
     13 * directory to allow the WordPress directory to remain
     14 * untouched.
    1515 *
    1616 * @package WordPress
  • branches/crazyhorse/xmlrpc.php

    r7991 r8103  
    111111        $this->methods = array(
    112112            // WordPress API
     113            'wp.getUsersBlogs'      => 'this:wp_getUsersBlogs',
    113114            'wp.getPage'            => 'this:wp_getPage',
    114115            'wp.getPages'           => 'this:wp_getPages',
     
    253254            }
    254255        }
     256    }
     257
     258    /**
     259     * WordPress XML-RPC API
     260     * wp_getUsersBlogs
     261     */
     262    function wp_getUsersBlogs( $args ) {
     263        // If this isn't on WPMU then just use blogger_getUsersBlogs
     264        if( !function_exists( 'is_site_admin' ) ) {
     265            array_unshift( $args, 1 );
     266            return $this->blogger_getUsersBlogs( $args );
     267        }
     268
     269        $this->escape( $args );
     270
     271        $username = $args[0];
     272        $password = $args[1];
     273
     274        if( !$this->login_pass_ok( $username, $password ) )
     275            return $this->error;
     276
     277        do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
     278
     279        $user = set_current_user( 0, $username );
     280
     281        $blogs = (array) get_blogs_of_user( $user->ID );
     282        $struct = array( );
     283
     284        foreach( $blogs as $blog ) {
     285            // Don't include blogs that aren't hosted at this site
     286            if( $blog->site_id != 1 )
     287                continue;
     288
     289            $blog_id = $blog->userblog_id;
     290            switch_to_blog($blog_id);
     291            $is_admin = current_user_can('level_8');
     292
     293            $struct[] = array(
     294                'isAdmin'       => $is_admin,
     295                'url'           => get_option( 'home' ) . '/',
     296                'blogid'        => $blog_id,
     297                'blogName'      => get_option( 'blogname' ),
     298                'xmlrpc'        => get_option( 'home' ) . '/xmlrpc.php'
     299            );
     300        }
     301
     302        return $struct;
    255303    }
    256304
     
    842890            'url'      => get_option('home') . '/',
    843891            'blogid'   => '1',
    844             'blogName' => get_option('blogname')
     892            'blogName' => get_option('blogname'),
     893            'xmlrpc'   => get_option('home') . '/xmlrpc.php',
    845894        );
    846895
Note: See TracChangeset for help on using the changeset viewer.