本文整理汇总了PHP中cat_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP cat_rows函数的具体用法?PHP cat_rows怎么用?PHP cat_rows使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cat_rows函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cat_rows
function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
if ( !$categories ) {
$args = array('hide_empty' => 0);
if ( !empty($_GET['s']) )
$args['search'] = $_GET['s'];
$categories = get_categories( $args );
}
$children = _get_term_hierarchy('category');
if ( $categories ) {
ob_start();
foreach ( $categories as $category ) {
if ( $category->parent == $parent) {
echo "\t" . _cat_row( $category, $level );
if ( isset($children[$category->term_id]) )
cat_rows( $category->term_id, $level +1, $categories );
}
}
$output = ob_get_contents();
ob_end_clean();
$output = apply_filters('cat_rows', $output);
echo $output;
} else {
return false;
}
}
示例2: cat_rows
function cat_rows($parent = 0, $level = 0, $categories = 0)
{
global $wpdb, $wp_id, $bgcolor;
if (!$categories) {
$categories = $wpdb->get_results("SELECT * FROM {$wpdb->categories[$wp_id]} ORDER BY cat_name");
}
if ($categories) {
foreach ($categories as $category) {
if ($category->category_parent == $parent) {
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM {$wpdb->post2cat[$wp_id]} WHERE category_id = {$category->cat_ID}");
$pad = str_repeat('— ', $level);
$bgcolor = '#eee' == $bgcolor ? 'none' : '#eee';
echo "<tr style='background-color: {$bgcolor}'><th scope='row'>{$category->cat_ID}</th><td>{$pad} {$category->cat_name}</td>\n\t\t\t\t<td>{$category->category_description}</td>\n\t\t\t\t<td>{$count}</td>\n\t\t\t\t<td><a href='categories.php?action=edit&cat_ID={$category->cat_ID}' class='edit'>" . _LANG_C_NAME_EDIT . "</a></td><td><a href='categories.php?action=Delete&cat_ID={$category->cat_ID}' onclick=\"return confirm('" . sprintf("You are about to delete the category \\'%s\\'. All of its posts will go to the default category.\\n \\'OK\\' to delete, \\'Cancel\\' to stop.", addslashes($category->cat_name)) . "')\" class='delete'>" . _LANG_C_NAME_DELETE . "</a></td>\n\t\t\t\t</tr>";
cat_rows($category->cat_ID, $level + 1);
}
}
} else {
return false;
}
}
示例3: cat_rows
function cat_rows($parent = 0, $level = 0, $categories = 0)
{
global $wpdb, $class, $user_level;
if (!$categories) {
$categories = $wpdb->get_results("SELECT * FROM {$wpdb->categories} ORDER BY cat_name");
}
if ($categories) {
foreach ($categories as $category) {
if ($category->category_parent == $parent) {
$category->cat_name = wp_specialchars($category->cat_name);
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM {$wpdb->post2cat} WHERE category_id = {$category->cat_ID}");
$pad = str_repeat('— ', $level);
if ($user_level > 3) {
$edit = "<a href='categories.php?action=edit&cat_ID={$category->cat_ID}' class='edit'>" . __('Edit') . "</a></td><td><a href='categories.php?action=delete&cat_ID={$category->cat_ID}' onclick=\"return confirm('" . sprintf(__("You are about to delete the category \\'%s\\'. All of its posts will go to the default category.\\n \\'OK\\' to delete, \\'Cancel\\' to stop."), addslashes($category->cat_name)) . "')\" class='delete'>" . __('Delete') . "</a>";
} else {
$edit = '';
}
$class = 'alternate' == $class ? '' : 'alternate';
echo "<tr class='{$class}'><th scope='row'>{$category->cat_ID}</th><td>{$pad} {$category->cat_name}</td>\n\t\t\t\t<td>{$category->category_description}</td>\n\t\t\t\t<td>{$count}</td>\n\t\t\t\t<td>{$edit}</td>\n\t\t\t\t</tr>";
cat_rows($category->cat_ID, $level + 1, $categories);
}
}
} else {
return false;
}
}
示例4: _e
</th>
<th scope="col"><?php
_e('Description');
?>
</th>
<th scope="col"><?php
_e('# Posts');
?>
</th>
<th colspan="2"><?php
_e('Action');
?>
</th>
</tr>
<?php
cat_rows();
?>
</table>
<div id="ajax-response"></div>
</div>
<?php
if (current_user_can('manage_categories')) {
?>
<div class="wrap">
<p><?php
printf(__('<strong>Note:</strong><br />Deleting a category does not delete posts from that category, it will just set them back to the default category <strong>%s</strong>.'), get_catname(get_option('default_category')));
?>
</p>
示例5: cat_rows
function cat_rows($parent = 0, $level = 0, $categories = 0)
{
global $wpdb, $class;
if (!$categories) {
$categories = $wpdb->get_results("SELECT * FROM {$wpdb->categories} ORDER BY cat_name");
}
if ($categories) {
foreach ($categories as $category) {
if ($category->category_parent == $parent) {
$category->cat_name = wp_specialchars($category->cat_name);
$pad = str_repeat('— ', $level);
if (current_user_can('manage_categories')) {
$edit = "<a href='categories.php?action=edit&cat_ID={$category->cat_ID}' class='edit'>" . __('Edit') . "</a></td>";
$default_cat_id = get_option('default_category');
if ($category->cat_ID != $default_cat_id) {
$edit .= "<td><a href='" . wp_nonce_url("categories.php?action=delete&cat_ID={$category->cat_ID}", 'delete-category_' . $category->cat_ID) . "' onclick=\"return deleteSomething( 'cat', {$category->cat_ID}, '" . sprintf(__("You are about to delete the category "%s". All of its posts will go to the default category.\\n"OK" to delete, "Cancel" to stop."), js_escape($category->cat_name)) . "' );\" class='delete'>" . __('Delete') . "</a>";
} else {
$edit .= "<td style='text-align:center'>" . __("Default");
}
} else {
$edit = '';
}
$class = 'alternate' == $class ? '' : 'alternate';
echo "<tr id='cat-{$category->cat_ID}' class='{$class}'><th scope='row'>{$category->cat_ID}</th><td>{$pad} {$category->cat_name}</td>\n\t\t\t\t\t\t\t\t<td>{$category->category_description}</td>\n\t\t\t\t\t\t\t\t<td>{$category->category_count}</td>\n\t\t\t\t\t\t\t\t<td>{$edit}</td>\n\t\t\t\t\t\t\t\t</tr>";
cat_rows($category->cat_ID, $level + 1, $categories);
}
}
} else {
return false;
}
}
示例6: print_column_headers
print_column_headers('categories');
?>
</tr>
</thead>
<tfoot>
<tr>
<?php
print_column_headers('categories', false);
?>
</tr>
</tfoot>
<tbody id="the-list" class="list:cat">
<?php
cat_rows(0, 0, 0, $pagenum, $cats_per_page);
?>
</tbody>
</table>
<div class="tablenav">
<?php
if ($page_links) {
echo "<div class='tablenav-pages'>{$page_links}</div>";
}
?>
<div class="alignleft actions">
<select name="action2">
<option value="" selected="selected"><?php
_e('Bulk Actions');
示例7: print_column_headers
print_column_headers('categories');
?>
</tr>
</thead>
<tfoot>
<tr>
<?php
print_column_headers('categories', false);
?>
</tr>
</tfoot>
<tbody id="the-list" class="list:cat">
<?php
cat_rows(0, 0, 0, $pagenum, $catsperpage);
?>
</tbody>
</table>
<div class="tablenav">
<?php
if ($page_links) {
echo "<div class='tablenav-pages'>{$page_links}</div>";
}
?>
<div class="alignleft actions">
<select name="action2">
<option value="" selected="selected"><?php
_e('Bulk Actions');
示例8: cat_rows
function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
if (!$categories )
$categories = get_categories( 'hide_empty=0' );
$children = _get_category_hierarchy();
if ( $categories ) {
ob_start();
foreach ( $categories as $category ) {
if ( $category->category_parent == $parent) {
echo "\t" . _cat_row( $category, $level );
if ( isset($children[$category->cat_ID]) )
cat_rows( $category->cat_ID, $level +1, $categories );
}
}
$output = ob_get_contents();
ob_end_clean();
$output = apply_filters('cat_rows', $output);
echo $output;
} else {
return false;
}
}
示例9: cat_rows
function cat_rows($parent = 0, $level = 0, $categories = 0)
{
global $wpdb, $wp_id;
$myts =& MyTextSanitizer::getInstance();
if (!$categories) {
$categories = $wpdb->get_results("SELECT * FROM {$wpdb->categories[$wp_id]} ORDER BY cat_name");
}
if ($categories) {
$i = 0;
foreach ($categories as $category) {
if ($category->category_parent == $parent) {
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM {$wpdb->post2cat[$wp_id]} WHERE category_id = {$category->cat_ID}");
$pad = str_repeat('— ', $level);
$i++;
$style = $i % 2 ? ' class="alternate"' : '';
$confirm_msg = sprintf('You are about to delete the category\\\'%s\\\'\\nAll of its posts will go to the default category.\\n\\\'OK\\\' to delete, \\\'Cancel\\\' to stop.', $myts->htmlSpecialChars(addslashes($category->cat_name)));
?>
<tr <?php
echo $style;
?>
>
<th scope='row'><?php
echo $category->cat_ID;
?>
</th>
<td><?php
echo "{$pad} {$category->cat_name}";
?>
</td>
<td><?php
echo $category->category_description;
?>
</td>
<td><?php
echo $count;
?>
</td>
<td><a href='categories.php?action=edit&cat_ID=<?php
echo $category->cat_ID;
?>
' class='edit'><?php
echo _LANG_C_NAME_EDIT;
?>
</a></td>
<td><a href='categories.php?action=Delete&cat_ID=<?php
echo $category->cat_ID;
?>
' onclick="return confirm('<?php
echo $confirm_msg;
?>
')" class='delete'><?php
echo _LANG_C_NAME_DELETE;
?>
</a></td>
</tr>
<?php
cat_rows($category->cat_ID, $level + 1);
}
}
} else {
return false;
}
}
示例10: cat_rows
function cat_rows($parent = 0, $level = 0, $categories = 0) {
global $wpdb, $class;
if (!$categories)
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
if ($categories) {
foreach ($categories as $category) {
if ($category->category_parent == $parent) {
$category->cat_name = wp_specialchars($category->cat_name);
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
$pad = str_repeat('— ', $level);
if ( current_user_can('manage_categories') ) {
$edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
$default_cat_id = get_option('default_category');
if ($category->cat_ID != $default_cat_id)
$edit .= "<td><a href='categories.php?action=delete&cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category "%s". All of its posts will go to the default category.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
else
$edit .= "<td style='text-align:center'>".__("Default");
}
else
$edit = '';
$class = ('alternate' == $class) ? '' : 'alternate';
echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td>
<td>$category->category_description</td>
<td>$count</td>
<td>$edit</td>
</tr>";
cat_rows($category->cat_ID, $level +1, $categories);
}
}
} else {
return false;
}
}