'custom date format', 'limit_to'=>'Run the plugin only for this file'); var $date_format = '%e %B %y'; var $limit_to = 'list_categories.php'; var $default_context = LP_CONTEXT_INDEX; var $description = 'Display a list of active categories and their posts titles'; var $active = true; var $hooks = array('pre_render'); function CategoriesListExtended(&$frontend, $args, $dummy_run=false) { $this->LightPressPlugin($frontend, $args, $dummy_run); if (!$dummy_run && !empty($this->limit_to) && basename($_SERVER['PHP_SELF']) != $this->limit_to) $this->active = false; } function &run($hook, &$hook_data) { $f =& $this->_frontend; $tpl =& $f->tpl; $db =& $f->db; $tpl->setFile('plugin_categorieslistextended', 'plugins/categories_list_extended.xml'); $tpl->setBlock('plugin_categorieslistextended', 'plugin_categorieslistextended_catgroup', 'PLUGIN_CATEGORIESLISTEXTENDED_CATGROUP'); $tpl->setBlock('plugin_categorieslistextended_catgroup', 'plugin_categorieslistextended_category', 'PLUGIN_CATEGORIESLISTEXTENDED_CATEGORY'); $categories =& $this->_frontend->getCategories(); $q = "select p.id, p.post_name, p.post_title, UNIX_TIMESTAMP(p.post_date) as tstamp, " . "p2c.category_id as post_category " . "from " . $f->tables['post2cat'] . " p2c " . "inner join " . $f->tables['posts'] . " p on p.id = p2c.post_id " . "where p.post_status='publish' and p.post_date_gmt <= '" . $f->where_date . "' " . "order by p2c.category_id, p.post_date desc"; $db->query($q); $opt_url = $f->options['url']; $category = null; foreach ($db->all() as $post) { if ($category != $post['post_category']) { if (!is_null($category)) $categories[$category]['posts'] = '