function b_wp_categories_show($options) { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] ? $options[1] : 0; $sorting_key = $options[2] ? $options[2] : 'name'; $sorting_order = $options[3] ? $options[3] : 'asc'; $id = 1; global $dateformat, $time_difference, $siteurl, $blogfilename; global $tablelinks, $tablelinkcategories; global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week; global $tableposts, $tablepost2cat, $tablecomments, $tablecategories; global $smilies_directory, $use_smilies, $wp_smiliessearch, $wp_smiliesreplace; global $wp_bbcode, $use_bbcode, $wp_gmcode, $use_gmcode, $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni; require_once dirname(__FILE__) . '/../wp-blog-header.php'; if ($block_style == 0) { // Simple Listing ob_start(); list_cats(0, 'All', $sorting_key, $sorting_order, '', true, 0, $with_count); $block['content'] = ob_get_contents(); ob_end_clean(); } else { // Dropdown Listing $file = "{$siteurl}/{$blogfilename}"; $link = $file . $querystring_start . 'cat' . $querystring_equal; ob_start(); echo '<form name="listcatform" action="">'; $select_str = '<select name="cat" onchange="window.location = (\'' . $link . '\'+document.forms.listcatform.cat[document.forms.listcatform.cat.selectedIndex].value);"> '; dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count); echo '</form>'; $block_str = ob_get_contents(); ob_end_clean(); $block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str); } return $block; }
function b_wp_categories_show($option) { $id = 1; require_once dirname(__FILE__) . '/../wp-blog-header.php'; global $wpdb, $tablecomments, $tableposts; ob_flush(); ob_start(); list_cats(0, 'All', 'name'); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_categories_show($option) { global $tableposts, $tablepost2cat, $tablecomments, $tablecategories; global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename; global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week; $id = 1; require_once dirname(__FILE__) . '/../wp-blog-header.php'; ob_flush(); ob_start(); list_cats(0, 'All', 'name'); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function b_wp_categories_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] ? $options[1] : 0; $sorting_key = $options[2] ? $options[2] : 'name'; $sorting_order = $options[3] ? $options[3] : 'asc'; global $wpdb, $siteurl, $wp_id, $wp_inblock, $user_cache, $cache_categories, $category_name, $cat; $id = 1; $use_cache = 1; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } $cur_PATH = $_SERVER['SCRIPT_FILENAME']; if (preg_match("/^" . preg_quote(XOOPS_ROOT_PATH . "/modules/wordpress" . $wp_num . "/", "/") . "/i", $cur_PATH)) { $cat = array_key_exists('cat', $_GET) ? intval($_GET['cat']) : null; $category_name = array_key_exists('category_name', $_GET) ? $_GET['category_name'] : ''; if ($category_name and $cat == 0) { $category_name = preg_replace('|/+$|', '', $category_name); $cat = $wpdb->get_var("SELECT cat_ID FROM {$wpdb->categories[$wp_id]} WHERE category_nicename='{$category_name}'"); } } else { $cat = 0; $category_name = ""; } if ($block_style == 0) { // Simple Listing ob_start(); list_cats(0, 'All', $sorting_key, $sorting_order, '', true, 0, $with_count); $block['content'] = ob_get_contents(); ob_end_clean(); } else { // Dropdown Listing $file = "{$siteurl}/index.php"; $link = $file . '?cat='; ob_start(); echo '<form name="listcatform' . $wp_num . '" action="">'; $select_str = '<select name="cat" onchange="window.location = (\'' . $link . '\'+document.forms.listcatform' . $wp_num . '.cat[document.forms.listcatform' . $wp_num . '.cat.selectedIndex].value);"> '; dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count); echo '</form>'; $block_str = ob_get_contents(); ob_end_clean(); $block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str); } return $block; }
function b_wp_categories_show($option) { $id = 1; global $dateformat, $time_difference, $siteurl, $blogfilename; global $tablelinks, $tablelinkcategories; global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week; global $tableposts, $tablepost2cat, $tablecomments, $tablecategories; global $smilies_directory, $use_smilies, $wp_smiliessearch, $wp_smiliesreplace; global $wp_bbcode, $use_bbcode, $wp_gmcode, $use_gmcode, $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni; require_once dirname(__FILE__) . '/../wp-blog-header.php'; ob_start(); list_cats(0, 'All', 'name'); $block['content'] = ob_get_contents(); ob_end_clean(); return $block; }
function categories_sidebar_module($args) { extract($args); echo $before_module . $before_title . $title . $after_title; ?> <ul> <?php if (function_exists('wp_list_categories')) { wp_list_categories('title_li=&show_count=1&hierarchical=0'); } else { list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0, '', '', '', '', ''); } ?> </ul> <?php echo $after_module; }
function b_wp_categories_show($options, $wp_num = "") { $block_style = $options[0] ? $options[0] : 0; $with_count = $options[1] ? $options[1] : 0; $sorting_key = $options[2] ? $options[2] : 'name'; $sorting_order = $options[3] ? $options[3] : 'asc'; global $wpdb, $siteurl, $wp_id, $wp_inblock, $user_cache, $category_name, $cat; $id = 1; $use_cache = 1; $cat = intval($_GET['cat']); $category_name = $_GET['category_name']; if ($wp_num == "") { $wp_id = $wp_num; $wp_inblock = 1; require dirname(__FILE__) . '/../wp-config.php'; $wp_inblock = 0; } if ($block_style == 0) { // Simple Listing ob_start(); list_cats(0, 'All', $sorting_key, $sorting_order, '', true, 0, $with_count); $block['content'] = ob_get_contents(); ob_end_clean(); } else { // Dropdown Listing $file = "{$siteurl}/index.php"; $link = $file . '?cat='; ob_start(); echo '<form name="listcatform' . $wp_num . '" action="">'; $select_str = '<select name="cat" onchange="window.location = (\'' . $link . '\'+document.forms.listcatform' . $wp_num . '.cat[document.forms.listcatform' . $wp_num . '.cat.selectedIndex].value);"> '; dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count); echo '</form>'; $block_str = ob_get_contents(); ob_end_clean(); $block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str); } return $block; }
function list_cats($parent, $lev, $color, $message) { global $mysql_table_prefix; if ($lev == 0) { ?> <div id="submenu"> <ul> <li><a href="admin.php?f=add_cat">Add category</a> </li> </ul> </div> <?php print $message; print "<br/>"; print "<br/><div align=\"center\"><center><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\" width =\"600\"><tr><td><table table cellpadding=\"3\" cellspacing=\"1\" width=\"100%\">\n"; } $space = ""; for ($x = 0; $x < $lev; $x++) { $space .= " "; } $query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent} ORDER BY category"; $result = mysql_query($query); echo mysql_error(); if (mysql_num_rows($result) != '') { while ($row = mysql_fetch_array($result)) { if ($color == "white") { $color = "grey"; } else { $color = "white"; } $id = $row['category_id']; $cat = $row['category']; print "<tr class=\"{$color}\"><td width=90% align=left>{$space}<a href=\"admin.php?f=edit_cat&cat_id={$id}\">" . stripslashes($cat) . "</a></td><td><a href=\"admin.php?f=edit_cat&cat_id={$id}\" id=\"small_button\">Edit</a></td><td> <a href=\"admin.php?f=11&cat_id={$id}\" onclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" id=\"small_button\">Delete</a></td></tr>\n"; $color = list_cats($id, $lev + 1, $color, ""); } } if ($lev == 0) { print "</table></td></tr></table></center></div>\n"; } return $color; }
function list_cats($cat, $indent = 0) { foreach ($cat as $v) { ?> <tr> <td><?php echo str_repeat(" ", $indent * 4); echo $v['category_title']; ?> </td> <td><?php echo $v['category_slug']; ?> </td> <td> 6565 </td> </tr> <?php if (!empty($v['category_subcats'])) { list_cats($v['category_subcats'], $indent + 1); } } }
<div id="menu"> <h4>quick links:</h4> <a href="http://www.cafelog.com" title="b2's homepage">cafelog.com</a><br /> <a href="http://some other site" title="another link">another link</a><br /> <a href="http://some other site" title="another link">another link</a><br /> <a href="http://some other site" title="another link">another link</a><br /> <h4>categories:</h4> <?php list_cats(0, 'All', 'name'); ?> <h4>search:</h4> <form name="searchform" method="get" action="<?php echo $PHP_SELF; /*$siteurl."/".$blogfilename*/ ?> "> <p> <input type="text" name="s" size="15" /><br /> <input type="submit" name="submit" value="search" /> </p> </form>
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) { global $wpdb, $wp_query; // Optiondates now works if ( '' == $file ) $file = get_settings('home') . '/'; $exclusions = ''; if ( !empty($exclude) ) { $excats = preg_split('/[\s,]+/',$exclude); if ( count($excats) ) { foreach ( $excats as $excat ) { $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; } } } $exclusions = apply_filters('list_cats_exclusions', $exclusions ); if ( intval($categories) == 0 ) { $sort_column = 'cat_'.$sort_column; $query = " SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, category_count FROM $wpdb->categories WHERE cat_ID > 0 $exclusions ORDER BY $sort_column $sort_order"; $categories = $wpdb->get_results($query); } if ( $optiondates ) { $cat_dates = $wpdb->get_results(" SELECT category_id, UNIX_TIMESTAMP( MAX(post_date) ) AS ts FROM $wpdb->posts, $wpdb->post2cat, $wpdb->categories WHERE post_status = 'publish' AND post_id = ID $exclusions GROUP BY category_id"); foreach ( $cat_dates as $cat_date ) { $category_timestamp["$cat_date->category_id"] = $cat_date->ts; } } $num_found=0; $thelist = ""; foreach ( (array) $categories as $category ) { if ( ( intval($hide_empty) == 0 || $category->category_count) && (!$hierarchical || $category->category_parent == $child_of) ) { $num_found++; $link = '<a href="'.get_category_link($category->cat_ID).'" '; if ( $use_desc_for_title == 0 || empty($category->category_description) ) $link .= 'title="'. sprintf(__("View all posts filed under %s"), attribute_escape($category->cat_name)) . '"'; else $link .= 'title="' . attribute_escape(apply_filters('category_description',$category->category_description,$category)) . '"'; $link .= '>'; $link .= apply_filters('list_cats', $category->cat_name, $category).'</a>'; if ( (! empty($feed_image)) || (! empty($feed)) ) { $link .= ' '; if ( empty($feed_image) ) $link .= '('; $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"'; if ( !empty($feed) ) { $title = ' title="' . $feed . '"'; $alt = ' alt="' . $feed . '"'; $name = $feed; $link .= $title; } $link .= '>'; if ( !empty($feed_image) ) $link .= "<img src='$feed_image' $alt$title" . ' />'; else $link .= $name; $link .= '</a>'; if (empty($feed_image)) $link .= ')'; } if ( intval($optioncount) == 1 ) $link .= ' ('.intval($category->category_count).')'; if ( $optiondates ) { if ( $optiondates == 1 ) $optiondates = 'Y-m-d'; $link .= ' ' . gmdate($optiondates, $category_timestamp["$category->cat_ID"]); } if ( $list ) { $thelist .= "\t<li"; if (($category->cat_ID == $wp_query->get_queried_object_id()) && is_category()) { $thelist .= ' class="current-cat"'; } $thelist .= ">$link\n"; } else { $thelist .= "\t$link<br />\n"; } if ($hierarchical && $children) $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical); if ($list) $thelist .= "</li>\n"; } } if ( !$num_found && !$child_of ) { if ( $list ) { $before = '<li>'; $after = '</li>'; } echo $before . __("No categories") . $after . "\n"; return; } if ( $list && $child_of && $num_found && $recurse ) { $pre = "\t\t<ul class='children'>"; $post = "\t\t</ul>\n"; } else { $pre = $post = ''; } $thelist = $pre . $thelist . $post; if ( $recurse ) return $thelist; echo apply_filters('list_cats', $thelist); }
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = FALSE, $child_of = 0, $categories = 0, $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = FALSE) { global $wpdb, $category_posts; // Optiondates now works if ('' == $file) { $file = get_settings('home') . '/'; } $exclusions = ''; if (!empty($exclude)) { $excats = preg_split('/[\\s,]+/', $exclude); if (count($excats)) { foreach ($excats as $excat) { $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; } } } $exclusions = apply_filters('list_cats_exclusions', $exclusions); if (intval($categories) == 0) { $sort_column = 'cat_' . $sort_column; $query = "\n\t\t\tSELECT cat_ID, cat_name, category_nicename, category_description, category_parent\n\t\t\tFROM {$wpdb->categories}\n\t\t\tWHERE cat_ID > 0 {$exclusions}\n\t\t\tORDER BY {$sort_column} {$sort_order}"; $categories = $wpdb->get_results($query); } if (!count($category_posts)) { $now = current_time('mysql', 1); $cat_counts = $wpdb->get_results("\tSELECT cat_ID,\n\t\tCOUNT({$wpdb->post2cat}.post_id) AS cat_count\n\t\tFROM {$wpdb->categories}\n\t\tINNER JOIN {$wpdb->post2cat} ON (cat_ID = category_id)\n\t\tINNER JOIN {$wpdb->posts} ON (ID = post_id)\n\t\tWHERE post_status = 'publish'\n\t\tAND post_date_gmt < '{$now}' {$exclusions}\n\t\tGROUP BY category_id"); if (!empty($cat_counts)) { foreach ($cat_counts as $cat_count) { if (1 != intval($hide_empty) || $cat_count > 0) { $category_posts["{$cat_count->cat_ID}"] = $cat_count->cat_count; } } } } if ($optiondates) { $cat_dates = $wpdb->get_results("\tSELECT category_id,\n\t\tUNIX_TIMESTAMP( MAX(post_date) ) AS ts\n\t\tFROM {$wpdb->posts}, {$wpdb->post2cat}\n\t\tWHERE post_status = 'publish' AND post_id = ID {$exclusions}\n\t\tGROUP BY category_id"); foreach ($cat_dates as $cat_date) { $category_timestamp["{$cat_date->category_id}"] = $cat_date->ts; } } $num_found = 0; $thelist = ""; foreach ($categories as $category) { if ((intval($hide_empty) == 0 || isset($category_posts["{$category->cat_ID}"])) && (!$hierarchical || $category->category_parent == $child_of)) { $num_found++; $link = '<a href="' . get_category_link($category->cat_ID) . '" '; if ($use_desc_for_title == 0 || empty($category->category_description)) { $link .= 'title="' . sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name)) . '"'; } else { $link .= 'title="' . wp_specialchars(apply_filters('category_description', $category->category_description, $category)) . '"'; } $link .= '>'; $link .= apply_filters('list_cats', $category->cat_name, $category) . '</a>'; if (!empty($feed_image) || !empty($feed)) { $link .= ' '; if (empty($feed_image)) { $link .= '('; } $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"'; if (!empty($feed)) { $title = ' title="' . $feed . '"'; $alt = ' alt="' . $feed . '"'; $name = $feed; $link .= $title; } $link .= '>'; if (!empty($feed_image)) { $link .= "<img src='{$feed_image}' {$alt}{$title}" . ' />'; } else { $link .= $name; } $link .= '</a>'; if (empty($feed_image)) { $link .= ')'; } } if (intval($optioncount) == 1) { $link .= ' (' . intval($category_posts["{$category->cat_ID}"]) . ')'; } if ($optiondates) { if ($optiondates == 1) { $optiondates = 'Y-m-d'; } $link .= ' ' . gmdate($optiondates, $category_timestamp["{$category->cat_ID}"]); } if ($list) { $thelist .= "\t<li>{$link}\n"; } else { $thelist .= "\t{$link}<br />\n"; } if ($hierarchical && $children) { $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical); } if ($list) { $thelist .= "</li>\n"; } } } if (!$num_found && !$child_of) { if ($list) { $before = '<li>'; $after = '</li>'; } echo $before . __("No categories") . $after . "\n"; return; } if ($list && $child_of && $num_found && $recurse) { $pre = "\t\t<ul class='children'>"; $post = "\t\t</ul>\n"; } else { $pre = $post = ''; } $thelist = $pre . $thelist . $post; if ($recurse) { return $thelist; } echo apply_filters('list_cats', $thelist); }
/** *@desc the output of the categoriy menu * @param array $data - holding the switches * @param int $number - the curretn widget number */ function king_cat_output($data, $number) { echo '<!-- Start King Cat ' . $number . ' -->' . "\n"; echo $data['before_widget'] . "\n"; echo $data['before_widget_title'] . "\n"; echo $data['title'] . "\n"; echo $data['after_widget_title'] . "\n"; if (function_exists('wswwpx_list_cats') && !empty($options[$number]['foldlist'])) { wswwpx_list_cats($data['optionall'] = 0, $data['all'] = 'All', $data['sort_column'], $data['sort_order'], $data['file'], $data['list'], $data['optiondates'], $data['optioncount'], $data['hide_empty'], $data['use_desc_for_title'], $data['children'], $data['child_of'], $data['categories'] = 0, $data['recurse'] = 0, $data['feed'], $data['feed_image'], $data['exclude'], $data['hierarchical']); } else { list_cats($data['optionall'] = 0, $data['all'] = 'All', $data['sort_column'], $data['sort_order'], $data['file'], $data['list'], $data['optiondates'], $data['optioncount'], $data['hide_empty'], $data['use_desc_for_title'], $data['children'], $data['child_of'], $data['categories'] = 0, $data['recurse'] = 0, $data['feed'], $data['feed_image'], $data['exclude'], $data['hierarchical']); } echo $data['after_widget'] . "\n"; echo '<!-- End Cat ' . $number . ' -->' . "\n"; return; }
function list_cats($parent, $lev, $color, $message) { global $db_con, $mysql_table_prefix, $debug, $dba_act; if ($lev == 0) { echo "<div class='submenu cntr y3'>| Database {$dba_act} Table prefix '{$mysql_table_prefix}' |<br />\n <ul>\n <li><a href='admin.php?f=add_cat'>Add category</a></li>\n </ul>\n </div>\n"; echo $message; echo "<div class='panel'>\n <table width='100%'>\n <tr>\n <td class='tblhead' colspan='3'>Categories</td>\n </tr>\n "; } $space = ""; for ($x = 0; $x < $lev; $x++) { $space .= "<span class='tree'>»</span> "; } $sql_query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent} ORDER BY category"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } if ($result->num_rows) { while ($row = $result->fetch_array(MYSQLI_ASSOC)) { if ($color == "odrow") { $color = "evrow"; } else { $color = "odrow"; } $id = $row['category_id']; $cat = $row['category']; echo "<tr class='{$color}'>\n "; if (!$space == "") { echo "<td width='90%'>\n <div>{$space}<a class='options' href='admin.php?f=edit_cat&cat_id={$id}'\n title='Edit this Sub-Category'>" . stripslashes($cat) . "</a></div></td>\n <td class='options'><a href='admin.php?f=edit_cat&cat_id={$id}' class='options' title='Edit this Sub-Category'>Edit</a></td>\n <td class='options'><a href='admin.php?f=11&cat_id={$id}' title='Delete this Sub-Category'\n onclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" class='options'>Delete</a></td>\n </tr>\n "; } else { echo "<td width='90%'><a class='options' href='admin.php?f=edit_cat&cat_id={$id}'\n title='Edit this Category'>" . stripslashes($cat) . "</a></td>\n <td class='options'><a href='admin.php?f=edit_cat&cat_id={$id}' class='options' title='Edit this Category'>Edit</a></td>\n <td class='options'><a href='admin.php?f=11&cat_id={$id}' title='Delete this Category'\n onclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" class='options'>Delete</a></td>\n </tr>\n"; } $color = list_cats($id, $lev + 1, $color, ""); } } if ($lev == 0) { echo "</table>\n</div>\n"; } return $color; }
<div id="ContextualContent"> <?php if (is_single() && function_exists('the_terms2posts')) { ?> <h4>Related Entries</h4> <ul class="ContextualList"> <?php the_terms2posts(); ?> </ul> <?php } ?> <h4>Categories</h4> <ul class="ContextualList"> <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 0, 1, 1, 1, 0, '', '', '', '', ''); ?> </ul> <h4>Archives</h4> <ul class="ContextualList"> <?php wp_get_archives('type=monthly'); ?> </ul> </div>
$message = addcat($category, $parent); list_cats(0, 0, "evrow", $message); break; case categories: list_cats(0, 0, "evrow", ""); break; case edit_cat: editcatform($cat_id); break; case 10: $message = editcat($cat_id, $category); list_cats(0, 0, "evrow", $message); break; case 11: deletecat($cat_id); list_cats(0, 0, "evrow"); break; case 14: clearBestMedia(); break; case 15: $back = "1"; cleanKeywords($back); break; case 16: $back = "1"; cleanLinks($back); break; case 17: $back = '1'; cleanTemp($back);
* Author URI: http://www.kiuz.it * Version: 0.5 */ ?> <?php get_header(); ?> <p> <h2>Pagina o contenuto inesistente!</h2> Spiacenti, ma stai cercando qualcosa che non è raggiungibile attraverso il presente indirizzo, potrebbe essere stato eliminato o spostato in una nuova locazione. <br /> Per maggiori informazioni contatta l'amministratore e/o prova ad utilizzare gli strumenti messi a disposizione in questa pagina. <br /> <br /> Scusateci per l'incoveniente. <br /><br /> <h3>Prova ad effettuare una ricaerca:</h3> <form method="get" id="searchform" action="<?php bloginfo('url'); ?> /"><input type="text" name="s" id="s" value="Inserisci testo" onfocus="document.forms['searchform'].s.value='';" onblur="if (document.forms['searchform'].s.value == '') document.forms['searchform'].s.value='Search Keywords';" /><input type="submit" id="searchsubmit" value="Cerca" /></form><br /> <h3>Cerca tra le categorie:</h3> <?php list_cats(); ?> </p> <?php get_sidebar(); get_footer();
function smarty_list_cats($params) { extract($params); list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty); }
#The full software license can be found here: #http://www.accounting-123.com/a.php?a=153/GPLv3 # # # # # # # # # # # require "settings.php"; require "libs/crm.lib.php"; $OUTPUT = list_cats(); $OUTPUT .= "<p>\r\n\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='tcat-add.php'>Add Query Category</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='tcat-list.php'>View Query Categories</a></td></tr>\r\n\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t<tr class='bg-odd'><td><a href='index.php'>My Business</a></td></tr>\r\n\t</table>"; require "template.php"; function list_cats() { db_conn('crm'); $Sl = "SELECT * FROM tcats WHERE div='" . USER_DIV . "' ORDER BY name"; $Ry = db_exec($Sl) or errDie("Unable to list teams."); if (pg_numrows($Ry) < 1) { dc(); $Sl = "SELECT * FROM tcats WHERE div='" . USER_DIV . "' ORDER BY name"; $Ry = db_exec($Sl) or errDie("Unable to list teams."); } $out = "<h3>Query Categories</h3>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Name</th><th>Description</th><th colspan=2>Options</th></tr>"; $i = 0; while ($tcatdata = pg_fetch_array($Ry)) {
function list_cats($parent, $lev, $color, $message) { // global $db, DEBUG; if ($lev == 0) { echo "<div class='submenu'>\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<li><a href='index.php?f=add_cat'>Add category</a></li>\r\n\t\t\t\t</ul>\r\n\t\t\t</div>"; echo $message; echo "<div class='panel'>\r\n\t\t\t\t<table width='100%'>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='tblhead' colspan='3'>Categories</td>\r\n\t\t\t\t</tr>"; } $space = ""; for ($x = 0; $x < $lev; $x++) { $space .= "<span class='tree'>»</span> "; } $query = "SELECT * FROM " . TABLE_PREFIX . "categories WHERE parent_num={$parent} ORDER BY category"; $result = mysql_query($query); if (DEBUG > '0') { echo mysql_error(); } if (mysql_num_rows($result) != '') { while ($row = mysql_fetch_array($result)) { if ($color == "odrow") { $color = "evrow"; } else { $color = "odrow"; } $id = $row['category_id']; $cat = $row['category']; echo "<tr class='{$color}'>"; if (!$space == "") { echo "<td width='90%'>\r\n\t\t\t\t\t\t\t<div>{$space}<a class='options' href='index.php?f=edit_cat&cat_id={$id}'\r\n\t\t\t\t\t\t\t\ttitle='Edit this Sub-Category'>" . stripslashes($cat) . "</a></div></td>\r\n\t\t\t\t\t\t\t<td class='options'><a href='index.php?f=edit_cat&cat_id={$id}' class='options' title='Edit this Sub-Category'>Edit</a></td>\r\n\t\t\t\t\t\t\t<td class='options'><a href='index.php?f=11&cat_id={$id}' title='Delete this Sub-Category'\r\n\t\t\t\t\t\t\t\tonclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" class='options'>Delete</a></td>\r\n\t\t\t\t\t\t</tr>"; } else { echo "<td width='90%'><a class='options' href='index.php?f=edit_cat&cat_id={$id}'\r\n\t\t\t\t\t\t\t\ttitle='Edit this Category'>" . stripslashes($cat) . "</a></td>\r\n\t\t\t\t\t\t\t<td class='options'><a href='index.php?f=edit_cat&cat_id={$id}' class='options' title='Edit this Category'>Edit</a></td>\r\n\t\t\t\t\t\t\t<td class='options'><a href='index.php?f=11&cat_id={$id}' title='Delete this Category'\r\n\t\t\t\t\t\t\t\tonclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" class='options'>Delete</a></td>\r\n\t\t\t\t\t\t</tr>"; } $color = list_cats($id, $lev + 1, $color, ""); } } if ($lev == 0) { echo "</table>\r\n\t</div>\r\n\t"; } return $color; }
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = FALSE, $child_of = 0, $categoryObjects = null, $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = FALSE, $echo = true) { $list_cats = ''; // Optiondates now works if ('' == $file) { $file = wp_siteurl() . '/index.php'; } $excludeCriteria = null; if (!empty($exclude)) { $excats = preg_split('/[\\s,]+/', $exclude); if (count($excats)) { $excludeCriteria = new CriteriaCompo(); foreach ($excats as $excat) { $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; $excludeCriteria->add(new Criteria('cat_ID', $excat, '!=')); $catc = trim(get_category_children($excat, '', ' ')); $catc_array = explode(' ', $catc); for ($i = 0; $i < count($catc_array); $i++) { $excludeCriteria->add(new Criteria('category_id', intval($catc_array[$i]), '!=')); } } } } $categoryHandler =& wp_handler('Category'); if (!$categoryObjects) { $criteria =& new CriteriaCompo(new Criteria('cat_ID', 0, '>')); if ($excludeCriteria) { $criteria->add($excludeCriteria); } $criteria->setSort('cat_' . $sort_column); $criteria->setOrder($sort_order); $categoryObjects =& $categoryHandler->getObjects($criteria, false, 'cat_ID, cat_name, category_nicename, category_description cat_description, category_parent'); } if (empty($GLOBALS['category_posts']) || !count($GLOBALS['category_posts'])) { $criteria =& new CriteriaCompo('post_status', 'publish'); if ($excludeCriteria) { $criteria->add($excludeCriteria); } $criteria->setGroupBy('category_id'); $joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'cat_ID', 'category_id', 'INNER'); $joinCriteria->cascade(new XoopsJoinCriteria(wp_table('posts'), 'post_id', 'ID', 'INNER')); $categoryPostsObjects =& $categoryHandler->getObjects($criteria, false, 'cat_ID, COUNT(' . wp_table('post2cat') . '.post_id) AS cat_count', false, $joinCriteria); if ($categoryPostsObjects) { foreach ($categoryPostsObjects as $categoryObject) { if (intval($hide_empty) != 1 || $categoryObject->getExtraVar('cat_count') > 0) { $GLOBALS['category_posts'][$categoryObject->getVar('cat_ID')] = $categoryObject->getExtraVar('cat_count'); } } } } if (intval($optiondates) == 1) { $criteria =& new CriteriaCompo('post_status', 'publish'); if ($excludeCriteria) { $criteria->add($excludeCriteria); } $criteria->setGroupBy('category_id'); $joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'cat_ID', 'category_id', 'INNER'); $joinCriteria->cascade(new XoopsJoinCriteria(wp_table('posts'), 'post_id', 'ID', 'INNER')); $categoryDateObjects =& $categoryHandler->getObjects($criteria, false, 'cat_ID, DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth', false, $joinCriteria); foreach ($categoryDateObjects as $categoryObject) { $category_lastday["" . $categoryObject->getVar('cat_ID')] = $categoryObject->getExtraVar('lastday'); $category_lastmonth["" . $categoryObject->getVar('cat_ID')] = $categoryObject->getExtraVar('lastmonth'); } } if (intval($optionall) == 1 && !$child_of && $categoryObjects) { $all = apply_filters('list_cats', $all); $link = "<a href=\"" . $file . '?cat=all">' . $all . "</a>"; if ($list) { $list_cats .= "\n\t<li>{$link}</li>"; } else { $list_cats .= "\t{$link}<br />\n"; } } $num_found = 0; $thelist = ""; foreach ($categoryObjects as $categoryObject) { $category = $categoryObject->exportWpObject(); $child_list = ''; if ((!$hierarchical || $category->category_parent == $child_of) && ($children || $category->category_parent == 0)) { if ($hierarchical && $children) { $child_list = list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categoryObjects, 1, $feed, $feed_image, $exclude, $hierarchical); } if (intval($hide_empty) == 0 || isset($GLOBALS['category_posts']["{$category->cat_ID}"]) || $child_list) { $num_found++; $link = '<a href="' . get_category_link(0, $category->cat_ID, $category->category_nicename) . '" '; if ($use_desc_for_title == 0 || empty($category->cat_description)) { $link .= 'title="' . sprintf("View all posts filed under %s", htmlspecialchars($category->cat_name)) . '"'; } else { $link .= 'title="' . htmlspecialchars(strip_tags($category->cat_description)) . '"'; } $link .= '>'; $link .= apply_filters('list_cats', $category->cat_name) . '</a>'; if (!empty($feed_image) || !empty($feed)) { $link .= ' '; if (empty($feed_image)) { $link .= '('; } $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"'; if (!empty($feed)) { $title = ' title="' . $feed . '"'; $alt = ' alt="' . $feed . '"'; $name = $feed; $link .= $title; } $link .= '>'; if (!empty($feed_image)) { $link .= "<img src=\"{$feed_image}\" border=\"0\"{$alt}{$title}" . ' />'; } else { $link .= $name; } $link .= '</a>'; if (empty($feed_image)) { $link .= ')'; } } if (intval($optioncount) == 1) { $link .= ' (' . intval($GLOBALS['category_posts']["{$category->cat_ID}"]) . ')'; } if (intval($optiondates) == 1) { $link .= ' ' . $category_lastday["{$category->cat_ID}"] . '/' . $category_lastmonth["{$category->cat_ID}"]; } if ($list) { $thelist .= "\t<li>{$link}\n"; } else { $thelist .= "\t{$link}<br />\n"; } if ($hierarchical && $children) { $thelist .= $child_list; } if ($list) { $thelist .= "</li>\n"; } } } } if (!$num_found && !$child_of) { if ($list) { $before = '<li>'; $after = '</li>'; } return _echo($before . "No categories" . $after . "\n", $echo); } if ($list && $child_of && $num_found && $recurse) { $pre = "\t\t<ul class='children'>"; $post = "\t\t</ul>\n"; } else { $pre = $post = ''; } $thelist = $pre . $thelist . $post; if ($recurse) { return $thelist; } $list_cats .= apply_filters('list_cats', $thelist); return _echo($list_cats, $echo); }
<p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives.</p> <?php } ?> </li> <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?> <li><h2><?php _e('Archives'); ?></h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </li> <li><h2><?php _e('Categories'); ?></h2> <ul> <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','') ?> </ul> </li> <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> <?php get_links_list(); ?> <li><h2><?php _e('Meta'); ?></h2> <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li> <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li> <li><a href="http://wordpress.org/" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>">WordPress</a></li> <?php wp_meta(); ?> </ul>
/* Template Name: Archives */ get_header(); ?> <div id="main"> <div id="content"> <div class="entry"> <h3>by Category</h3> <ul> <?php list_cats(0, '', 'name', 'ASC', '/', true, 0, 1); ?> </ul> <h3>by Month</h3> <ul><?php wp_get_archives('type=monthly'); ?> </ul> <h3>Last 20 Entries</h3> <ul class="last_20"> <?php $posts = query_posts('showposts=20'); ?>
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = FALSE, $child_of = 0, $categories = 0, $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = FALSE) { global $wpdb, $category_posts, $wp_id, $siteurl; // Optiondates now works if ('' == $file) { $file = $siteurl . '/index.php'; } $exclusions = ''; if (!empty($exclude)) { $excats = preg_split('/[\\s,]+/', $exclude); if (count($excats)) { foreach ($excats as $excat) { $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; } } } if (intval($categories) == 0) { $sort_column = 'cat_' . $sort_column; $query = "\n\t\t\tSELECT cat_ID, cat_name, category_nicename, category_description cat_description, category_parent\n\t\t\tFROM {$wpdb->categories[$wp_id]}\n\t\t\tWHERE cat_ID > 0 {$exclusions}\n\t\t\tORDER BY {$sort_column} {$sort_order}"; $categories = $wpdb->get_results($query); } if (!count($category_posts)) { $cat_counts = $wpdb->get_results("\tSELECT cat_ID,\n\t\tCOUNT({$wpdb->post2cat[$wp_id]}.post_id) AS cat_count\n\t\tFROM {$wpdb->categories[$wp_id]} \n\t\tINNER JOIN {$wpdb->post2cat[$wp_id]} ON (cat_ID = category_id)\n\t\tINNER JOIN {$wpdb->posts[$wp_id]} ON (ID = post_id)\n\t\tWHERE post_status = 'publish' {$exclusions}\n\t\tGROUP BY category_id"); if (!empty($cat_counts)) { foreach ($cat_counts as $cat_count) { if (1 != intval($hide_empty) || $cat_count > 0) { $category_posts["{$cat_count->cat_ID}"] = $cat_count->cat_count; } } } } if (intval($optiondates) == 1) { $cat_dates = $wpdb->get_results("\tSELECT cat_ID,\n\t\tDAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth\n\t\tFROM {$wpdb->categories[$wp_id]} \n\t\tINNER JOIN {$wpdb->post2cat[$wp_id]} ON (cat_ID = category_id)\n\t\tINNER JOIN {$wpdb->posts[$wp_id]} ON (ID = post_id)\n\t\tWHERE post_status = 'publish' {$exclusions}\n\t\tGROUP BY category_id"); foreach ($cat_dates as $cat_date) { $category_lastday["{$cat_date->cat_ID}"] = $cat_date->lastday; $category_lastmonth["{$cat_date->cat_ID}"] = $cat_date->lastmonth; } } if (intval($optionall) == 1 && !$child_of && $categories) { $all = apply_filters('list_cats', $all); $link = "<a href=\"" . $file . '?cat=all">' . $all . "</a>"; if ($list) { echo "\n\t<li>{$link}</li>"; } else { echo "\t{$link}<br />\n"; } } $num_found = 0; $thelist = ""; foreach ($categories as $category) { if ((intval($hide_empty) == 0 || isset($category_posts["{$category->cat_ID}"])) && (!$hierarchical || $category->category_parent == $child_of) && ($children || $category->category_parent == 0)) { $num_found++; $link = '<a href="' . get_category_link(0, $category->cat_ID, $category->category_nicename) . '" '; if ($use_desc_for_title == 0 || empty($category->category_description)) { $link .= 'title="' . sprintf("View all posts filed under %s", htmlspecialchars($category->cat_name)) . '"'; } else { $link .= 'title="' . htmlspecialchars($category->category_description) . '"'; } $link .= '>'; $link .= apply_filters('list_cats', $category->cat_name) . '</a>'; if (!empty($feed_image) || !empty($feed)) { $link .= ' '; if (empty($feed_image)) { $link .= '('; } $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"'; if (!empty($feed)) { $title = ' title="' . $feed . '"'; $alt = ' alt="' . $feed . '"'; $name = $feed; $link .= $title; } $link .= '>'; if (!empty($feed_image)) { $link .= "<img src=\"{$feed_image}\" border=\"0\"{$alt}{$title}" . ' />'; } else { $link .= $name; } $link .= '</a>'; if (empty($feed_image)) { $link .= ')'; } } if (intval($optioncount) == 1) { $link .= ' (' . intval($category_posts["{$category->cat_ID}"]) . ')'; } if (intval($optiondates) == 1) { $link .= ' ' . $category_lastday["{$category->cat_ID}"] . '/' . $category_lastmonth["{$category->cat_ID}"]; } if ($list) { $thelist .= "\t<li>{$link}\n"; } else { $thelist .= "\t{$link}<br />\n"; } if ($hierarchical && $children) { $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical); } if ($list) { $thelist .= "</li>\n"; } } } if (!$num_found && !$child_of) { if ($list) { $before = '<li>'; $after = '</li>'; } echo $before . "No categories" . $after . "\n"; return; } if ($list && $child_of && $num_found && $recurse) { $pre = "\t\t<ul class='children'>"; $post = "\t\t</ul>\n"; } else { $pre = $post = ''; } $thelist = $pre . $thelist . $post; if ($recurse) { return $thelist; } echo apply_filters('list_cats', $thelist); }