raw
mp-wp_genesis           1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * Template WordPress Administration API.
mp-wp_genesis 4 *
mp-wp_genesis 5 * A Big Mess. Also some neat functions that are nicely written.
mp-wp_genesis 6 *
mp-wp_genesis 7 * @package WordPress
mp-wp_genesis 8 * @subpackage Administration
mp-wp_genesis 9 */
mp-wp_genesis 10
mp-wp_genesis 11 // Ugly recursive category stuff.
mp-wp_genesis 12 /**
mp-wp_genesis 13 * {@internal Missing Short Description}}
mp-wp_genesis 14 *
mp-wp_genesis 15 * @since unknown
mp-wp_genesis 16 *
mp-wp_genesis 17 * @param unknown_type $parent
mp-wp_genesis 18 * @param unknown_type $level
mp-wp_genesis 19 * @param unknown_type $categories
mp-wp_genesis 20 * @param unknown_type $page
mp-wp_genesis 21 * @param unknown_type $per_page
mp-wp_genesis 22 */
mp-wp_genesis 23 function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
mp-wp_genesis 24 $count = 0;
mp-wp_genesis 25 _cat_rows($categories, $count, $parent, $level, $page, $per_page);
mp-wp_genesis 26 }
mp-wp_genesis 27
mp-wp_genesis 28 /**
mp-wp_genesis 29 * {@internal Missing Short Description}}
mp-wp_genesis 30 *
mp-wp_genesis 31 * @since unknown
mp-wp_genesis 32 *
mp-wp_genesis 33 * @param unknown_type $categories
mp-wp_genesis 34 * @param unknown_type $count
mp-wp_genesis 35 * @param unknown_type $parent
mp-wp_genesis 36 * @param unknown_type $level
mp-wp_genesis 37 * @param unknown_type $page
mp-wp_genesis 38 * @param unknown_type $per_page
mp-wp_genesis 39 * @return unknown
mp-wp_genesis 40 */
mp-wp_genesis 41 function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
mp-wp_genesis 42 if ( empty($categories) ) {
mp-wp_genesis 43 $args = array('hide_empty' => 0);
mp-wp_genesis 44 if ( !empty($_GET['s']) )
mp-wp_genesis 45 $args['search'] = $_GET['s'];
mp-wp_genesis 46 $categories = get_categories( $args );
mp-wp_genesis 47 }
mp-wp_genesis 48
mp-wp_genesis 49 if ( !$categories )
mp-wp_genesis 50 return false;
mp-wp_genesis 51
mp-wp_genesis 52 $children = _get_term_hierarchy('category');
mp-wp_genesis 53
mp-wp_genesis 54 $start = ($page - 1) * $per_page;
mp-wp_genesis 55 $end = $start + $per_page;
mp-wp_genesis 56 $i = -1;
mp-wp_genesis 57 ob_start();
mp-wp_genesis 58 foreach ( $categories as $category ) {
mp-wp_genesis 59 if ( $count >= $end )
mp-wp_genesis 60 break;
mp-wp_genesis 61
mp-wp_genesis 62 $i++;
mp-wp_genesis 63
mp-wp_genesis 64 if ( $category->parent != $parent )
mp-wp_genesis 65 continue;
mp-wp_genesis 66
mp-wp_genesis 67 // If the page starts in a subtree, print the parents.
mp-wp_genesis 68 if ( $count == $start && $category->parent > 0 ) {
mp-wp_genesis 69 $my_parents = array();
mp-wp_genesis 70 while ( $my_parent) {
mp-wp_genesis 71 $my_parent = get_category($my_parent);
mp-wp_genesis 72 $my_parents[] = $my_parent;
mp-wp_genesis 73 if ( !$my_parent->parent )
mp-wp_genesis 74 break;
mp-wp_genesis 75 $my_parent = $my_parent->parent;
mp-wp_genesis 76 }
mp-wp_genesis 77 $num_parents = count($my_parents);
mp-wp_genesis 78 while( $my_parent = array_pop($my_parents) ) {
mp-wp_genesis 79 echo "\t" . _cat_row( $my_parent, $level - $num_parents );
mp-wp_genesis 80 $num_parents--;
mp-wp_genesis 81 }
mp-wp_genesis 82 }
mp-wp_genesis 83
mp-wp_genesis 84 if ( $count >= $start )
mp-wp_genesis 85 echo "\t" . _cat_row( $category, $level );
mp-wp_genesis 86
mp-wp_genesis 87 unset($categories[$i]); // Prune the working set
mp-wp_genesis 88 $count++;
mp-wp_genesis 89
mp-wp_genesis 90 if ( isset($children[$category->term_id]) )
mp-wp_genesis 91 _cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
mp-wp_genesis 92
mp-wp_genesis 93 }
mp-wp_genesis 94
mp-wp_genesis 95 $output = ob_get_contents();
mp-wp_genesis 96 ob_end_clean();
mp-wp_genesis 97
mp-wp_genesis 98 echo $output;
mp-wp_genesis 99 }
mp-wp_genesis 100
mp-wp_genesis 101 /**
mp-wp_genesis 102 * {@internal Missing Short Description}}
mp-wp_genesis 103 *
mp-wp_genesis 104 * @since unknown
mp-wp_genesis 105 *
mp-wp_genesis 106 * @param unknown_type $category
mp-wp_genesis 107 * @param unknown_type $level
mp-wp_genesis 108 * @param unknown_type $name_override
mp-wp_genesis 109 * @return unknown
mp-wp_genesis 110 */
mp-wp_genesis 111 function _cat_row( $category, $level, $name_override = false ) {
mp-wp_genesis 112 static $row_class = '';
mp-wp_genesis 113
mp-wp_genesis 114 $category = get_category( $category, OBJECT, 'display' );
mp-wp_genesis 115
mp-wp_genesis 116 $default_cat_id = (int) get_option( 'default_category' );
mp-wp_genesis 117 $pad = str_repeat( '&#8212; ', $level );
mp-wp_genesis 118 $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
mp-wp_genesis 119 $edit_link = "categories.php?action=edit&amp;cat_ID=$category->term_id";
mp-wp_genesis 120 if ( current_user_can( 'manage_categories' ) ) {
mp-wp_genesis 121 $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
mp-wp_genesis 122 $actions = array();
mp-wp_genesis 123 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
mp-wp_genesis 124 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
mp-wp_genesis 125 if ( $default_cat_id != $category->term_id )
mp-wp_genesis 126 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
mp-wp_genesis 127 $action_count = count($actions);
mp-wp_genesis 128 $i = 0;
mp-wp_genesis 129 $edit .= '<div class="row-actions">';
mp-wp_genesis 130 foreach ( $actions as $action => $link ) {
mp-wp_genesis 131 ++$i;
mp-wp_genesis 132 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
mp-wp_genesis 133 $edit .= "<span class='$action'>$link$sep</span>";
mp-wp_genesis 134 }
mp-wp_genesis 135 $edit .= '</div>';
mp-wp_genesis 136 } else {
mp-wp_genesis 137 $edit = $name;
mp-wp_genesis 138 }
mp-wp_genesis 139
mp-wp_genesis 140 $row_class = 'alternate' == $row_class ? '' : 'alternate';
mp-wp_genesis 141 $qe_data = get_category_to_edit($category->term_id);
mp-wp_genesis 142
mp-wp_genesis 143 $category->count = number_format_i18n( $category->count );
mp-wp_genesis 144 $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
mp-wp_genesis 145 $output = "<tr id='cat-$category->term_id' class='iedit $row_class'>";
mp-wp_genesis 146
mp-wp_genesis 147 $columns = get_column_headers('categories');
mp-wp_genesis 148 $hidden = get_hidden_columns('categories');
mp-wp_genesis 149 foreach ( $columns as $column_name => $column_display_name ) {
mp-wp_genesis 150 $class = "class=\"$column_name column-$column_name\"";
mp-wp_genesis 151
mp-wp_genesis 152 $style = '';
mp-wp_genesis 153 if ( in_array($column_name, $hidden) )
mp-wp_genesis 154 $style = ' style="display:none;"';
mp-wp_genesis 155
mp-wp_genesis 156 $attributes = "$class$style";
mp-wp_genesis 157
mp-wp_genesis 158 switch ($column_name) {
mp-wp_genesis 159 case 'cb':
mp-wp_genesis 160 $output .= "<th scope='row' class='check-column'>";
mp-wp_genesis 161 if ( $default_cat_id != $category->term_id ) {
mp-wp_genesis 162 $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
mp-wp_genesis 163 } else {
mp-wp_genesis 164 $output .= "&nbsp;";
mp-wp_genesis 165 }
mp-wp_genesis 166 $output .= '</th>';
mp-wp_genesis 167 break;
mp-wp_genesis 168 case 'name':
mp-wp_genesis 169 $output .= "<td $attributes>$edit";
mp-wp_genesis 170 $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
mp-wp_genesis 171 $output .= '<div class="name">' . $qe_data->name . '</div>';
mp-wp_genesis 172 $output .= '<div class="slug">' . $qe_data->slug . '</div>';
mp-wp_genesis 173 $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
mp-wp_genesis 174 break;
mp-wp_genesis 175 case 'description':
mp-wp_genesis 176 $output .= "<td $attributes>$category->description</td>";
mp-wp_genesis 177 break;
mp-wp_genesis 178 case 'slug':
mp-wp_genesis 179 $output .= "<td $attributes>$category->slug</td>";
mp-wp_genesis 180 break;
mp-wp_genesis 181 case 'posts':
mp-wp_genesis 182 $attributes = 'class="posts column-posts num"' . $style;
mp-wp_genesis 183 $output .= "<td $attributes>$posts_count</td>\n";
mp-wp_genesis 184 }
mp-wp_genesis 185 }
mp-wp_genesis 186 $output .= '</tr>';
mp-wp_genesis 187
mp-wp_genesis 188 return $output;
mp-wp_genesis 189 }
mp-wp_genesis 190
mp-wp_genesis 191 /**
mp-wp_genesis 192 * {@internal Missing Short Description}}
mp-wp_genesis 193 *
mp-wp_genesis 194 * @since 2.7
mp-wp_genesis 195 *
mp-wp_genesis 196 * Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit.
mp-wp_genesis 197 *
mp-wp_genesis 198 * @param string $type "tag", "category" or "link-category"
mp-wp_genesis 199 * @return
mp-wp_genesis 200 */
mp-wp_genesis 201 function inline_edit_term_row($type) {
mp-wp_genesis 202
mp-wp_genesis 203 if ( ! current_user_can( 'manage_categories' ) )
mp-wp_genesis 204 return;
mp-wp_genesis 205
mp-wp_genesis 206 $is_tag = $type == 'edit-tags';
mp-wp_genesis 207 $columns = get_column_headers($type);
mp-wp_genesis 208 $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
mp-wp_genesis 209 $col_count = count($columns) - count($hidden);
mp-wp_genesis 210 ?>
mp-wp_genesis 211
mp-wp_genesis 212 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
mp-wp_genesis 213 <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">
mp-wp_genesis 214
mp-wp_genesis 215 <fieldset><div class="inline-edit-col">
mp-wp_genesis 216 <h4><?php _e( 'Quick Edit' ); ?></h4>
mp-wp_genesis 217
mp-wp_genesis 218 <label>
mp-wp_genesis 219 <span class="title"><?php _e( 'Name' ); ?></span>
mp-wp_genesis 220 <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
mp-wp_genesis 221 </label>
mp-wp_genesis 222
mp-wp_genesis 223 <label>
mp-wp_genesis 224 <span class="title"><?php _e( 'Slug' ); ?></span>
mp-wp_genesis 225 <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
mp-wp_genesis 226 </label>
mp-wp_genesis 227
mp-wp_genesis 228 <?php if ( 'category' == $type ) : ?>
mp-wp_genesis 229
mp-wp_genesis 230 <label>
mp-wp_genesis 231 <span class="title"><?php _e( 'Parent' ); ?></span>
mp-wp_genesis 232 <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('None'))); ?>
mp-wp_genesis 233 </label>
mp-wp_genesis 234
mp-wp_genesis 235 <?php endif; // $type ?>
mp-wp_genesis 236
mp-wp_genesis 237 </div></fieldset>
mp-wp_genesis 238
mp-wp_genesis 239 <?php
mp-wp_genesis 240
mp-wp_genesis 241 $core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true );
mp-wp_genesis 242
mp-wp_genesis 243 foreach ( $columns as $column_name => $column_display_name ) {
mp-wp_genesis 244 if ( isset( $core_columns[$column_name] ) )
mp-wp_genesis 245 continue;
mp-wp_genesis 246 do_action( 'quick_edit_custom_box', $column_name, $type );
mp-wp_genesis 247 }
mp-wp_genesis 248
mp-wp_genesis 249 ?>
mp-wp_genesis 250
mp-wp_genesis 251 <p class="inline-edit-save submit">
mp-wp_genesis 252 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
mp-wp_genesis 253 <?php $update_text = ( $is_tag ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?>
mp-wp_genesis 254 <a accesskey="s" href="#inline-edit" title="<?php echo attribute_escape( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
mp-wp_update-imag... 255 <img class="waiting" style="display:none;" src="images/loading.svg" alt="" />
mp-wp_genesis 256 <span class="error" style="display:none;"></span>
mp-wp_genesis 257 <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
mp-wp_genesis 258 <br class="clear" />
mp-wp_genesis 259 </p>
mp-wp_genesis 260 </td></tr>
mp-wp_genesis 261 </tbody></table></form>
mp-wp_genesis 262 <?php
mp-wp_genesis 263 }
mp-wp_genesis 264
mp-wp_genesis 265 /**
mp-wp_genesis 266 * {@internal Missing Short Description}}
mp-wp_genesis 267 *
mp-wp_genesis 268 * @since unknown
mp-wp_genesis 269 *
mp-wp_genesis 270 * @param unknown_type $category
mp-wp_genesis 271 * @param unknown_type $name_override
mp-wp_genesis 272 * @return unknown
mp-wp_genesis 273 */
mp-wp_genesis 274 function link_cat_row( $category, $name_override = false ) {
mp-wp_genesis 275 static $row_class = '';
mp-wp_genesis 276
mp-wp_genesis 277 if ( !$category = get_term( $category, 'link_category', OBJECT, 'display' ) )
mp-wp_genesis 278 return false;
mp-wp_genesis 279 if ( is_wp_error( $category ) )
mp-wp_genesis 280 return $category;
mp-wp_genesis 281
mp-wp_genesis 282 $default_cat_id = (int) get_option( 'default_link_category' );
mp-wp_genesis 283 $name = ( $name_override ? $name_override : $category->name );
mp-wp_genesis 284 $edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id";
mp-wp_genesis 285 if ( current_user_can( 'manage_categories' ) ) {
mp-wp_genesis 286 $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
mp-wp_genesis 287 $actions = array();
mp-wp_genesis 288 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
mp-wp_genesis 289 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
mp-wp_genesis 290 if ( $default_cat_id != $category->term_id )
mp-wp_genesis 291 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
mp-wp_genesis 292 $action_count = count($actions);
mp-wp_genesis 293 $i = 0;
mp-wp_genesis 294 $edit .= '<div class="row-actions">';
mp-wp_genesis 295 foreach ( $actions as $action => $link ) {
mp-wp_genesis 296 ++$i;
mp-wp_genesis 297 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
mp-wp_genesis 298 $edit .= "<span class='$action'>$link$sep</span>";
mp-wp_genesis 299 }
mp-wp_genesis 300 $edit .= '</div>';
mp-wp_genesis 301 } else {
mp-wp_genesis 302 $edit = $name;
mp-wp_genesis 303 }
mp-wp_genesis 304
mp-wp_genesis 305 $row_class = 'alternate' == $row_class ? '' : 'alternate';
mp-wp_genesis 306 $qe_data = get_term_to_edit($category->term_id, 'link_category');
mp-wp_genesis 307
mp-wp_genesis 308 $category->count = number_format_i18n( $category->count );
mp-wp_genesis 309 $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
mp-wp_genesis 310 $output = "<tr id='link-cat-$category->term_id' class='iedit $row_class'>";
mp-wp_genesis 311 $columns = get_column_headers('edit-link-categories');
mp-wp_genesis 312 $hidden = get_hidden_columns('edit-link-categories');
mp-wp_genesis 313 foreach ( $columns as $column_name => $column_display_name ) {
mp-wp_genesis 314 $class = "class=\"$column_name column-$column_name\"";
mp-wp_genesis 315
mp-wp_genesis 316 $style = '';
mp-wp_genesis 317 if ( in_array($column_name, $hidden) )
mp-wp_genesis 318 $style = ' style="display:none;"';
mp-wp_genesis 319
mp-wp_genesis 320 $attributes = "$class$style";
mp-wp_genesis 321
mp-wp_genesis 322 switch ($column_name) {
mp-wp_genesis 323 case 'cb':
mp-wp_genesis 324 $output .= "<th scope='row' class='check-column'>";
mp-wp_genesis 325 if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
mp-wp_genesis 326 $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
mp-wp_genesis 327 } else {
mp-wp_genesis 328 $output .= "&nbsp;";
mp-wp_genesis 329 }
mp-wp_genesis 330 $output .= "</th>";
mp-wp_genesis 331 break;
mp-wp_genesis 332 case 'name':
mp-wp_genesis 333 $output .= "<td $attributes>$edit";
mp-wp_genesis 334 $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
mp-wp_genesis 335 $output .= '<div class="name">' . $qe_data->name . '</div>';
mp-wp_genesis 336 $output .= '<div class="slug">' . $qe_data->slug . '</div>';
mp-wp_genesis 337 $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
mp-wp_genesis 338 break;
mp-wp_genesis 339 case 'description':
mp-wp_genesis 340 $output .= "<td $attributes>$category->description</td>";
mp-wp_genesis 341 break;
mp-wp_genesis 342 case 'slug':
mp-wp_genesis 343 $output .= "<td $attributes>$category->slug</td>";
mp-wp_genesis 344 break;
mp-wp_genesis 345 case 'links':
mp-wp_genesis 346 $attributes = 'class="links column-links num"' . $style;
mp-wp_genesis 347 $output .= "<td $attributes>$count</td>";
mp-wp_genesis 348 }
mp-wp_genesis 349 }
mp-wp_genesis 350 $output .= '</tr>';
mp-wp_genesis 351
mp-wp_genesis 352 return $output;
mp-wp_genesis 353 }
mp-wp_genesis 354
mp-wp_genesis 355 /**
mp-wp_genesis 356 * {@internal Missing Short Description}}
mp-wp_genesis 357 *
mp-wp_genesis 358 * @since unknown
mp-wp_genesis 359 *
mp-wp_genesis 360 * @param unknown_type $checked
mp-wp_genesis 361 * @param unknown_type $current
mp-wp_genesis 362 */
mp-wp_genesis 363 function checked( $checked, $current) {
mp-wp_genesis 364 if ( $checked == $current)
mp-wp_genesis 365 echo ' checked="checked"';
mp-wp_genesis 366 }
mp-wp_genesis 367
mp-wp_genesis 368 /**
mp-wp_genesis 369 * {@internal Missing Short Description}}
mp-wp_genesis 370 *
mp-wp_genesis 371 * @since unknown
mp-wp_genesis 372 *
mp-wp_genesis 373 * @param unknown_type $selected
mp-wp_genesis 374 * @param unknown_type $current
mp-wp_genesis 375 */
mp-wp_genesis 376 function selected( $selected, $current) {
mp-wp_genesis 377 if ( $selected == $current)
mp-wp_genesis 378 echo ' selected="selected"';
mp-wp_genesis 379 }
mp-wp_genesis 380
mp-wp_genesis 381 //
mp-wp_genesis 382 // Category Checklists
mp-wp_genesis 383 //
mp-wp_genesis 384
mp-wp_genesis 385 /**
mp-wp_genesis 386 * {@internal Missing Short Description}}
mp-wp_genesis 387 *
mp-wp_genesis 388 * @since unknown
mp-wp_genesis 389 * @deprecated Use {@link wp_link_category_checklist()}
mp-wp_genesis 390 * @see wp_link_category_checklist()
mp-wp_genesis 391 *
mp-wp_genesis 392 * @param unknown_type $default
mp-wp_genesis 393 * @param unknown_type $parent
mp-wp_genesis 394 * @param unknown_type $popular_ids
mp-wp_genesis 395 */
mp-wp_genesis 396 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
mp-wp_genesis 397 global $post_ID;
mp-wp_genesis 398 wp_category_checklist($post_ID);
mp-wp_genesis 399 }
mp-wp_genesis 400
mp-wp_genesis 401 /**
mp-wp_genesis 402 * {@internal Missing Short Description}}
mp-wp_genesis 403 *
mp-wp_genesis 404 * @since unknown
mp-wp_genesis 405 */
mp-wp_genesis 406 class Walker_Category_Checklist extends Walker {
mp-wp_genesis 407 var $tree_type = 'category';
mp-wp_genesis 408 var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
mp-wp_genesis 409
mp-wp_genesis 410 function start_lvl(&$output, $depth, $args) {
mp-wp_genesis 411 $indent = str_repeat("\t", $depth);
mp-wp_genesis 412 $output .= "$indent<ul class='children'>\n";
mp-wp_genesis 413 }
mp-wp_genesis 414
mp-wp_genesis 415 function end_lvl(&$output, $depth, $args) {
mp-wp_genesis 416 $indent = str_repeat("\t", $depth);
mp-wp_genesis 417 $output .= "$indent</ul>\n";
mp-wp_genesis 418 }
mp-wp_genesis 419
mp-wp_genesis 420 function start_el(&$output, $category, $depth, $args) {
mp-wp_genesis 421 extract($args);
mp-wp_genesis 422
mp-wp_genesis 423 $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
mp-wp_genesis 424 $output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . wp_specialchars( apply_filters('the_category', $category->name )) . '</label>';
mp-wp_genesis 425 }
mp-wp_genesis 426
mp-wp_genesis 427 function end_el(&$output, $category, $depth, $args) {
mp-wp_genesis 428 $output .= "</li>\n";
mp-wp_genesis 429 }
mp-wp_genesis 430 }
mp-wp_genesis 431
mp-wp_genesis 432 /**
mp-wp_genesis 433 * {@internal Missing Short Description}}
mp-wp_genesis 434 *
mp-wp_genesis 435 * @since unknown
mp-wp_genesis 436 *
mp-wp_genesis 437 * @param unknown_type $post_id
mp-wp_genesis 438 * @param unknown_type $descendants_and_self
mp-wp_genesis 439 * @param unknown_type $selected_cats
mp-wp_genesis 440 * @param unknown_type $popular_cats
mp-wp_genesis 441 */
mp-wp_genesis 442 function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
mp-wp_genesis 443 $walker = new Walker_Category_Checklist;
mp-wp_genesis 444 $descendants_and_self = (int) $descendants_and_self;
mp-wp_genesis 445
mp-wp_genesis 446 $args = array();
mp-wp_genesis 447
mp-wp_genesis 448 if ( is_array( $selected_cats ) )
mp-wp_genesis 449 $args['selected_cats'] = $selected_cats;
mp-wp_genesis 450 elseif ( $post_id )
mp-wp_genesis 451 $args['selected_cats'] = wp_get_post_categories($post_id);
mp-wp_genesis 452 else
mp-wp_genesis 453 $args['selected_cats'] = array();
mp-wp_genesis 454
mp-wp_genesis 455 if ( is_array( $popular_cats ) )
mp-wp_genesis 456 $args['popular_cats'] = $popular_cats;
mp-wp_genesis 457 else
mp-wp_genesis 458 $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
mp-wp_genesis 459
mp-wp_genesis 460 if ( $descendants_and_self ) {
mp-wp_genesis 461 $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
mp-wp_genesis 462 $self = get_category( $descendants_and_self );
mp-wp_genesis 463 array_unshift( $categories, $self );
mp-wp_genesis 464 } else {
mp-wp_genesis 465 $categories = get_categories('get=all');
mp-wp_genesis 466 }
mp-wp_genesis 467
mp-wp_genesis 468 // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
mp-wp_genesis 469 $checked_categories = array();
mp-wp_genesis 470 for ( $i = 0; isset($categories[$i]); $i++ ) {
mp-wp_genesis 471 if ( in_array($categories[$i]->term_id, $args['selected_cats']) ) {
mp-wp_genesis 472 $checked_categories[] = $categories[$i];
mp-wp_genesis 473 unset($categories[$i]);
mp-wp_genesis 474 }
mp-wp_genesis 475 }
mp-wp_genesis 476
mp-wp_genesis 477 // Put checked cats on top
mp-wp_genesis 478 echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
mp-wp_genesis 479 // Then the rest of them
mp-wp_genesis 480 echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
mp-wp_genesis 481 }
mp-wp_genesis 482
mp-wp_genesis 483 /**
mp-wp_genesis 484 * {@internal Missing Short Description}}
mp-wp_genesis 485 *
mp-wp_genesis 486 * @since unknown
mp-wp_genesis 487 *
mp-wp_genesis 488 * @param unknown_type $taxonomy
mp-wp_genesis 489 * @param unknown_type $default
mp-wp_genesis 490 * @param unknown_type $number
mp-wp_genesis 491 * @param unknown_type $echo
mp-wp_genesis 492 * @return unknown
mp-wp_genesis 493 */
mp-wp_genesis 494 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
mp-wp_genesis 495 global $post_ID;
mp-wp_genesis 496 if ( $post_ID )
mp-wp_genesis 497 $checked_categories = wp_get_post_categories($post_ID);
mp-wp_genesis 498 else
mp-wp_genesis 499 $checked_categories = array();
mp-wp_genesis 500 $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
mp-wp_genesis 501
mp-wp_genesis 502 $popular_ids = array();
mp-wp_genesis 503 foreach ( (array) $categories as $category ) {
mp-wp_genesis 504 $popular_ids[] = $category->term_id;
mp-wp_genesis 505 if ( !$echo ) // hack for AJAX use
mp-wp_genesis 506 continue;
mp-wp_genesis 507 $id = "popular-category-$category->term_id";
mp-wp_genesis 508 ?>
mp-wp_genesis 509
mp-wp_genesis 510 <li id="<?php echo $id; ?>" class="popular-category">
mp-wp_genesis 511 <label class="selectit">
mp-wp_genesis 512 <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" />
mp-wp_genesis 513 <?php echo wp_specialchars( apply_filters( 'the_category', $category->name ) ); ?>
mp-wp_genesis 514 </label>
mp-wp_genesis 515 </li>
mp-wp_genesis 516
mp-wp_genesis 517 <?php
mp-wp_genesis 518 }
mp-wp_genesis 519 return $popular_ids;
mp-wp_genesis 520 }
mp-wp_genesis 521
mp-wp_genesis 522 /**
mp-wp_genesis 523 * {@internal Missing Short Description}}
mp-wp_genesis 524 *
mp-wp_genesis 525 * @since unknown
mp-wp_genesis 526 * @deprecated Use {@link wp_link_category_checklist()}
mp-wp_genesis 527 * @see wp_link_category_checklist()
mp-wp_genesis 528 *
mp-wp_genesis 529 * @param unknown_type $default
mp-wp_genesis 530 */
mp-wp_genesis 531 function dropdown_link_categories( $default = 0 ) {
mp-wp_genesis 532 global $link_id;
mp-wp_genesis 533
mp-wp_genesis 534 wp_link_category_checklist($link_id);
mp-wp_genesis 535 }
mp-wp_genesis 536
mp-wp_genesis 537 /**
mp-wp_genesis 538 * {@internal Missing Short Description}}
mp-wp_genesis 539 *
mp-wp_genesis 540 * @since unknown
mp-wp_genesis 541 *
mp-wp_genesis 542 * @param unknown_type $link_id
mp-wp_genesis 543 */
mp-wp_genesis 544 function wp_link_category_checklist( $link_id = 0 ) {
mp-wp_genesis 545 $default = 1;
mp-wp_genesis 546
mp-wp_genesis 547 if ( $link_id ) {
mp-wp_genesis 548 $checked_categories = wp_get_link_cats($link_id);
mp-wp_genesis 549
mp-wp_genesis 550 if ( count( $checked_categories ) == 0 ) {
mp-wp_genesis 551 // No selected categories, strange
mp-wp_genesis 552 $checked_categories[] = $default;
mp-wp_genesis 553 }
mp-wp_genesis 554 } else {
mp-wp_genesis 555 $checked_categories[] = $default;
mp-wp_genesis 556 }
mp-wp_genesis 557
mp-wp_genesis 558 $categories = get_terms('link_category', 'orderby=count&hide_empty=0');
mp-wp_genesis 559
mp-wp_genesis 560 if ( empty($categories) )
mp-wp_genesis 561 return;
mp-wp_genesis 562
mp-wp_genesis 563 foreach ( $categories as $category ) {
mp-wp_genesis 564 $cat_id = $category->term_id;
mp-wp_genesis 565 $name = wp_specialchars( apply_filters('the_category', $category->name));
mp-wp_genesis 566 $checked = in_array( $cat_id, $checked_categories );
mp-wp_genesis 567 echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
mp-wp_genesis 568 }
mp-wp_genesis 569 }
mp-wp_genesis 570
mp-wp_genesis 571 // Tag stuff
mp-wp_genesis 572
mp-wp_genesis 573 // Returns a single tag row (see tag_rows below)
mp-wp_genesis 574 // Note: this is also used in admin-ajax.php!
mp-wp_genesis 575 /**
mp-wp_genesis 576 * {@internal Missing Short Description}}
mp-wp_genesis 577 *
mp-wp_genesis 578 * @since unknown
mp-wp_genesis 579 *
mp-wp_genesis 580 * @param unknown_type $tag
mp-wp_genesis 581 * @param unknown_type $class
mp-wp_genesis 582 * @return unknown
mp-wp_genesis 583 */
mp-wp_genesis 584 function _tag_row( $tag, $class = '' ) {
mp-wp_genesis 585 $count = number_format_i18n( $tag->count );
mp-wp_genesis 586 $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
mp-wp_genesis 587
mp-wp_genesis 588 $name = apply_filters( 'term_name', $tag->name );
mp-wp_genesis 589 $qe_data = get_term($tag->term_id, 'post_tag', object, 'edit');
mp-wp_genesis 590 $edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
mp-wp_genesis 591 $out = '';
mp-wp_genesis 592 $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
mp-wp_genesis 593 $columns = get_column_headers('edit-tags');
mp-wp_genesis 594 $hidden = get_hidden_columns('edit-tags');
mp-wp_genesis 595 foreach ( $columns as $column_name => $column_display_name ) {
mp-wp_genesis 596 $class = "class=\"$column_name column-$column_name\"";
mp-wp_genesis 597
mp-wp_genesis 598 $style = '';
mp-wp_genesis 599 if ( in_array($column_name, $hidden) )
mp-wp_genesis 600 $style = ' style="display:none;"';
mp-wp_genesis 601
mp-wp_genesis 602 $attributes = "$class$style";
mp-wp_genesis 603
mp-wp_genesis 604 switch ($column_name) {
mp-wp_genesis 605 case 'cb':
mp-wp_genesis 606 $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
mp-wp_genesis 607 break;
mp-wp_genesis 608 case 'name':
mp-wp_genesis 609 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
mp-wp_genesis 610 $actions = array();
mp-wp_genesis 611 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
mp-wp_genesis 612 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
mp-wp_genesis 613 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
mp-wp_genesis 614 $action_count = count($actions);
mp-wp_genesis 615 $i = 0;
mp-wp_genesis 616 $out .= '<div class="row-actions">';
mp-wp_genesis 617 foreach ( $actions as $action => $link ) {
mp-wp_genesis 618 ++$i;
mp-wp_genesis 619 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
mp-wp_genesis 620 $out .= "<span class='$action'>$link$sep</span>";
mp-wp_genesis 621 }
mp-wp_genesis 622 $out .= '</div>';
mp-wp_genesis 623 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
mp-wp_genesis 624 $out .= '<div class="name">' . $qe_data->name . '</div>';
mp-wp_genesis 625 $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
mp-wp_genesis 626 break;
mp-wp_genesis 627 case 'slug':
mp-wp_genesis 628 $out .= "<td $attributes>$tag->slug</td>";
mp-wp_genesis 629 break;
mp-wp_genesis 630 case 'posts':
mp-wp_genesis 631 $attributes = 'class="posts column-posts num"' . $style;
mp-wp_genesis 632 $out .= "<td $attributes>$count</td>";
mp-wp_genesis 633 break;
mp-wp_genesis 634 }
mp-wp_genesis 635 }
mp-wp_genesis 636
mp-wp_genesis 637 $out .= '</tr>';
mp-wp_genesis 638
mp-wp_genesis 639 return $out;
mp-wp_genesis 640 }
mp-wp_genesis 641
mp-wp_genesis 642 // Outputs appropriate rows for the Nth page of the Tag Management screen,
mp-wp_genesis 643 // assuming M tags displayed at a time on the page
mp-wp_genesis 644 // Returns the number of tags displayed
mp-wp_genesis 645 /**
mp-wp_genesis 646 * {@internal Missing Short Description}}
mp-wp_genesis 647 *
mp-wp_genesis 648 * @since unknown
mp-wp_genesis 649 *
mp-wp_genesis 650 * @param unknown_type $page
mp-wp_genesis 651 * @param unknown_type $pagesize
mp-wp_genesis 652 * @param unknown_type $searchterms
mp-wp_genesis 653 * @return unknown
mp-wp_genesis 654 */
mp-wp_genesis 655 function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
mp-wp_genesis 656
mp-wp_genesis 657 // Get a page worth of tags
mp-wp_genesis 658 $start = ($page - 1) * $pagesize;
mp-wp_genesis 659
mp-wp_genesis 660 $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
mp-wp_genesis 661
mp-wp_genesis 662 if ( !empty( $searchterms ) ) {
mp-wp_genesis 663 $args['search'] = $searchterms;
mp-wp_genesis 664 }
mp-wp_genesis 665
mp-wp_genesis 666 $tags = get_terms( 'post_tag', $args );
mp-wp_genesis 667
mp-wp_genesis 668 // convert it to table rows
mp-wp_genesis 669 $out = '';
mp-wp_genesis 670 $count = 0;
mp-wp_genesis 671 foreach( $tags as $tag )
mp-wp_genesis 672 $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );
mp-wp_genesis 673
mp-wp_genesis 674 // filter and send to screen
mp-wp_genesis 675 echo $out;
mp-wp_genesis 676 return $count;
mp-wp_genesis 677 }
mp-wp_genesis 678
mp-wp_genesis 679 // define the columns to display, the syntax is 'internal name' => 'display name'
mp-wp_genesis 680 /**
mp-wp_genesis 681 * {@internal Missing Short Description}}
mp-wp_genesis 682 *
mp-wp_genesis 683 * @since unknown
mp-wp_genesis 684 *
mp-wp_genesis 685 * @return unknown
mp-wp_genesis 686 */
mp-wp_genesis 687 function wp_manage_posts_columns() {
mp-wp_genesis 688 $posts_columns = array();
mp-wp_genesis 689 $posts_columns['cb'] = '<input type="checkbox" />';
mp-wp_genesis 690 $posts_columns['title'] = _c('Post|noun');
mp-wp_genesis 691 $posts_columns['author'] = __('Author');
mp-wp_genesis 692 $posts_columns['categories'] = __('Categories');
mp-wp_genesis 693 $posts_columns['tags'] = __('Tags');
mp-wp_genesis 694 if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
mp-wp_update-imag... 695 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.svg" /></div>';
mp-wp_genesis 696 $posts_columns['date'] = __('Date');
mp-wp_genesis 697 $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
mp-wp_genesis 698
mp-wp_genesis 699 return $posts_columns;
mp-wp_genesis 700 }
mp-wp_genesis 701
mp-wp_genesis 702 // define the columns to display, the syntax is 'internal name' => 'display name'
mp-wp_genesis 703 /**
mp-wp_genesis 704 * {@internal Missing Short Description}}
mp-wp_genesis 705 *
mp-wp_genesis 706 * @since unknown
mp-wp_genesis 707 *
mp-wp_genesis 708 * @return unknown
mp-wp_genesis 709 */
mp-wp_genesis 710 function wp_manage_media_columns() {
mp-wp_genesis 711 $posts_columns = array();
mp-wp_genesis 712 $posts_columns['cb'] = '<input type="checkbox" />';
mp-wp_genesis 713 $posts_columns['icon'] = '';
mp-wp_genesis 714 $posts_columns['media'] = _c('File|media column header');
mp-wp_genesis 715 $posts_columns['author'] = __('Author');
mp-wp_genesis 716 //$posts_columns['tags'] = _c('Tags|media column header');
mp-wp_genesis 717 $posts_columns['parent'] = _c('Attached to|media column header');
mp-wp_update-imag... 718 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.svg" /></div>';
mp-wp_genesis 719 //$posts_columns['comments'] = __('Comments');
mp-wp_genesis 720 $posts_columns['date'] = _c('Date|media column header');
mp-wp_genesis 721 $posts_columns = apply_filters('manage_media_columns', $posts_columns);
mp-wp_genesis 722
mp-wp_genesis 723 return $posts_columns;
mp-wp_genesis 724 }
mp-wp_genesis 725
mp-wp_genesis 726 /**
mp-wp_genesis 727 * {@internal Missing Short Description}}
mp-wp_genesis 728 *
mp-wp_genesis 729 * @since unknown
mp-wp_genesis 730 *
mp-wp_genesis 731 * @return unknown
mp-wp_genesis 732 */
mp-wp_genesis 733 function wp_manage_pages_columns() {
mp-wp_genesis 734 $posts_columns = array();
mp-wp_genesis 735 $posts_columns['cb'] = '<input type="checkbox" />';
mp-wp_genesis 736 $posts_columns['title'] = __('Title');
mp-wp_genesis 737 $posts_columns['author'] = __('Author');
mp-wp_genesis 738 $post_status = 'all';
mp-wp_genesis 739 if ( !empty($_GET['post_status']) )
mp-wp_genesis 740 $post_status = $_GET['post_status'];
mp-wp_genesis 741 if ( !in_array($post_status, array('pending', 'draft', 'future')) )
mp-wp_update-imag... 742 $posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.svg" /></div>';
mp-wp_genesis 743 $posts_columns['date'] = __('Date');
mp-wp_genesis 744 $posts_columns = apply_filters('manage_pages_columns', $posts_columns);
mp-wp_genesis 745
mp-wp_genesis 746 return $posts_columns;
mp-wp_genesis 747 }
mp-wp_genesis 748
mp-wp_genesis 749 /**
mp-wp_genesis 750 * {@internal Missing Short Description}}
mp-wp_genesis 751 *
mp-wp_genesis 752 * @since unknown
mp-wp_genesis 753 *
mp-wp_genesis 754 * @param unknown_type $page
mp-wp_genesis 755 * @return unknown
mp-wp_genesis 756 */
mp-wp_genesis 757 function get_column_headers($page) {
mp-wp_genesis 758 global $_wp_column_headers;
mp-wp_genesis 759
mp-wp_genesis 760 if ( !isset($_wp_column_headers) )
mp-wp_genesis 761 $_wp_column_headers = array();
mp-wp_genesis 762
mp-wp_genesis 763 // Store in static to avoid running filters on each call
mp-wp_genesis 764 if ( isset($_wp_column_headers[$page]) )
mp-wp_genesis 765 return $_wp_column_headers[$page];
mp-wp_genesis 766
mp-wp_genesis 767 switch ($page) {
mp-wp_genesis 768 case 'edit':
mp-wp_genesis 769 $_wp_column_headers[$page] = wp_manage_posts_columns();
mp-wp_genesis 770 break;
mp-wp_genesis 771 case 'edit-pages':
mp-wp_genesis 772 $_wp_column_headers[$page] = wp_manage_pages_columns();
mp-wp_genesis 773 break;
mp-wp_genesis 774 case 'edit-comments':
mp-wp_genesis 775 $_wp_column_headers[$page] = array(
mp-wp_genesis 776 'cb' => '<input type="checkbox" />',
mp-wp_genesis 777 'author' => __('Author'),
mp-wp_genesis 778 'comment' => _c('Comment|noun'),
mp-wp_genesis 779 //'date' => __('Submitted'),
mp-wp_genesis 780 'response' => __('In Response To')
mp-wp_genesis 781 );
mp-wp_genesis 782
mp-wp_genesis 783 break;
mp-wp_genesis 784 case 'link-manager':
mp-wp_genesis 785 $_wp_column_headers[$page] = array(
mp-wp_genesis 786 'cb' => '<input type="checkbox" />',
mp-wp_genesis 787 'name' => __('Name'),
mp-wp_genesis 788 'url' => __('URL'),
mp-wp_genesis 789 'categories' => __('Categories'),
mp-wp_genesis 790 'rel' => __('rel'),
mp-wp_genesis 791 'visible' => __('Visible')
mp-wp_genesis 792 );
mp-wp_genesis 793
mp-wp_genesis 794 break;
mp-wp_genesis 795 case 'upload':
mp-wp_genesis 796 $_wp_column_headers[$page] = wp_manage_media_columns();
mp-wp_genesis 797 break;
mp-wp_genesis 798 case 'categories':
mp-wp_genesis 799 $_wp_column_headers[$page] = array(
mp-wp_genesis 800 'cb' => '<input type="checkbox" />',
mp-wp_genesis 801 'name' => __('Name'),
mp-wp_genesis 802 'description' => __('Description'),
mp-wp_genesis 803 'slug' => __('Slug'),
mp-wp_genesis 804 'posts' => __('Posts')
mp-wp_genesis 805 );
mp-wp_genesis 806
mp-wp_genesis 807 break;
mp-wp_genesis 808 case 'edit-link-categories':
mp-wp_genesis 809 $_wp_column_headers[$page] = array(
mp-wp_genesis 810 'cb' => '<input type="checkbox" />',
mp-wp_genesis 811 'name' => __('Name'),
mp-wp_genesis 812 'description' => __('Description'),
mp-wp_genesis 813 'slug' => __('Slug'),
mp-wp_genesis 814 'links' => __('Links')
mp-wp_genesis 815 );
mp-wp_genesis 816
mp-wp_genesis 817 break;
mp-wp_genesis 818 case 'edit-tags':
mp-wp_genesis 819 $_wp_column_headers[$page] = array(
mp-wp_genesis 820 'cb' => '<input type="checkbox" />',
mp-wp_genesis 821 'name' => __('Name'),
mp-wp_genesis 822 'slug' => __('Slug'),
mp-wp_genesis 823 'posts' => __('Posts')
mp-wp_genesis 824 );
mp-wp_genesis 825
mp-wp_genesis 826 break;
mp-wp_genesis 827 case 'users':
mp-wp_genesis 828 $_wp_column_headers[$page] = array(
mp-wp_genesis 829 'cb' => '<input type="checkbox" />',
mp-wp_genesis 830 'username' => __('Username'),
mp-wp_genesis 831 'name' => __('Name'),
mp-wp_genesis 832 'email' => __('E-mail'),
mp-wp_genesis 833 'role' => __('Role'),
mp-wp_genesis 834 'posts' => __('Posts')
mp-wp_genesis 835 );
mp-wp_genesis 836 break;
mp-wp_genesis 837 default :
mp-wp_genesis 838 $_wp_column_headers[$page] = array();
mp-wp_genesis 839 }
mp-wp_genesis 840
mp-wp_genesis 841 $_wp_column_headers[$page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]);
mp-wp_genesis 842 return $_wp_column_headers[$page];
mp-wp_genesis 843 }
mp-wp_genesis 844
mp-wp_genesis 845 /**
mp-wp_genesis 846 * {@internal Missing Short Description}}
mp-wp_genesis 847 *
mp-wp_genesis 848 * @since unknown
mp-wp_genesis 849 *
mp-wp_genesis 850 * @param unknown_type $type
mp-wp_genesis 851 * @param unknown_type $id
mp-wp_genesis 852 */
mp-wp_genesis 853 function print_column_headers( $type, $id = true ) {
mp-wp_genesis 854 $type = str_replace('.php', '', $type);
mp-wp_genesis 855 $columns = get_column_headers( $type );
mp-wp_genesis 856 $hidden = get_hidden_columns($type);
mp-wp_genesis 857 $styles = array();
mp-wp_genesis 858 // $styles['tag']['posts'] = 'width: 90px;';
mp-wp_genesis 859 // $styles['link-category']['links'] = 'width: 90px;';
mp-wp_genesis 860 // $styles['category']['posts'] = 'width: 90px;';
mp-wp_genesis 861 // $styles['link']['visible'] = 'text-align: center;';
mp-wp_genesis 862
mp-wp_genesis 863 foreach ( $columns as $column_key => $column_display_name ) {
mp-wp_genesis 864 $class = ' class="manage-column';
mp-wp_genesis 865
mp-wp_genesis 866 $class .= " column-$column_key";
mp-wp_genesis 867
mp-wp_genesis 868 if ( 'cb' == $column_key )
mp-wp_genesis 869 $class .= ' check-column';
mp-wp_genesis 870 elseif ( in_array($column_key, array('posts', 'comments', 'links')) )
mp-wp_genesis 871 $class .= ' num';
mp-wp_genesis 872
mp-wp_genesis 873 $class .= '"';
mp-wp_genesis 874
mp-wp_genesis 875 $style = '';
mp-wp_genesis 876 if ( in_array($column_key, $hidden) )
mp-wp_genesis 877 $style = 'display:none;';
mp-wp_genesis 878
mp-wp_genesis 879 if ( isset($styles[$type]) && isset($styles[$type][$column_key]) )
mp-wp_genesis 880 $style .= ' ' . $styles[$type][$column_key];
mp-wp_genesis 881 $style = ' style="' . $style . '"';
mp-wp_genesis 882 ?>
mp-wp_genesis 883 <th scope="col" <?php echo $id ? "id=\"$column_key\"" : ""; echo $class; echo $style; ?>><?php echo $column_display_name; ?></th>
mp-wp_genesis 884 <?php }
mp-wp_genesis 885 }
mp-wp_genesis 886
mp-wp_genesis 887 /**
mp-wp_genesis 888 * Register column headers for a particular screen. The header names will be listed in the Screen Options.
mp-wp_genesis 889 *
mp-wp_genesis 890 * @since 2.7.0
mp-wp_genesis 891 *
mp-wp_genesis 892 * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
mp-wp_genesis 893 * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
mp-wp_genesis 894 * @see get_column_headers(), print_column_headers(), get_hidden_columns()
mp-wp_genesis 895 */
mp-wp_genesis 896 function register_column_headers($screen, $columns) {
mp-wp_genesis 897 global $_wp_column_headers;
mp-wp_genesis 898
mp-wp_genesis 899 if ( !isset($_wp_column_headers) )
mp-wp_genesis 900 $_wp_column_headers = array();
mp-wp_genesis 901
mp-wp_genesis 902 $_wp_column_headers[$screen] = $columns;
mp-wp_genesis 903 }
mp-wp_genesis 904
mp-wp_genesis 905 /**
mp-wp_genesis 906 * {@internal Missing Short Description}}
mp-wp_genesis 907 *
mp-wp_genesis 908 * @since unknown
mp-wp_genesis 909 *
mp-wp_genesis 910 * @param unknown_type $page
mp-wp_genesis 911 */
mp-wp_genesis 912 function get_hidden_columns($page) {
mp-wp_genesis 913 $page = str_replace('.php', '', $page);
mp-wp_genesis 914 return (array) get_user_option( 'manage-' . $page . '-columns-hidden', 0, false );
mp-wp_genesis 915 }
mp-wp_genesis 916
mp-wp_genesis 917 /**
mp-wp_genesis 918 * {@internal Missing Short Description}}
mp-wp_genesis 919 *
mp-wp_genesis 920 * Outputs the quick edit and bulk edit table rows for posts and pages
mp-wp_genesis 921 *
mp-wp_genesis 922 * @since 2.7
mp-wp_genesis 923 *
mp-wp_genesis 924 * @param string $type 'post' or 'page'
mp-wp_genesis 925 */
mp-wp_genesis 926 function inline_edit_row( $type ) {
mp-wp_genesis 927 global $current_user, $mode;
mp-wp_genesis 928
mp-wp_genesis 929 $is_page = 'page' == $type;
mp-wp_genesis 930 if ( $is_page ) {
mp-wp_genesis 931 $screen = 'edit-pages';
mp-wp_genesis 932 $post = get_default_page_to_edit();
mp-wp_genesis 933 } else {
mp-wp_genesis 934 $screen = 'edit';
mp-wp_genesis 935 $post = get_default_post_to_edit();
mp-wp_genesis 936 }
mp-wp_genesis 937
mp-wp_genesis 938 $columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns();
mp-wp_genesis 939 $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
mp-wp_genesis 940 $col_count = count($columns) - count($hidden);
mp-wp_genesis 941 $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
mp-wp_genesis 942 $can_publish = current_user_can("publish_{$type}s");
mp-wp_genesis 943 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
mp-wp_genesis 944
mp-wp_genesis 945 ?>
mp-wp_genesis 946
mp-wp_genesis 947 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
mp-wp_genesis 948 <?php
mp-wp_genesis 949 $bulk = 0;
mp-wp_genesis 950 while ( $bulk < 2 ) { ?>
mp-wp_genesis 951
mp-wp_genesis 952 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$type ";
mp-wp_genesis 953 echo $bulk ? "bulk-edit-row bulk-edit-row-$type" : "quick-edit-row quick-edit-row-$type";
mp-wp_genesis 954 ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
mp-wp_genesis 955
mp-wp_genesis 956 <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
mp-wp_genesis 957 <h4><?php echo $bulk ? ( $is_page ? __( 'Bulk Edit Pages' ) : __( 'Bulk Edit Posts' ) ) : __( 'Quick Edit' ); ?></h4>
mp-wp_genesis 958
mp-wp_genesis 959
mp-wp_genesis 960 <?php if ( $bulk ) : ?>
mp-wp_genesis 961 <div id="bulk-title-div">
mp-wp_genesis 962 <div id="bulk-titles"></div>
mp-wp_genesis 963 </div>
mp-wp_genesis 964
mp-wp_genesis 965 <?php else : // $bulk ?>
mp-wp_genesis 966
mp-wp_genesis 967 <label>
mp-wp_genesis 968 <span class="title"><?php _e( 'Title' ); ?></span>
mp-wp_genesis 969 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
mp-wp_genesis 970 </label>
mp-wp_genesis 971
mp-wp_genesis 972 <?php endif; // $bulk ?>
mp-wp_genesis 973
mp-wp_genesis 974
mp-wp_genesis 975 <?php if ( !$bulk ) : ?>
mp-wp_genesis 976
mp-wp_genesis 977 <label>
mp-wp_genesis 978 <span class="title"><?php _e( 'Slug' ); ?></span>
mp-wp_genesis 979 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
mp-wp_genesis 980 </label>
mp-wp_genesis 981
mp-wp_genesis 982 <label><span class="title"><?php _e( 'Date' ); ?></span></label>
mp-wp_genesis 983 <div class="inline-edit-date">
mp-wp_genesis 984 <?php touch_time(1, 1, 4, 1); ?>
mp-wp_genesis 985 </div>
mp-wp_genesis 986 <br class="clear" />
mp-wp_genesis 987
mp-wp_genesis 988 <?php endif; // $bulk
mp-wp_genesis 989
mp-wp_genesis 990 ob_start();
mp-wp_genesis 991 $authors = get_editable_user_ids( $current_user->id, true, $type ); // TODO: ROLE SYSTEM
mp-wp_genesis 992 if ( $authors && count( $authors ) > 1 ) :
mp-wp_genesis 993 $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1);
mp-wp_genesis 994 if ( $bulk )
mp-wp_genesis 995 $users_opt['show_option_none'] = __('- No Change -');
mp-wp_genesis 996 ?>
mp-wp_genesis 997 <label>
mp-wp_genesis 998 <span class="title"><?php _e( 'Author' ); ?></span>
mp-wp_genesis 999 <?php wp_dropdown_users( $users_opt ); ?>
mp-wp_genesis 1000 </label>
mp-wp_genesis 1001
mp-wp_genesis 1002 <?php
mp-wp_genesis 1003 endif; // authors
mp-wp_genesis 1004 $authors_dropdown = ob_get_clean();
mp-wp_genesis 1005 ?>
mp-wp_genesis 1006
mp-wp_genesis 1007 <?php if ( !$bulk ) : echo $authors_dropdown; ?>
mp-wp_genesis 1008
mp-wp_genesis 1009 <div class="inline-edit-group">
mp-wp_genesis 1010 <label class="alignleft">
mp-wp_genesis 1011 <span class="title"><?php _e( 'Password' ); ?></span>
mp-wp_genesis 1012 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
mp-wp_genesis 1013 </label>
mp-wp_genesis 1014
mp-wp_genesis 1015 <em style="margin:5px 10px 0 0" class="alignleft"><?php echo _c( '&ndash;OR&ndash;|Between password field and private checkbox on post quick edit interface' ); ?></em>
mp-wp_genesis 1016
mp-wp_genesis 1017 <label class="alignleft inline-edit-private">
mp-wp_genesis 1018 <input type="checkbox" name="keep_private" value="private" />
mp-wp_genesis 1019 <span class="checkbox-title"><?php echo $is_page ? __('Private page') : __('Private post'); ?></span>
mp-wp_genesis 1020 </label>
mp-wp_genesis 1021 </div>
mp-wp_genesis 1022
mp-wp_genesis 1023 <?php endif; ?>
mp-wp_genesis 1024
mp-wp_genesis 1025 </div></fieldset>
mp-wp_genesis 1026
mp-wp_genesis 1027 <?php if ( !$is_page && !$bulk ) : ?>
mp-wp_genesis 1028
mp-wp_genesis 1029 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
mp-wp_genesis 1030 <span class="title inline-edit-categories-label"><?php _e( 'Categories' ); ?>
mp-wp_genesis 1031 <span class="catshow"><?php _e('[more]'); ?></span>
mp-wp_genesis 1032 <span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>
mp-wp_genesis 1033 </span>
mp-wp_genesis 1034 <ul class="cat-checklist">
mp-wp_genesis 1035 <?php wp_category_checklist(); ?>
mp-wp_genesis 1036 </ul>
mp-wp_genesis 1037 </div></fieldset>
mp-wp_genesis 1038
mp-wp_genesis 1039 <?php endif; // !$is_page && !$bulk ?>
mp-wp_genesis 1040
mp-wp_genesis 1041 <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
mp-wp_genesis 1042
mp-wp_genesis 1043 <?php
mp-wp_genesis 1044 if ( $bulk )
mp-wp_genesis 1045 echo $authors_dropdown;
mp-wp_genesis 1046 ?>
mp-wp_genesis 1047
mp-wp_genesis 1048 <?php if ( $is_page ) : ?>
mp-wp_genesis 1049
mp-wp_genesis 1050 <label>
mp-wp_genesis 1051 <span class="title"><?php _e( 'Parent' ); ?></span>
mp-wp_genesis 1052 <?php
mp-wp_genesis 1053 $dropdown_args = array('selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title');
mp-wp_genesis 1054 if ( $bulk )
mp-wp_genesis 1055 $dropdown_args['show_option_no_change'] = __('- No Change -');
mp-wp_genesis 1056 $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);
mp-wp_genesis 1057 wp_dropdown_pages($dropdown_args);
mp-wp_genesis 1058 ?>
mp-wp_genesis 1059 </label>
mp-wp_genesis 1060
mp-wp_genesis 1061 <?php if ( !$bulk ) : ?>
mp-wp_genesis 1062
mp-wp_genesis 1063 <label>
mp-wp_genesis 1064 <span class="title"><?php _e( 'Order' ); ?></span>
mp-wp_genesis 1065 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
mp-wp_genesis 1066 </label>
mp-wp_genesis 1067
mp-wp_genesis 1068 <?php endif; // !$bulk ?>
mp-wp_genesis 1069
mp-wp_genesis 1070 <label>
mp-wp_genesis 1071 <span class="title"><?php _e( 'Template' ); ?></span>
mp-wp_genesis 1072 <select name="page_template">
mp-wp_genesis 1073 <?php if ( $bulk ) : ?>
mp-wp_genesis 1074 <option value="-1"><?php _e('- No Change -'); ?></option>
mp-wp_genesis 1075 <?php endif; // $bulk ?>
mp-wp_genesis 1076 <option value="default"><?php _e( 'Default Template' ); ?></option>
mp-wp_genesis 1077 <?php page_template_dropdown() ?>
mp-wp_genesis 1078 </select>
mp-wp_genesis 1079 </label>
mp-wp_genesis 1080
mp-wp_genesis 1081 <?php elseif ( !$bulk ) : // $is_page ?>
mp-wp_genesis 1082
mp-wp_genesis 1083 <label class="inline-edit-tags">
mp-wp_genesis 1084 <span class="title"><?php _e( 'Tags' ); ?></span>
mp-wp_genesis 1085 <textarea cols="22" rows="1" name="tags_input" class="tags_input"></textarea>
mp-wp_genesis 1086 </label>
mp-wp_genesis 1087
mp-wp_genesis 1088 <?php endif; // $is_page ?>
mp-wp_genesis 1089
mp-wp_genesis 1090 <?php if ( $bulk ) : ?>
mp-wp_genesis 1091
mp-wp_genesis 1092 <div class="inline-edit-group">
mp-wp_genesis 1093 <label class="alignleft">
mp-wp_genesis 1094 <span class="title"><?php _e( 'Comments' ); ?></span>
mp-wp_genesis 1095 <select name="comment_status">
mp-wp_genesis 1096 <option value=""><?php _e('- No Change -'); ?></option>
mp-wp_genesis 1097 <option value="open"><?php _e('Allow'); ?></option>
mp-wp_genesis 1098 <option value="closed"><?php _e('Do not allow'); ?></option>
mp-wp_genesis 1099 </select>
mp-wp_genesis 1100 </label>
mp-wp_genesis 1101
mp-wp_genesis 1102 <label class="alignright">
mp-wp_genesis 1103 <span class="title"><?php _e( 'Pings' ); ?></span>
mp-wp_genesis 1104 <select name="ping_status">
mp-wp_genesis 1105 <option value=""><?php _e('- No Change -'); ?></option>
mp-wp_genesis 1106 <option value="open"><?php _e('Allow'); ?></option>
mp-wp_genesis 1107 <option value="closed"><?php _e('Do not allow'); ?></option>
mp-wp_genesis 1108 </select>
mp-wp_genesis 1109 </label>
mp-wp_genesis 1110 </div>
mp-wp_genesis 1111
mp-wp_genesis 1112 <?php else : // $bulk ?>
mp-wp_genesis 1113
mp-wp_genesis 1114 <div class="inline-edit-group">
mp-wp_genesis 1115 <label class="alignleft">
mp-wp_genesis 1116 <input type="checkbox" name="comment_status" value="open" />
mp-wp_genesis 1117 <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
mp-wp_genesis 1118 </label>
mp-wp_genesis 1119
mp-wp_genesis 1120 <label class="alignleft">
mp-wp_genesis 1121 <input type="checkbox" name="ping_status" value="open" />
mp-wp_genesis 1122 <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
mp-wp_genesis 1123 </label>
mp-wp_genesis 1124 </div>
mp-wp_genesis 1125
mp-wp_genesis 1126 <?php endif; // $bulk ?>
mp-wp_genesis 1127
mp-wp_genesis 1128
mp-wp_genesis 1129 <div class="inline-edit-group">
mp-wp_genesis 1130 <label class="inline-edit-status alignleft">
mp-wp_genesis 1131 <span class="title"><?php _e( 'Status' ); ?></span>
mp-wp_genesis 1132 <select name="_status">
mp-wp_genesis 1133 <?php if ( $bulk ) : ?>
mp-wp_genesis 1134 <option value="-1"><?php _e('- No Change -'); ?></option>
mp-wp_genesis 1135 <?php endif; // $bulk ?>
mp-wp_genesis 1136 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
mp-wp_genesis 1137 <option value="publish"><?php _e( 'Published' ); ?></option>
mp-wp_genesis 1138 <option value="future"><?php _e( 'Scheduled' ); ?></option>
mp-wp_genesis 1139 <?php if ( $bulk ) : ?>
mp-wp_genesis 1140 <option value="private"><?php _e('Private') ?></option>
mp-wp_genesis 1141 <?php endif; // $bulk ?>
mp-wp_genesis 1142 <?php endif; ?>
mp-wp_genesis 1143 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
mp-wp_genesis 1144 <option value="draft"><?php _e( 'Unpublished' ); ?></option>
mp-wp_genesis 1145 </select>
mp-wp_genesis 1146 </label>
mp-wp_genesis 1147
mp-wp_genesis 1148 <?php if ( !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?>
mp-wp_genesis 1149
mp-wp_genesis 1150 <?php if ( $bulk ) : ?>
mp-wp_genesis 1151
mp-wp_genesis 1152 <label class="alignright">
mp-wp_genesis 1153 <span class="title"><?php _e( 'Sticky' ); ?></span>
mp-wp_genesis 1154 <select name="sticky">
mp-wp_genesis 1155 <option value="-1"><?php _e( '- No Change -' ); ?></option>
mp-wp_genesis 1156 <option value="sticky"><?php _e( 'Sticky' ); ?></option>
mp-wp_genesis 1157 <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
mp-wp_genesis 1158 </select>
mp-wp_genesis 1159 </label>
mp-wp_genesis 1160
mp-wp_genesis 1161 <?php else : // $bulk ?>
mp-wp_genesis 1162
mp-wp_genesis 1163 <label class="alignleft">
mp-wp_genesis 1164 <input type="checkbox" name="sticky" value="sticky" />
mp-wp_genesis 1165 <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
mp-wp_genesis 1166 </label>
mp-wp_genesis 1167
mp-wp_genesis 1168 <?php endif; // $bulk ?>
mp-wp_genesis 1169
mp-wp_genesis 1170 <?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ?>
mp-wp_genesis 1171
mp-wp_genesis 1172 </div>
mp-wp_genesis 1173
mp-wp_genesis 1174 </div></fieldset>
mp-wp_genesis 1175
mp-wp_genesis 1176 <?php
mp-wp_genesis 1177 foreach ( $columns as $column_name => $column_display_name ) {
mp-wp_genesis 1178 if ( isset( $core_columns[$column_name] ) )
mp-wp_genesis 1179 continue;
mp-wp_genesis 1180 do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $type);
mp-wp_genesis 1181 }
mp-wp_genesis 1182 ?>
mp-wp_genesis 1183 <p class="submit inline-edit-save">
mp-wp_genesis 1184 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a>
mp-wp_genesis 1185 <?php if ( ! $bulk ) {
mp-wp_genesis 1186 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
mp-wp_genesis 1187 $update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' );
mp-wp_genesis 1188 ?>
mp-wp_genesis 1189 <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo attribute_escape( $update_text ); ?></a>
mp-wp_update-imag... 1190 <img class="waiting" style="display:none;" src="images/loading.svg" alt="" />
mp-wp_genesis 1191 <?php } else {
mp-wp_genesis 1192 $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );
mp-wp_genesis 1193 ?>
mp-wp_genesis 1194 <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo attribute_escape( $update_text ); ?>" />
mp-wp_genesis 1195 <?php } ?>
mp-wp_genesis 1196 <input type="hidden" name="post_view" value="<?php echo $m; ?>" />
mp-wp_genesis 1197 <br class="clear" />
mp-wp_genesis 1198 </p>
mp-wp_genesis 1199 </td></tr>
mp-wp_genesis 1200 <?php
mp-wp_genesis 1201 $bulk++;
mp-wp_genesis 1202 } ?>
mp-wp_genesis 1203 </tbody></table></form>
mp-wp_genesis 1204 <?php
mp-wp_genesis 1205 }
mp-wp_genesis 1206
mp-wp_genesis 1207 // adds hidden fields with the data for use in the inline editor for posts and pages
mp-wp_genesis 1208 /**
mp-wp_genesis 1209 * {@internal Missing Short Description}}
mp-wp_genesis 1210 *
mp-wp_genesis 1211 * @since unknown
mp-wp_genesis 1212 *
mp-wp_genesis 1213 * @param unknown_type $post
mp-wp_genesis 1214 */
mp-wp_genesis 1215 function get_inline_data($post) {
mp-wp_genesis 1216
mp-wp_genesis 1217 if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
mp-wp_genesis 1218 return;
mp-wp_genesis 1219
mp-wp_genesis 1220 $title = attribute_escape($post->post_title);
mp-wp_genesis 1221
mp-wp_genesis 1222 echo '
mp-wp_genesis 1223 <div class="hidden" id="inline_' . $post->ID . '">
mp-wp_genesis 1224 <div class="post_title">' . $title . '</div>
mp-wp_genesis 1225 <div class="post_name">' . $post->post_name . '</div>
mp-wp_genesis 1226 <div class="post_author">' . $post->post_author . '</div>
mp-wp_genesis 1227 <div class="comment_status">' . $post->comment_status . '</div>
mp-wp_genesis 1228 <div class="ping_status">' . $post->ping_status . '</div>
mp-wp_genesis 1229 <div class="_status">' . $post->post_status . '</div>
mp-wp_genesis 1230 <div class="jj">' . mysql2date( 'd', $post->post_date ) . '</div>
mp-wp_genesis 1231 <div class="mm">' . mysql2date( 'm', $post->post_date ) . '</div>
mp-wp_genesis 1232 <div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div>
mp-wp_genesis 1233 <div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div>
mp-wp_genesis 1234 <div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div>
mp-wp_genesis 1235 <div class="ss">' . mysql2date( 's', $post->post_date ) . '</div>
mp-wp_genesis 1236 <div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>';
mp-wp_genesis 1237
mp-wp_genesis 1238 if( $post->post_type == 'page' )
mp-wp_genesis 1239 echo '
mp-wp_genesis 1240 <div class="post_parent">' . $post->post_parent . '</div>
mp-wp_genesis 1241 <div class="page_template">' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '</div>
mp-wp_genesis 1242 <div class="menu_order">' . $post->menu_order . '</div>';
mp-wp_genesis 1243
mp-wp_genesis 1244 if( $post->post_type == 'post' )
mp-wp_genesis 1245 echo '
mp-wp_genesis 1246 <div class="tags_input">' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '</div>
mp-wp_genesis 1247 <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
mp-wp_genesis 1248 <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
mp-wp_genesis 1249
mp-wp_genesis 1250 echo '</div>';
mp-wp_genesis 1251 }
mp-wp_genesis 1252
mp-wp_genesis 1253 /**
mp-wp_genesis 1254 * {@internal Missing Short Description}}
mp-wp_genesis 1255 *
mp-wp_genesis 1256 * @since unknown
mp-wp_genesis 1257 *
mp-wp_genesis 1258 * @param unknown_type $posts
mp-wp_genesis 1259 */
mp-wp_genesis 1260 function post_rows( $posts = array() ) {
mp-wp_genesis 1261 global $wp_query, $post, $mode;
mp-wp_genesis 1262
mp-wp_genesis 1263 add_filter('the_title','wp_specialchars');
mp-wp_genesis 1264
mp-wp_genesis 1265 // Create array of post IDs.
mp-wp_genesis 1266 $post_ids = array();
mp-wp_genesis 1267
mp-wp_genesis 1268 if ( empty($posts) )
mp-wp_genesis 1269 $posts = &$wp_query->posts;
mp-wp_genesis 1270
mp-wp_genesis 1271 foreach ( $posts as $a_post )
mp-wp_genesis 1272 $post_ids[] = $a_post->ID;
mp-wp_genesis 1273
mp-wp_genesis 1274 $comment_pending_count = get_pending_comments_num($post_ids);
mp-wp_genesis 1275 if ( empty($comment_pending_count) )
mp-wp_genesis 1276 $comment_pending_count = array();
mp-wp_genesis 1277
mp-wp_genesis 1278 foreach ( $posts as $post ) {
mp-wp_genesis 1279 if ( empty($comment_pending_count[$post->ID]) )
mp-wp_genesis 1280 $comment_pending_count[$post->ID] = 0;
mp-wp_genesis 1281
mp-wp_genesis 1282 _post_row($post, $comment_pending_count[$post->ID], $mode);
mp-wp_genesis 1283 }
mp-wp_genesis 1284 }
mp-wp_genesis 1285
mp-wp_genesis 1286 /**
mp-wp_genesis 1287 * {@internal Missing Short Description}}
mp-wp_genesis 1288 *
mp-wp_genesis 1289 * @since unknown
mp-wp_genesis 1290 *
mp-wp_genesis 1291 * @param unknown_type $a_post
mp-wp_genesis 1292 * @param unknown_type $pending_comments
mp-wp_genesis 1293 * @param unknown_type $mode
mp-wp_genesis 1294 */
mp-wp_genesis 1295 function _post_row($a_post, $pending_comments, $mode) {
mp-wp_genesis 1296 global $post;
mp-wp_genesis 1297 static $rowclass;
mp-wp_genesis 1298
mp-wp_genesis 1299 $global_post = $post;
mp-wp_genesis 1300 $post = $a_post;
mp-wp_genesis 1301 setup_postdata($post);
mp-wp_genesis 1302
mp-wp_genesis 1303 $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
mp-wp_genesis 1304 global $current_user;
mp-wp_genesis 1305 $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
mp-wp_genesis 1306 $edit_link = get_edit_post_link( $post->ID );
mp-wp_genesis 1307 $title = _draft_or_post_title();
mp-wp_genesis 1308 ?>
mp-wp_genesis 1309 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
mp-wp_genesis 1310 <?php
mp-wp_genesis 1311 $posts_columns = get_column_headers('edit');
mp-wp_genesis 1312 $hidden = get_hidden_columns('edit');
mp-wp_genesis 1313 foreach ( $posts_columns as $column_name=>$column_display_name ) {
mp-wp_genesis 1314 $class = "class=\"$column_name column-$column_name\"";
mp-wp_genesis 1315
mp-wp_genesis 1316 $style = '';
mp-wp_genesis 1317 if ( in_array($column_name, $hidden) )
mp-wp_genesis 1318 $style = ' style="display:none;"';
mp-wp_genesis 1319
mp-wp_genesis 1320 $attributes = "$class$style";
mp-wp_genesis 1321
mp-wp_genesis 1322 switch ($column_name) {
mp-wp_genesis 1323
mp-wp_genesis 1324 case 'cb':
mp-wp_genesis 1325 ?>
mp-wp_genesis 1326 <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
mp-wp_genesis 1327 <?php
mp-wp_genesis 1328 break;
mp-wp_genesis 1329
mp-wp_genesis 1330 case 'date':
mp-wp_genesis 1331 if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
mp-wp_genesis 1332 $t_time = $h_time = __('Unpublished');
mp-wp_genesis 1333 } else {
mp-wp_genesis 1334 $t_time = get_the_time(__('Y/m/d g:i:s A'));
mp-wp_genesis 1335 $m_time = $post->post_date;
mp-wp_genesis 1336 $time = get_post_time('G', true, $post);
mp-wp_genesis 1337
mp-wp_genesis 1338 $time_diff = time() - $time;
mp-wp_genesis 1339
mp-wp_genesis 1340 if ( ( 'future' == $post->post_status) ) {
mp-wp_genesis 1341 if ( $time_diff <= 0 ) {
mp-wp_genesis 1342 $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
mp-wp_genesis 1343 } else {
mp-wp_genesis 1344 $h_time = $t_time;
mp-wp_genesis 1345 $missed = true;
mp-wp_genesis 1346 }
mp-wp_genesis 1347 } else {
mp-wp_genesis 1348
mp-wp_genesis 1349 if ( $time_diff > 0 && $time_diff < 24*60*60 )
mp-wp_genesis 1350 $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
mp-wp_genesis 1351 else
mp-wp_genesis 1352 $h_time = mysql2date(__('Y/m/d'), $m_time);
mp-wp_genesis 1353 }
mp-wp_genesis 1354 }
mp-wp_genesis 1355
mp-wp_genesis 1356 echo '<td ' . $attributes . '>';
mp-wp_genesis 1357 if ( 'excerpt' == $mode )
mp-wp_genesis 1358 echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
mp-wp_genesis 1359 else
mp-wp_genesis 1360 echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
mp-wp_genesis 1361 echo '<br />';
mp-wp_genesis 1362 if ( 'publish' == $post->post_status ) {
mp-wp_genesis 1363 _e('Published');
mp-wp_genesis 1364 } elseif ( 'future' == $post->post_status ) {
mp-wp_genesis 1365 if ( isset($missed) )
mp-wp_genesis 1366 echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
mp-wp_genesis 1367 else
mp-wp_genesis 1368 _e('Scheduled');
mp-wp_genesis 1369 } else {
mp-wp_genesis 1370 _e('Last Modified');
mp-wp_genesis 1371 }
mp-wp_genesis 1372 echo '</td>';
mp-wp_genesis 1373 break;
mp-wp_genesis 1374
mp-wp_genesis 1375 case 'title':
mp-wp_genesis 1376 $attributes = 'class="post-title column-title"' . $style;
mp-wp_genesis 1377 ?>
mp-wp_genesis 1378 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
mp-wp_genesis 1379 <?php
mp-wp_genesis 1380 if ( 'excerpt' == $mode )
mp-wp_genesis 1381 the_excerpt();
mp-wp_genesis 1382
mp-wp_genesis 1383 $actions = array();
mp-wp_genesis 1384 if ( current_user_can('edit_post', $post->ID) ) {
mp-wp_genesis 1385 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . attribute_escape(__('Edit this post')) . '">' . __('Edit') . '</a>';
mp-wp_genesis 1386 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . attribute_escape(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
mp-wp_genesis 1387 $actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
mp-wp_genesis 1388 }
mp-wp_genesis 1389 if ( in_array($post->post_status, array('pending', 'draft')) ) {
mp-wp_genesis 1390 if ( current_user_can('edit_post', $post->ID) )
mp-wp_genesis 1391 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
mp-wp_genesis 1392 } else {
mp-wp_genesis 1393 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
mp-wp_genesis 1394 }
mp-wp_genesis 1395 $action_count = count($actions);
mp-wp_genesis 1396 $i = 0;
mp-wp_genesis 1397 echo '<div class="row-actions">';
mp-wp_genesis 1398 foreach ( $actions as $action => $link ) {
mp-wp_genesis 1399 ++$i;
mp-wp_genesis 1400 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
mp-wp_genesis 1401 echo "<span class='$action'>$link$sep</span>";
mp-wp_genesis 1402 }
mp-wp_genesis 1403 echo '</div>';
mp-wp_genesis 1404
mp-wp_genesis 1405 get_inline_data($post);
mp-wp_genesis 1406 ?>
mp-wp_genesis 1407 </td>
mp-wp_genesis 1408 <?php
mp-wp_genesis 1409 break;
mp-wp_genesis 1410
mp-wp_genesis 1411 case 'categories':
mp-wp_genesis 1412 ?>
mp-wp_genesis 1413 <td <?php echo $attributes ?>><?php
mp-wp_genesis 1414 $categories = get_the_category();
mp-wp_genesis 1415 if ( !empty( $categories ) ) {
mp-wp_genesis 1416 $out = array();
mp-wp_genesis 1417 foreach ( $categories as $c )
mp-wp_genesis 1418 $out[] = "<a href='edit.php?category_name=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
mp-wp_genesis 1419 echo join( ', ', $out );
mp-wp_genesis 1420 } else {
mp-wp_genesis 1421 _e('Uncategorized');
mp-wp_genesis 1422 }
mp-wp_genesis 1423 ?></td>
mp-wp_genesis 1424 <?php
mp-wp_genesis 1425 break;
mp-wp_genesis 1426
mp-wp_genesis 1427 case 'tags':
mp-wp_genesis 1428 ?>
mp-wp_genesis 1429 <td <?php echo $attributes ?>><?php
mp-wp_genesis 1430 $tags = get_the_tags($post->ID);
mp-wp_genesis 1431 if ( !empty( $tags ) ) {
mp-wp_genesis 1432 $out = array();
mp-wp_genesis 1433 foreach ( $tags as $c )
mp-wp_genesis 1434 $out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
mp-wp_genesis 1435 echo join( ', ', $out );
mp-wp_genesis 1436 } else {
mp-wp_genesis 1437 _e('No Tags');
mp-wp_genesis 1438 }
mp-wp_genesis 1439 ?></td>
mp-wp_genesis 1440 <?php
mp-wp_genesis 1441 break;
mp-wp_genesis 1442
mp-wp_genesis 1443 case 'comments':
mp-wp_genesis 1444 ?>
mp-wp_genesis 1445 <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
mp-wp_genesis 1446 <?php
mp-wp_genesis 1447 $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
mp-wp_genesis 1448 if ( $pending_comments )
mp-wp_genesis 1449 echo '<strong>';
mp-wp_genesis 1450 comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
mp-wp_genesis 1451 if ( $pending_comments )
mp-wp_genesis 1452 echo '</strong>';
mp-wp_genesis 1453 ?>
mp-wp_genesis 1454 </div></td>
mp-wp_genesis 1455 <?php
mp-wp_genesis 1456 break;
mp-wp_genesis 1457
mp-wp_genesis 1458 case 'author':
mp-wp_genesis 1459 ?>
mp-wp_genesis 1460 <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
mp-wp_genesis 1461 <?php
mp-wp_genesis 1462 break;
mp-wp_genesis 1463
mp-wp_genesis 1464 case 'control_view':
mp-wp_genesis 1465 ?>
mp-wp_genesis 1466 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
mp-wp_genesis 1467 <?php
mp-wp_genesis 1468 break;
mp-wp_genesis 1469
mp-wp_genesis 1470 case 'control_edit':
mp-wp_genesis 1471 ?>
mp-wp_genesis 1472 <td><?php if ( current_user_can('edit_post', $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td>
mp-wp_genesis 1473 <?php
mp-wp_genesis 1474 break;
mp-wp_genesis 1475
mp-wp_genesis 1476 case 'control_delete':
mp-wp_genesis 1477 ?>
mp-wp_genesis 1478 <td><?php if ( current_user_can('delete_post', $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>
mp-wp_genesis 1479 <?php
mp-wp_genesis 1480 break;
mp-wp_genesis 1481
mp-wp_genesis 1482 default:
mp-wp_genesis 1483 ?>
mp-wp_genesis 1484 <td <?php echo $attributes ?>><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td>
mp-wp_genesis 1485 <?php
mp-wp_genesis 1486 break;
mp-wp_genesis 1487 }
mp-wp_genesis 1488 }
mp-wp_genesis 1489 ?>
mp-wp_genesis 1490 </tr>
mp-wp_genesis 1491 <?php
mp-wp_genesis 1492 $post = $global_post;
mp-wp_genesis 1493 }
mp-wp_genesis 1494
mp-wp_genesis 1495 /*
mp-wp_genesis 1496 * display one row if the page doesn't have any children
mp-wp_genesis 1497 * otherwise, display the row and its children in subsequent rows
mp-wp_genesis 1498 */
mp-wp_genesis 1499 /**
mp-wp_genesis 1500 * {@internal Missing Short Description}}
mp-wp_genesis 1501 *
mp-wp_genesis 1502 * @since unknown
mp-wp_genesis 1503 *
mp-wp_genesis 1504 * @param unknown_type $page
mp-wp_genesis 1505 * @param unknown_type $level
mp-wp_genesis 1506 */
mp-wp_genesis 1507 function display_page_row( $page, $level = 0 ) {
mp-wp_genesis 1508 global $post;
mp-wp_genesis 1509 static $rowclass;
mp-wp_genesis 1510
mp-wp_genesis 1511 $post = $page;
mp-wp_genesis 1512 setup_postdata($page);
mp-wp_genesis 1513
mp-wp_genesis 1514 $page->post_title = wp_specialchars( $page->post_title );
mp-wp_genesis 1515 $pad = str_repeat( '&#8212; ', $level );
mp-wp_genesis 1516 $id = (int) $page->ID;
mp-wp_genesis 1517 $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
mp-wp_genesis 1518 $posts_columns = get_column_headers('edit-pages');
mp-wp_genesis 1519 $hidden = get_hidden_columns('edit-pages');
mp-wp_genesis 1520 $title = _draft_or_post_title();
mp-wp_genesis 1521 ?>
mp-wp_genesis 1522 <tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
mp-wp_genesis 1523 <?php
mp-wp_genesis 1524
mp-wp_genesis 1525 foreach ($posts_columns as $column_name=>$column_display_name) {
mp-wp_genesis 1526 $class = "class=\"$column_name column-$column_name\"";
mp-wp_genesis 1527
mp-wp_genesis 1528 $style = '';
mp-wp_genesis 1529 if ( in_array($column_name, $hidden) )
mp-wp_genesis 1530 $style = ' style="display:none;"';
mp-wp_genesis 1531
mp-wp_genesis 1532 $attributes = "$class$style";
mp-wp_genesis 1533
mp-wp_genesis 1534 switch ($column_name) {
mp-wp_genesis 1535
mp-wp_genesis 1536 case 'cb':
mp-wp_genesis 1537 ?>
mp-wp_genesis 1538 <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th>
mp-wp_genesis 1539 <?php
mp-wp_genesis 1540 break;
mp-wp_genesis 1541 case 'date':
mp-wp_genesis 1542 if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
mp-wp_genesis 1543 $t_time = $h_time = __('Unpublished');
mp-wp_genesis 1544 } else {
mp-wp_genesis 1545 $t_time = get_the_time(__('Y/m/d g:i:s A'));
mp-wp_genesis 1546 $m_time = $page->post_date;
mp-wp_genesis 1547 $time = get_post_time('G', true);
mp-wp_genesis 1548
mp-wp_genesis 1549 if ( ( abs(time() - $time) ) < 86400 ) {
mp-wp_genesis 1550 if ( ( 'future' == $page->post_status) )
mp-wp_genesis 1551 $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
mp-wp_genesis 1552 else
mp-wp_genesis 1553 $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
mp-wp_genesis 1554 } else {
mp-wp_genesis 1555 $h_time = mysql2date(__('Y/m/d'), $m_time);
mp-wp_genesis 1556 }
mp-wp_genesis 1557 }
mp-wp_genesis 1558 echo '<td ' . $attributes . '>';
mp-wp_genesis 1559 echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>';
mp-wp_genesis 1560 echo '<br />';
mp-wp_genesis 1561 if ( 'publish' == $page->post_status || 'future' == $page->post_status )
mp-wp_genesis 1562 _e('Published');
mp-wp_genesis 1563 else
mp-wp_genesis 1564 _e('Last Modified');
mp-wp_genesis 1565 echo '</td>';
mp-wp_genesis 1566 break;
mp-wp_genesis 1567 case 'title':
mp-wp_genesis 1568 $attributes = 'class="post-title page-title column-title"' . $style;
mp-wp_genesis 1569 $edit_link = get_edit_post_link( $page->ID );
mp-wp_genesis 1570 ?>
mp-wp_genesis 1571 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); ?></strong>
mp-wp_genesis 1572 <?php
mp-wp_genesis 1573 $actions = array();
mp-wp_genesis 1574 if ( current_user_can('edit_page', $page->ID) ) {
mp-wp_genesis 1575 $actions['edit'] = '<a href="' . $edit_link . '" title="' . attribute_escape(__('Edit this page')) . '">' . __('Edit') . '</a>';
mp-wp_genesis 1576 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
mp-wp_genesis 1577 $actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
mp-wp_genesis 1578 }
mp-wp_genesis 1579 if ( in_array($post->post_status, array('pending', 'draft')) ) {
mp-wp_genesis 1580 if ( current_user_can('edit_page', $page->ID) )
mp-wp_genesis 1581 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
mp-wp_genesis 1582 } else {
mp-wp_genesis 1583 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
mp-wp_genesis 1584 }
mp-wp_genesis 1585 $action_count = count($actions);
mp-wp_genesis 1586
mp-wp_genesis 1587 $i = 0;
mp-wp_genesis 1588 echo '<div class="row-actions">';
mp-wp_genesis 1589 foreach ( $actions as $action => $link ) {
mp-wp_genesis 1590 ++$i;
mp-wp_genesis 1591 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
mp-wp_genesis 1592 echo "<span class='$action'>$link$sep</span>";
mp-wp_genesis 1593 }
mp-wp_genesis 1594 echo '</div>';
mp-wp_genesis 1595
mp-wp_genesis 1596 get_inline_data($post);
mp-wp_genesis 1597 echo '</td>';
mp-wp_genesis 1598 break;
mp-wp_genesis 1599
mp-wp_genesis 1600 case 'comments':
mp-wp_genesis 1601 ?>
mp-wp_genesis 1602 <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
mp-wp_genesis 1603 <?php
mp-wp_genesis 1604 $left = get_pending_comments_num( $page->ID );
mp-wp_genesis 1605 $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
mp-wp_genesis 1606 if ( $left )
mp-wp_genesis 1607 echo '<strong>';
mp-wp_genesis 1608 comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
mp-wp_genesis 1609 if ( $left )
mp-wp_genesis 1610 echo '</strong>';
mp-wp_genesis 1611 ?>
mp-wp_genesis 1612 </div></td>
mp-wp_genesis 1613 <?php
mp-wp_genesis 1614 break;
mp-wp_genesis 1615
mp-wp_genesis 1616 case 'author':
mp-wp_genesis 1617 ?>
mp-wp_genesis 1618 <td <?php echo $attributes ?>><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
mp-wp_genesis 1619 <?php
mp-wp_genesis 1620 break;
mp-wp_genesis 1621
mp-wp_genesis 1622 default:
mp-wp_genesis 1623 ?>
mp-wp_genesis 1624 <td <?php echo $attributes ?>><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td>
mp-wp_genesis 1625 <?php
mp-wp_genesis 1626 break;
mp-wp_genesis 1627 }
mp-wp_genesis 1628 }
mp-wp_genesis 1629 ?>
mp-wp_genesis 1630
mp-wp_genesis 1631 </tr>
mp-wp_genesis 1632
mp-wp_genesis 1633 <?php
mp-wp_genesis 1634 }
mp-wp_genesis 1635
mp-wp_genesis 1636 /*
mp-wp_genesis 1637 * displays pages in hierarchical order with paging support
mp-wp_genesis 1638 */
mp-wp_genesis 1639 /**
mp-wp_genesis 1640 * {@internal Missing Short Description}}
mp-wp_genesis 1641 *
mp-wp_genesis 1642 * @since unknown
mp-wp_genesis 1643 *
mp-wp_genesis 1644 * @param unknown_type $pages
mp-wp_genesis 1645 * @param unknown_type $pagenum
mp-wp_genesis 1646 * @param unknown_type $per_page
mp-wp_genesis 1647 * @return unknown
mp-wp_genesis 1648 */
mp-wp_genesis 1649 function page_rows($pages, $pagenum = 1, $per_page = 20) {
mp-wp_genesis 1650 global $wpdb;
mp-wp_genesis 1651
mp-wp_genesis 1652 $level = 0;
mp-wp_genesis 1653
mp-wp_genesis 1654 if ( ! $pages ) {
mp-wp_genesis 1655 $pages = get_pages( array('sort_column' => 'menu_order') );
mp-wp_genesis 1656
mp-wp_genesis 1657 if ( ! $pages )
mp-wp_genesis 1658 return false;
mp-wp_genesis 1659 }
mp-wp_genesis 1660
mp-wp_genesis 1661 /*
mp-wp_genesis 1662 * arrange pages into two parts: top level pages and children_pages
mp-wp_genesis 1663 * children_pages is two dimensional array, eg.
mp-wp_genesis 1664 * children_pages[10][] contains all sub-pages whose parent is 10.
mp-wp_genesis 1665 * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
mp-wp_genesis 1666 * If searching, ignore hierarchy and treat everything as top level
mp-wp_genesis 1667 */
mp-wp_genesis 1668 if ( empty($_GET['s']) ) {
mp-wp_genesis 1669
mp-wp_genesis 1670 $top_level_pages = array();
mp-wp_genesis 1671 $children_pages = array();
mp-wp_genesis 1672
mp-wp_genesis 1673 foreach ( $pages as $page ) {
mp-wp_genesis 1674
mp-wp_genesis 1675 // catch and repair bad pages
mp-wp_genesis 1676 if ( $page->post_parent == $page->ID ) {
mp-wp_genesis 1677 $page->post_parent = 0;
mp-wp_genesis 1678 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
mp-wp_genesis 1679 clean_page_cache( $page->ID );
mp-wp_genesis 1680 }
mp-wp_genesis 1681
mp-wp_genesis 1682 if ( 0 == $page->post_parent )
mp-wp_genesis 1683 $top_level_pages[] = $page;
mp-wp_genesis 1684 else
mp-wp_genesis 1685 $children_pages[ $page->post_parent ][] = $page;
mp-wp_genesis 1686 }
mp-wp_genesis 1687
mp-wp_genesis 1688 $pages = &$top_level_pages;
mp-wp_genesis 1689 }
mp-wp_genesis 1690
mp-wp_genesis 1691 $count = 0;
mp-wp_genesis 1692 $start = ($pagenum - 1) * $per_page;
mp-wp_genesis 1693 $end = $start + $per_page;
mp-wp_genesis 1694
mp-wp_genesis 1695 foreach ( $pages as $page ) {
mp-wp_genesis 1696 if ( $count >= $end )
mp-wp_genesis 1697 break;
mp-wp_genesis 1698
mp-wp_genesis 1699 if ( $count >= $start )
mp-wp_genesis 1700 echo "\t" . display_page_row( $page, $level );
mp-wp_genesis 1701
mp-wp_genesis 1702 $count++;
mp-wp_genesis 1703
mp-wp_genesis 1704 if ( isset($children_pages) )
mp-wp_genesis 1705 _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
mp-wp_genesis 1706 }
mp-wp_genesis 1707
mp-wp_genesis 1708 // if it is the last pagenum and there are orphaned pages, display them with paging as well
mp-wp_genesis 1709 if ( isset($children_pages) && $count < $end ){
mp-wp_genesis 1710 foreach( $children_pages as $orphans ){
mp-wp_genesis 1711 foreach ( $orphans as $op ) {
mp-wp_genesis 1712 if ( $count >= $end )
mp-wp_genesis 1713 break;
mp-wp_genesis 1714 if ( $count >= $start )
mp-wp_genesis 1715 echo "\t" . display_page_row( $op, 0 );
mp-wp_genesis 1716 $count++;
mp-wp_genesis 1717 }
mp-wp_genesis 1718 }
mp-wp_genesis 1719 }
mp-wp_genesis 1720 }
mp-wp_genesis 1721
mp-wp_genesis 1722 /*
mp-wp_genesis 1723 * Given a top level page ID, display the nested hierarchy of sub-pages
mp-wp_genesis 1724 * together with paging support
mp-wp_genesis 1725 */
mp-wp_genesis 1726 /**
mp-wp_genesis 1727 * {@internal Missing Short Description}}
mp-wp_genesis 1728 *
mp-wp_genesis 1729 * @since unknown
mp-wp_genesis 1730 *
mp-wp_genesis 1731 * @param unknown_type $children_pages
mp-wp_genesis 1732 * @param unknown_type $count
mp-wp_genesis 1733 * @param unknown_type $parent
mp-wp_genesis 1734 * @param unknown_type $level
mp-wp_genesis 1735 * @param unknown_type $pagenum
mp-wp_genesis 1736 * @param unknown_type $per_page
mp-wp_genesis 1737 */
mp-wp_genesis 1738 function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
mp-wp_genesis 1739
mp-wp_genesis 1740 if ( ! isset( $children_pages[$parent] ) )
mp-wp_genesis 1741 return;
mp-wp_genesis 1742
mp-wp_genesis 1743 $start = ($pagenum - 1) * $per_page;
mp-wp_genesis 1744 $end = $start + $per_page;
mp-wp_genesis 1745
mp-wp_genesis 1746 foreach ( $children_pages[$parent] as $page ) {
mp-wp_genesis 1747
mp-wp_genesis 1748 if ( $count >= $end )
mp-wp_genesis 1749 break;
mp-wp_genesis 1750
mp-wp_genesis 1751 // If the page starts in a subtree, print the parents.
mp-wp_genesis 1752 if ( $count == $start && $page->post_parent > 0 ) {
mp-wp_genesis 1753 $my_parents = array();
mp-wp_genesis 1754 $my_parent = $page->post_parent;
mp-wp_genesis 1755 while ( $my_parent) {
mp-wp_genesis 1756 $my_parent = get_post($my_parent);
mp-wp_genesis 1757 $my_parents[] = $my_parent;
mp-wp_genesis 1758 if ( !$my_parent->post_parent )
mp-wp_genesis 1759 break;
mp-wp_genesis 1760 $my_parent = $my_parent->post_parent;
mp-wp_genesis 1761 }
mp-wp_genesis 1762 $num_parents = count($my_parents);
mp-wp_genesis 1763 while( $my_parent = array_pop($my_parents) ) {
mp-wp_genesis 1764 echo "\t" . display_page_row( $my_parent, $level - $num_parents );
mp-wp_genesis 1765 $num_parents--;
mp-wp_genesis 1766 }
mp-wp_genesis 1767 }
mp-wp_genesis 1768
mp-wp_genesis 1769 if ( $count >= $start )
mp-wp_genesis 1770 echo "\t" . display_page_row( $page, $level );
mp-wp_genesis 1771
mp-wp_genesis 1772 $count++;
mp-wp_genesis 1773
mp-wp_genesis 1774 _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
mp-wp_genesis 1775 }
mp-wp_genesis 1776
mp-wp_genesis 1777 unset( $children_pages[$parent] ); //required in order to keep track of orphans
mp-wp_genesis 1778 }
mp-wp_genesis 1779
mp-wp_genesis 1780 /**
mp-wp_genesis 1781 * {@internal Missing Short Description}}
mp-wp_genesis 1782 *
mp-wp_genesis 1783 * @since unknown
mp-wp_genesis 1784 *
mp-wp_genesis 1785 * @param unknown_type $user_object
mp-wp_genesis 1786 * @param unknown_type $style
mp-wp_genesis 1787 * @param unknown_type $role
mp-wp_genesis 1788 * @return unknown
mp-wp_genesis 1789 */
mp-wp_genesis 1790 function user_row( $user_object, $style = '', $role = '' ) {
mp-wp_genesis 1791 global $wp_roles;
mp-wp_genesis 1792
mp-wp_genesis 1793 $current_user = wp_get_current_user();
mp-wp_genesis 1794
mp-wp_genesis 1795 if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
mp-wp_genesis 1796 $user_object = new WP_User( (int) $user_object );
mp-wp_genesis 1797 $email = $user_object->user_email;
mp-wp_genesis 1798 $url = $user_object->user_url;
mp-wp_genesis 1799 $short_url = str_replace( 'http://', '', $url );
mp-wp_genesis 1800 $short_url = str_replace( 'www.', '', $short_url );
mp-wp_genesis 1801 if ('/' == substr( $short_url, -1 ))
mp-wp_genesis 1802 $short_url = substr( $short_url, 0, -1 );
mp-wp_genesis 1803 if ( strlen( $short_url ) > 35 )
mp-wp_genesis 1804 $short_url = substr( $short_url, 0, 32 ).'...';
mp-wp_genesis 1805 $numposts = get_usernumposts( $user_object->ID );
mp-wp_genesis 1806 if ( current_user_can( 'edit_user', $user_object->ID ) ) {
mp-wp_genesis 1807 if ($current_user->ID == $user_object->ID) {
mp-wp_genesis 1808 $edit_link = 'profile.php';
mp-wp_genesis 1809 } else {
mp-wp_genesis 1810 $edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
mp-wp_genesis 1811 }
mp-wp_genesis 1812 $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
mp-wp_genesis 1813 $actions = array();
mp-wp_genesis 1814 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
mp-wp_genesis 1815 if ( $current_user->ID != $user_object->ID )
mp-wp_genesis 1816 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
mp-wp_genesis 1817 $action_count = count($actions);
mp-wp_genesis 1818 $i = 0;
mp-wp_genesis 1819 $edit .= '<div class="row-actions">';
mp-wp_genesis 1820 foreach ( $actions as $action => $link ) {
mp-wp_genesis 1821 ++$i;
mp-wp_genesis 1822 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
mp-wp_genesis 1823 $edit .= "<span class='$action'>$link$sep</span>";
mp-wp_genesis 1824 }
mp-wp_genesis 1825 $edit .= '</div>';
mp-wp_genesis 1826 } else {
mp-wp_genesis 1827 $edit = '<strong>' . $user_object->user_login . '</strong>';
mp-wp_genesis 1828 }
mp-wp_genesis 1829 $role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None');
mp-wp_genesis 1830 $r = "<tr id='user-$user_object->ID'$style>";
mp-wp_genesis 1831 $columns = get_column_headers('users');
mp-wp_genesis 1832 $hidden = get_hidden_columns('users');
mp-wp_genesis 1833 $avatar = get_avatar( $user_object->user_email, 32 );
mp-wp_genesis 1834 foreach ( $columns as $column_name => $column_display_name ) {
mp-wp_genesis 1835 $class = "class=\"$column_name column-$column_name\"";
mp-wp_genesis 1836
mp-wp_genesis 1837 $style = '';
mp-wp_genesis 1838 if ( in_array($column_name, $hidden) )
mp-wp_genesis 1839 $style = ' style="display:none;"';
mp-wp_genesis 1840
mp-wp_genesis 1841 $attributes = "$class$style";
mp-wp_genesis 1842
mp-wp_genesis 1843 switch ($column_name) {
mp-wp_genesis 1844 case 'cb':
mp-wp_genesis 1845 $r .= "<th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th>";
mp-wp_genesis 1846 break;
mp-wp_genesis 1847 case 'username':
mp-wp_genesis 1848 $r .= "<td $attributes>$avatar $edit</td>";
mp-wp_genesis 1849 break;
mp-wp_genesis 1850 case 'name':
mp-wp_genesis 1851 $r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
mp-wp_genesis 1852 break;
mp-wp_genesis 1853 case 'email':
mp-wp_genesis 1854 $r .= "<td $attributes><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>";
mp-wp_genesis 1855 break;
mp-wp_genesis 1856 case 'role':
mp-wp_genesis 1857 $r .= "<td $attributes>$role_name</td>";
mp-wp_genesis 1858 break;
mp-wp_genesis 1859 case 'posts':
mp-wp_genesis 1860 $attributes = 'class="posts column-posts num"' . $style;
mp-wp_genesis 1861 $r .= "<td $attributes>";
mp-wp_genesis 1862 if ( $numposts > 0 ) {
mp-wp_genesis 1863 $r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
mp-wp_genesis 1864 $r .= $numposts;
mp-wp_genesis 1865 $r .= '</a>';
mp-wp_genesis 1866 } else {
mp-wp_genesis 1867 $r .= 0;
mp-wp_genesis 1868 }
mp-wp_genesis 1869 $r .= "</td>";
mp-wp_genesis 1870 }
mp-wp_genesis 1871 }
mp-wp_genesis 1872 $r .= '</tr>';
mp-wp_genesis 1873
mp-wp_genesis 1874 return $r;
mp-wp_genesis 1875 }
mp-wp_genesis 1876
mp-wp_genesis 1877 /**
mp-wp_genesis 1878 * {@internal Missing Short Description}}
mp-wp_genesis 1879 *
mp-wp_genesis 1880 * @since unknown
mp-wp_genesis 1881 *
mp-wp_genesis 1882 * @param unknown_type $status
mp-wp_genesis 1883 * @param unknown_type $s
mp-wp_genesis 1884 * @param unknown_type $start
mp-wp_genesis 1885 * @param unknown_type $num
mp-wp_genesis 1886 * @param unknown_type $post
mp-wp_genesis 1887 * @param unknown_type $type
mp-wp_genesis 1888 * @return unknown
mp-wp_genesis 1889 */
mp-wp_genesis 1890 function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
mp-wp_genesis 1891 global $wpdb;
mp-wp_genesis 1892
mp-wp_genesis 1893 $start = abs( (int) $start );
mp-wp_genesis 1894 $num = (int) $num;
mp-wp_genesis 1895 $post = (int) $post;
mp-wp_genesis 1896
mp-wp_genesis 1897 if ( 'moderated' == $status )
mp-wp_genesis 1898 $approved = "comment_approved = '0'";
mp-wp_genesis 1899 elseif ( 'approved' == $status )
mp-wp_genesis 1900 $approved = "comment_approved = '1'";
mp-wp_genesis 1901 elseif ( 'spam' == $status )
mp-wp_genesis 1902 $approved = "comment_approved = 'spam'";
mp-wp_genesis 1903 else
mp-wp_genesis 1904 $approved = "( comment_approved = '0' OR comment_approved = '1' )";
mp-wp_genesis 1905
mp-wp_genesis 1906 if ( $post ) {
mp-wp_genesis 1907 $post = " AND comment_post_ID = '$post'";
mp-wp_genesis 1908 $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num";
mp-wp_genesis 1909 } else {
mp-wp_genesis 1910 $post = '';
mp-wp_genesis 1911 $orderby = "ORDER BY comment_date_gmt DESC LIMIT $start, $num";
mp-wp_genesis 1912 }
mp-wp_genesis 1913
mp-wp_genesis 1914 if ( 'comment' == $type )
mp-wp_genesis 1915 $typesql = "AND comment_type = ''";
mp-wp_genesis 1916 elseif ( 'pingback' == $type )
mp-wp_genesis 1917 $typesql = "AND comment_type = 'pingback'";
mp-wp_genesis 1918 elseif ( 'trackback' == $type )
mp-wp_genesis 1919 $typesql = "AND comment_type = 'trackback'";
mp-wp_genesis 1920 elseif ( 'pings' == $type )
mp-wp_genesis 1921 $typesql = "AND ( comment_type = 'pingback' OR comment_type = 'trackback' )";
mp-wp_genesis 1922 else
mp-wp_genesis 1923 $typesql = '';
mp-wp_genesis 1924
mp-wp_genesis 1925 if ( $s ) {
mp-wp_genesis 1926 $s = $wpdb->escape($s);
mp-wp_genesis 1927 $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
mp-wp_genesis 1928 (comment_author LIKE '%$s%' OR
mp-wp_genesis 1929 comment_author_email LIKE '%$s%' OR
mp-wp_genesis 1930 comment_author_url LIKE ('%$s%') OR
mp-wp_genesis 1931 comment_author_IP LIKE ('%$s%') OR
mp-wp_genesis 1932 comment_content LIKE ('%$s%') ) AND
mp-wp_genesis 1933 $approved
mp-wp_genesis 1934 $typesql
mp-wp_genesis 1935 $orderby");
mp-wp_genesis 1936 } else {
mp-wp_genesis 1937 $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post $typesql $orderby" );
mp-wp_genesis 1938 }
mp-wp_genesis 1939
mp-wp_genesis 1940 update_comment_cache($comments);
mp-wp_genesis 1941
mp-wp_genesis 1942 $total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
mp-wp_genesis 1943
mp-wp_genesis 1944 return array($comments, $total);
mp-wp_genesis 1945 }
mp-wp_genesis 1946
mp-wp_genesis 1947 /**
mp-wp_genesis 1948 * {@internal Missing Short Description}}
mp-wp_genesis 1949 *
mp-wp_genesis 1950 * @since unknown
mp-wp_genesis 1951 *
mp-wp_genesis 1952 * @param unknown_type $comment_id
mp-wp_genesis 1953 * @param unknown_type $mode
mp-wp_genesis 1954 * @param unknown_type $comment_status
mp-wp_genesis 1955 * @param unknown_type $checkbox
mp-wp_genesis 1956 */
mp-wp_genesis 1957 function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
mp-wp_genesis 1958 global $comment, $post, $_comment_pending_count;
mp-wp_genesis 1959 $comment = get_comment( $comment_id );
mp-wp_genesis 1960 $post = get_post($comment->comment_post_ID);
mp-wp_genesis 1961 $the_comment_status = wp_get_comment_status($comment->comment_ID);
mp-wp_genesis 1962
mp-wp_genesis 1963 $author_url = get_comment_author_url();
mp-wp_genesis 1964 if ( 'http://' == $author_url )
mp-wp_genesis 1965 $author_url = '';
mp-wp_genesis 1966 $author_url_display = $author_url;
mp-wp_genesis 1967 $author_url_display = str_replace('http://www.', '', $author_url_display);
mp-wp_genesis 1968 $author_url_display = str_replace('http://', '', $author_url_display);
mp-wp_genesis 1969 if ( strlen($author_url_display) > 50 )
mp-wp_genesis 1970 $author_url_display = substr($author_url_display, 0, 49) . '...';
mp-wp_genesis 1971
mp-wp_genesis 1972 $ptime = date('G', strtotime( $comment->comment_date ) );
mp-wp_genesis 1973 if ( ( abs(time() - $ptime) ) < 86400 )
mp-wp_genesis 1974 $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) );
mp-wp_genesis 1975 else
mp-wp_genesis 1976 $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
mp-wp_genesis 1977
mp-wp_genesis 1978 $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
mp-wp_genesis 1979 $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
mp-wp_genesis 1980 $unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
mp-wp_genesis 1981 $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
mp-wp_genesis 1982
mp-wp_genesis 1983 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
mp-wp_genesis 1984 $columns = get_column_headers('edit-comments');
mp-wp_genesis 1985 $hidden = get_hidden_columns('edit-comments');
mp-wp_genesis 1986 foreach ( $columns as $column_name => $column_display_name ) {
mp-wp_genesis 1987 $class = "class=\"$column_name column-$column_name\"";
mp-wp_genesis 1988
mp-wp_genesis 1989 $style = '';
mp-wp_genesis 1990 if ( in_array($column_name, $hidden) )
mp-wp_genesis 1991 $style = ' style="display:none;"';
mp-wp_genesis 1992
mp-wp_genesis 1993 $attributes = "$class$style";
mp-wp_genesis 1994
mp-wp_genesis 1995 switch ($column_name) {
mp-wp_genesis 1996 case 'cb':
mp-wp_genesis 1997 if ( !$checkbox ) break;
mp-wp_genesis 1998 echo '<th scope="row" class="check-column">';
mp-wp_genesis 1999 if ( current_user_can('edit_post', $post->ID) ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
mp-wp_genesis 2000 echo '</th>';
mp-wp_genesis 2001 break;
mp-wp_genesis 2002 case 'comment':
mp-wp_genesis 2003 echo "<td $attributes>";
mp-wp_genesis 2004 echo '<div id="submitted-on">';
mp-wp_genesis 2005 printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), get_comment_link($comment->comment_ID), get_comment_date(__('Y/m/d')), get_comment_date(__('g:ia')));
mp-wp_genesis 2006 echo '</div>';
mp-wp_genesis 2007 comment_text(); ?>
mp-wp_genesis 2008 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
mp-wp_genesis 2009 <textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
mp-wp_genesis 2010 <div class="author-email"><?php echo attribute_escape( $comment->comment_author_email ); ?></div>
mp-wp_genesis 2011 <div class="author"><?php echo attribute_escape( $comment->comment_author ); ?></div>
mp-wp_genesis 2012 <div class="author-url"><?php echo attribute_escape( $comment->comment_author_url ); ?></div>
mp-wp_genesis 2013 <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
mp-wp_genesis 2014 </div>
mp-wp_genesis 2015 <?php
mp-wp_genesis 2016 $actions = array();
mp-wp_genesis 2017
mp-wp_genesis 2018 if ( current_user_can('edit_post', $post->ID) ) {
mp-wp_genesis 2019 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
mp-wp_genesis 2020 $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
mp-wp_genesis 2021 if ( $comment_status ) { // not looking at all comments
mp-wp_genesis 2022 if ( 'approved' == $the_comment_status ) {
mp-wp_genesis 2023 $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
mp-wp_genesis 2024 unset($actions['approve']);
mp-wp_genesis 2025 } else {
mp-wp_genesis 2026 $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
mp-wp_genesis 2027 unset($actions['unapprove']);
mp-wp_genesis 2028 }
mp-wp_genesis 2029 }
mp-wp_genesis 2030 if ( 'spam' != $the_comment_status )
mp-wp_genesis 2031 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . _c( 'Spam|verb' ) . '</a>';
mp-wp_genesis 2032 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
mp-wp_genesis 2033 $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
mp-wp_genesis 2034 $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
mp-wp_genesis 2035 if ( 'spam' != $the_comment_status )
mp-wp_genesis 2036 $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
mp-wp_genesis 2037
mp-wp_genesis 2038 $actions = apply_filters( 'comment_row_actions', $actions, $comment );
mp-wp_genesis 2039
mp-wp_genesis 2040 $i = 0;
mp-wp_genesis 2041 echo '<div class="row-actions">';
mp-wp_genesis 2042 foreach ( $actions as $action => $link ) {
mp-wp_genesis 2043 ++$i;
mp-wp_genesis 2044 ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
mp-wp_genesis 2045
mp-wp_genesis 2046 // Reply and quickedit need a hide-if-no-js span when not added with ajax
mp-wp_genesis 2047 if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax )
mp-wp_genesis 2048 $action .= ' hide-if-no-js';
mp-wp_genesis 2049
mp-wp_genesis 2050 echo "<span class='$action'>$sep$link</span>";
mp-wp_genesis 2051 }
mp-wp_genesis 2052 echo '</div>';
mp-wp_genesis 2053 }
mp-wp_genesis 2054
mp-wp_genesis 2055 echo '</td>';
mp-wp_genesis 2056 break;
mp-wp_genesis 2057 case 'author':
mp-wp_genesis 2058 echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
mp-wp_genesis 2059 if ( !empty($author_url) )
mp-wp_genesis 2060 echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
mp-wp_genesis 2061 if ( current_user_can( 'edit_post', $post->ID ) ) {
mp-wp_genesis 2062 if ( !empty($comment->comment_author_email) ) {
mp-wp_genesis 2063 comment_author_email_link();
mp-wp_genesis 2064 echo '<br />';
mp-wp_genesis 2065 }
mp-wp_genesis 2066 echo '<a href="edit-comments.php?s=';
mp-wp_genesis 2067 comment_author_IP();
mp-wp_genesis 2068 echo '&amp;mode=detail';
mp-wp_genesis 2069 if ( 'spam' == $comment_status )
mp-wp_genesis 2070 echo '&amp;comment_status=spam';
mp-wp_genesis 2071 echo '">';
mp-wp_genesis 2072 comment_author_IP();
mp-wp_genesis 2073 echo '</a>';
mp-wp_genesis 2074 } //current_user_can
mp-wp_genesis 2075 echo '</td>';
mp-wp_genesis 2076 break;
mp-wp_genesis 2077 case 'date':
mp-wp_genesis 2078 echo "<td $attributes>" . get_comment_date(__('Y/m/d \a\t g:ia')) . '</td>';
mp-wp_genesis 2079 break;
mp-wp_genesis 2080 case 'response':
mp-wp_genesis 2081 if ( 'single' !== $mode ) {
mp-wp_genesis 2082 if ( isset( $_comment_pending_count[$post->ID] ) ) {
mp-wp_genesis 2083 $pending_comments = absint( $_comment_pending_count[$post->ID] );
mp-wp_genesis 2084 } else {
mp-wp_genesis 2085 $_comment_pending_count_temp = (array) get_pending_comments_num( array( $post->ID ) );
mp-wp_genesis 2086 $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
mp-wp_genesis 2087 }
mp-wp_genesis 2088 if ( current_user_can( 'edit_post', $post->ID ) ) {
mp-wp_genesis 2089 $post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
mp-wp_genesis 2090 $post_link .= get_the_title($post->ID) . '</a>';
mp-wp_genesis 2091 } else {
mp-wp_genesis 2092 $post_link = get_the_title($post->ID);
mp-wp_genesis 2093 }
mp-wp_genesis 2094 echo "<td $attributes>\n";
mp-wp_genesis 2095 echo $post_link;
mp-wp_genesis 2096
mp-wp_genesis 2097 echo '<div class="response-links"><span class="post-com-count-wrapper">';
mp-wp_genesis 2098 $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
mp-wp_genesis 2099 if ( $pending_comments )
mp-wp_genesis 2100 echo '<strong>';
mp-wp_genesis 2101 comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
mp-wp_genesis 2102 if ( $pending_comments )
mp-wp_genesis 2103 echo '</strong>';
mp-wp_genesis 2104 echo '</span> ';
mp-wp_genesis 2105 echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
mp-wp_genesis 2106 echo '</div></td>';
mp-wp_genesis 2107 }
mp-wp_genesis 2108 }
mp-wp_genesis 2109 }
mp-wp_genesis 2110 echo "</tr>\n";
mp-wp_genesis 2111 }
mp-wp_genesis 2112
mp-wp_genesis 2113 /**
mp-wp_genesis 2114 * {@internal Missing Short Description}}
mp-wp_genesis 2115 *
mp-wp_genesis 2116 * @since unknown
mp-wp_genesis 2117 *
mp-wp_genesis 2118 * @param unknown_type $position
mp-wp_genesis 2119 * @param unknown_type $checkbox
mp-wp_genesis 2120 * @param unknown_type $mode
mp-wp_genesis 2121 */
mp-wp_genesis 2122 function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
mp-wp_genesis 2123 global $current_user;
mp-wp_genesis 2124
mp-wp_genesis 2125 // allow plugin to replace the popup content
mp-wp_genesis 2126 $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );
mp-wp_genesis 2127
mp-wp_genesis 2128 if ( ! empty($content) ) {
mp-wp_genesis 2129 echo $content;
mp-wp_genesis 2130 return;
mp-wp_genesis 2131 }
mp-wp_genesis 2132
mp-wp_genesis 2133 $columns = get_column_headers('edit-comments');
mp-wp_genesis 2134 $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns('edit-comments') ) );
mp-wp_genesis 2135 $col_count = count($columns) - count($hidden);
mp-wp_genesis 2136
mp-wp_genesis 2137 ?>
mp-wp_genesis 2138 <form method="get" action="">
mp-wp_genesis 2139 <?php if ( $table_row ) : ?>
mp-wp_genesis 2140 <table style="display:none;"><tbody id="com-reply"><tr id="replyrow"><td colspan="<?php echo $col_count; ?>">
mp-wp_genesis 2141 <?php else : ?>
mp-wp_genesis 2142 <div id="com-reply" style="display:none;"><div id="replyrow">
mp-wp_genesis 2143 <?php endif; ?>
mp-wp_genesis 2144 <div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div>
mp-wp_genesis 2145
mp-wp_genesis 2146 <div id="edithead" style="display:none;">
mp-wp_genesis 2147 <div class="inside">
mp-wp_genesis 2148 <label for="author"><?php _e('Name') ?></label>
mp-wp_genesis 2149 <input type="text" name="newcomment_author" size="50" value="" tabindex="101" id="author" />
mp-wp_genesis 2150 </div>
mp-wp_genesis 2151
mp-wp_genesis 2152 <div class="inside">
mp-wp_genesis 2153 <label for="author-email"><?php _e('E-mail') ?></label>
mp-wp_genesis 2154 <input type="text" name="newcomment_author_email" size="50" value="" tabindex="102" id="author-email" />
mp-wp_genesis 2155 </div>
mp-wp_genesis 2156
mp-wp_genesis 2157 <div class="inside">
mp-wp_genesis 2158 <label for="author-url"><?php _e('URL') ?></label>
mp-wp_genesis 2159 <input type="text" id="author-url" name="newcomment_author_url" size="103" value="" tabindex="103" />
mp-wp_genesis 2160 </div>
mp-wp_genesis 2161 <div style="clear:both;"></div>
mp-wp_genesis 2162 </div>
mp-wp_genesis 2163
mp-wp_genesis 2164 <div id="replycontainer"><textarea rows="8" cols="40" name="replycontent" tabindex="104" id="replycontent"></textarea></div>
mp-wp_genesis 2165
mp-wp_genesis 2166 <p id="replysubmit" class="submit">
mp-wp_genesis 2167 <a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php _e('Cancel'); ?></a>
mp-wp_genesis 2168 <a href="#comments-form" class="save button-primary alignright" tabindex="104">
mp-wp_genesis 2169 <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
mp-wp_genesis 2170 <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
mp-wp_update-imag... 2171 <img class="waiting" style="display:none;" src="images/loading.svg" alt="" />
mp-wp_genesis 2172 <span class="error" style="display:none;"></span>
mp-wp_genesis 2173 <br class="clear" />
mp-wp_genesis 2174 </p>
mp-wp_genesis 2175
mp-wp_genesis 2176 <input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
mp-wp_genesis 2177 <input type="hidden" name="action" id="action" value="" />
mp-wp_genesis 2178 <input type="hidden" name="comment_ID" id="comment_ID" value="" />
mp-wp_genesis 2179 <input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
mp-wp_genesis 2180 <input type="hidden" name="status" id="status" value="" />
mp-wp_genesis 2181 <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
mp-wp_genesis 2182 <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
mp-wp_genesis 2183 <input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" />
mp-wp_genesis 2184 <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
mp-wp_genesis 2185 <?php wp_comment_form_unfiltered_html_nonce(); ?>
mp-wp_genesis 2186 <?php if ( $table_row ) : ?>
mp-wp_genesis 2187 </td></tr></tbody></table>
mp-wp_genesis 2188 <?php else : ?>
mp-wp_genesis 2189 </div></div>
mp-wp_genesis 2190 <?php endif; ?>
mp-wp_genesis 2191 </form>
mp-wp_genesis 2192 <?php
mp-wp_genesis 2193 }
mp-wp_genesis 2194
mp-wp_genesis 2195 /**
mp-wp_genesis 2196 * {@internal Missing Short Description}}
mp-wp_genesis 2197 *
mp-wp_genesis 2198 * @since unknown
mp-wp_genesis 2199 *
mp-wp_genesis 2200 * @param unknown_type $currentcat
mp-wp_genesis 2201 * @param unknown_type $currentparent
mp-wp_genesis 2202 * @param unknown_type $parent
mp-wp_genesis 2203 * @param unknown_type $level
mp-wp_genesis 2204 * @param unknown_type $categories
mp-wp_genesis 2205 * @return unknown
mp-wp_genesis 2206 */
mp-wp_genesis 2207 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
mp-wp_genesis 2208 if (!$categories )
mp-wp_genesis 2209 $categories = get_categories( array('hide_empty' => 0) );
mp-wp_genesis 2210
mp-wp_genesis 2211 if ( $categories ) {
mp-wp_genesis 2212 foreach ( $categories as $category ) {
mp-wp_genesis 2213 if ( $currentcat != $category->term_id && $parent == $category->parent) {
mp-wp_genesis 2214 $pad = str_repeat( '&#8211; ', $level );
mp-wp_genesis 2215 $category->name = wp_specialchars( $category->name );
mp-wp_genesis 2216 echo "\n\t<option value='$category->term_id'";
mp-wp_genesis 2217 if ( $currentparent == $category->term_id )
mp-wp_genesis 2218 echo " selected='selected'";
mp-wp_genesis 2219 echo ">$pad$category->name</option>";
mp-wp_genesis 2220 wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
mp-wp_genesis 2221 }
mp-wp_genesis 2222 }
mp-wp_genesis 2223 } else {
mp-wp_genesis 2224 return false;
mp-wp_genesis 2225 }
mp-wp_genesis 2226 }
mp-wp_genesis 2227
mp-wp_genesis 2228 /**
mp-wp_genesis 2229 * {@internal Missing Short Description}}
mp-wp_genesis 2230 *
mp-wp_genesis 2231 * @since unknown
mp-wp_genesis 2232 *
mp-wp_genesis 2233 * @param unknown_type $meta
mp-wp_genesis 2234 */
mp-wp_genesis 2235 function list_meta( $meta ) {
mp-wp_genesis 2236 // Exit if no meta
mp-wp_genesis 2237 if ( ! $meta ) {
mp-wp_genesis 2238 echo '
mp-wp_genesis 2239 <table id="list-table" style="display: none;">
mp-wp_genesis 2240 <thead>
mp-wp_genesis 2241 <tr>
mp-wp_genesis 2242 <th class="left">' . __( 'Name' ) . '</th>
mp-wp_genesis 2243 <th>' . __( 'Value' ) . '</th>
mp-wp_genesis 2244 </tr>
mp-wp_genesis 2245 </thead>
mp-wp_genesis 2246 <tbody id="the-list" class="list:meta">
mp-wp_genesis 2247 <tr><td></td></tr>
mp-wp_genesis 2248 </tbody>
mp-wp_genesis 2249 </table>'; //TBODY needed for list-manipulation JS
mp-wp_genesis 2250 return;
mp-wp_genesis 2251 }
mp-wp_genesis 2252 $count = 0;
mp-wp_genesis 2253 ?>
mp-wp_genesis 2254 <table id="list-table">
mp-wp_genesis 2255 <thead>
mp-wp_genesis 2256 <tr>
mp-wp_genesis 2257 <th class="left"><?php _e( 'Name' ) ?></th>
mp-wp_genesis 2258 <th><?php _e( 'Value' ) ?></th>
mp-wp_genesis 2259 </tr>
mp-wp_genesis 2260 </thead>
mp-wp_genesis 2261 <tbody id='the-list' class='list:meta'>
mp-wp_genesis 2262 <?php
mp-wp_genesis 2263 foreach ( $meta as $entry )
mp-wp_genesis 2264 echo _list_meta_row( $entry, $count );
mp-wp_genesis 2265 ?>
mp-wp_genesis 2266 </tbody>
mp-wp_genesis 2267 </table>
mp-wp_genesis 2268 <?php
mp-wp_genesis 2269 }
mp-wp_genesis 2270
mp-wp_genesis 2271 /**
mp-wp_genesis 2272 * {@internal Missing Short Description}}
mp-wp_genesis 2273 *
mp-wp_genesis 2274 * @since unknown
mp-wp_genesis 2275 *
mp-wp_genesis 2276 * @param unknown_type $entry
mp-wp_genesis 2277 * @param unknown_type $count
mp-wp_genesis 2278 * @return unknown
mp-wp_genesis 2279 */
mp-wp_genesis 2280 function _list_meta_row( $entry, &$count ) {
mp-wp_genesis 2281 static $update_nonce = false;
mp-wp_genesis 2282 if ( !$update_nonce )
mp-wp_genesis 2283 $update_nonce = wp_create_nonce( 'add-meta' );
mp-wp_genesis 2284
mp-wp_genesis 2285 $r = '';
mp-wp_genesis 2286 ++ $count;
mp-wp_genesis 2287 if ( $count % 2 )
mp-wp_genesis 2288 $style = 'alternate';
mp-wp_genesis 2289 else
mp-wp_genesis 2290 $style = '';
mp-wp_genesis 2291 if ('_' == $entry['meta_key'] { 0 } )
mp-wp_genesis 2292 $style .= ' hidden';
mp-wp_genesis 2293
mp-wp_genesis 2294 if ( is_serialized( $entry['meta_value'] ) ) {
mp-wp_genesis 2295 if ( is_serialized_string( $entry['meta_value'] ) ) {
mp-wp_genesis 2296 // this is a serialized string, so we should display it
mp-wp_genesis 2297 $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
mp-wp_genesis 2298 } else {
mp-wp_genesis 2299 // this is a serialized array/object so we should NOT display it
mp-wp_genesis 2300 --$count;
mp-wp_genesis 2301 return;
mp-wp_genesis 2302 }
mp-wp_genesis 2303 }
mp-wp_genesis 2304
mp-wp_genesis 2305 $entry['meta_key'] = attribute_escape($entry['meta_key']);
mp-wp_genesis 2306 $entry['meta_value'] = htmlspecialchars($entry['meta_value']); // using a <textarea />
mp-wp_genesis 2307 $entry['meta_id'] = (int) $entry['meta_id'];
mp-wp_genesis 2308
mp-wp_genesis 2309 $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
mp-wp_genesis 2310
mp-wp_genesis 2311 $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
mp-wp_genesis 2312 $r .= "\n\t\t<td class='left'><label class='hidden' for='meta[{$entry['meta_id']}][key]'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' />";
mp-wp_genesis 2313
mp-wp_genesis 2314 $r .= "\n\t\t<div class='submit'><input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
mp-wp_genesis 2315 $r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />";
mp-wp_genesis 2316 $r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /></div>";
mp-wp_genesis 2317 $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
mp-wp_genesis 2318 $r .= "</td>";
mp-wp_genesis 2319
mp-wp_genesis 2320 $r .= "\n\t\t<td><label class='hidden' for='meta[{$entry['meta_id']}][value]'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
mp-wp_genesis 2321 return $r;
mp-wp_genesis 2322 }
mp-wp_genesis 2323
mp-wp_genesis 2324 /**
mp-wp_genesis 2325 * {@internal Missing Short Description}}
mp-wp_genesis 2326 *
mp-wp_genesis 2327 * @since unknown
mp-wp_genesis 2328 */
mp-wp_genesis 2329 function meta_form() {
mp-wp_genesis 2330 global $wpdb;
mp-wp_genesis 2331 $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
mp-wp_genesis 2332 $keys = $wpdb->get_col( "
mp-wp_genesis 2333 SELECT meta_key
mp-wp_genesis 2334 FROM $wpdb->postmeta
mp-wp_genesis 2335 WHERE meta_key NOT LIKE '\_%'
mp-wp_genesis 2336 GROUP BY meta_key
mp-wp_genesis 2337 ORDER BY meta_id DESC
mp-wp_genesis 2338 LIMIT $limit" );
mp-wp_genesis 2339 if ( $keys )
mp-wp_genesis 2340 natcasesort($keys);
mp-wp_genesis 2341 ?>
mp-wp_genesis 2342 <p><strong><?php _e( 'Add new custom field:' ) ?></strong></p>
mp-wp_genesis 2343 <table id="newmeta">
mp-wp_genesis 2344 <thead>
mp-wp_genesis 2345 <tr>
mp-wp_genesis 2346 <th class="left"><label for="metakeyselect"><?php _e( 'Name' ) ?></label></th>
mp-wp_genesis 2347 <th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
mp-wp_genesis 2348 </tr>
mp-wp_genesis 2349 </thead>
mp-wp_genesis 2350
mp-wp_genesis 2351 <tbody>
mp-wp_genesis 2352 <tr>
mp-wp_genesis 2353 <td id="newmetaleft" class="left">
mp-wp_genesis 2354 <?php if ( $keys ) { ?>
mp-wp_genesis 2355 <select id="metakeyselect" name="metakeyselect" tabindex="7">
mp-wp_genesis 2356 <option value="#NONE#"><?php _e( '- Select -' ); ?></option>
mp-wp_genesis 2357 <?php
mp-wp_genesis 2358
mp-wp_genesis 2359 foreach ( $keys as $key ) {
mp-wp_genesis 2360 $key = attribute_escape( $key );
mp-wp_genesis 2361 echo "\n<option value='$key'>$key</option>";
mp-wp_genesis 2362 }
mp-wp_genesis 2363 ?>
mp-wp_genesis 2364 </select>
mp-wp_genesis 2365 <input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" />
mp-wp_genesis 2366 <a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
mp-wp_genesis 2367 <span id="enternew"><?php _e('Enter new'); ?></span>
mp-wp_genesis 2368 <span id="cancelnew" class="hidden"><?php _e('Cancel'); ?></span></a>
mp-wp_genesis 2369 <?php } else { ?>
mp-wp_genesis 2370 <input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" />
mp-wp_genesis 2371 <?php } ?>
mp-wp_genesis 2372 </td>
mp-wp_genesis 2373 <td><textarea id="metavalue" name="metavalue" rows="2" cols="25" tabindex="8"></textarea></td>
mp-wp_genesis 2374 </tr>
mp-wp_genesis 2375
mp-wp_genesis 2376 <tr><td colspan="2" class="submit">
mp-wp_genesis 2377 <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
mp-wp_genesis 2378 <?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
mp-wp_genesis 2379 </td></tr>
mp-wp_genesis 2380 </tbody>
mp-wp_genesis 2381 </table>
mp-wp_genesis 2382 <?php
mp-wp_genesis 2383
mp-wp_genesis 2384 }
mp-wp_genesis 2385
mp-wp_genesis 2386 /**
mp-wp_genesis 2387 * {@internal Missing Short Description}}
mp-wp_genesis 2388 *
mp-wp_genesis 2389 * @since unknown
mp-wp_genesis 2390 *
mp-wp_genesis 2391 * @param unknown_type $edit
mp-wp_genesis 2392 * @param unknown_type $for_post
mp-wp_genesis 2393 * @param unknown_type $tab_index
mp-wp_genesis 2394 * @param unknown_type $multi
mp-wp_genesis 2395 */
mp-wp_genesis 2396 function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
mp-wp_genesis 2397 global $wp_locale, $post, $comment;
mp-wp_genesis 2398
mp-wp_genesis 2399 if ( $for_post )
mp-wp_genesis 2400 $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
mp-wp_genesis 2401
mp-wp_genesis 2402 $tab_index_attribute = '';
mp-wp_genesis 2403 if ( (int) $tab_index > 0 )
mp-wp_genesis 2404 $tab_index_attribute = " tabindex=\"$tab_index\"";
mp-wp_genesis 2405
mp-wp_genesis 2406 // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
mp-wp_genesis 2407
mp-wp_genesis 2408 $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
mp-wp_genesis 2409 $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
mp-wp_genesis 2410 $jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj );
mp-wp_genesis 2411 $mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj );
mp-wp_genesis 2412 $aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj );
mp-wp_genesis 2413 $hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj );
mp-wp_genesis 2414 $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
mp-wp_genesis 2415 $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
mp-wp_genesis 2416
mp-wp_genesis 2417 $cur_jj = gmdate( 'd', $time_adj );
mp-wp_genesis 2418 $cur_mm = gmdate( 'm', $time_adj );
mp-wp_genesis 2419 $cur_aa = gmdate( 'Y', $time_adj );
mp-wp_genesis 2420 $cur_hh = gmdate( 'H', $time_adj );
mp-wp_genesis 2421 $cur_mn = gmdate( 'i', $time_adj );
mp-wp_genesis 2422
mp-wp_genesis 2423 $month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n";
mp-wp_genesis 2424 for ( $i = 1; $i < 13; $i = $i +1 ) {
mp-wp_genesis 2425 $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
mp-wp_genesis 2426 if ( $i == $mm )
mp-wp_genesis 2427 $month .= ' selected="selected"';
mp-wp_genesis 2428 $month .= '>' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) . "</option>\n";
mp-wp_genesis 2429 }
mp-wp_genesis 2430 $month .= '</select>';
mp-wp_genesis 2431
mp-wp_genesis 2432 $day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
mp-wp_genesis 2433 $year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />';
mp-wp_genesis 2434 $hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
mp-wp_genesis 2435 $minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
mp-wp_genesis 2436 printf(_c('%1$s%2$s, %3$s @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
mp-wp_genesis 2437
mp-wp_genesis 2438 echo '<input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
mp-wp_genesis 2439
mp-wp_genesis 2440 if ( $multi ) return;
mp-wp_genesis 2441
mp-wp_genesis 2442 echo "\n\n";
mp-wp_genesis 2443 foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {
mp-wp_genesis 2444 echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
mp-wp_genesis 2445 $cur_timeunit = 'cur_' . $timeunit;
mp-wp_genesis 2446 echo '<input type="hidden" id="'. $cur_timeunit . '" name="'. $cur_timeunit . '" value="' . $$cur_timeunit . '" />' . "\n";
mp-wp_genesis 2447 }
mp-wp_genesis 2448 ?>
mp-wp_genesis 2449
mp-wp_genesis 2450 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
mp-wp_genesis 2451
mp-wp_genesis 2452 <p>
mp-wp_genesis 2453 <a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
mp-wp_genesis 2454 <a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
mp-wp_genesis 2455 </p>
mp-wp_genesis 2456 <?php
mp-wp_genesis 2457 }
mp-wp_genesis 2458
mp-wp_genesis 2459 /**
mp-wp_genesis 2460 * {@internal Missing Short Description}}
mp-wp_genesis 2461 *
mp-wp_genesis 2462 * @since unknown
mp-wp_genesis 2463 *
mp-wp_genesis 2464 * @param unknown_type $default
mp-wp_genesis 2465 */
mp-wp_genesis 2466 function page_template_dropdown( $default = '' ) {
mp-wp_genesis 2467 $templates = get_page_templates();
mp-wp_genesis 2468 ksort( $templates );
mp-wp_genesis 2469 foreach (array_keys( $templates ) as $template )
mp-wp_genesis 2470 : if ( $default == $templates[$template] )
mp-wp_genesis 2471 $selected = " selected='selected'";
mp-wp_genesis 2472 else
mp-wp_genesis 2473 $selected = '';
mp-wp_genesis 2474 echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
mp-wp_genesis 2475 endforeach;
mp-wp_genesis 2476 }
mp-wp_genesis 2477
mp-wp_genesis 2478 /**
mp-wp_genesis 2479 * {@internal Missing Short Description}}
mp-wp_genesis 2480 *
mp-wp_genesis 2481 * @since unknown
mp-wp_genesis 2482 *
mp-wp_genesis 2483 * @param unknown_type $default
mp-wp_genesis 2484 * @param unknown_type $parent
mp-wp_genesis 2485 * @param unknown_type $level
mp-wp_genesis 2486 * @return unknown
mp-wp_genesis 2487 */
mp-wp_genesis 2488 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
mp-wp_genesis 2489 global $wpdb, $post_ID;
mp-wp_genesis 2490 $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
mp-wp_genesis 2491
mp-wp_genesis 2492 if ( $items ) {
mp-wp_genesis 2493 foreach ( $items as $item ) {
mp-wp_genesis 2494 // A page cannot be its own parent.
mp-wp_genesis 2495 if (!empty ( $post_ID ) ) {
mp-wp_genesis 2496 if ( $item->ID == $post_ID ) {
mp-wp_genesis 2497 continue;
mp-wp_genesis 2498 }
mp-wp_genesis 2499 }
mp-wp_genesis 2500 $pad = str_repeat( '&nbsp;', $level * 3 );
mp-wp_genesis 2501 if ( $item->ID == $default)
mp-wp_genesis 2502 $current = ' selected="selected"';
mp-wp_genesis 2503 else
mp-wp_genesis 2504 $current = '';
mp-wp_genesis 2505
mp-wp_genesis 2506 echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";
mp-wp_genesis 2507 parent_dropdown( $default, $item->ID, $level +1 );
mp-wp_genesis 2508 }
mp-wp_genesis 2509 } else {
mp-wp_genesis 2510 return false;
mp-wp_genesis 2511 }
mp-wp_genesis 2512 }
mp-wp_genesis 2513
mp-wp_genesis 2514 /**
mp-wp_genesis 2515 * {@internal Missing Short Description}}
mp-wp_genesis 2516 *
mp-wp_genesis 2517 * @since unknown
mp-wp_genesis 2518 */
mp-wp_genesis 2519 function browse_happy() {
mp-wp_genesis 2520 $getit = __( 'WordPress recommends a better browser' );
mp-wp_genesis 2521 echo '
mp-wp_update-imag... 2522 <div id="bh"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.svg" alt="Browse Happy" /></a></div>
mp-wp_genesis 2523 ';
mp-wp_genesis 2524 }
mp-wp_genesis 2525
mp-wp_genesis 2526 /**
mp-wp_genesis 2527 * {@internal Missing Short Description}}
mp-wp_genesis 2528 *
mp-wp_genesis 2529 * @since unknown
mp-wp_genesis 2530 *
mp-wp_genesis 2531 * @param unknown_type $id
mp-wp_genesis 2532 * @return unknown
mp-wp_genesis 2533 */
mp-wp_genesis 2534 function the_attachment_links( $id = false ) {
mp-wp_genesis 2535 $id = (int) $id;
mp-wp_genesis 2536 $post = & get_post( $id );
mp-wp_genesis 2537
mp-wp_genesis 2538 if ( $post->post_type != 'attachment' )
mp-wp_genesis 2539 return false;
mp-wp_genesis 2540
mp-wp_genesis 2541 $icon = get_attachment_icon( $post->ID );
mp-wp_genesis 2542 $attachment_data = wp_get_attachment_metadata( $id );
mp-wp_genesis 2543 $thumb = isset( $attachment_data['thumb'] );
mp-wp_genesis 2544 ?>
mp-wp_genesis 2545 <form id="the-attachment-links">
mp-wp_genesis 2546 <table>
mp-wp_genesis 2547 <col />
mp-wp_genesis 2548 <col class="widefat" />
mp-wp_genesis 2549 <tr>
mp-wp_genesis 2550 <th scope="row"><?php _e( 'URL' ) ?></th>
mp-wp_genesis 2551 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo wp_get_attachment_url(); ?></textarea></td>
mp-wp_genesis 2552 </tr>
mp-wp_genesis 2553 <?php if ( $icon ) : ?>
mp-wp_genesis 2554 <tr>
mp-wp_genesis 2555 <th scope="row"><?php $thumb ? _e( 'Thumbnail linked to file' ) : _e( 'Image linked to file' ); ?></th>
mp-wp_genesis 2556 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $icon ?></a></textarea></td>
mp-wp_genesis 2557 </tr>
mp-wp_genesis 2558 <tr>
mp-wp_genesis 2559 <th scope="row"><?php $thumb ? _e( 'Thumbnail linked to page' ) : _e( 'Image linked to page' ); ?></th>
mp-wp_genesis 2560 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon ?></a></textarea></td>
mp-wp_genesis 2561 </tr>
mp-wp_genesis 2562 <?php else : ?>
mp-wp_genesis 2563 <tr>
mp-wp_genesis 2564 <th scope="row"><?php _e( 'Link to file' ) ?></th>
mp-wp_genesis 2565 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
mp-wp_genesis 2566 </tr>
mp-wp_genesis 2567 <tr>
mp-wp_genesis 2568 <th scope="row"><?php _e( 'Link to page' ) ?></th>
mp-wp_genesis 2569 <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td>
mp-wp_genesis 2570 </tr>
mp-wp_genesis 2571 <?php endif; ?>
mp-wp_genesis 2572 </table>
mp-wp_genesis 2573 </form>
mp-wp_genesis 2574 <?php
mp-wp_genesis 2575 }
mp-wp_genesis 2576
mp-wp_genesis 2577 /**
mp-wp_genesis 2578 * {@internal Missing Short Description}}
mp-wp_genesis 2579 *
mp-wp_genesis 2580 * @since unknown
mp-wp_genesis 2581 *
mp-wp_genesis 2582 * @param unknown_type $default
mp-wp_genesis 2583 */
mp-wp_genesis 2584 function wp_dropdown_roles( $default = false ) {
mp-wp_genesis 2585 global $wp_roles;
mp-wp_genesis 2586 $p = '';
mp-wp_genesis 2587 $r = '';
mp-wp_genesis 2588 foreach( $wp_roles->role_names as $role => $name ) {
mp-wp_genesis 2589 $name = translate_with_context($name);
mp-wp_genesis 2590 if ( $default == $role ) // Make default first in list
mp-wp_genesis 2591 $p = "\n\t<option selected='selected' value='$role'>$name</option>";
mp-wp_genesis 2592 else
mp-wp_genesis 2593 $r .= "\n\t<option value='$role'>$name</option>";
mp-wp_genesis 2594 }
mp-wp_genesis 2595 echo $p . $r;
mp-wp_genesis 2596 }
mp-wp_genesis 2597
mp-wp_genesis 2598 /**
mp-wp_genesis 2599 * {@internal Missing Short Description}}
mp-wp_genesis 2600 *
mp-wp_genesis 2601 * @since unknown
mp-wp_genesis 2602 *
mp-wp_genesis 2603 * @param unknown_type $size
mp-wp_genesis 2604 * @return unknown
mp-wp_genesis 2605 */
mp-wp_genesis 2606 function wp_convert_hr_to_bytes( $size ) {
mp-wp_genesis 2607 $size = strtolower($size);
mp-wp_genesis 2608 $bytes = (int) $size;
mp-wp_genesis 2609 if ( strpos($size, 'k') !== false )
mp-wp_genesis 2610 $bytes = intval($size) * 1024;
mp-wp_genesis 2611 elseif ( strpos($size, 'm') !== false )
mp-wp_genesis 2612 $bytes = intval($size) * 1024 * 1024;
mp-wp_genesis 2613 elseif ( strpos($size, 'g') !== false )
mp-wp_genesis 2614 $bytes = intval($size) * 1024 * 1024 * 1024;
mp-wp_genesis 2615 return $bytes;
mp-wp_genesis 2616 }
mp-wp_genesis 2617
mp-wp_genesis 2618 /**
mp-wp_genesis 2619 * {@internal Missing Short Description}}
mp-wp_genesis 2620 *
mp-wp_genesis 2621 * @since unknown
mp-wp_genesis 2622 *
mp-wp_genesis 2623 * @param unknown_type $bytes
mp-wp_genesis 2624 * @return unknown
mp-wp_genesis 2625 */
mp-wp_genesis 2626 function wp_convert_bytes_to_hr( $bytes ) {
mp-wp_genesis 2627 $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
mp-wp_genesis 2628 $log = log( $bytes, 1024 );
mp-wp_genesis 2629 $power = (int) $log;
mp-wp_genesis 2630 $size = pow(1024, $log - $power);
mp-wp_genesis 2631 return $size . $units[$power];
mp-wp_genesis 2632 }
mp-wp_genesis 2633
mp-wp_genesis 2634 /**
mp-wp_genesis 2635 * {@internal Missing Short Description}}
mp-wp_genesis 2636 *
mp-wp_genesis 2637 * @since unknown
mp-wp_genesis 2638 *
mp-wp_genesis 2639 * @return unknown
mp-wp_genesis 2640 */
mp-wp_genesis 2641 function wp_max_upload_size() {
mp-wp_genesis 2642 $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
mp-wp_genesis 2643 $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
mp-wp_genesis 2644 $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );
mp-wp_genesis 2645 return $bytes;
mp-wp_genesis 2646 }
mp-wp_genesis 2647
mp-wp_genesis 2648 /**
mp-wp_genesis 2649 * {@internal Missing Short Description}}
mp-wp_genesis 2650 *
mp-wp_genesis 2651 * @since unknown
mp-wp_genesis 2652 *
mp-wp_genesis 2653 * @param unknown_type $action
mp-wp_genesis 2654 */
mp-wp_genesis 2655 function wp_import_upload_form( $action ) {
mp-wp_genesis 2656 $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
mp-wp_genesis 2657 $size = wp_convert_bytes_to_hr( $bytes );
mp-wp_genesis 2658 ?>
mp-wp_genesis 2659 <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
mp-wp_genesis 2660 <p>
mp-wp_genesis 2661 <?php wp_nonce_field('import-upload'); ?>
mp-wp_genesis 2662 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
mp-wp_genesis 2663 <input type="file" id="upload" name="import" size="25" />
mp-wp_genesis 2664 <input type="hidden" name="action" value="save" />
mp-wp_genesis 2665 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
mp-wp_genesis 2666 </p>
mp-wp_genesis 2667 <p class="submit">
mp-wp_genesis 2668 <input type="submit" class="button" value="<?php _e( 'Upload file and import' ); ?>" />
mp-wp_genesis 2669 </p>
mp-wp_genesis 2670 </form>
mp-wp_genesis 2671 <?php
mp-wp_genesis 2672 }
mp-wp_genesis 2673
mp-wp_genesis 2674 /**
mp-wp_genesis 2675 * {@internal Missing Short Description}}
mp-wp_genesis 2676 *
mp-wp_genesis 2677 * @since unknown
mp-wp_genesis 2678 */
mp-wp_genesis 2679 function wp_remember_old_slug() {
mp-wp_genesis 2680 global $post;
mp-wp_genesis 2681 $name = attribute_escape($post->post_name); // just in case
mp-wp_genesis 2682 if ( strlen($name) )
mp-wp_genesis 2683 echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />';
mp-wp_genesis 2684 }
mp-wp_genesis 2685
mp-wp_genesis 2686 /**
mp-wp_genesis 2687 * Add a meta box to an edit form.
mp-wp_genesis 2688 *
mp-wp_genesis 2689 * @since 2.5.0
mp-wp_genesis 2690 *
mp-wp_genesis 2691 * @param string $id String for use in the 'id' attribute of tags.
mp-wp_genesis 2692 * @param string $title Title of the meta box.
mp-wp_genesis 2693 * @param string $callback Function that fills the box with the desired content. The function should echo its output.
mp-wp_genesis 2694 * @param string $page The type of edit page on which to show the box (post, page, link).
mp-wp_genesis 2695 * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
mp-wp_genesis 2696 * @param string $priority The priority within the context where the boxes should show ('high', 'low').
mp-wp_genesis 2697 */
mp-wp_genesis 2698 function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
mp-wp_genesis 2699 global $wp_meta_boxes;
mp-wp_genesis 2700
mp-wp_genesis 2701 if ( !isset($wp_meta_boxes) )
mp-wp_genesis 2702 $wp_meta_boxes = array();
mp-wp_genesis 2703 if ( !isset($wp_meta_boxes[$page]) )
mp-wp_genesis 2704 $wp_meta_boxes[$page] = array();
mp-wp_genesis 2705 if ( !isset($wp_meta_boxes[$page][$context]) )
mp-wp_genesis 2706 $wp_meta_boxes[$page][$context] = array();
mp-wp_genesis 2707
mp-wp_genesis 2708 foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
mp-wp_genesis 2709 foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
mp-wp_genesis 2710 if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
mp-wp_genesis 2711 continue;
mp-wp_genesis 2712
mp-wp_genesis 2713 // If a core box was previously added or removed by a plugin, don't add.
mp-wp_genesis 2714 if ( 'core' == $priority ) {
mp-wp_genesis 2715 // If core box previously deleted, don't add
mp-wp_genesis 2716 if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
mp-wp_genesis 2717 return;
mp-wp_genesis 2718 // If box was added with default priority, give it core priority to maintain sort order
mp-wp_genesis 2719 if ( 'default' == $a_priority ) {
mp-wp_genesis 2720 $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
mp-wp_genesis 2721 unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
mp-wp_genesis 2722 }
mp-wp_genesis 2723 return;
mp-wp_genesis 2724 }
mp-wp_genesis 2725 // If no priority given and id already present, use existing priority
mp-wp_genesis 2726 if ( empty($priority) ) {
mp-wp_genesis 2727 $priority = $a_priority;
mp-wp_genesis 2728 // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
mp-wp_genesis 2729 } elseif ( 'sorted' == $priority ) {
mp-wp_genesis 2730 $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
mp-wp_genesis 2731 $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
mp-wp_genesis 2732 }
mp-wp_genesis 2733 // An id can be in only one priority and one context
mp-wp_genesis 2734 if ( $priority != $a_priority || $context != $a_context )
mp-wp_genesis 2735 unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
mp-wp_genesis 2736 }
mp-wp_genesis 2737 }
mp-wp_genesis 2738
mp-wp_genesis 2739 if ( empty($priority) )
mp-wp_genesis 2740 $priority = 'low';
mp-wp_genesis 2741
mp-wp_genesis 2742 if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
mp-wp_genesis 2743 $wp_meta_boxes[$page][$context][$priority] = array();
mp-wp_genesis 2744
mp-wp_genesis 2745 $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
mp-wp_genesis 2746 }
mp-wp_genesis 2747
mp-wp_genesis 2748 /**
mp-wp_genesis 2749 * {@internal Missing Short Description}}
mp-wp_genesis 2750 *
mp-wp_genesis 2751 * @since unknown
mp-wp_genesis 2752 *
mp-wp_genesis 2753 * @param unknown_type $page
mp-wp_genesis 2754 * @param unknown_type $context
mp-wp_genesis 2755 * @param unknown_type $object
mp-wp_genesis 2756 * @return int number of meta_boxes
mp-wp_genesis 2757 */
mp-wp_genesis 2758 function do_meta_boxes($page, $context, $object) {
mp-wp_genesis 2759 global $wp_meta_boxes;
mp-wp_genesis 2760 static $already_sorted = false;
mp-wp_genesis 2761
mp-wp_genesis 2762 //do_action('do_meta_boxes', $page, $context, $object);
mp-wp_genesis 2763
mp-wp_genesis 2764 $hidden = get_hidden_meta_boxes($page);
mp-wp_genesis 2765
mp-wp_genesis 2766 echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
mp-wp_genesis 2767
mp-wp_genesis 2768 $i = 0;
mp-wp_genesis 2769 do {
mp-wp_genesis 2770 // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
mp-wp_genesis 2771 if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page", 0, false ) ) {
mp-wp_genesis 2772 foreach ( $sorted as $box_context => $ids )
mp-wp_genesis 2773 foreach ( explode(',', $ids) as $id )
mp-wp_genesis 2774 if ( $id )
mp-wp_genesis 2775 add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
mp-wp_genesis 2776 }
mp-wp_genesis 2777 $already_sorted = true;
mp-wp_genesis 2778
mp-wp_genesis 2779 if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
mp-wp_genesis 2780 break;
mp-wp_genesis 2781
mp-wp_genesis 2782 foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {
mp-wp_genesis 2783 if ( isset($wp_meta_boxes[$page][$context][$priority]) ) {
mp-wp_genesis 2784 foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
mp-wp_genesis 2785 if ( false == $box || ! $box['title'] )
mp-wp_genesis 2786 continue;
mp-wp_genesis 2787 $i++;
mp-wp_genesis 2788 $style = '';
mp-wp_genesis 2789 if ( in_array($box['id'], $hidden) )
mp-wp_genesis 2790 $style = 'style="display:none;"';
mp-wp_genesis 2791 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '" ' . $style . '>' . "\n";
mp-wp_genesis 2792 echo '<div class="handlediv" title="' . __('Click to toggle') . '"><br /></div>';
mp-wp_genesis 2793 echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
mp-wp_genesis 2794 echo '<div class="inside">' . "\n";
mp-wp_genesis 2795 call_user_func($box['callback'], $object, $box);
mp-wp_genesis 2796 echo "</div>\n";
mp-wp_genesis 2797 echo "</div>\n";
mp-wp_genesis 2798 }
mp-wp_genesis 2799 }
mp-wp_genesis 2800 }
mp-wp_genesis 2801 } while(0);
mp-wp_genesis 2802
mp-wp_genesis 2803 echo "</div>";
mp-wp_genesis 2804
mp-wp_genesis 2805 return $i;
mp-wp_genesis 2806
mp-wp_genesis 2807 }
mp-wp_genesis 2808
mp-wp_genesis 2809 /**
mp-wp_genesis 2810 * Remove a meta box from an edit form.
mp-wp_genesis 2811 *
mp-wp_genesis 2812 * @since 2.6.0
mp-wp_genesis 2813 *
mp-wp_genesis 2814 * @param string $id String for use in the 'id' attribute of tags.
mp-wp_genesis 2815 * @param string $page The type of edit page on which to show the box (post, page, link).
mp-wp_genesis 2816 * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
mp-wp_genesis 2817 */
mp-wp_genesis 2818 function remove_meta_box($id, $page, $context) {
mp-wp_genesis 2819 global $wp_meta_boxes;
mp-wp_genesis 2820
mp-wp_genesis 2821 if ( !isset($wp_meta_boxes) )
mp-wp_genesis 2822 $wp_meta_boxes = array();
mp-wp_genesis 2823 if ( !isset($wp_meta_boxes[$page]) )
mp-wp_genesis 2824 $wp_meta_boxes[$page] = array();
mp-wp_genesis 2825 if ( !isset($wp_meta_boxes[$page][$context]) )
mp-wp_genesis 2826 $wp_meta_boxes[$page][$context] = array();
mp-wp_genesis 2827
mp-wp_genesis 2828 foreach ( array('high', 'core', 'default', 'low') as $priority )
mp-wp_genesis 2829 $wp_meta_boxes[$page][$context][$priority][$id] = false;
mp-wp_genesis 2830 }
mp-wp_genesis 2831
mp-wp_genesis 2832 /**
mp-wp_genesis 2833 * {@internal Missing Short Description}}
mp-wp_genesis 2834 *
mp-wp_genesis 2835 * @since unknown
mp-wp_genesis 2836 *
mp-wp_genesis 2837 * @param unknown_type $page
mp-wp_genesis 2838 */
mp-wp_genesis 2839 function meta_box_prefs($page) {
mp-wp_genesis 2840 global $wp_meta_boxes;
mp-wp_genesis 2841
mp-wp_genesis 2842 if ( empty($wp_meta_boxes[$page]) )
mp-wp_genesis 2843 return;
mp-wp_genesis 2844
mp-wp_genesis 2845 $hidden = get_hidden_meta_boxes($page);
mp-wp_genesis 2846
mp-wp_genesis 2847 foreach ( array_keys($wp_meta_boxes[$page]) as $context ) {
mp-wp_genesis 2848 foreach ( array_keys($wp_meta_boxes[$page][$context]) as $priority ) {
mp-wp_genesis 2849 foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) {
mp-wp_genesis 2850 if ( false == $box || ! $box['title'] )
mp-wp_genesis 2851 continue;
mp-wp_genesis 2852 // Submit box cannot be hidden
mp-wp_genesis 2853 if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
mp-wp_genesis 2854 continue;
mp-wp_genesis 2855 $box_id = $box['id'];
mp-wp_genesis 2856 echo '<label for="' . $box_id . '-hide">';
mp-wp_genesis 2857 echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
mp-wp_genesis 2858 echo "{$box['title']}</label>\n";
mp-wp_genesis 2859 }
mp-wp_genesis 2860 }
mp-wp_genesis 2861 }
mp-wp_genesis 2862 }
mp-wp_genesis 2863
mp-wp_genesis 2864 function get_hidden_meta_boxes($page) {
mp-wp_genesis 2865 $hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false );
mp-wp_genesis 2866
mp-wp_genesis 2867 // Hide slug boxes by default
mp-wp_genesis 2868 if ( empty($hidden[0]) ) {
mp-wp_genesis 2869 if ( 'page' == $page )
mp-wp_genesis 2870 $hidden = array('pageslugdiv');
mp-wp_genesis 2871 elseif ( 'post' == $page )
mp-wp_genesis 2872 $hidden = array('slugdiv');
mp-wp_genesis 2873 }
mp-wp_genesis 2874
mp-wp_genesis 2875 return $hidden;
mp-wp_genesis 2876 }
mp-wp_genesis 2877
mp-wp_genesis 2878 /**
mp-wp_genesis 2879 * Add a new section to a settings page.
mp-wp_genesis 2880 *
mp-wp_genesis 2881 * @since 2.7.0
mp-wp_genesis 2882 *
mp-wp_genesis 2883 * @param string $id String for use in the 'id' attribute of tags.
mp-wp_genesis 2884 * @param string $title Title of the section.
mp-wp_genesis 2885 * @param string $callback Function that fills the section with the desired content. The function should echo its output.
mp-wp_genesis 2886 * @param string $page The type of settings page on which to show the section (general, reading, writing, ...).
mp-wp_genesis 2887 */
mp-wp_genesis 2888 function add_settings_section($id, $title, $callback, $page) {
mp-wp_genesis 2889 global $wp_settings_sections;
mp-wp_genesis 2890
mp-wp_genesis 2891 if ( !isset($wp_settings_sections) )
mp-wp_genesis 2892 $wp_settings_sections = array();
mp-wp_genesis 2893 if ( !isset($wp_settings_sections[$page]) )
mp-wp_genesis 2894 $wp_settings_sections[$page] = array();
mp-wp_genesis 2895 if ( !isset($wp_settings_sections[$page][$id]) )
mp-wp_genesis 2896 $wp_settings_sections[$page][$id] = array();
mp-wp_genesis 2897
mp-wp_genesis 2898 $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
mp-wp_genesis 2899 }
mp-wp_genesis 2900
mp-wp_genesis 2901 /**
mp-wp_genesis 2902 * Add a new field to a settings page.
mp-wp_genesis 2903 *
mp-wp_genesis 2904 * @since 2.7.0
mp-wp_genesis 2905 *
mp-wp_genesis 2906 * @param string $id String for use in the 'id' attribute of tags.
mp-wp_genesis 2907 * @param string $title Title of the field.
mp-wp_genesis 2908 * @param string $callback Function that fills the field with the desired content. The function should echo its output.
mp-wp_genesis 2909 * @param string $page The type of settings page on which to show the field (general, reading, writing, ...).
mp-wp_genesis 2910 * @param string $section The section of the settingss page in which to show the box (default, ...).
mp-wp_genesis 2911 * @param array $args Additional arguments
mp-wp_genesis 2912 */
mp-wp_genesis 2913 function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
mp-wp_genesis 2914 global $wp_settings_fields;
mp-wp_genesis 2915
mp-wp_genesis 2916 if ( !isset($wp_settings_fields) )
mp-wp_genesis 2917 $wp_settings_fields = array();
mp-wp_genesis 2918 if ( !isset($wp_settings_fields[$page]) )
mp-wp_genesis 2919 $wp_settings_fields[$page] = array();
mp-wp_genesis 2920 if ( !isset($wp_settings_fields[$page][$section]) )
mp-wp_genesis 2921 $wp_settings_fields[$page][$section] = array();
mp-wp_genesis 2922
mp-wp_genesis 2923 $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
mp-wp_genesis 2924 }
mp-wp_genesis 2925
mp-wp_genesis 2926 /**
mp-wp_genesis 2927 * {@internal Missing Short Description}}
mp-wp_genesis 2928 *
mp-wp_genesis 2929 * @since unknown
mp-wp_genesis 2930 *
mp-wp_genesis 2931 * @param unknown_type $page
mp-wp_genesis 2932 */
mp-wp_genesis 2933 function do_settings_sections($page) {
mp-wp_genesis 2934 global $wp_settings_sections, $wp_settings_fields;
mp-wp_genesis 2935
mp-wp_genesis 2936 if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )
mp-wp_genesis 2937 return;
mp-wp_genesis 2938
mp-wp_genesis 2939 foreach ( (array) $wp_settings_sections[$page] as $section ) {
mp-wp_genesis 2940 echo "<h3>{$section['title']}</h3>\n";
mp-wp_genesis 2941 call_user_func($section['callback'], $section);
mp-wp_genesis 2942 if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )
mp-wp_genesis 2943 continue;
mp-wp_genesis 2944 echo '<table class="form-table">';
mp-wp_genesis 2945 do_settings_fields($page, $section['id']);
mp-wp_genesis 2946 echo '</table>';
mp-wp_genesis 2947 }
mp-wp_genesis 2948 }
mp-wp_genesis 2949
mp-wp_genesis 2950 /**
mp-wp_genesis 2951 * {@internal Missing Short Description}}
mp-wp_genesis 2952 *
mp-wp_genesis 2953 * @since unknown
mp-wp_genesis 2954 *
mp-wp_genesis 2955 * @param unknown_type $page
mp-wp_genesis 2956 * @param unknown_type $section
mp-wp_genesis 2957 */
mp-wp_genesis 2958 function do_settings_fields($page, $section) {
mp-wp_genesis 2959 global $wp_settings_fields;
mp-wp_genesis 2960
mp-wp_genesis 2961 if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
mp-wp_genesis 2962 return;
mp-wp_genesis 2963
mp-wp_genesis 2964 foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
mp-wp_genesis 2965 echo '<tr valign="top">';
mp-wp_genesis 2966 if ( !empty($field['args']['label_for']) )
mp-wp_genesis 2967 echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>';
mp-wp_genesis 2968 else
mp-wp_genesis 2969 echo '<th scope="row">' . $field['title'] . '</th>';
mp-wp_genesis 2970 echo '<td>';
mp-wp_genesis 2971 call_user_func($field['callback']);
mp-wp_genesis 2972 echo '</td>';
mp-wp_genesis 2973 echo '</tr>';
mp-wp_genesis 2974 }
mp-wp_genesis 2975 }
mp-wp_genesis 2976
mp-wp_genesis 2977 /**
mp-wp_genesis 2978 * {@internal Missing Short Description}}
mp-wp_genesis 2979 *
mp-wp_genesis 2980 * @since unknown
mp-wp_genesis 2981 *
mp-wp_genesis 2982 * @param unknown_type $page
mp-wp_genesis 2983 */
mp-wp_genesis 2984 function manage_columns_prefs($page) {
mp-wp_genesis 2985 $columns = get_column_headers($page);
mp-wp_genesis 2986
mp-wp_genesis 2987 $hidden = get_hidden_columns($page);
mp-wp_genesis 2988
mp-wp_genesis 2989 foreach ( $columns as $column => $title ) {
mp-wp_genesis 2990 // Can't hide these
mp-wp_genesis 2991 if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column )
mp-wp_genesis 2992 continue;
mp-wp_genesis 2993 if ( empty($title) )
mp-wp_genesis 2994 continue;
mp-wp_genesis 2995
mp-wp_genesis 2996 if ( 'comments' == $column )
mp-wp_genesis 2997 $title = __('Comments');
mp-wp_genesis 2998 $id = "$column-hide";
mp-wp_genesis 2999 echo '<label for="' . $id . '">';
mp-wp_genesis 3000 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . (! in_array($column, $hidden) ? ' checked="checked"' : '') . ' />';
mp-wp_genesis 3001 echo "$title</label>\n";
mp-wp_genesis 3002 }
mp-wp_genesis 3003 }
mp-wp_genesis 3004
mp-wp_genesis 3005 /**
mp-wp_genesis 3006 * {@internal Missing Short Description}}
mp-wp_genesis 3007 *
mp-wp_genesis 3008 * @since unknown
mp-wp_genesis 3009 *
mp-wp_genesis 3010 * @param unknown_type $found_action
mp-wp_genesis 3011 */
mp-wp_genesis 3012 function find_posts_div($found_action = '') {
mp-wp_genesis 3013 ?>
mp-wp_genesis 3014 <div id="find-posts" class="find-box" style="display:none;">
mp-wp_genesis 3015 <div id="find-posts-head" class="find-box-head"><?php _e('Find Posts or Pages'); ?></div>
mp-wp_genesis 3016 <div class="find-box-inside">
mp-wp_genesis 3017 <div class="find-box-search">
mp-wp_genesis 3018 <?php if ( $found_action ) { ?>
mp-wp_genesis 3019 <input type="hidden" name="found_action" value="<?php echo $found_action; ?>" />
mp-wp_genesis 3020 <?php } ?>
mp-wp_genesis 3021
mp-wp_genesis 3022 <input type="hidden" name="affected" id="affected" value="" />
mp-wp_genesis 3023 <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
mp-wp_genesis 3024 <label class="hidden" for="find-posts-input"><?php _e( 'Search' ); ?></label>
mp-wp_genesis 3025 <input type="text" id="find-posts-input" class="search-input" name="ps" value="" />
mp-wp_genesis 3026 <input type="button" onclick="findPosts.send();" value="<?php _e( 'Search' ); ?>" class="button" /><br />
mp-wp_genesis 3027
mp-wp_genesis 3028 <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
mp-wp_genesis 3029 <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label>
mp-wp_genesis 3030 <input type="radio" name="find-posts-what" id="find-posts-pages" value="pages" />
mp-wp_genesis 3031 <label for="find-posts-pages"><?php _e( 'Pages' ); ?></label>
mp-wp_genesis 3032 </div>
mp-wp_genesis 3033 <div id="find-posts-response"></div>
mp-wp_genesis 3034 </div>
mp-wp_genesis 3035 <div class="find-box-buttons">
mp-wp_genesis 3036 <input type="button" class="button" onclick="findPosts.close();" value="<?php _e('Close'); ?>" />
mp-wp_genesis 3037 <input id="find-posts-submit" type="submit" class="button" value="<?php _e('Select'); ?>" />
mp-wp_genesis 3038 </div>
mp-wp_genesis 3039 </div>
mp-wp_genesis 3040 <script type="text/javascript">
mp-wp_genesis 3041 /* <![CDATA[ */
mp-wp_genesis 3042 (function($){
mp-wp_genesis 3043 findPosts = {
mp-wp_genesis 3044 open : function(af_name, af_val) {
mp-wp_genesis 3045 var st = document.documentElement.scrollTop || $(document).scrollTop();
mp-wp_genesis 3046
mp-wp_genesis 3047 if ( af_name && af_val )
mp-wp_genesis 3048 $('#affected').attr('name', af_name).val(af_val);
mp-wp_genesis 3049
mp-wp_genesis 3050 $('#find-posts').show().draggable({
mp-wp_genesis 3051 handle: '#find-posts-head'
mp-wp_genesis 3052 }).resizable({
mp-wp_genesis 3053 handles: 'all',
mp-wp_genesis 3054 minHeight: 150,
mp-wp_genesis 3055 minWidth: 280
mp-wp_genesis 3056 }).css({'top':st+'px','left':'50%','marginLeft':'-200px'});
mp-wp_genesis 3057
mp-wp_genesis 3058 $('.ui-resizable-handle').css({
mp-wp_genesis 3059 'backgroundColor': '#e5e5e5'
mp-wp_genesis 3060 });
mp-wp_genesis 3061
mp-wp_genesis 3062 $('.ui-resizable-se').css({
mp-wp_genesis 3063 'border': '0 none',
mp-wp_genesis 3064 'width': '15px',
mp-wp_genesis 3065 'height': '16px',
mp-wp_update-imag... 3066 'background': 'transparent url(images/se.svg) no-repeat scroll 0 0'
mp-wp_genesis 3067 });
mp-wp_genesis 3068
mp-wp_genesis 3069 $('#find-posts-input').focus().keyup(function(e){
mp-wp_genesis 3070 if (e.which == 27) findPosts.close(); // close on Escape
mp-wp_genesis 3071 });
mp-wp_genesis 3072
mp-wp_genesis 3073 return false;
mp-wp_genesis 3074 },
mp-wp_genesis 3075
mp-wp_genesis 3076 close : function() {
mp-wp_genesis 3077 $('#find-posts-response').html('');
mp-wp_genesis 3078 $('#find-posts').draggable('destroy').resizable('destroy').hide();
mp-wp_genesis 3079 },
mp-wp_genesis 3080
mp-wp_genesis 3081 send : function() {
mp-wp_genesis 3082 var post = {};
mp-wp_genesis 3083
mp-wp_genesis 3084 post['ps'] = $('#find-posts-input').val();
mp-wp_genesis 3085 post['action'] = 'find_posts';
mp-wp_genesis 3086 post['_ajax_nonce'] = $('#_ajax_nonce').val();
mp-wp_genesis 3087
mp-wp_genesis 3088 if ( $('#find-posts-pages:checked').val() )
mp-wp_genesis 3089 post['pages'] = 1;
mp-wp_genesis 3090 else
mp-wp_genesis 3091 post['posts'] = 1;
mp-wp_genesis 3092
mp-wp_genesis 3093 $.ajax({
mp-wp_genesis 3094 type : 'POST',
mp-wp_genesis 3095 url : '<?php echo admin_url('admin-ajax.php'); ?>',
mp-wp_genesis 3096 data : post,
mp-wp_genesis 3097 success : function(x) { findPosts.show(x); },
mp-wp_genesis 3098 error : function(r) { findPosts.error(r); }
mp-wp_genesis 3099 });
mp-wp_genesis 3100 },
mp-wp_genesis 3101
mp-wp_genesis 3102 show : function(x) {
mp-wp_genesis 3103
mp-wp_genesis 3104 if ( typeof(x) == 'string' ) {
mp-wp_genesis 3105 this.error({'responseText': x});
mp-wp_genesis 3106 return;
mp-wp_genesis 3107 }
mp-wp_genesis 3108
mp-wp_genesis 3109 var r = wpAjax.parseAjaxResponse(x);
mp-wp_genesis 3110
mp-wp_genesis 3111 if ( r.errors )
mp-wp_genesis 3112 this.error({'responseText': wpAjax.broken});
mp-wp_genesis 3113
mp-wp_genesis 3114 r = r.responses[0];
mp-wp_genesis 3115 $('#find-posts-response').html(r.data);
mp-wp_genesis 3116 },
mp-wp_genesis 3117
mp-wp_genesis 3118 error : function(r) {
mp-wp_genesis 3119 var er = r.statusText;
mp-wp_genesis 3120
mp-wp_genesis 3121 if ( r.responseText )
mp-wp_genesis 3122 er = r.responseText.replace( /<.[^<>]*?>/g, '' );
mp-wp_genesis 3123
mp-wp_genesis 3124 if ( er )
mp-wp_genesis 3125 $('#find-posts-response').html(er);
mp-wp_genesis 3126 }
mp-wp_genesis 3127 };
mp-wp_genesis 3128
mp-wp_genesis 3129 $(document).ready(function(){
mp-wp_genesis 3130 $('#find-posts-submit').click(function(e) {
mp-wp_genesis 3131 if ( '' == $('#find-posts-response').html() )
mp-wp_genesis 3132 e.preventDefault();
mp-wp_genesis 3133 });
mp-wp_genesis 3134 });
mp-wp_genesis 3135 })(jQuery);
mp-wp_genesis 3136 /* ]]> */
mp-wp_genesis 3137 </script>
mp-wp_genesis 3138 <?php
mp-wp_genesis 3139 }
mp-wp_genesis 3140
mp-wp_genesis 3141 /**
mp-wp_genesis 3142 * Display the post password.
mp-wp_genesis 3143 *
mp-wp_genesis 3144 * The password is passed through {@link attribute_escape()} to ensure that it
mp-wp_genesis 3145 * is safe for placing in an html attribute.
mp-wp_genesis 3146 *
mp-wp_genesis 3147 * @uses attribute_escape
mp-wp_genesis 3148 * @since 2.7.0
mp-wp_genesis 3149 */
mp-wp_genesis 3150 function the_post_password() {
mp-wp_genesis 3151 global $post;
mp-wp_genesis 3152 if ( isset( $post->post_password ) ) echo attribute_escape( $post->post_password );
mp-wp_genesis 3153 }
mp-wp_genesis 3154
mp-wp_genesis 3155 /**
mp-wp_genesis 3156 * {@internal Missing Short Description}}
mp-wp_genesis 3157 *
mp-wp_genesis 3158 * @since unknown
mp-wp_genesis 3159 */
mp-wp_genesis 3160 function favorite_actions() {
mp-wp_genesis 3161 $actions = array(
mp-wp_genesis 3162 'post-new.php' => array(__('New Post'), 'edit_posts'),
mp-wp_genesis 3163 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
mp-wp_genesis 3164 'page-new.php' => array(__('New Page'), 'edit_pages'),
mp-wp_genesis 3165 'media-new.php' => array(__('Upload'), 'upload_files'),
mp-wp_genesis 3166 'edit-comments.php' => array(__('Comments'), 'moderate_comments')
mp-wp_genesis 3167 );
mp-wp_genesis 3168
mp-wp_genesis 3169 $actions = apply_filters('favorite_actions', $actions);
mp-wp_genesis 3170
mp-wp_genesis 3171 $allowed_actions = array();
mp-wp_genesis 3172 foreach ( $actions as $action => $data ) {
mp-wp_genesis 3173 if ( current_user_can($data[1]) )
mp-wp_genesis 3174 $allowed_actions[$action] = $data[0];
mp-wp_genesis 3175 }
mp-wp_genesis 3176
mp-wp_genesis 3177 if ( empty($allowed_actions) )
mp-wp_genesis 3178 return;
mp-wp_genesis 3179
mp-wp_genesis 3180 $first = array_keys($allowed_actions);
mp-wp_genesis 3181 $first = $first[0];
mp-wp_genesis 3182 echo '<div id="favorite-actions">';
mp-wp_genesis 3183 echo '<div id="favorite-first"><a href="' . $first . '">' . $allowed_actions[$first] . '</a></div><div id="favorite-toggle"><br /></div>';
mp-wp_genesis 3184 echo '<div id="favorite-inside">';
mp-wp_genesis 3185
mp-wp_genesis 3186 array_shift($allowed_actions);
mp-wp_genesis 3187
mp-wp_genesis 3188 foreach ( $allowed_actions as $action => $label) {
mp-wp_genesis 3189 echo "<div class='favorite-action'><a href='$action'>";
mp-wp_genesis 3190 echo $label;
mp-wp_genesis 3191 echo "</a></div>\n";
mp-wp_genesis 3192 }
mp-wp_genesis 3193 echo "</div></div>\n";
mp-wp_genesis 3194 }
mp-wp_genesis 3195
mp-wp_genesis 3196 /**
mp-wp_genesis 3197 * Get the post title.
mp-wp_genesis 3198 *
mp-wp_genesis 3199 * The post title is fetched and if it is blank then a default string is
mp-wp_genesis 3200 * returned.
mp-wp_genesis 3201 *
mp-wp_genesis 3202 * @since 2.7.0
mp-wp_genesis 3203 * @param int $id The post id. If not supplied the global $post is used.
mp-wp_genesis 3204 *
mp-wp_genesis 3205 */
mp-wp_genesis 3206 function _draft_or_post_title($post_id = 0)
mp-wp_genesis 3207 {
mp-wp_genesis 3208 $title = get_the_title($post_id);
mp-wp_genesis 3209 if ( empty($title) )
mp-wp_genesis 3210 $title = __('(no title)');
mp-wp_genesis 3211 return $title;
mp-wp_genesis 3212 }
mp-wp_genesis 3213
mp-wp_genesis 3214 /**
mp-wp_genesis 3215 * Display the search query.
mp-wp_genesis 3216 *
mp-wp_genesis 3217 * A simple wrapper to display the "s" parameter in a GET URI. This function
mp-wp_genesis 3218 * should only be used when {@link the_search_query()} cannot.
mp-wp_genesis 3219 *
mp-wp_genesis 3220 * @uses attribute_escape
mp-wp_genesis 3221 * @since 2.7.0
mp-wp_genesis 3222 *
mp-wp_genesis 3223 */
mp-wp_genesis 3224 function _admin_search_query() {
mp-wp_genesis 3225 echo isset($_GET['s']) ? attribute_escape( stripslashes( $_GET['s'] ) ) : '';
mp-wp_genesis 3226 }
mp-wp_genesis 3227
mp-wp_genesis 3228 /**
mp-wp_genesis 3229 * Generic Iframe header for use with Thickbox
mp-wp_genesis 3230 *
mp-wp_genesis 3231 * @since 2.7.0
mp-wp_genesis 3232 * @param string $title Title of the Iframe page.
mp-wp_genesis 3233 * @param bool $limit_styles Limit styles to colour-related styles only (unless others are enqueued).
mp-wp_genesis 3234 *
mp-wp_genesis 3235 */
mp-wp_genesis 3236 function iframe_header( $title = '', $limit_styles = false) {
mp-wp_genesis 3237 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
mp-wp_genesis 3238 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
mp-wp_genesis 3239 <head>
mp-wp_genesis 3240 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
mp-wp_genesis 3241 <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
mp-wp_genesis 3242 <?php
mp-wp_genesis 3243 wp_enqueue_style( 'global' );
mp-wp_genesis 3244 wp_enqueue_style( 'colors' );
mp-wp_genesis 3245 if ( ! $limit_styles )
mp-wp_genesis 3246 wp_enqueue_style( 'wp-admin' );
mp-wp_genesis 3247 ?>
mp-wp_genesis 3248 <script type="text/javascript">
mp-wp_genesis 3249 //<![CDATA[
mp-wp_genesis 3250 function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
mp-wp_genesis 3251 //]]>
mp-wp_genesis 3252 </script>
mp-wp_genesis 3253 <?php
mp-wp_genesis 3254 do_action('admin_print_styles');
mp-wp_genesis 3255 do_action('admin_print_scripts');
mp-wp_genesis 3256 do_action('admin_head');
mp-wp_genesis 3257 ?>
mp-wp_genesis 3258 </head>
mp-wp_genesis 3259 <body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>>
mp-wp_genesis 3260 <?php
mp-wp_genesis 3261 }
mp-wp_genesis 3262
mp-wp_genesis 3263 /**
mp-wp_genesis 3264 * Generic Iframe footer for use with Thickbox
mp-wp_genesis 3265 *
mp-wp_genesis 3266 * @since 2.7.0
mp-wp_genesis 3267 *
mp-wp_genesis 3268 */
mp-wp_genesis 3269 function iframe_footer() {
mp-wp_genesis 3270 echo '
mp-wp_genesis 3271 </body>
mp-wp_genesis 3272 </html>';
mp-wp_genesis 3273 }
mp-wp_genesis 3274
mp-wp_genesis 3275 function _post_states($post) {
mp-wp_genesis 3276 $post_states = array();
mp-wp_genesis 3277 if ( isset($_GET['post_status']) )
mp-wp_genesis 3278 $post_status = $_GET['post_status'];
mp-wp_genesis 3279 else
mp-wp_genesis 3280 $post_status = '';
mp-wp_genesis 3281
mp-wp_genesis 3282 if ( !empty($post->post_password) )
mp-wp_genesis 3283 $post_states[] = __('Password protected');
mp-wp_genesis 3284 if ( 'private' == $post->post_status && 'private' != $post_status )
mp-wp_genesis 3285 $post_states[] = __('Private');
mp-wp_genesis 3286 if ( 'draft' == $post->post_status && 'draft' != $post_status )
mp-wp_genesis 3287 $post_states[] = __('Draft');
mp-wp_genesis 3288 if ( 'pending' == $post->post_status && 'pending' != $post_status )
mp-wp_genesis 3289 $post_states[] = __('Pending');
mp-wp_genesis 3290
mp-wp_genesis 3291 if ( ! empty($post_states) ) {
mp-wp_genesis 3292 $state_count = count($post_states);
mp-wp_genesis 3293 $i = 0;
mp-wp_genesis 3294 echo ' - ';
mp-wp_genesis 3295 foreach ( $post_states as $state ) {
mp-wp_genesis 3296 ++$i;
mp-wp_genesis 3297 ( $i == $state_count ) ? $sep = '' : $sep = ', ';
mp-wp_genesis 3298 echo "<span class='post-state'>$state$sep</span>";
mp-wp_genesis 3299 }
mp-wp_genesis 3300 }
mp-wp_genesis 3301 }
mp-wp_genesis 3302
mp-wp_genesis 3303 function screen_meta($screen) {
mp-wp_genesis 3304 global $wp_meta_boxes, $_wp_contextual_help;
mp-wp_genesis 3305
mp-wp_genesis 3306 $screen = str_replace('.php', '', $screen);
mp-wp_genesis 3307 $screen = str_replace('-new', '', $screen);
mp-wp_genesis 3308 $screen = str_replace('-add', '', $screen);
mp-wp_genesis 3309 $screen = apply_filters('screen_meta_screen', $screen);
mp-wp_genesis 3310
mp-wp_genesis 3311 $column_screens = get_column_headers($screen);
mp-wp_genesis 3312 $meta_screens = array('index' => 'dashboard');
mp-wp_genesis 3313
mp-wp_genesis 3314 if ( isset($meta_screens[$screen]) )
mp-wp_genesis 3315 $screen = $meta_screens[$screen];
mp-wp_genesis 3316 $show_screen = false;
mp-wp_genesis 3317 if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) )
mp-wp_genesis 3318 $show_screen = true;
mp-wp_genesis 3319 ?>
mp-wp_genesis 3320 <div id="screen-meta">
mp-wp_genesis 3321 <?php
mp-wp_genesis 3322 if ( $show_screen ) :
mp-wp_genesis 3323 ?>
mp-wp_genesis 3324 <div id="screen-options-wrap" class="hidden">
mp-wp_genesis 3325 <h5><?php _e('Show on screen') ?></h5>
mp-wp_genesis 3326 <form id="adv-settings" action="" method="get">
mp-wp_genesis 3327 <div class="metabox-prefs">
mp-wp_genesis 3328 <?php
mp-wp_genesis 3329 if ( !meta_box_prefs($screen) && isset($column_screens) ) {
mp-wp_genesis 3330 manage_columns_prefs($screen);
mp-wp_genesis 3331 wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
mp-wp_genesis 3332 }
mp-wp_genesis 3333 ?>
mp-wp_genesis 3334 <br class="clear" />
mp-wp_genesis 3335 </div></form>
mp-wp_genesis 3336 </div>
mp-wp_genesis 3337
mp-wp_genesis 3338 <?php
mp-wp_genesis 3339 endif;
mp-wp_genesis 3340
mp-wp_genesis 3341 global $title;
mp-wp_genesis 3342
mp-wp_genesis 3343 if ( !isset($_wp_contextual_help) )
mp-wp_genesis 3344 $_wp_contextual_help = array();
mp-wp_genesis 3345
mp-wp_genesis 3346 if ( !isset($_wp_contextual_help['post']) ) {
mp-wp_genesis 3347 $help = drag_drop_help();
mp-wp_genesis 3348 $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
mp-wp_genesis 3349 $_wp_contextual_help['post'] = $help;
mp-wp_genesis 3350 }
mp-wp_genesis 3351
mp-wp_genesis 3352 if ( !isset($_wp_contextual_help['page']) ) {
mp-wp_genesis 3353 $help = drag_drop_help();
mp-wp_genesis 3354 $_wp_contextual_help['page'] = $help;
mp-wp_genesis 3355 }
mp-wp_genesis 3356
mp-wp_genesis 3357 if ( !isset($_wp_contextual_help['dashboard']) ) {
mp-wp_genesis 3358 $help = drag_drop_help();
mp-wp_genesis 3359 $_wp_contextual_help['dashboard'] = $help;
mp-wp_genesis 3360 }
mp-wp_genesis 3361
mp-wp_genesis 3362 if ( !isset($_wp_contextual_help['link']) ) {
mp-wp_genesis 3363 $help = drag_drop_help();
mp-wp_genesis 3364 $_wp_contextual_help['link'] = $help;
mp-wp_genesis 3365 }
mp-wp_genesis 3366
mp-wp_genesis 3367 if ( !isset($_wp_contextual_help['options-general']) )
mp-wp_genesis 3368 $_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
mp-wp_genesis 3369
mp-wp_genesis 3370 $_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
mp-wp_genesis 3371 ?>
mp-wp_genesis 3372 <div id="contextual-help-wrap" class="hidden">
mp-wp_genesis 3373 <?php
mp-wp_genesis 3374 $contextual_help = '';
mp-wp_genesis 3375 if ( isset($_wp_contextual_help[$screen]) ) {
mp-wp_genesis 3376 if ( !empty($title) )
mp-wp_genesis 3377 $contextual_help .= '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
mp-wp_genesis 3378 else
mp-wp_genesis 3379 $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
mp-wp_genesis 3380 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n";
mp-wp_genesis 3381
mp-wp_genesis 3382 $contextual_help .= '<h5>' . __('Other Help') . '</h5>';
mp-wp_genesis 3383 } else {
mp-wp_genesis 3384 $contextual_help .= '<h5>' . __('Help') . '</h5>';
mp-wp_genesis 3385 }
mp-wp_genesis 3386
mp-wp_genesis 3387 $contextual_help .= '<div class="metabox-prefs">';
mp-wp_genesis 3388 $contextual_help .= __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
mp-wp_genesis 3389 $contextual_help .= '<br />';
mp-wp_genesis 3390 $contextual_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
mp-wp_genesis 3391 $contextual_help .= "</div>\n";
mp-wp_genesis 3392 echo apply_filters('contextual_help', $contextual_help, $screen);
mp-wp_genesis 3393 ?>
mp-wp_genesis 3394 </div>
mp-wp_genesis 3395
mp-wp_genesis 3396 <div id="screen-meta-links">
mp-wp_genesis 3397 <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
mp-wp_genesis 3398 <a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>
mp-wp_genesis 3399 </div>
mp-wp_genesis 3400 <?php if ( $show_screen ) { ?>
mp-wp_genesis 3401 <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
mp-wp_genesis 3402 <a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>
mp-wp_genesis 3403 </div>
mp-wp_genesis 3404 <?php } ?>
mp-wp_genesis 3405 </div>
mp-wp_genesis 3406 </div>
mp-wp_genesis 3407 <?php
mp-wp_genesis 3408 }
mp-wp_genesis 3409
mp-wp_genesis 3410 /**
mp-wp_genesis 3411 * Add contextual help text for a page
mp-wp_genesis 3412 *
mp-wp_genesis 3413 * @since 2.7.0
mp-wp_genesis 3414 *
mp-wp_genesis 3415 * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
mp-wp_genesis 3416 * @param string $help Arbitrary help text
mp-wp_genesis 3417 */
mp-wp_genesis 3418 function add_contextual_help($screen, $help) {
mp-wp_genesis 3419 global $_wp_contextual_help;
mp-wp_genesis 3420
mp-wp_genesis 3421 if ( !isset($_wp_contextual_help) )
mp-wp_genesis 3422 $_wp_contextual_help = array();
mp-wp_genesis 3423
mp-wp_genesis 3424 $_wp_contextual_help[$screen] = $help;
mp-wp_genesis 3425 }
mp-wp_genesis 3426
mp-wp_genesis 3427 function drag_drop_help() {
mp-wp_genesis 3428 return '
mp-wp_genesis 3429 <p>' . __('Most of the modules on this screen can be moved. If you hover your mouse over the title bar of a module you`ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the module to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the module will be placed when you release the mouse button.') . '</p>
mp-wp_genesis 3430 <p>' . __('The same modules can be expanded and collapsed by clicking once on their title bar and also completely hidden from the Screen Options tab.') . '</p>
mp-wp_genesis 3431 ';
mp-wp_genesis 3432 }
mp-wp_genesis 3433
mp-wp_genesis 3434 function screen_icon($name = '') {
mp-wp_genesis 3435 global $parent_file, $hook_suffix;
mp-wp_genesis 3436
mp-wp_genesis 3437 if ( empty($name) ) {
mp-wp_genesis 3438 if ( isset($parent_file) && !empty($parent_file) )
mp-wp_genesis 3439 $name = substr($parent_file, 0, -4);
mp-wp_genesis 3440 else
mp-wp_genesis 3441 $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
mp-wp_genesis 3442 }
mp-wp_genesis 3443 unset($hook_suffix);
mp-wp_genesis 3444 ?>
mp-wp_genesis 3445 <div id="icon-<?php echo $name; ?>" class="icon32"><br /></div>
mp-wp_genesis 3446 <?php
mp-wp_genesis 3447 }
mp-wp_genesis 3448
mp-wp_genesis 3449 ?>