Changeset 558 for trunk/b2-include/b2template.functions.php
- Timestamp:
- 11/25/2003 12:46:52 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/b2-include/b2template.functions.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r557 r558 233 233 234 234 function 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; 236 236 237 237 // Quick check. If we have no posts at all, abort! 238 238 if (!$posts) { 239 239 $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; 240 241 if (!$gotsome) 241 242 return; … … 254 255 $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's 255 256 $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')"); 257 ++$querycount; 256 258 } elseif (!empty($m)) { 257 259 $calendar = substr($m, 0, 6); … … 276 278 ORDER BY post_date DESC 277 279 LIMIT 1"); 280 ++$querycount; 278 281 $next = $wpdb->get_row("SELECT DISTINCT MONTH( post_date ) AS month, YEAR( post_date ) AS year 279 282 FROM $tableposts … … 283 286 ORDER BY post_date ASC 284 287 LIMIT 1"); 288 ++$querycount; 285 289 286 290 echo '<table id="wp-calendar"> … … 330 334 AND post_status = 'publish' 331 335 AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."'", ARRAY_N); 332 336 ++$querycount; 333 337 if ($dayswithposts) { 334 338 foreach ($dayswithposts as $daywith) { … … 356 360 ."AND post_status = 'publish'" 357 361 ); 362 ++$querycount; 358 363 if ($ak_post_titles) { 359 364 foreach ($ak_post_titles as $ak_post_title) { … … 406 411 function get_permalink($id=false) { 407 412 global $post, $wpdb, $tableposts; 408 global $siteurl, $blogfilename, $querystring_start, $querystring_equal; 413 global $siteurl, $blogfilename, $querystring_start, $querystring_equal, $querycount; 414 409 415 $rewritecode = array( 410 416 '%year%', … … 428 434 } else { // if an ID is given 429 435 $idpost = $wpdb->get_row("SELECT post_date, post_name FROM $tableposts WHERE ID = $id"); 436 ++$querycount; 430 437 if ('' != get_settings('permalink_structure')) { 431 438 $unixtime = strtotime($idpost->post_date); … … 1351 1358 1352 1359 $categories = $wpdb->get_results($query); 1353 1360 ++$querycount; 1354 1361 if (!$categories) { 1355 1362 if ($list) { … … 1360 1367 return; 1361 1368 } 1362 ++$querycount;1363 1369 if (intval($optionall) == 1) { 1364 1370 $all = apply_filters('list_cats', $all); … … 1406 1412 function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $include_unapproved = false) { 1407 1413 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"; 1409 1415 if (false == $include_unapproved) { 1410 1416 $query .= " AND comment_approved = '1'"; 1411 1417 } 1412 1418 $number = $wpdb->get_var($query); 1419 ++$querycount; 1413 1420 if ($number == 0) { 1414 1421 $blah = $zero; … … 1439 1446 1440 1447 function 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; 1442 1449 global $querystring_start, $querystring_equal, $querystring_separator, $siteurl; 1443 1450 $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'"); 1451 ++$querycount; 1444 1452 if (0 == $number && 'closed' == $post->comment_status) { 1445 1453 echo $none;
Note: See TracChangeset
for help on using the changeset viewer.