| [ Index ] |
PHP Cross Reference of zeList |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Ugly recursive category stuff. 5 * 6 * @since unknown 7 * 8 * @param unknown_type $parent 9 * @param unknown_type $level 10 * @param unknown_type $categories 11 * @param unknown_type $page 12 * @param unknown_type $per_page 13 */ 14 function link_cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) { 15 $count = 0; 16 _link_cat_rows($categories, $count, $parent, $level, $page, $per_page); 17 } 18 19 /** 20 * Display link categories rows 21 * 22 * @since unknown 23 * 24 * @param unknown_type $categories 25 * @param unknown_type $count 26 * @param unknown_type $parent 27 * @param unknown_type $level 28 * @param unknown_type $page 29 * @param unknown_type $per_page 30 * @return unknown 31 */ 32 function _link_cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) { 33 if ( empty($categories) ) { 34 $args = array('hide_empty' => 0); 35 if ( !empty($_GET['s']) ) { 36 $args['search'] = $_GET['s']; 37 if(is_admin()) $args['hide_empty'] = 0; 38 $parent = false; 39 } 40 $args['type'] = 'link'; 41 $categories = get_categories( $args ); 42 } 43 44 if ( !$categories ) 45 return false; 46 47 $children = _get_term_hierarchy('link_category'); 48 49 $start = ($page - 1) * $per_page; 50 $end = $start + $per_page; 51 $i = -1; 52 ob_start(); 53 foreach ( $categories as $category ) { 54 if ( $count >= $end ) 55 break; 56 57 $i++; 58 if ( $parent !== false && $category->parent != $parent ) 59 continue; 60 61 // If the page starts in a subtree, print the parents. 62 if ( $count == $start && $category->parent > 0 ) { 63 $my_parents = array(); 64 while ( $my_parent) { 65 $my_parent = get_link_category($my_parent); 66 $my_parents[] = $my_parent; 67 if ( !$my_parent->parent ) 68 break; 69 $my_parent = $my_parent->parent; 70 } 71 $num_parents = count($my_parents); 72 while( $my_parent = array_pop($my_parents) ) { 73 echo "\t" . _link_cat_row( $my_parent, $level - $num_parents ); 74 $num_parents--; 75 } 76 } 77 78 if ( $count >= $start ) 79 echo "\t" . _link_cat_row( $category, $level ); 80 81 unset($categories[$i]); // Prune the working set 82 $count++; 83 84 if ( isset($children[$category->term_id]) ) 85 _link_cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page ); 86 87 } 88 89 $output = ob_get_contents(); 90 ob_end_clean(); 91 92 echo $output; 93 } 94 95 /** 96 * Display a link category row 97 * 98 * @since unknown 99 * 100 * @param unknown_type $category 101 * @param unknown_type $level 102 * @param unknown_type $name_override 103 * @return unknown 104 */ 105 function _link_cat_row( $category, $level, $name_override = false ) { 106 static $row_class = ''; 107 108 $category = get_link_category( $category, OBJECT, 'display' ); 109 110 $default_cat_id = (int) get_option( 'default_link_category' ); 111 $pad = str_repeat( '— ', $level ); 112 $name = ( $name_override ? $name_override : $pad . ' ' . $category->name ); 113 $edit_link = ZELIST_ADMIN_URL_CATEGORY."&action=edit&cat_ID=$category->term_id"; 114 if ( current_user_can( 'manage_categories' ) ) { 115 $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />'; 116 $actions = array(); 117 if(current_user_can('manage_categories')) 118 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 119 // @TODO inline edit of link categories 120 //$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 121 if ( $default_cat_id != $category->term_id ) 122 if(current_user_can('manage_categories')) 123 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url(ZELIST_ADMIN_URL_CATEGORY."&noheader=1&action=delete&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>"; 124 $action_count = count($actions); 125 $i = 0; 126 $edit .= '<div class="row-actions">'; 127 foreach ( $actions as $action => $link ) { 128 ++$i; 129 ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 130 $edit .= "<span class='$action'>$link$sep</span>"; 131 } 132 $edit .= '</div>'; 133 } else { 134 $edit = $name; 135 } 136 137 $row_class = 'alternate' == $row_class ? '' : 'alternate'; 138 $qe_data = get_link_category_to_edit($category->term_id); 139 140 $category->count = number_format_i18n( $category->count ); 141 $links_count = ( $category->count > 0 ) ? "<a href='".ZELIST_ADMIN_URL_MANAGER."&cat_id=$category->term_id'>$category->count</a>" : $category->count; 142 143 $output = "<tr id='cat-$category->term_id' class='iedit $row_class'>"; 144 145 $columns = get_column_headers('edit-link-categories'); 146 $hidden = get_hidden_columns('edit-link-categories'); 147 foreach ( $columns as $column_name => $column_display_name ) { 148 $class = "class=\"$column_name column-$column_name\""; 149 150 $style = ''; 151 if ( in_array($column_name, $hidden) ) 152 $style = ' style="display:none;"'; 153 154 $attributes = "$class$style"; 155 156 switch ($column_name) { 157 case 'cb': 158 $output .= "<th scope='row' class='check-column'>"; 159 if ( $default_cat_id != $category->term_id ) { 160 $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />"; 161 } else { 162 $output .= " "; 163 } 164 $output .= '</th>'; 165 break; 166 case 'name': 167 $output .= "<td $attributes>$edit"; 168 $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 169 $output .= '<div class="name">' . $qe_data->name . '</div>'; 170 $output .= '<div class="slug">' . $qe_data->slug . '</div>'; 171 $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>'; 172 break; 173 case 'description': 174 $output .= "<td $attributes>$category->description</td>"; 175 break; 176 case 'slug': 177 $output .= "<td $attributes>$category->slug</td>"; 178 break; 179 case 'links': 180 $attributes = 'class="links column-links num"' . $style; 181 $output .= "<td $attributes>$links_count</td>\n"; 182 } 183 } 184 $output .= '</tr>'; 185 186 return $output; 187 } 188 189 /** 190 * Display link rows 191 * 192 * @since unknown 193 * 194 * @param unknown_type $links 195 */ 196 function link_rows( $links = array() ) { 197 global $wp_query, $zelist_query, $link, $mode; 198 199 add_filter('the_title','wp_specialchars'); 200 201 // Create array of link IDs. 202 $link_ids = array(); 203 204 if ( empty($links) ) 205 $links = &$zelist_query->links; 206 207 foreach ( $links as $a_link ) 208 $link_ids[] = $a_link->ID; 209 /* 210 $comment_pending_count = get_pending_comments_num($link_ids); 211 if ( empty($comment_pending_count) ) 212 $comment_pending_count = array(); 213 214 215 if ( empty($comment_pending_count[$link->ID]) ) 216 $comment_pending_count[$link->ID] = 0; 217 */ 218 foreach ( $links as $link ) { 219 _link_row($link, $mode); 220 } 221 } 222 223 /** 224 * Display a link row 225 * 226 * @since unknown 227 * 228 * @param unknown_type $a_link 229 * @param unknown_type $pending_comments 230 * @param unknown_type $mode 231 */ 232 function _link_row($a_link, $mode) { 233 global $link,$link_id; 234 static $rowclass; 235 236 //$global_link = $link; 237 $link = $a_link; 238 $link_id = $link->link_id; 239 setup_linkdata($link); 240 241 $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; 242 global $current_user; 243 $link_owner = ( $current_user->ID == $link->link_author ? 'self' : 'other' ); 244 $edit_link = get_edit_bookmark_link( $link->link_id ); 245 246 $link_columns = get_column_headers('link-manager'); 247 $hidden = get_hidden_columns('link-manager'); 248 249 $link = sanitize_bookmark($link); 250 $link->link_name = attribute_escape($link->link_name); 251 $link->link_categories = wp_get_link_cats($link->link_id); 252 253 $short_url = str_replace('http://', '', $link->link_url); 254 $short_url = preg_replace('/^www./i', '', $short_url); 255 if ('/' == substr($short_url, -1)) 256 $short_url = substr($short_url, 0, -1); 257 if (strlen($short_url) > 35) 258 $short_url = substr($short_url, 0, 32).'...'; 259 $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No'); 260 $style = ($alt % 2) ? 'class="iedit"' : ' class="iedit alternate"'; 261 ++ $alt; 262 263 if(current_user_can('manage_links')) $edit_link = get_edit_bookmark_link(); 264 else $edit_link = get_link_permalink($link->link_id); 265 //$edit_link = ZELIST_ADMIN_URL_LINK.'?link_id='.$link->link_id; 266 ?> 267 <tr id="link-<?php echo $link->link_id; ?>" valign="middle" 268 <?php echo $style; ?>> 269 <?php 270 foreach($link_columns as $column_name => $column_display_name) { 271 //if($column_name == 'name' || $column_name = 'cb') echo "<br />name $column_name $link->link_id = ".count($link->link_categories); 272 $class = "class=\"column-$column_name link-$link->link_status\""; 273 274 $style = ''; 275 if ( in_array($column_name, $hidden) ) 276 $style = ' style="display:none;"'; 277 if ( 'visible' == $column_name ) 278 $style = empty($style) ? ' style="text-align: center;"' : ' style="text-align: center; display: none;"'; 279 $attributes = "$class$style"; 280 281 switch($column_name) { 282 case 'cb': 283 echo '<th scope="row" class="check-column link-'.$link->link_status.'">'; 284 echo '<input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" />'; 285 echo zelist_admin_show_status(); 286 echo '</th>'; 287 break; 288 case 'name': 289 290 echo "\n"."<td $attributes>"; 291 echo "<strong><a class='row-title' href='$edit_link' title='" 292 . attribute_escape(sprintf(__('Edit "%s"'), $link->link_name)) 293 . "'>$link->link_name</a> "; 294 _link_states($link) ; 295 echo '</strong><br />'; 296 297 298 $actions = array(); 299 global $debug; 300 $debug = true; 301 if(current_user_can('edit_links',$link->link_id)) $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 302 if(current_user_can('edit_links',$link->link_id)) $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . attribute_escape(__('Edit this link inline','zelist')) . '">' . __('Quick Edit') . '</a>'; 303 304 $debug = false; 305 if(current_user_can('delete_links')) $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url(ZELIST_ADMIN_URL_LINK."&noheader=1&action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 306 307 if($link->link_status != 'deny' && current_user_can('deny_links')) 308 $actions['deny'] = "<a class='submitdeny' href='" . wp_nonce_url(ZELIST_ADMIN_URL_LINK."&noheader=1&action=deny&link_id=$link->link_id", 'deny-bookmark_' . $link->link_id)."'".">". __('Deny','zelist') . "</a>"; 309 310 if($link->link_status != 'publish' && current_user_can('publish_links')) 311 $actions['publish'] = "<a class='submitpublish' href='" . wp_nonce_url(ZELIST_ADMIN_URL_LINK."&noheader=1&action=publish&link_id=$link->link_id", 'publish-bookmark_' . $link->link_id)."'".">". __('Publish','zelist') . "</a>"; 312 313 $action_count = count($actions); 314 $i = 0; 315 echo '<div class="row-actions">'; 316 foreach ( $actions as $action => $linkaction ) { 317 ++$i; 318 ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 319 echo "<span class='$action'>$linkaction$sep</span>"; 320 } 321 echo '</div>'; 322 323 get_link_inline_data($link); 324 echo '</td>'; 325 break; 326 327 case 'web' : 328 $user = get_userdata($link->link_owner); 329 $count = get_links_count_by_user($user->ID,false); 330 echo "\n"."<td $attributes>"; 331 echo '<ul class="web">'; 332 echo '<li class="url"><a href="'.$link->link_url.'" title="'.sprintf(__('Visit %s'), $link->link_name).'">'.$short_url.'</a></li>'; 333 echo '<li class="owner"><a title="'.sprintf(__('View sites submitted by %s','zelist'),$user->display_name).'" href="'.ZELIST_ADMIN_URL_MANAGER.'&link_owner='.$user->ID.'">'.$user->display_name."</a> ($count)</li>"; 334 if($link->link_status == 'pending') { 335 // submitted ... ago 336 $since = human_time_diff(strtotime($link->link_added)); 337 echo '<li class="mod since">'.sprintf(__('Submitted %s ago','zelist'),$since).'</li>'; 338 339 // word count 340 //$count = count(explode(' ',$link->link_description)); 341 $count = strlen($link->link_description); 342 $class = ($count < get_option('zelist_description_min_length') || $count > get_option('zelist_description_max_length')) ? 'class="red"' :''; 343 $desc_title = $link->link_description; 344 $desc_title = str_replace('<br />',"\n",$desc_title); 345 $desc_title = addslashes($desc_title); 346 echo '<li class="mod wc "><a href="#" '.$class.' onclick"return false;" title="'.$desc_title.'">'.sprintf(__('%d characters','zelist'),$count).'</a></li>'; 347 } 348 349 echo '</ul>'; 350 echo "</td>"; 351 break; 352 case 'categories': 353 echo "\n<td $attributes>"; 354 $cat_names = array(); 355 if($link->link_categories) { 356 foreach ($link->link_categories as $category) { 357 $cat = get_term($category, 'link_category', OBJECT, 'display'); 358 if ( is_wp_error( $cat ) ) 359 echo $cat->get_error_message(); 360 $cat_name = $cat->name; 361 if ( $cat_id != $category ) 362 $cat_name = "<a href='".ZELIST_ADMIN_URL_MANAGER."&cat_id=$category'>$cat_name</a>"; 363 $cat_names[] = $cat_name; 364 } 365 echo implode(', ', $cat_names); 366 } 367 else _e('No category','zelist'); 368 369 370 $tags = wp_get_link_tags($link->link_id); 371 if ( !empty( $tags ) ) { 372 $out = array(); 373 foreach ( $tags as $c ) { 374 if(current_user_can('manage_options')) 375 $out[] = "<a href='".ZELIST_ADMIN_URL_TAGS."&tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'link_tag', 'display')) . "</a>"; 376 else 377 $out[] = wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'link_tag', 'display')); 378 } 379 echo '<div class="link_row_tags" id="link_row_tags_'.$link->link_id.'">'.__('Tags:').' '.join( ', ', $out ).'</div>'; 380 } 381 else { 382 //_e('No Tags'); 383 } 384 echo "</td>"; 385 break; 386 case 'metas' : 387 388 echo "\n<td $attributes><div class='metas_keys'>"; 389 the_pagerank_image(); 390 echo '<br />'; 391 if($link->link_image) echo '<img alt="" title="'.$link->link_image.'" src="'.ZELIST_URL.'/style/image.png" />'; 392 393 $metas = get_link_custom(); 394 395 if($metas['alive'] && $metas['alive'][0] != '1') echo '<img alt="'.__('Alive','zelist').'" src="'.ZELIST_URL.'/style/disconnect.png" />'; 396 397 if($link->link_rss) echo '<img alt="" title="'.$link->link_rss.'" src="'.ZELIST_URL.'/style/feed.png" />'; 398 399 //if($link->link_pagerank) echo '<br /><img src="'.ZELIST_URL.'/style/pr'.intval($link->link_pagerank).'.gif" />'; 400 //if($link->link_rel) printf(__('Rel: %s','zelist'),$link->link_rel); 401 //if($visible) _e('Visible','zelist'); else _e('Not visible','zelist'); 402 echo '</div>'; 403 echo "</td>"; 404 break; 405 default: 406 echo "\n<td $attributes>"; 407 do_action('manage_link_custom_column', $column_name, $link->link_id); 408 echo "</td>"; 409 break; 410 } 411 //$link = $global_link; 412 } 413 414 415 } 416 417 /** 418 * TAGS TEMPLATE 419 */ 420 421 /** 422 * Outputs appropriate rows for the Nth page of the link Tag Management screen, 423 * assuming M tags displayed at a time on the page 424 * Returns the number of tags displayed 425 * 426 * @since unknown 427 * 428 * @param unknown_type $page 429 * @param unknown_type $pagesize 430 * @param unknown_type $searchterms 431 * @return unknown 432 */ 433 function link_tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) { 434 435 // Get a page worth of tags 436 $start = ($page - 1) * $pagesize; 437 438 $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0); 439 440 if ( !empty( $searchterms ) ) { 441 $args['search'] = $searchterms; 442 } 443 444 $tags = get_terms( 'link_tag', $args ); 445 446 // convert it to table rows 447 $out = ''; 448 $count = 0; 449 foreach( $tags as $tag ) 450 $out .= _link_tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' ); 451 452 // filter and send to screen 453 echo $out; 454 return $count; 455 } 456 457 458 /** 459 * Returns a single tag row (see tag_rows below) 460 * Note: this is also used in admin-ajax.php! 461 * 462 * @since unknown 463 * 464 * @param unknown_type $tag 465 * @param unknown_type $class 466 * @return unknown 467 */ 468 function _link_tag_row( $tag, $class = '' ) { 469 $count = number_format_i18n( $tag->count ); 470 $count = ( $count > 0 ) ? "<a href='".ZELIST_ADMIN_URL_MANAGER."&link_tag=$tag->slug'>$count</a>" : $count; 471 472 $name = apply_filters( 'term_name', $tag->name ); 473 $qe_data = get_term($tag->term_id, 'link_tag', object, 'edit'); 474 // ONE MODIFICATION 475 $edit_link = ZELIST_ADMIN_URL_TAGS."&action=edit&tag_ID=$tag->term_id"; 476 $out = ''; 477 $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>'; 478 $columns = get_column_headers('edit-link-tags'); 479 $hidden = get_hidden_columns('edit-link-tags'); 480 foreach ( $columns as $column_name => $column_display_name ) { 481 $class = "class=\"$column_name column-$column_name\""; 482 483 $style = ''; 484 if ( in_array($column_name, $hidden) ) 485 $style = ' style="display:none;"'; 486 487 $attributes = "$class$style"; 488 489 switch ($column_name) { 490 case 'cb': 491 $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>'; 492 break; 493 case 'name': 494 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />'; 495 $actions = array(); 496 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 497 //$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 498 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url(ZELIST_ADMIN_URL_TAGS."&noheader=1&action=delete&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>"; 499 $action_count = count($actions); 500 $i = 0; 501 $out .= '<div class="row-actions">'; 502 foreach ( $actions as $action => $link ) { 503 ++$i; 504 ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 505 $out .= "<span class='$action'>$link$sep</span>"; 506 } 507 $out .= '</div>'; 508 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 509 $out .= '<div class="name">' . $qe_data->name . '</div>'; 510 $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>'; 511 break; 512 case 'slug': 513 $out .= "<td $attributes>$tag->slug</td>"; 514 break; 515 case 'links': 516 $attributes = 'class="links column-links num"' . $style; 517 $out .= "<td $attributes>$count</td>"; 518 break; 519 } 520 } 521 522 $out .= '</tr>'; 523 524 return $out; 525 } 526 527 /** 528 * Display a little flag (red/orange/green) next to links 529 * @return unknown_type 530 */ 531 function zelist_admin_show_status() { 532 global $link; 533 $string = ''; 534 $src = false; 535 if(!$_GET['link_status']) { // not when status is explicit 536 if($link->link_status == 'deny') $src = ZELIST_URL.'/style/flag_red.png'; 537 elseif($link->link_status == 'pending') $src = ZELIST_URL.'/style/flag_orange.png'; 538 elseif($link->link_status == 'publish') $src = ZELIST_URL.'/style/flag_green.png'; 539 elseif($link->link_status == 'dead') $src = ZELIST_URL.'/style/flag_purple.png'; 540 } 541 542 543 if($src) $string = '<span style="margin-left: 8px;"><img src="'.$src.'" /></span>'; 544 545 return apply_filters('zelist_admin_show_status',$string,$link); 546 } 547 548 549 function _link_states($link) { 550 $link_states = array(); 551 if ( isset($_GET['link_status']) ) 552 $link_status = $_GET['link_status']; 553 else 554 $link_status = ''; 555 556 if ( 'deny' == $link->link_status && 'deny' != $link_status ) 557 $link_states[] = __('Denied','zelist'); 558 if ( 'pending' == $link->link_status && 'pending' != $link_status ) 559 $link_states[] = __('Pending','zelist'); 560 if ( 'dead' == $link->link_status && 'dead' != $link_status ) 561 $link_states[] = __('Dead','zelist'); 562 563 564 if ( ! empty($link_states) ) { 565 $state_count = count($link_states); 566 $i = 0; 567 echo ' - '; 568 foreach ( $link_states as $state ) { 569 ++$i; 570 $sep = ( $i == $state_count ) ? '' : ', '; 571 echo "<span class='link-state'>$state$sep</span>"; 572 } 573 } 574 } 575 576 577 /** 578 * {@internal Missing Short Description}} 579 * 580 * Outputs the quick edit and bulk edit table rows for posts and pages 581 * 582 * @since 2.7 583 * 584 * @param string $type 'post' or 'page' 585 */ 586 function inline_edit_link( ) { 587 global $current_user, $mode; 588 589 $screen = 'link-manager'; 590 $type = 'link'; 591 $link = get_default_link_to_edit(); 592 593 $columns = get_column_headers('link-manager'); 594 $hidden = get_hidden_columns('link-manager'); 595 $col_count = count($columns) - count($hidden); 596 $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; 597 $can_publish = current_user_can("publish_{$type}s"); 598 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); 599 600 ?> 601 602 <form method="get" action=""> 603 <table style=""> 604 <tbody id="inlineedit"> 605 606 <tr id="inline-edit" 607 class="inline-edit-row inline-edit-row-link quick-edit-row quick-edit-row-link" 608 style="display: none;"> 609 <td colspan="<?php echo $col_count; ?>"> 610 611 <fieldset class="inline-edit-col-left"> 612 <div class="inline-edit-col"> 613 <h4><?php _e( 'Quick Edit' ); ?></h4> 614 <label> <span class="title"><?php _e( 'Name','zelist' ); ?></span> <span 615 class="input-text-wrap"> <input type="text" name="link_name" 616 class="ptitle" value="" /></span> </label> <label> <span 617 class="title"><?php _e('URL','zelist'); ?></span> <span 618 class="input-text-wrap"><a target="_blank" class="link_url" 619 href="#"></a> </span> </label> <!-- label> 620 <span class="title"><?php _e( 'Slug' ); ?></span> 621 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span> 622 </label --> <br class="clear" /> 623 624 <?php 625 /* 626 * Can cause wpdb to hang with more than ??? (560 users = crash) 627 * <label> <span class="title"><?php _e( 'Webmaster','zelist' ); ?></span> 628 <?php 629 $users_opt = array('name' => 'link_owner', 'class'=> 'authors', 'multi' => 1); 630 $authors = get_editable_user_ids( $current_user->ID ); 631 if ( $authors && count( $authors ) > 1 ) $users_opt['include'] = $authors; 632 wp_dropdown_users( $users_opt ); 633 ?> </label> 634 */ 635 ?> 636 637 <div class="inline-edit-group"><label 638 class="inline-edit-status alignleft"> <span class="title"><?php _e( 'Status' ); ?></span> 639 <select name="_status"> 640 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?> 641 <option value="publish"><?php _e( 'Published','zelist' ); ?></option> 642 <?php endif; ?> 643 <option value="pending"><?php _e( 'Pending Review','zelist' ); ?></option> 644 <option value="deny"><?php _e( 'Denied','zelist' ); ?></option> 645 <option value="dead"><?php _e( 'Dead','zelist' ); ?></option> 646 </select> </label> <label 647 class="inline-edit-reason alignleft hidden"> <span class="title"><?php _e( 'Ban Reason','zelist' ); ?></span> 648 649 <select name="ban_reason"> 650 <?php $ban_reasons = get_option('zelist_banreasons'); if($ban_reasons) foreach($ban_reasons as $reason => $label) : ?> 651 <option value="<?php echo $reason; ?>"><?php echo stripslashes($label); ?></option> 652 <?php endforeach; ?> 653 </select> </label></div> 654 </div> 655 </fieldset> 656 657 <fieldset class="inline-edit-col-center inline-edit-categories"> 658 <div class="inline-edit-col"><span 659 class="title inline-edit-categories-label"><?php _e( 'Categories' ); ?> 660 <span class="catshow"><?php _e('[more]'); ?></span> <span 661 class="cathide" style="display: none;"><?php _e('[less]'); ?></span> 662 </span> 663 664 <?php if(get_option('zelist_allow_multiple_categories')) : ?> 665 <ul class="cat-checklist"> 666 <?php zelist_link_category_checklist(); ?> 667 </ul> 668 <?php else: ?> 669 <?php wp_dropdown_categories('type=link&orderby=name&hide_empty=0&hierarchical=1&name=link_category[]'); 670 endif; ?> 671 </div> 672 </fieldset> 673 674 <fieldset class="inline-edit-col-right"> 675 <div class="inline-edit-col"><label> <span class="title"><?php _e('Description','zelist'); ?></span> 676 <p class="link_description"></p> 677 </label> <label class="inline-edit-tags"> <span class="title"><?php _e( 'Tags' ); ?></span> 678 <textarea cols="22" rows="1" name="tags_input" class="tags_input"></textarea> 679 </label></div> 680 </fieldset> 681 682 <p class="submit inline-edit-save"><a accesskey="c" 683 href="#inline-edit" title="<?php _e('Cancel'); ?>" 684 class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a> 685 <?php 686 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); 687 $update_text = __('Update link','zelist'); 688 ?> <a accesskey="s" href="#inline-edit" 689 title="<?php _e('Update'); ?>" 690 class="button-primary save alignright"><?php echo attribute_escape( $update_text ); ?></a> 691 <img class="waiting" style="display: none;" src="images/loading.gif" 692 alt="" /> <input type="hidden" name="post_view" 693 value="<?php echo $m; ?>" /> <br class="clear" /> 694 </p> 695 </td> 696 </tr> 697 </tbody> 698 </table> 699 </form> 700 <?php 701 } 702 703 // adds hidden fields with the data for use in the inline editor for posts and pages 704 /** 705 * {@internal Missing Short Description}} 706 * 707 * @since unknown 708 * 709 * @param unknown_type $post 710 */ 711 function get_link_inline_data($link) { 712 713 if ( ! current_user_can('edit_links', $link->ID) ) 714 return; 715 716 echo ' 717 <div class="hidden" id="inline_' . $link->link_id . '"> 718 <div class="link_name">' . $link->link_name . '</div> 719 <div class="link_owner">' . $link->link_owner . '</div> 720 <div class="link_description">'.$link->link_description.'</div> 721 <div class="_url">'.$link->link_url.'</div> 722 <div class="_status">' . $link->link_status . '</div> 723 <div class="tags_input">' . wp_specialchars( str_replace( ',', ', ', get_link_tags_to_edit($link->link_id) ), 1) . '</div> 724 <div class="link_category">' . implode( ',', wp_get_link_categories( $link->link_id ) ) . '</div> 725 </div>'; 726 } 727 728 729 730 function banreason_label($reason) { 731 if($reason == 'notpertinent') $label = __('Not pertinent','zelist'); 732 elseif($reason == 'incomplete') $label = __('Incomplete','zelist'); 733 elseif($reason == 'spam') $label = __('Spam','zelist'); 734 elseif($reason == 'short_description') $label = __('Description too short','zelist'); 735 elseif($reason == 'noimage') $label = __('Missing Image','zelist'); 736 elseif($label = apply_filters('ban_reason_label',$reason) && !empty($label)) $label = __($label,'zelist'); 737 else $label = __($reason,'zelist'); 738 return $label; 739 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat May 30 23:51:06 2009 | Cross-referenced by PHPXref 0.7 |