Changeset 760
- Timestamp:
- 01/12/2004 11:52:35 AM (21 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r737 r760 2 2 /* Don't remove these lines. */ 3 3 $blog = 1; 4 require _once('wp-blog-header.php');4 require('wp-blog-header.php'); 5 5 // Uncomment the next line if you want to track blog updates from weblogs.com 6 6 //include_once(ABSPATH.WPINC.'/links-update-xml.php'); -
trunk/wp-blog-header.php
r756 r760 9 9 die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='wp-admin/install-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file."); 10 10 11 require _once($curpath.'/wp-config.php');11 require($curpath.'/wp-config.php'); 12 12 13 13 $wpvarstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'name', 'category_name'); … … 340 340 341 341 // Do the same for comment numbers 342 342 $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount 343 FROM $tableposts 344 LEFT JOIN $tablecomments ON ( comment_post_ID = ID AND comment_approved = '1') 345 WHERE post_status = 'publish' AND ID IN ($post_id_list) 346 GROUP BY ID"); 347 348 foreach ($comment_counts as $comment_count) { 349 $comment_count_cache["$comment_count->ID"] = $comment_count->ccount; 350 } 343 351 344 352 if (1 == count($posts)) { -
trunk/wp-includes/template-functions.php
r752 r760 863 863 } 864 864 865 function the_title($before ='', $after='', $echo=true) {865 function the_title($before = '', $after = '', $echo = true) { 866 866 $title = get_the_title(); 867 $title = convert_bbcode($title);868 $title = convert_gmcode($title);869 867 $title = convert_smilies($title); 870 if ( $title) {868 if (!empty($title)) { 871 869 $title = convert_chars($before.$title.$after); 872 870 $title = apply_filters('the_title', $title); … … 879 877 function the_title_rss() { 880 878 $title = get_the_title(); 881 $title = convert_bbcode($title);882 $title = convert_gmcode($title);883 879 $title = strip_tags($title); 884 880 if (trim($title)) { … … 897 893 } 898 894 function get_the_title() { 899 global $ id, $post;895 global $post; 900 896 $output = stripslashes($post->post_title); 901 897 if (!empty($post->post_password)) { // if there's a password … … 1447 1443 } 1448 1444 1449 // out of the b2loop1445 // out of the WordPress loop 1450 1446 function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', 1451 1447 $optiondates = 0, $optioncount = 0, $hide_empty = 1) { … … 1489 1485 } 1490 1486 1491 // out of the b2 loop 1492 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', 1493 $file = 'blah', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1) { 1487 // out of the WordPress loop 1488 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1) { 1494 1489 global $tablecategories, $tableposts, $tablepost2cat, $wpdb; 1495 1490 global $pagenow, $siteurl, $blogfilename; 1496 1491 global $querystring_start, $querystring_equal, $querystring_separator; 1497 if (($file == 'blah') || ($file == '')) { 1492 // Optiondates does not currently work 1493 if ('' == $file) { 1498 1494 $file = "$siteurl/$blogfilename"; 1499 1495 } … … 1501 1497 1502 1498 $query = " 1503 SELECT cat_ID, cat_name, category_nicename, 1504 COUNT($tablepost2cat.post_id) AS cat_count, 1505 DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth 1506 FROM $tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id) 1507 LEFT JOIN $tableposts ON (ID = post_id) 1499 SELECT cat_ID, cat_name, category_nicename 1500 FROM $tablecategories 1508 1501 WHERE cat_ID > 0 1509 GROUP BY category_id1510 1502 "; 1503 $query .= " ORDER BY $sort_column $sort_order"; 1504 1505 $categories = $wpdb->get_results($query); 1506 1511 1507 if (intval($hide_empty) == 1) { 1512 $query .= " HAVING cat_count > 0"; 1508 $cat_counts = $wpdb->get_results(" SELECT cat_ID, 1509 COUNT(wp_post2cat.post_id) AS cat_count 1510 FROM wp_categories LEFT JOIN wp_post2cat ON (cat_ID = category_id) 1511 LEFT JOIN wp_posts ON (ID = post_id) 1512 GROUP BY category_id"); 1513 foreach ($cat_counts as $cat_count) { 1514 $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count; 1515 } 1513 1516 } 1514 $query .= " ORDER BY $sort_column $sort_order, post_date DESC"; 1515 1516 $categories = $wpdb->get_results($query); 1517 1518 if (intval($optioncount) == 1) { 1519 $link .= ' ('.$category->cat_count.')'; 1520 } 1521 1517 1522 if (!$categories) { 1518 1523 if ($list) { … … 1523 1528 return; 1524 1529 } 1525 if (intval($optionall) == 1) {1526 $all = apply_filters('list_cats', $all);1527 $link = "<a href=\"".$file.$querystring_start.'cat'.$querystring_equal.'all">'.$all."</a>";1528 if ($list) echo "\n\t<li>$link</li>";1529 else echo "\t$link<br />\n";1530 }1531 1530 1532 1531 foreach ($categories as $category) { 1533 $cat_name = apply_filters('list_cats', $category->cat_name);1534 1532 $link = '<a href="'.get_category_link(0, $category->cat_ID, $category->category_nicename).'" title="View all posts filed under ' . $category->cat_name . '">'; 1535 $link .= stripslashes($cat _name).'</a>';1533 $link .= stripslashes($category->cat_name).'</a>'; 1536 1534 if (intval($optioncount) == 1) { 1537 $link .= ' ('.$category->cat_count.')';1535 $link .= ' ('.$category_posts["$category->cat_ID"].')'; 1538 1536 } 1539 1537 if (intval($optiondates) == 1) { 1540 $link .= ' '.$category->lastday.'/'.$category->lastmonth;1538 $link .= ' '.$category->lastday.'/'.$category->lastmonth; 1541 1539 } 1542 1540 if ($list) { … … 1581 1579 function comments_link($file='', $echo=true) { 1582 1580 global $id, $pagenow; 1583 global $querystring_start, $querystring_equal, $querystring_separator;1584 1581 if ($file == '') $file = $pagenow; 1585 1582 if ($file == '/') $file = ''; … … 1599 1596 global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash; 1600 1597 global $querystring_start, $querystring_equal, $querystring_separator, $siteurl; 1601 $number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1';"); 1598 global $comment_count_cache; 1599 if ('' == $comment_count_cache["$id"]) { 1600 $number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1';"); 1601 } else { 1602 $number = $comment_count_cache["$id"]; 1603 } 1602 1604 if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) { 1603 1605 echo $none;
Note: See TracChangeset
for help on using the changeset viewer.