Changeset 8103
- Timestamp:
- 06/16/2008 09:08:49 PM (17 years ago)
- Location:
- branches/crazyhorse
- Files:
-
- 34 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-admin/categories.php
r7883 r8103 135 135 136 136 <div class="tablenav"> 137 138 <?php 139 $pagenum = absint( $_GET['pagenum'] ); 140 if ( empty($pagenum) ) 141 $pagenum = 1; 142 if( !$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 152 if ( $page_links ) 153 echo "<div class='tablenav-pages'>$page_links</div>"; 154 ?> 137 155 138 156 <div class="alignleft"> … … 157 175 <tbody id="the-list" class="list:cat"> 158 176 <?php 159 cat_rows( );177 cat_rows(0, 0, 0, $pagenum, $catsperpage); 160 178 ?> 161 179 </tbody> … … 164 182 165 183 <div class="tablenav"> 184 185 <?php 186 if ( $page_links ) 187 echo "<div class='tablenav-pages'>$page_links</div>"; 188 ?> 166 189 <br class="clear" /> 167 190 </div> -
branches/crazyhorse/wp-admin/css/press-this.css
r8071 r8103 450 450 padding-bottom: 2px; 451 451 } 452 #photo_saving { 453 margin-bottom: 8px; 454 } -
branches/crazyhorse/wp-admin/edit-pages.php
r7998 r8103 118 118 119 119 <div class="tablenav"> 120 121 <?php 122 $pagenum = absint( $_GET['pagenum'] ); 123 if ( empty($pagenum) ) 124 $pagenum = 1; 125 if( !$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 136 if ( $page_links ) 137 echo "<div class='tablenav-pages'>$page_links</div>"; 138 ?> 120 139 121 140 <div class="alignleft"> … … 152 171 </thead> 153 172 <tbody> 154 <?php page_rows($posts ); ?>173 <?php page_rows($posts, $pagenum, $per_page); ?> 155 174 </tbody> 156 175 </table> … … 170 189 171 190 <div class="tablenav"> 191 <?php 192 if ( $page_links ) 193 echo "<div class='tablenav-pages'>$page_links</div>"; 194 ?> 172 195 <br class="clear" /> 173 196 </div> -
branches/crazyhorse/wp-admin/gears-manifest.php
r8066 r8103 88 88 { 89 89 "betaManifestVersion" : 1, 90 "version" : "<?php echo $man_version; ?>_200806 06",90 "version" : "<?php echo $man_version; ?>_20080613", 91 91 "entries" : [ 92 92 <?php echo $defaults; ?> … … 178 178 { "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=3091" }, 179 179 { "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" }, 180 181 { "url" : "../wp-includes/js/tinymce/wordpress.css?ver=3091" }, 181 182 -
branches/crazyhorse/wp-admin/import/wp-cat2tag.php
r7897 r8103 25 25 26 26 function populate_cats() { 27 global $wpdb;28 27 29 28 $categories = get_categories('get=all'); 30 29 foreach ( $categories as $category ) { 31 30 $this->all_categories[] = $category; 32 if ( tag_exists( $wpdb->escape($category->name)) )31 if ( is_term( $category->slug, 'post_tag' ) ) 33 32 $this->hybrids_ids[] = $category->term_id; 34 33 } … … 36 35 37 36 function populate_tags() { 38 global $wpdb;39 37 40 38 $tags = get_terms( array('post_tag'), 'get=all' ); 41 39 foreach ( $tags as $tag ) { 42 40 $this->all_tags[] = $tag; 43 if ( $this->_category_exists($tag->term_id) )41 if ( is_term( $tag->slug, 'category' ) ) 44 42 $this->hybrids_ids[] = $tag->term_id; 45 43 } … … 53 51 54 52 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>'; 56 54 echo '<div class="narrow">'; 57 55 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>'; … … 59 57 60 58 $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>';63 59 } else { 64 60 echo '<p>'.__('You have no categories to convert!').'</p>'; … … 93 89 94 90 <form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&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()" /> 96 92 <?php wp_nonce_field('import-cat2tag'); ?></p> 97 93 <ul style="list-style:none"> 98 <?php 99 94 95 <?php $hier = _get_term_hierarchy('category'); 100 96 101 97 foreach ($this->all_categories as $category) { 102 98 $category = sanitize_term( $category, 'category', 'display' ); 103 99 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 111 102 <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php 112 103 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 } ?> 121 111 </ul> 122 112 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 128 116 <p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p> 129 117 </form> 130 118 131 <?php 132 } 119 <?php } 133 120 134 121 function tags_tab() { … … 139 126 140 127 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>'; 142 129 echo '<div class="narrow">'; 143 130 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>'; 144 131 echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>'; 145 146 132 147 133 $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>';150 134 } else { 151 135 echo '<p>'.__('You have no tags to convert!').'</p>'; … … 180 164 181 165 <form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&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()" /> 183 167 <?php wp_nonce_field('import-cat2tag'); ?></p> 184 168 <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 } ?> 199 174 </ul> 200 175 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>'; ?> 205 178 206 179 <p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php _e('Convert Tags to Categories'); ?>" /></p> 207 180 </form> 208 181 209 <?php 210 } 211 212 function _category_children($parent, $hier) { 213 ?> 182 <?php } 183 184 function _category_children($parent, $hier) { ?> 214 185 215 186 <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>'; 228 193 229 194 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 238 198 } 239 199 … … 253 213 global $wpdb; 254 214 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’t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';258 echo '</div>';259 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’t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag'); ?></p> 218 </div> 219 <?php return; 260 220 } 261 221 262 222 if ( empty($this->categories_to_convert) ) 263 223 $this->categories_to_convert = $_POST['cats_to_convert']; 224 264 225 $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'); 265 229 266 230 echo '<ul>'; … … 269 233 $cat_id = (int) $cat_id; 270 234 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"; 275 237 } else { 276 238 $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"; 281 263 continue; 282 264 } 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 ) 292 294 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 tag310 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );311 295 } 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"; 316 306 } 317 318 echo '</li>'; 319 } 320 307 } 321 308 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>'; 322 326 echo '<p>' . sprintf( __('We’re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag' ) . '</p>'; 323 327 } … … 333 337 } 334 338 335 if ( empty($this-> categories_to_convert) )339 if ( empty($this->tags_to_convert) ) 336 340 $this->tags_to_convert = $_POST['tags_to_convert']; 337 341 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'); 339 345 echo '<ul>'; 340 346 … … 342 348 $tag_id = (int) $tag_id; 343 349 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 353 377 continue; 354 378 } 355 379 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 363 380 // 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)) ) { 366 383 $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 ); 375 396 } 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 383 413 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>'; 384 416 echo '<p>' . sprintf( __('We’re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag&step=3' ) . '</p>'; 385 417 } … … 402 434 $this->convert_categories(); 403 435 break; 404 436 405 437 case 3 : 406 438 $this->tags_tab(); 407 439 break; 408 440 409 441 case 4 : 410 442 check_admin_referer('import-cat2tag'); -
branches/crazyhorse/wp-admin/includes/dashboard.php
r8016 r8103 316 316 @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP ); 317 317 $rss = @fetch_rss( $url ); 318 if ( isset($rss->items) && 1 < count($rss->items) ) {// Technorati returns a 1-item feed when it has no results318 if ( isset($rss->items) && 0 < count($rss->items) ) { 319 319 320 320 echo "<ul>\n"; -
branches/crazyhorse/wp-admin/includes/file.php
r8053 r8103 41 41 42 42 return $real_file; 43 } 44 //$folder = Full path to folder 45 //$levels = Levels of folders to follow, Default: 100 (PHP Loop limit) 46 function 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; 43 71 } 44 72 -
branches/crazyhorse/wp-admin/includes/plugin.php
r8068 r8103 137 137 } 138 138 139 //Replaces reactivate_all_plugins() / deactivate_all_plugins() = 'deactivated_plugins' is now useless140 139 function activate_plugins($plugins, $redirect = '') { 141 140 if ( !is_array($plugins) ) … … 168 167 169 168 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'); 171 170 if ( false === ($credentials = request_filesystem_credentials($url)) ) { 172 171 $data = ob_get_contents(); … … 244 243 // plugins. 245 244 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); 253 248 } 254 249 } -
branches/crazyhorse/wp-admin/includes/template.php
r7956 r8103 5 5 // 6 6 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. 8 function 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 13 function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) { 14 if ( empty($categories) ) { 10 15 $args = array('hide_empty' => 0); 11 16 if ( !empty($_GET['s']) ) … … 14 19 } 15 20 21 if ( !$categories ) 22 return false; 23 16 24 $children = _get_term_hierarchy('category'); 17 25 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; 25 49 } 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; 36 74 } 37 75 … … 361 399 * otherwise, display the row and its children in subsequent rows 362 400 */ 363 function display_page_row( $page, &$children_pages,$level = 0 ) {401 function display_page_row( $page, $level = 0 ) { 364 402 global $post; 365 403 static $class; … … 485 523 486 524 <?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 splice499 }500 }501 525 } 502 526 … … 504 528 * displays pages in hierarchical order 505 529 */ 506 function page_rows( $pages ) { 507 if ( ! $pages ) 530 531 function page_rows($pages, $pagenum = 1, $per_page = 20) { 532 $level = 0; 533 534 if ( ! $pages ) { 508 535 $pages = get_pages( array('sort_column' => 'menu_order') ); 509 536 510 if ( ! $pages ) 511 return false; 537 if ( ! $pages ) 538 return false; 539 } 512 540 513 541 // splice pages into two parts: those without parent and those with parent 514 515 542 $top_level_pages = array(); 516 543 $children_pages = array(); 517 544 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; 518 568 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 584 function _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 } 547 623 } 548 624 -
branches/crazyhorse/wp-admin/plugins.php
r8068 r8103 31 31 break; 32 32 case 'activate-selected': 33 check_admin_referer(' mass-manage-plugins');33 check_admin_referer('bulk-manage-plugins'); 34 34 activate_plugins($_POST['checked'], 'plugins.php?error=true'); 35 35 … … 63 63 break; 64 64 case 'deactivate-selected': 65 check_admin_referer(' mass-manage-plugins');65 check_admin_referer('bulk-manage-plugins'); 66 66 deactivate_plugins($_POST['checked']); 67 67 $deactivated = array(); … … 75 75 if( ! current_user_can('delete_plugins') ) 76 76 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. 79 81 include(ABSPATH . 'wp-admin/update.php'); 80 82 81 83 $title = __('Delete Plugin'); 82 84 $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 } 84 153 $delete_result = delete_plugins($plugins); 85 154 … … 87 156 88 157 break; 89 default:90 var_dump("Unknown Action $action");91 158 } 92 159 } … … 225 292 <h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3> 226 293 <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') ?> 228 295 229 296 <div class="tablenav"> … … 241 308 <h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3> 242 309 <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') ?> 244 311 245 312 <div class="tablenav"> … … 258 325 <h3 id="available-plugins"><?php _e('Available Plugins') ?></h3> 259 326 <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) ) : ?> 262 330 <div class="tablenav"> 263 331 <div class="alignleft"> … … 271 339 <?php print_plugins_table($available_plugins, 'available') ?> 272 340 </form> 341 <?php endif; ?> 273 342 274 343 <h2><?php _e('Get More Plugins'); ?></h2> -
branches/crazyhorse/wp-admin/press-this.php
r8071 r8103 77 77 <p class="submit"> 78 78 <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;"/> 80 80 </p> 81 81 </div> … … 155 155 156 156 if($_REQUEST['ajax'] == 'photo_images') { 157 $url = urldecode($url); 158 $url = str_replace(' ', '%20', $url); 159 157 error_log('photo images'); 160 158 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 162 162 $content = wp_remote_fopen($uri); 163 163 $host = parse_url($uri); 164 164 165 if ( false === $content ) return ''; 165 166 $pattern = '/<img [^>]+src=[\'"]([^\'" >]+?)[\'" >]/is';166 167 $pattern = '/<img ([^>]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is'; 167 168 preg_match_all($pattern, $content, $matches); 168 if ( empty($matches[1]) ) return ''; 169 169 if ( empty($matches[1]) ) { error_log('empty'); return ''; }; 170 170 $sources = array(); 171 171 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; 174 175 if(strpos($src, 'http') === false) { 175 176 if(strpos($src, '../') === false && strpos($src, './') === false) { … … 179 180 } 180 181 } 182 181 183 $sources[] = $src; 182 184 } … … 184 186 } 185 187 186 188 $url = urldecode($url); 189 $url = str_replace(' ', '%20', $url); 187 190 echo 'new Array('.get_images_from_uri($url).')'; 188 191 die; … … 367 370 set_menu('text'); 368 371 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 } ?> 370 377 return false; 371 378 break; … … 376 383 set_menu('quote'); 377 384 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>"); 379 386 380 387 return false; … … 422 429 <?php if($selection) { ?> 423 430 set_editor("<?php echo $selection; ?>"); 424 <?php } else { ?>425 set_editor('')426 431 <?php } ?> 427 432 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>'); 429 434 jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&u='.attribute_escape($url); ?>'); 430 435 jQuery.ajax({ … … 435 440 dataType : "script", 436 441 success : function() { 437 jQuery('#waiting'). innerHTML('');442 jQuery('#waiting').remove(); 438 443 } 439 444 }); … … 490 495 <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> 491 496 <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> 495 498 </div> 496 499 </div> -
branches/crazyhorse/wp-admin/wp-admin.css
r8066 r8103 601 601 } 602 602 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 { 604 604 text-decoration: none; 605 605 } -
branches/crazyhorse/wp-includes/atomlib.php
r6440 r8103 1 1 <?php 2 /* 2 /** 3 3 * Atom Syndication Format PHP Library 4 4 * -
branches/crazyhorse/wp-includes/category.php
r6655 r8103 1 1 <?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 */ 3 16 function get_all_category_ids() { 4 17 if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { … … 10 23 } 11 24 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 */ 12 39 function &get_categories($args = '') { 13 40 $defaults = array('type' => 'category'); … … 25 52 } 26 53 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 */ 29 76 function &get_category($category, $output = OBJECT, $filter = 'raw') { 30 77 $category = get_term($category, 'category', $output, $filter); … … 37 84 } 38 85 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 */ 39 105 function get_category_by_path($category_path, $full_match = true, $output = OBJECT) { 40 106 $category_path = rawurlencode(urldecode($category_path)); … … 51 117 52 118 if ( empty($categories) ) 53 return NULL;119 return null; 54 120 55 121 foreach ($categories as $category) { … … 71 137 return get_category($categories[0]->term_id, $output); 72 138 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 */ 76 150 function get_category_by_slug( $slug ) { 77 151 $category = get_term_by('slug', $slug, 'category'); … … 82 156 } 83 157 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 */ 85 167 function get_cat_ID($cat_name='General') { 86 168 $cat = get_term_by('name', $cat_name, 'category'); … … 90 172 } 91 173 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 */ 93 185 function get_catname($cat_ID) { 94 186 return get_cat_name($cat_ID); 95 187 } 96 188 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 */ 98 198 function get_cat_name($cat_id) { 99 199 $cat_id = (int) $cat_id; … … 102 202 } 103 203 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 */ 104 217 function cat_is_ancestor_of($cat1, $cat2) { 105 218 if ( is_int($cat1) ) … … 117 230 } 118 231 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 */ 119 243 function sanitize_category($category, $context = 'display') { 120 244 return sanitize_term($category, 'category', $context); 121 245 } 122 246 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 */ 123 260 function sanitize_category_field($field, $value, $cat_id, $context) { 124 261 return sanitize_term_field($field, $value, $cat_id, 'category', $context); 125 262 } 126 263 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 */ 129 277 function &get_tags($args = '') { 130 278 $tags = get_terms('post_tag', $args); … … 137 285 } 138 286 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 */ 139 307 function &get_tag($tag, $output = OBJECT, $filter = 'raw') { 140 308 return get_term($tag, 'post_tag', $output, $filter); 141 309 } 142 310 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 */ 147 326 function update_category_cache() { 148 327 return true; 149 328 } 150 329 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 */ 151 339 function clean_category_cache($id) { 152 340 clean_term_cache($id, 'category'); 153 341 } 154 342 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 */ 159 363 function _make_cat_compat( &$category) { 160 364 if ( is_object($category) ) { … … 175 379 } 176 380 381 177 382 ?> -
branches/crazyhorse/wp-includes/class-IXR.php
r7615 r8103 14 14 */ 15 15 16 /** 17 * IXR_Value 18 * 19 * @package IXR 20 * @since 1.5 21 */ 16 22 class IXR_Value { 17 23 var $data; … … 121 127 } 122 128 123 129 /** 130 * IXR_Message 131 * 132 * @package IXR 133 * @since 1.5 134 */ 124 135 class IXR_Message { 125 136 var $message; … … 264 275 } 265 276 266 277 /** 278 * IXR_Server 279 * 280 * @package IXR 281 * @since 1.5 282 */ 267 283 class IXR_Server { 268 284 var $data; … … 425 441 } 426 442 443 /** 444 * IXR_Request 445 * 446 * @package IXR 447 * @since 1.5 448 */ 427 449 class IXR_Request { 428 450 var $method; … … 455 477 } 456 478 457 479 /** 480 * IXR_Client 481 * 482 * @package IXR 483 * @since 1.5 484 */ 458 485 class IXR_Client { 459 486 var $server; … … 566 593 } 567 594 568 595 /** 596 * IXR_Error 597 * 598 * @package IXR 599 * @since 1.5 600 */ 569 601 class IXR_Error { 570 602 var $code; … … 598 630 } 599 631 600 632 /** 633 * IXR_Date 634 * 635 * @package IXR 636 * @since 1.5 637 */ 601 638 class IXR_Date { 602 639 var $year; … … 642 679 } 643 680 644 681 /** 682 * IXR_Base64 683 * 684 * @package IXR 685 * @since 1.5 686 */ 645 687 class IXR_Base64 { 646 688 var $data; … … 653 695 } 654 696 655 697 /** 698 * IXR_IntrospectionServer 699 * 700 * @package IXR 701 * @since 1.5 702 */ 656 703 class IXR_IntrospectionServer extends IXR_Server { 657 704 var $signatures; … … 797 844 } 798 845 799 846 /** 847 * IXR_ClientMulticall 848 * 849 * @package IXR 850 * @since 1.5 851 */ 800 852 class IXR_ClientMulticall extends IXR_Client { 801 853 var $calls = array(); -
branches/crazyhorse/wp-includes/class-phpass.php
r7421 r8103 9 9 10 10 # 11 # Portable PHP password hashing framework.12 #13 # Version 0.1 / genuine.14 #15 11 # Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in 16 12 # the public domain. 17 13 # 18 14 # There's absolutely no warranty. 19 #20 # The homepage URL for this framework is:21 #22 # http://www.openwall.com/phpass/23 15 # 24 16 # Please be sure to update the Version line if you edit this file in any way. … … 33 25 # requirements (there can be none), but merely suggestions. 34 26 # 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 */ 35 36 class PasswordHash { 36 37 var $itoa64; -
branches/crazyhorse/wp-includes/class-phpmailer.php
r7451 r8103 1 1 <?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 */ 13 12 14 13 /** -
branches/crazyhorse/wp-includes/class-pop3.php
r6440 r8103 18 18 */ 19 19 20 /** 21 * POP3 22 * 23 * @package SquirrelMail 24 */ 20 25 class POP3 { 21 26 var $ERROR = ''; // Error string. -
branches/crazyhorse/wp-includes/class-smtp.php
r5700 r8103 1 1 <?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 */ 15 14 16 15 /** … … 19 18 * error. SMTP also provides some utility methods for sending mail 20 19 * to an SMTP server. 20 * 21 21 * @package PHPMailer 22 22 * @author Chris Ryan -
branches/crazyhorse/wp-includes/class-snoopy.php
r6440 r8103 9 9 * @package Snoopy 10 10 */ 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 12 if ( !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 * 18 20 * This library is free software; you can redistribute it and/or 19 21 * modify it under the terms of the GNU Lesser General Public … … 29 31 * License along with this library; if not, write to the Free Software 30 32 * 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 */ 47 46 class Snoopy 48 47 { -
branches/crazyhorse/wp-includes/comment.php
r8052 r8103 7 7 8 8 /** 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). 12 26 * 13 27 * @since 1.2 14 28 * @uses $wpdb 15 29 * 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 24 40 */ 25 41 function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) { … … 84 100 85 101 /** 86 * get_approved_comments() - Returns the approved comments for post $post_id102 * Retrieve the approved comments for post $post_id. 87 103 * 88 104 * @since 2.0 … … 98 114 99 115 /** 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. 103 123 * 104 124 * @since 2.0 105 125 * @uses $wpdb 106 126 * 107 * @param object|string|int $comment {@internal Missing Description}}108 * @param string $output O BJECT or ARRAY_A or ARRAY_N constants127 * @param object|string|int $comment Comment to retrieve. 128 * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants 109 129 * @return object|array|null Depends on $output value. 110 130 */ … … 143 163 144 164 /** 145 * get_commentdata() - Returns an array of comment data about comment $comment_ID146 * 147 * get_comment() technically does the same thing as this function. This function also148 * a ppears 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 in150 * 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(). 151 171 * 152 172 * @deprecated Use get_comment() … … 163 183 * @return array The comment data 164 184 */ 165 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries185 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { 166 186 global $postc, $wpdb; 167 187 if ( $no_cache ) { … … 187 207 188 208 /** 189 * get_lastcommentmodified() - The date the last comment was modified209 * The date the last comment was modified. 190 210 * 191 211 * {@internal Missing Long Description}} … … 195 215 * @global array $cache_lastcommentmodified 196 216 * 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 198 219 * @return string Last comment modified date 199 220 */ … … 224 245 225 246 /** 226 * get_comment_count() - The amount of comments in a post or total comments247 * The amount of comments in a post or total comments. 227 248 * 228 249 * {@internal Missing Long Description}} … … 231 252 * @uses $wpdb 232 253 * 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 235 255 * @return array The amount of spam, approved, awaiting moderation, and total 236 256 */ … … 282 302 283 303 /** 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. 287 308 * 288 309 * @since 2.0.4 289 *290 310 */ 291 311 function sanitize_comment_cookies() { … … 312 332 313 333 /** 314 * wp_allow_comment() - Validates whether this comment is allowed to be made or not334 * Validates whether this comment is allowed to be made or not. 315 335 * 316 336 * {@internal Missing Long Description}} … … 363 383 364 384 /** 365 * check_comment_flood_db() -{@internal Missing Short Description}}385 * {@internal Missing Short Description}} 366 386 * 367 387 * {@internal Missing Long Description}} … … 392 412 393 413 /** 394 * wp_blacklist_check() - Does comment contain blacklisted characters or words414 * Does comment contain blacklisted characters or words. 395 415 * 396 416 * {@internal Missing Long Description}} … … 449 469 } 450 470 471 /** 472 * {@internal Missing Short Description}} 473 * 474 * {@internal Missing Long Description}} 475 * 476 * @param unknown_type $post_id 477 * @return unknown 478 */ 451 479 function wp_count_comments( $post_id = 0 ) { 452 480 global $wpdb; … … 486 514 487 515 /** 488 * wp_delete_comment() - Removes comment ID and maybe updates post comment count489 * 490 * The post comment count will be updated if the comment was approved and has a post491 * 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. 492 520 * 493 521 * @since 2.0.0 … … 519 547 520 548 /** 521 * wp_get_comment_status() - The status of a comment by ID549 * The status of a comment by ID. 522 550 * 523 551 * @since 1.0.0 … … 546 574 547 575 /** 548 * wp_get_current_commenter() - Get current commenter's name, email, and URL576 * Get current commenter's name, email, and URL. 549 577 * 550 578 * Expects cookies content to already be sanitized. User of this function … … 576 604 577 605 /** 578 * wp_insert_comment() - Inserts a comment to the database606 * Inserts a comment to the database. 579 607 * 580 608 * {@internal Missing Long Description}} … … 617 645 618 646 /** 619 * wp_filter_comment() - Parses and returns comment information620 * 621 * Sets the comment data 'filtered' field to true when finished. This 622 * c an be checked as to whether the comment should be filtered and to623 * keep fromfiltering 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. 624 652 * 625 653 * @since 2.0.0 … … 648 676 649 677 /** 650 * wp_throttle_comment_flood() -{@internal Missing Short Description}}678 * {@internal Missing Short Description}} 651 679 * 652 680 * {@internal Missing Long Description}} … … 668 696 669 697 /** 670 * wp_new_comment() - Parses and adds a new comment to the database698 * Parses and adds a new comment to the database. 671 699 * 672 700 * {@internal Missing Long Description}} … … 716 744 717 745 /** 718 * wp_set_comment_status() - Sets the status of comment ID746 * Sets the status of comment ID. 719 747 * 720 748 * {@internal Missing Long Description}} … … 763 791 764 792 /** 765 * wp_update_comment() - Parses and updates an existing comment in the database793 * Parses and updates an existing comment in the database. 766 794 * 767 795 * {@internal Missing Long Description}} … … 822 850 823 851 /** 824 * wp_defer_comment_counting() - Whether to defer comment counting852 * Whether to defer comment counting. 825 853 * 826 854 * When setting $defer to true, all post comment counts will not be updated … … 849 877 850 878 /** 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 will855 * be updated at alater 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 deferred859 * postIDs 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. 860 888 * 861 889 * @since 2.1.0 … … 888 916 889 917 /** 890 * wp_update_comment_count_now() - Updates the comment count for the post918 * Updates the comment count for the post. 891 919 * 892 920 * @since 2.5 … … 926 954 927 955 /** 928 * discover_pingback_server_uri() - Finds a pingback server URI based on the given URL956 * Finds a pingback server URI based on the given URL. 929 957 * 930 958 * {@internal Missing Long Description}} … … 1022 1050 1023 1051 /** 1024 * do_all_pings() -{@internal Missing Short Description}}1052 * {@internal Missing Short Description}} 1025 1053 * 1026 1054 * {@internal Missing Long Description}} … … 1055 1083 1056 1084 /** 1057 * do_trackbacks() -{@internal Missing Short Description}}1085 * {@internal Missing Short Description}} 1058 1086 * 1059 1087 * {@internal Missing Long Description}} … … 1099 1127 1100 1128 /** 1101 * generic_ping() -{@internal Missing Short Description}}1129 * {@internal Missing Short Description}} 1102 1130 * 1103 1131 * {@internal Missing Long Description}} … … 1122 1150 1123 1151 /** 1124 * pingback() - Pings back the links found in a post1152 * Pings back the links found in a post. 1125 1153 * 1126 1154 * {@internal Missing Long Description}} … … 1199 1227 1200 1228 /** 1201 * privacy_ping_filter() -{@internal Missing Short Description}}1229 * {@internal Missing Short Description}} 1202 1230 * 1203 1231 * {@internal Missing Long Description}} … … 1216 1244 1217 1245 /** 1218 * trackback() - Send a Trackback1219 * 1220 * {@internal Missing Long Description}}1246 * Send a Trackback. 1247 * 1248 * Updates database when sending trackback to prevent duplicates. 1221 1249 * 1222 1250 * @since 0.71 … … 1224 1252 * @uses $wp_version WordPress version 1225 1253 * 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 1231 1259 */ 1232 1260 function trackback($trackback_url, $title, $excerpt, $ID) { … … 1262 1290 1263 1291 /** 1264 * weblog_ping() - {@internal Missing Short Description}} 1265 * 1266 * {@internal Missing Long Description}} 1292 * Send a pingback. 1267 1293 * 1268 1294 * @since 1.2.0 … … 1270 1296 * @uses IXR_Client 1271 1297 * 1272 * @param unknown_type $server1273 * @param unknown_type $path1298 * @param string $server Host of blog to connect to. 1299 * @param string $path Path to send the ping. 1274 1300 */ 1275 1301 function weblog_ping($server = '', $path = '') { … … 1294 1320 1295 1321 /** 1296 * clean_comment_cache() - Removes comment ID from the comment cache1322 * Removes comment ID from the comment cache. 1297 1323 * 1298 1324 * @since 2.3.0 … … 1307 1333 1308 1334 /** 1309 * update_comment_cache() - Updates the comment cache of given comments1335 * Updates the comment cache of given comments. 1310 1336 * 1311 1337 * Will add the comments in $comments to the cache. If comment ID already -
branches/crazyhorse/wp-includes/formatting.php
r8054 r8103 1133 1133 $output = str_replace('>', '&gt;', $output); 1134 1134 1135 // These should be entities too 1136 $output = str_replace('<', '<', $output); 1137 $output = str_replace('>', '>', $output); 1138 1135 1139 return apply_filters('richedit_pre', $output); 1136 1140 } -
branches/crazyhorse/wp-includes/functions.php
r8069 r8103 1 1 <?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 */ 3 25 function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) { 4 26 global $wp_locale; … … 52 74 } 53 75 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 */ 55 91 function current_time( $type, $gmt = 0 ) { 56 92 switch ( $type ) { … … 89 125 } 90 126 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 */ 92 136 function number_format_i18n( $number, $decimals = null ) { 93 137 global $wp_locale; … … 98 142 } 99 143 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 */ 101 165 function size_format( $bytes, $decimals = null ) { 102 // technically the correct unit names for powers of 1024 are KiB, MiB etc103 // see http://en.wikipedia.org/wiki/Byte104 166 $quant = array( 105 167 // ========================= Origin ==== … … 145 207 } 146 208 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 */ 148 217 function maybe_unserialize( $original ) { 149 218 if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in … … 153 222 } 154 223 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 */ 156 235 function is_serialized( $data ) { 157 236 // if it isn't a string, it isn't serialized … … 180 259 } 181 260 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 */ 183 269 function is_serialized_string( $data ) { 184 270 // if it isn't a string, it isn't a serialized string … … 191 277 } 192 278 193 194 279 /* Options functions */ 195 280 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 */ 197 293 function get_option( $setting ) { 198 294 global $wpdb; … … 244 340 } 245 341 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 */ 247 353 function wp_protect_special_option( $option ) { 248 354 $protected = array( 'alloptions', 'notoptions' ); … … 251 357 } 252 358 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 */ 253 369 function form_option( $option ) { 254 370 echo attribute_escape (get_option( $option ) ); … … 405 521 function maybe_serialize( $data ) { 406 522 if ( is_string( $data ) ) 407 $data = trim( $data );523 return $data; 408 524 elseif ( is_array( $data ) || is_object( $data ) ) 409 525 return serialize( $data ); … … 537 653 } 538 654 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 */ 542 668 function wp_get_http( $url, $file_path = false, $red = 1 ) { 543 669 global $wp_version; … … 611 737 } 612 738 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 */ 613 748 function wp_get_http_headers( $url, $red = 1 ) { 614 749 return wp_get_http( $url, false, $red ); 615 750 } 616 751 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 */ 618 763 function is_new_day() { 619 764 global $day, $previousday; … … 629 774 } 630 775 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 */ 642 792 function add_query_arg() { 643 793 $ret = ''; … … 705 855 } 706 856 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 */ 866 function remove_query_arg( $key, $query=false ) { 719 867 if ( is_array( $key ) ) { // removing multiple keys 720 868 foreach ( (array) $key as $k ) 721 $query = add_query_arg( $k, FALSE, $query );869 $query = add_query_arg( $k, false, $query ); 722 870 return $query; 723 871 } 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 */ 728 883 function add_magic_quotes( $array ) { 729 884 global $wpdb; … … 783 938 } 784 939 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 */ 786 948 function get_status_header_desc( $code ) { 787 949 global $wp_header_to_desc; … … 863 1025 } 864 1026 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 */ 866 1035 function nocache_headers() { 867 1036 // why are these @-silenced when other header calls aren't? … … 872 1041 } 873 1042 874 1043 /** 1044 * Set the headers for caching for 10 days with JavaScript content type. 1045 * 1046 * @since 2.1.0 1047 */ 875 1048 function cache_javascript_headers() { 876 1049 $expiresOffset = 864000; // 10 days … … 880 1053 } 881 1054 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 */ 883 1062 function get_num_queries() { 884 1063 global $wpdb; … … 886 1065 } 887 1066 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 */ 889 1075 function bool_from_yn( $yn ) { 890 1076 return ( strtolower( $yn ) == 'y' ); … … 912 1098 } 913 1099 914 1100 /** 1101 * Load the RDF RSS 0.91 Feed template. 1102 * 1103 * @since 2.1.0 1104 */ 915 1105 function do_feed_rdf() { 916 1106 load_template( ABSPATH . WPINC . '/feed-rdf.php' ); 917 1107 } 918 1108 919 1109 /** 1110 * Load the RSS 1.0 Feed Template 1111 * 1112 * @since 2.1.0 1113 */ 920 1114 function do_feed_rss() { 921 1115 load_template( ABSPATH . WPINC . '/feed-rss.php' ); 922 1116 } 923 1117 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 */ 925 1125 function do_feed_rss2( $for_comments ) { 926 1126 if ( $for_comments ) … … 930 1130 } 931 1131 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 */ 933 1139 function do_feed_atom( $for_comments ) { 934 1140 if ($for_comments) … … 938 1144 } 939 1145 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 */ 940 1155 function do_robots() { 941 1156 header( 'Content-Type: text/plain; charset=utf-8' ); … … 1512 1727 } 1513 1728 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 */ 1515 1741 function wp_parse_args( $args, $defaults = '' ) { 1516 1742 if ( is_object( $args ) ) … … 1526 1752 } 1527 1753 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 */ 1529 1763 function wp_maybe_load_widgets() { 1530 1764 if ( !function_exists( 'dynamic_sidebar' ) ) { … … 1534 1768 } 1535 1769 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 */ 1537 1776 function wp_widgets_add_menu() { 1538 1777 global $submenu; … … 1541 1780 } 1542 1781 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 */ 1546 1789 function wp_ob_end_flush_all() { 1547 1790 while ( @ob_end_flush() ); … … 1549 1792 1550 1793 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 1558 1803 */ 1559 1804 function require_wp_db() { … … 1565 1810 } 1566 1811 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 */ 1567 1827 function dead_db() { 1568 1828 global $wpdb; … … 1598 1858 } 1599 1859 1600 /** 1601 * Converts input to an absolute integer 1860 1861 /** 1862 * Converts value to positive integer. 1863 * 1864 * @since 2.5 1865 * 1602 1866 * @param mixed $maybeint data you wish to have convered to an absolute integer 1603 1867 * @return int an absolute integer … … 1607 1871 } 1608 1872 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 1612 1883 */ 1613 1884 function url_is_accessable_via_ssl($url) … … 1634 1905 } 1635 1906 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 */ 1636 1916 function atom_service_url_filter($url) 1637 1917 { 1638 1918 if ( url_is_accessable_via_ssl($url) ) 1639 return 1919 return preg_replace( '/^http:\/\//', 'https://', $url ); 1640 1920 else 1641 1921 return $url; 1642 1922 } 1643 1923 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. 1651 1934 * 1652 1935 * This function is to be used in every function in depreceated.php … … 1677 1960 } 1678 1961 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. 1686 1972 * 1687 1973 * This function is to be used in every file that is depreceated … … 1712 1998 } 1713 1999 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 1716 2005 * 1717 2006 * @return bool Whether the server is running lighttpd < 1.5.0 … … 1723 2012 } 1724 2013 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 1727 2019 * 1728 2020 * @param string $mod e.g. mod_rewrite … … 1750 2042 } 1751 2043 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 */ 1752 2059 function validate_file( $file, $allowed_files = '' ) { 1753 2060 if ( false !== strpos( $file, '..' )) … … 1766 2073 } 1767 2074 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 */ 1768 2083 function is_ssl() { 1769 2084 return ( 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false; 1770 2085 } 1771 2086 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 */ 1772 2096 function force_ssl_login($force = '') { 1773 2097 static $forced; 1774 2098 1775 2099 if ( '' != $force ) { 1776 $old_forc ded = $forced;2100 $old_forced = $forced; 1777 2101 $forced = $force; 1778 2102 return $old_forced; … … 1782 2106 } 1783 2107 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 */ 1784 2117 function force_ssl_admin($force = '') { 1785 2118 static $forced; 1786 2119 1787 2120 if ( '' != $force ) { 1788 $old_forc ded = $forced;2121 $old_forced = $forced; 1789 2122 $forced = $force; 1790 2123 return $old_forced; -
branches/crazyhorse/wp-includes/js/thickbox/thickbox.css
r7961 r8103 117 117 position: fixed; 118 118 display:none; 119 height:13px;120 width:208px;121 119 z-index:103; 122 120 top: 50%; 123 121 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; 125 126 } 126 127 -
branches/crazyhorse/wp-includes/js/tinymce/langs/wp-langs.php
r7380 r8103 398 398 wp_page_alt:"' . mce_escape( __('Next page...') ) . '" 399 399 }); 400 401 tinyMCE.addI18n("' . $language . '.wpeditimage",{ 402 edit_img:"' . mce_escape( __('Edit Image') ) . '", 403 adv_settings:"' . mce_escape( __('Advanced Settings') ) . '", 404 none:"' . mce_escape( __('None') ) . '", 405 size:"' . mce_escape( __('Size') ) . '", 406 thumbnail:"' . mce_escape( __('Thumbnail') ) . '", 407 medium:"' . mce_escape( __('Medium') ) . '", 408 full_size:"' . mce_escape( __('Full Size') ) . '", 409 alt_help:"' . js_escape( __('Alternate text, e.g. "The Mona Lisa"') ) . '", 410 current_link:"' . mce_escape( __('Current Link') ) . '", 411 link_to_img:"' . mce_escape( __('Link to Image') ) . '", 412 link_help:"' . mce_escape( __('Enter a link URL or click above for presets.') ) . '", 413 adv_img_settings:"' . mce_escape( __('Advanced Image Settings') ) . '", 414 source:"' . mce_escape( __('Source') ) . '", 415 width:"' . mce_escape( __('Width') ) . '", 416 height:"' . mce_escape( __('Height') ) . '", 417 orig_size:"' . mce_escape( __('Original Size') ) . '", 418 css:"' . mce_escape( __('CSS Class') ) . '", 419 adv_link_settings:"' . mce_escape( __('Advanced Link Settings') ) . '", 420 link_rel:"' . mce_escape( __('Link Rel') ) . '", 421 height:"' . mce_escape( __('Height') ) . '", 422 orig_size:"' . mce_escape( __('Original Size') ) . '", 423 css:"' . mce_escape( __('CSS Class') ) . '", 424 caption:"' . mce_escape( __('Caption') ) . '" 425 }); 400 426 '; 401 427 ?> -
branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css
r8066 r8103 39 39 } 40 40 41 img.alignright, 41 42 .alignright { 42 43 float: right; 43 44 } 44 45 46 img.alignleft, 45 47 .alignleft { 46 48 float: left; 47 49 } 48 50 49 .aligncenter {51 img.aligncenter { 50 52 display: block; 51 53 margin-left: auto; … … 62 64 63 65 .show-align { 64 padding: 8px;65 66 height: 200px; 67 width: 480px; 68 float: right; 66 69 background-color: #f1f1f1; 67 70 cursor: default; … … 74 77 border: 1px solid #c0c0c0; 75 78 width: 623px; 76 margin: 20px autoauto;79 margin: 15px auto; 77 80 } 78 81 … … 91 94 92 95 #img_demo { 93 padding: 0 5px 4px;96 padding: 0; 94 97 } 95 98 … … 138 141 139 142 #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; 152 155 } 153 156 154 157 #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; 157 163 } 158 164 … … 161 167 } 162 168 163 #basic .align .field label { 164 margin: 0 10px 0 0; 165 padding: 0 0 0 25px; 169 #show_align_sp { 170 width: 115px; 166 171 } 167 172 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 1 1 <!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"> 3 3 <head> 4 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> … … 10 10 <link rel="stylesheet" href="css/editimage.css?ver=3091" type="text/css" media="all" /> 11 11 <link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-bleeding2" type="text/css" media="all" /> 12 <script type="text/javascript"> 13 if ( '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> 12 16 <base target="_self" /> 13 17 </head> … … 16 20 <div id="media-upload-header"> 17 21 <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> 21 24 </ul> 22 25 </div> 23 26 24 27 <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"> 29 34 <img id="img_demo" src="img/image.png" alt="" /> 30 35 <span id="img_demo_txt"> … … 32 37 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. 33 38 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. 35 40 </span> 36 41 </div> 37 42 38 <table id="basic" class="describe"> 43 <div id="div_basic"> 44 <table id="basic" class="describe"> 39 45 <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>78 46 79 47 <tr class="align"> 80 48 <th valign="top" scope="row" class="label"> 81 49 <label for="img_align_td"> 82 <span class="alignleft">{# advanced_dlg.image_align}</span>50 <span class="alignleft">{#contextmenu.align}</span> 83 51 </label> 84 52 </th> 85 53 <td class="field" id="img_align_td"> 86 54 <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> 88 56 89 57 <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> 91 59 92 60 <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> 94 62 95 63 <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> 97 65 </td> 98 66 </tr> … … 101 69 <th valign="top" scope="row" class="label"> 102 70 <label for="img_size"> 103 <span class="alignleft"> Size</span>71 <span class="alignleft">{#wpeditimage.size}</span> 104 72 </label> 105 73 </th> 106 74 <td class="field" id="img_size"> 107 75 <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> 109 77 110 78 <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> 112 80 113 81 <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> 115 122 </td> 116 123 </tr> … … 119 126 120 127 <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"> 123 130 <tbody> 124 131 <tr> 125 132 <th valign="top" scope="row" class="label"> 126 133 <label for="img_src"> 127 <span class="alignleft"> Source</span>134 <span class="alignleft">{#wpeditimage.source}</span> 128 135 <span class="alignright"><abbr title="required" class="required">*</abbr></span> 129 136 </label> 130 137 </th> 131 138 <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();" /> 151 157 </td> 152 158 </tr> … … 155 161 <th valign="top" scope="row" class="label"> 156 162 <label for="img_classes"> 157 <span class="alignleft"> CSS Class</span>163 <span class="alignleft">{#wpeditimage.css}</span> 158 164 </label> 159 165 </th> … … 166 172 <th valign="top" scope="row" class="label"> 167 173 <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')" /> 173 197 </td> 174 198 </tr> … … 176 200 </table> 177 201 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"> 180 204 <tbody> 181 205 <tr> 182 206 <th valign="top" scope="row" class="label"> 183 207 <label for="link_title"> 184 <span class="alignleft"> Link Title</span>208 <span class="alignleft">{#advanced_dlg.link_titlefield}</span> 185 209 </label> 186 210 </th> … … 193 217 <th valign="top" scope="row" class="label"> 194 218 <label for="link_rel"> 195 <span class="alignleft"> Link Rel</span>219 <span class="alignleft">{#wpeditimage.link_rel}</span> 196 220 </label> 197 221 </th> … … 203 227 <tr> 204 228 <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">216 229 <label for="link_classes"> 217 <span class="alignleft"> CSS Class</span>230 <span class="alignleft">{#wpeditimage.css}</span> 218 231 </label> 219 232 </th> … … 226 239 <th valign="top" scope="row" class="label"> 227 240 <label for="link_style"> 228 <span class="alignleft"> Style</span>241 <span class="alignleft">{#advanced.style_select}</span> 229 242 </label> 230 243 </th> … … 236 249 <tr> 237 250 <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"> 238 256 <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" /> 244 260 </td> 245 261 </tr> … … 248 264 249 265 <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="" />253 266 <input type="hidden" id="align" name="align" value="" /> 254 267 -
branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
r8066 r8103 95 95 link : '', 96 96 link_rel : '', 97 target_value : '', 97 98 98 99 setTabs : function(tab) { … … 180 181 m = Math.min(W, m); 181 182 f.width.value = m; 182 f.height.value = Math. floor((m / W) * H);183 f.height.value = Math.round((m / W) * H); 183 184 } else { 184 185 m = Math.min(H, m); 185 186 f.height.value = m; 186 f.width.value = Math. floor((m / H) * W);187 f.width.value = Math.round((m / H) * W); 187 188 } 188 189 … … 196 197 var demo = this.I('img_demo'), f = document.forms[0]; 197 198 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); 200 208 }, 201 209 … … 218 226 h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') 219 227 220 document.dir = ed.getParam('directionality','');221 228 document.body.innerHTML = ed.translate(h); 222 229 window.setTimeout( function(){wpImage.setup();}, 100 ); … … 224 231 225 232 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',''); 228 235 tinyMCEPopup.restoreSelection(); 229 236 el = ed.selection.getNode(); … … 242 249 f.img_classes.value = c = ed.dom.getAttrib(el, 'class'); 243 250 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'); 245 264 246 265 if (pa = ed.dom.getParent(el, 'A')) { … … 248 267 f.link_title.value = ed.dom.getAttrib(pa, 'title'); 249 268 f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel'); 250 f.link_rev.value = ed.dom.getAttrib(pa, 'rev');251 269 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'); 253 271 f.link_classes.value = ed.dom.getAttrib(pa, 'class'); 254 272 } 255 273 274 f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : ''; 275 256 276 fname = link.substring( link.lastIndexOf('/') ); 257 277 fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' ); … … 281 301 document.body.style.display = ''; 282 302 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 // } 288 310 }, 289 311 … … 351 373 title : f.link_title.value, 352 374 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' : '', 355 376 'class' : f.link_classes.value, 356 377 style : f.link_style.value … … 363 384 title : f.link_title.value, 364 385 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' : '', 367 387 'class' : f.link_classes.value, 368 388 style : f.link_style.value … … 373 393 tinyMCEPopup.close(); 374 394 }, 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}); 378 398 379 399 if (tinyMCEPopup.editor.settings.inline_styles) { 380 st = tinyMCEPopup.dom.parseStyle(f.img_style.value);381 382 400 // 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; 391 411 } 392 } else {393 delete st['float'];394 delete st['vertical-align'];395 412 } 396 413 397 414 // 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 } 406 426 407 427 // 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 } 416 437 } 417 438 418 439 // 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 } 427 449 } 428 450 429 451 // 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(); 432 454 } 433 455 }, … … 445 467 var f = document.forms[0]; 446 468 447 f.width.value = f.height.value = "";469 f.width.value = f.height.value = ''; 448 470 }, 449 471 -
branches/crazyhorse/wp-includes/js/tinymce/tiny_mce_config.php
r8066 r8103 227 227 if ( $disk_cache ) { 228 228 229 $cacheKey = apply_filters('tiny_mce_version', '200806 06');229 $cacheKey = apply_filters('tiny_mce_version', '20080613'); 230 230 231 231 foreach ( $initArray as $v ) -
branches/crazyhorse/wp-includes/pluggable.php
r8069 r8103 316 316 $content_type = trim( $content ); 317 317 } 318 } elseif ( 'cc' == strtolower($name) ) { 319 $cc = explode(",", $content); 320 } elseif ( 'bcc' == strtolower($name) ) { 321 $bcc = explode(",", $content); 318 322 } else { 319 323 // Add it to our grand headers array … … 360 364 $phpmailer->Subject = $subject; 361 365 $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 } 362 378 363 379 // Set to use PHP's mail() -
branches/crazyhorse/wp-includes/post.php
r8058 r8103 1 1 <?php 2 2 /** 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. 4 8 * 5 9 * @package WordPress … … 751 755 752 756 /** 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. 756 768 * 757 769 * @package WordPress 758 770 * @subpackage Post 759 771 * @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 763 777 */ 764 778 function wp_count_posts( $type = 'post', $perm = '' ) { … … 1814 1828 function get_page_uri($page_id) { 1815 1829 $page = get_page($page_id); 1816 $uri = urldecode($page->post_name);1830 $uri = $page->post_name; 1817 1831 1818 1832 // A page cannot be it's own parent. … … 1822 1836 while ($page->post_parent != 0) { 1823 1837 $page = get_page($page->post_parent); 1824 $uri = urldecode($page->post_name). "/" . $uri;1838 $uri = $page->post_name . "/" . $uri; 1825 1839 } 1826 1840 -
branches/crazyhorse/wp-includes/script-loader.php
r8066 r8103 36 36 37 37 // Modify this version when tinyMCE plugins are changed. 38 $mce_version = apply_filters('tiny_mce_version', '200806 06');38 $mce_version = apply_filters('tiny_mce_version', '20080613'); 39 39 $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); 40 40 … … 227 227 $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' ); 228 228 $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' ); 230 230 $styles->add( 'login', '/wp-admin/css/login.css' ); 231 231 -
branches/crazyhorse/wp-load.php
r8070 r8103 10 10 * wp-config.php file. 11 11 * 12 * Also made to work in the wp-admin/ folder, because it13 * will look in the parent directory if the file is not14 * 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. 15 15 * 16 16 * @package WordPress -
branches/crazyhorse/xmlrpc.php
r7991 r8103 111 111 $this->methods = array( 112 112 // WordPress API 113 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs', 113 114 'wp.getPage' => 'this:wp_getPage', 114 115 'wp.getPages' => 'this:wp_getPages', … … 253 254 } 254 255 } 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; 255 303 } 256 304 … … 842 890 'url' => get_option('home') . '/', 843 891 'blogid' => '1', 844 'blogName' => get_option('blogname') 892 'blogName' => get_option('blogname'), 893 'xmlrpc' => get_option('home') . '/xmlrpc.php', 845 894 ); 846 895
Note: See TracChangeset
for help on using the changeset viewer.