Make WordPress Core


Ignore:
Timestamp:
11/25/2003 12:46:52 AM (22 years ago)
Author:
mikelittle
Message:

Missing querycount

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2-include/b2template.functions.php

    r557 r558  
    233233
    234234function get_calendar($daylength = 1) {
    235     global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts;
     235    global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts, $querycount;
    236236
    237237    // Quick check. If we have no posts at all, abort!
    238238    if (!$posts) {
    239239        $gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' AND post_category > 0 ORDER BY post_date DESC LIMIT 1");
     240        ++$querycount;
    240241        if (!$gotsome)
    241242            return;
     
    254255        $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
    255256        $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
     257        ++$querycount;
    256258    } elseif (!empty($m)) {
    257259        $calendar = substr($m, 0, 6);
     
    276278                              ORDER BY post_date DESC
    277279                              LIMIT 1");
     280    ++$querycount;
    278281    $next = $wpdb->get_row("SELECT  DISTINCT MONTH( post_date ) AS month, YEAR( post_date ) AS year
    279282            FROM $tableposts
     
    283286                              ORDER  BY post_date ASC
    284287                              LIMIT 1");
     288    ++$querycount;
    285289
    286290    echo '<table id="wp-calendar">
     
    330334            AND post_status = 'publish'
    331335            AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."'", ARRAY_N);
    332 
     336    ++$querycount;
    333337    if ($dayswithposts) {
    334338        foreach ($dayswithposts as $daywith) {
     
    356360                                         ."AND post_status = 'publish'"
    357361                                        );
     362    ++$querycount;
    358363    if ($ak_post_titles) {
    359364        foreach ($ak_post_titles as $ak_post_title) {
     
    406411function get_permalink($id=false) {
    407412    global $post, $wpdb, $tableposts;
    408     global $siteurl, $blogfilename, $querystring_start, $querystring_equal;
     413    global $siteurl, $blogfilename, $querystring_start, $querystring_equal, $querycount;
     414
    409415    $rewritecode = array(
    410416        '%year%',
     
    428434    } else { // if an ID is given
    429435        $idpost = $wpdb->get_row("SELECT post_date, post_name FROM $tableposts WHERE ID = $id");
     436        ++$querycount;
    430437        if ('' != get_settings('permalink_structure')) {
    431438            $unixtime = strtotime($idpost->post_date);
     
    13511358
    13521359    $categories = $wpdb->get_results($query);
    1353 
     1360    ++$querycount;
    13541361    if (!$categories) {
    13551362        if ($list) {
     
    13601367        return;
    13611368    }
    1362     ++$querycount;
    13631369    if (intval($optionall) == 1) {
    13641370        $all = apply_filters('list_cats', $all);
     
    14061412function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $include_unapproved = false) {
    14071413    global $id, $comment, $tablecomments, $querycount, $wpdb;
    1408     $query = "SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = '$id'";
     1414    $query = "SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id";
    14091415    if (false == $include_unapproved) {
    14101416        $query .= " AND comment_approved = '1'";
    14111417    }
    14121418    $number = $wpdb->get_var($query);
     1419    ++$querycount;
    14131420    if ($number == 0) {
    14141421        $blah = $zero;
     
    14391446
    14401447function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
    1441     global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash;
     1448    global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $querycount, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash;
    14421449    global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
    14431450    $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
     1451    ++$querycount;
    14441452    if (0 == $number && 'closed' == $post->comment_status) {
    14451453        echo $none;
Note: See TracChangeset for help on using the changeset viewer.