root/branches/release-39/php/lib/block.mtpages.php @ 2496

Revision 2496, 1.4 kB (checked in by bchoate, 18 months ago)

Fix to permit plugins that prepopulate the entries stash to call the entries handler allowing for further filtering using category/tag/author attributes. BugId:80022

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
8require_once('block.mtentries.php');
9function smarty_block_mtpages($args, $content, &$ctx, &$repeat) {
10    $args['class'] = 'page';
11    if (isset($args['include_subfolders']) &&
12        $args['include_subfolders'] == 1)
13    {
14        $args['include_subcategories'] = 1;
15    }
16    if (isset($args['folder'])) {
17        $args['category'] = $args['folder'];
18    }
19
20    if(isset($args['no_folder'])) {
21        $folders =& $ctx->mt->db->fetch_folders(array("blog_id" => $ctx->stash('blog_id')));
22        $not_folder = '';
23        if (isset($folders)) {
24            foreach ($folders as $folder) {
25                if ($not_folder == '') {
26                    $not_folder = $folder['category_label'];
27                } else {
28                    $not_folder = $not_folder.' OR '.$folder['category_label'];
29                }
30            }
31        }
32        if ($not_folder != '') {
33            $args['category'] = "NOT ($not_folder)";
34        }
35    }
36
37    $localvars = array('current_timestamp', 'current_timestamp_end', 'current_archive_type');
38    $ctx->localize($localvars);
39    foreach ($localvars as $localvar) {
40        $ctx->__stash[$localvar] = null;
41    }
42
43    $out = smarty_block_mtentries($args, $content, $ctx, $repeat);
44
45    $ctx->restore($localvars);
46
47    return $out;
48}
Note: See TracBrowser for help on using the browser.