root/branches/release-26/php/lib/function.mtarchivecount.php @ 1174

Revision 1174, 1.4 kB (checked in by bchoate, 23 months ago)

Updated copyright year for source.

  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
3# This program is distributed under the terms of the
4# GNU General Public License, version 2.
5#
6# $Id$
7
8function smarty_function_mtarchivecount($args, &$ctx) {
9    if ($ctx->stash('inside_mt_categories')) {
10        return $ctx->tag('MTCategoryCount', $args);
11    } elseif ($count = $ctx->stash('archive_count')) {
12        return $count;
13    } elseif ($entries = $ctx->stash('entries')) {
14        return count($entries);
15    } else {
16        $eargs = array();
17        $eargs['blog_id'] = $ctx->stash('blog_id');
18        if ($at = $ctx->stash('current_archive_type')) {
19            require_once("archive_lib.php");
20            $ts = $ctx->stash('current_timestamp');
21            $tse = $ctx->stash('current_timestamp_end');
22            global $_archivers;
23            $archiver = $_archivers[$at];
24            if (isset($archiver)) {
25                if ($ts && $tse) {
26                    # assign date range if we have both
27                    # start and end date
28                    $eargs['current_timestamp'] = $ts;
29                    $eargs['current_timestamp_end'] = $tse;
30                }
31                $archiver->setup_args($ctx, $eargs);
32            }
33            $eargs['lastn'] = -1;
34            $entries =& $ctx->mt->db->fetch_entries($eargs);
35            return count($entries);
36        }
37    }
38    return 0;
39}
40?>
Note: See TracBrowser for help on using the browser.