b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: plugins ] [ index: plugins ] [ all elements ]

Source for file _calendar.plugin.php

Documentation is available at _calendar.plugin.php

  1. <?php
  2. /**
  3.  * This file implements the Calendar plugin.
  4.  *
  5.  * This file is part of the b2evolution project - {@link http://b2evolution.net/}
  6.  *
  7.  * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  8.  *  Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  9.  *
  10.  *  {@internal License choice
  11.  *  - If you have received this file as part of a package, please find the license.txt file in
  12.  *    the same folder or the closest folder above for complete license terms.
  13.  *  - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  14.  *    then you must choose one of the following licenses before using the file:
  15.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  16.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  17.  *  }}}
  18.  *
  19.  *  {@internal Open Source relicensing agreement:
  20.  *  Daniel HAHLER grants Francois PLANQUE the right to license
  21.  *  Daniel HAHLER's contributions to this file and the b2evolution project
  22.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  23.  *  }}}
  24.  *
  25.  * @package plugins
  26.  *
  27.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  28.  * @author blueyed: Daniel HAHLER.
  29.  * @author fplanque: Francois PLANQUE - {@link http://fplanque.net/}
  30.  * @author hansreinders: Hans REINDERS
  31.  * @author cafelog (team)
  32.  *
  33.  * @version $Id: _calendar.plugin.php,v 1.59 2010/02/08 17:55:47 efy-yury Exp $
  34.  */
  35. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  36.  
  37.  
  38. /**
  39.  * Calendar Plugin
  40.  *
  41.  * This plugin displays
  42.  */
  43. class calendar_plugin extends Plugin
  44. {
  45.     /**
  46.      * Variables below MUST be overriden by plugin implementations,
  47.      * either in the subclass declaration or in the subclass constructor.
  48.      */
  49.  
  50.     var $name;
  51.     var $code = 'evo_Calr';
  52.     var $priority = 20;
  53.     var $version = '3.0';
  54.     var $author = 'The b2evo Group';
  55.     var $group = 'widget';
  56.  
  57.  
  58.   /**
  59.      * @var ItemQuery 
  60.      */
  61.     var $ItemQuery;
  62.  
  63.     /**
  64.      * Init
  65.      */
  66.     function PluginInit$params )
  67.     {
  68.         $this->name = T_'Calendar Widget' );
  69.         $this->short_desc = T_('This skin tag displays a navigable calendar.');
  70.         $this->long_desc = T_('Days containing posts are highlighted.');
  71.  
  72.         $this->dbtable 'T_items__item';
  73.         $this->dbprefix 'post_';
  74.         $this->dbIDname 'post_ID';
  75.     }
  76.  
  77.  
  78.   /**
  79.    * Get definitions for widget specific editable params
  80.    *
  81.      * @see Plugin::GetDefaultSettings()
  82.      * @param local params like 'for_editing' => true
  83.      */
  84.     function get_widget_param_definitions$params )
  85.     {
  86.         $r array(
  87.             'displaycaption' => array(
  88.                 'label' => T_('Display caption'),
  89.                 'note' => T_('Display caption on top of calendar'),
  90.                 'type' => 'checkbox',
  91.                 'defaultvalue' => true,
  92.             ),
  93.             'linktomontharchive' => array(
  94.                 'label' => T_('Link caption to archives'),
  95.                 'note' => T_('The month in the caption can be clicked to see all posts for this month'),
  96.                 'type' => 'checkbox',
  97.                 'defaultvalue' => true,
  98.             ),
  99.             'headerdisplay' => array(
  100.                 'label' => 'Column headers',
  101.                 'note' => T_('How do you want to display the days of the week in the column headers?'),
  102.                 'type' => 'select',
  103.                 'options' => array'e' => 'F''D' => 'Fri''l' => 'Friday''' => T_('No header') ),
  104.                 'defaultvalue' => 'D',
  105.             ),
  106.             'navigation' => array(
  107.                 'label' => 'Navigation arrows',
  108.                 'note' => T_('Where do you want to display the navigation arrows?'),
  109.                 'type' => 'select',
  110.                 'options' => array'caption' => T_('Top')'tfoot' => T_('Bottom')'' => T_('No navigation') ),
  111.                 'defaultvalue' => 'tfoot',
  112.             ),
  113.             'browseyears' => array(
  114.                 'label' => T_('Navigate years'),
  115.                 'note' => T_('Display double arrows for yearly navigation?'),
  116.                 'type' => 'checkbox',
  117.                 'defaultvalue' => true,
  118.             ),
  119.         );
  120.         return $r;
  121.     }
  122.  
  123.  
  124.     /**
  125.      * Event handler: SkinTag (widget)
  126.      *
  127.      * @param array Associative array of parameters. Valid keys are:
  128.      *       - 'block_start' : (Default: '<div class="bSideItem">')
  129.      *       - 'block_end' : (Default: '</div>')
  130.      *       - 'title' : (Default: T_('Calendar'))
  131.      *       - 'displaycaption'
  132.      *       - 'monthformat'
  133.      *       - 'linktomontharchive'
  134.      *       - 'tablestart'
  135.      *       - 'tableend'
  136.      *       - 'monthstart'
  137.      *       - 'monthend'
  138.      *       - 'rowstart'
  139.      *       - 'rowend'
  140.      *       - 'headerdisplay'
  141.      *       - 'headerrowstart'
  142.      *       - 'headerrowend'
  143.      *       - 'headercellstart'
  144.      *       - 'headercellend'
  145.      *       - 'cellstart'
  146.      *       - 'cellend'
  147.      *       - 'linkpostcellstart'
  148.      *       - 'linkposttodaycellstart'
  149.      *       - 'todaycellstart'
  150.      *       - 'todaycellstartpost'
  151.      *       - 'navigation' : Where do we want to have the navigation arrows? (Default: 'tfoot')
  152.      *       - 'browseyears' : boolean  Do we want arrows to move one year at a time?
  153.      *       - 'min_timestamp' : Minimum unix timestamp the user can browse too or 'query' (Default: 2000-01-01)
  154.      *       - 'max_timestamp' : Maximum unix timestamp the user can browse too or 'query' (Default: now + 1 year )
  155.      *       - 'postcount_month_atitle'
  156.      *       - 'postcount_month_atitle_one'
  157.      *       - 'postcount_year_atitle'
  158.      *       - 'postcount_year_atitle_one'
  159.      *       - 'link_type' : 'canonic'|'context' (default: canonic)
  160.      * @return boolean did we display?
  161.      */
  162.     function SkinTag$params )
  163.     {
  164.         global $month;
  165.         global $Blog$cat_array$cat_modifier;
  166.         global $show_statuses;
  167.         global $author$assgn$status$types;
  168.         global $m$w$dstart$timestamp_min$timestamp_max;
  169.         global $s$sentence$exact;
  170.  
  171.         /**
  172.          * Default params:
  173.          */
  174.         // This is what will enclose the block in the skin:
  175.         if(!isset($params['block_start'])) $params['block_start''<div class="bSideItem">';
  176.         if(!isset($params['block_end'])) $params['block_end'"</div>\n";
  177.  
  178.         // Title:
  179.         if(!isset($params['block_title_start'])) $params['block_title_start''<h3>';
  180.         if(!isset($params['block_title_end'])) $params['block_title_end''</h3>';
  181.         if(!isset($params['title'])) $params['title''';
  182.  
  183.  
  184.         $Calendar new Calendar$m$params );
  185.  
  186.         // TODO: automate with a table inside of Calendatr object. Table should also contain descriptions and default values to display in help screen.
  187.         // Note: minbrowse and maxbrowe already work this way.
  188.         ifisset($params['displaycaption']) ) $Calendar->set'displaycaption'$params['displaycaption');
  189.         ifisset($params['monthformat']) ) $Calendar->set'monthformat'$params['monthformat');
  190.         ifisset($params['linktomontharchive']) ) $Calendar->set'linktomontharchive'$params['linktomontharchive');
  191.         ifisset($params['tablestart']) ) $Calendar->set'tablestart'$params['tablestart');
  192.         ifisset($params['tableend']) ) $Calendar->set'tableend'$params['tableend');
  193.         ifisset($params['monthstart']) ) $Calendar->set'monthstart'$params['monthstart');
  194.         ifisset($params['monthend']) ) $Calendar->set'monthend'$params['monthend');
  195.         ifisset($params['rowstart']) ) $Calendar->set'rowstart'$params['rowstart');
  196.         ifisset($params['rowend']) ) $Calendar->set'rowend'$params['rowend');
  197.         ifisset($params['headerdisplay']) ) $Calendar->set'headerdisplay'$params['headerdisplay');
  198.         ifisset($params['headerrowstart']) ) $Calendar->set'headerrowstart'$params['headerrowstart');
  199.         ifisset($params['headerrowend']) ) $Calendar->set'headerrowend'$params['headerrowend');
  200.         ifisset($params['headercellstart']) ) $Calendar->set'headercellstart'$params['headercellstart');
  201.         ifisset($params['headercellend']) ) $Calendar->set'headercellend'$params['headercellend');
  202.         ifisset($params['cellstart']) ) $Calendar->set'cellstart'$params['cellstart');
  203.         ifisset($params['cellend']) ) $Calendar->set'cellend'$params['cellend');
  204.         ifisset($params['emptycellstart']) ) $Calendar->set'emptycellstart'$params['emptycellstart');
  205.         ifisset($params['emptycellend']) ) $Calendar->set'emptycellend'$params['emptycellend');
  206.         ifisset($params['emptycellcontent']) ) $Calendar->set'emptycellcontent'$params['emptycellcontent');
  207.         ifisset($params['linkpostcellstart']) ) $Calendar->set'linkpostcellstart'$params['linkpostcellstart');
  208.         ifisset($params['linkposttodaycellstart']) ) $Calendar->set'linkposttodaycellstart'$params['linkposttodaycellstart');
  209.         ifisset($params['todaycellstart']) ) $Calendar->set'todaycellstart'$params['todaycellstart');
  210.         ifisset($params['todaycellstartpost']) ) $Calendar->set'todaycellstartpost'$params['todaycellstartpost');
  211.         ifisset($params['navigation']) ) $Calendar->set'navigation'$params['navigation');
  212.         ifisset($params['browseyears']) ) $Calendar->set'browseyears'$params['browseyears');
  213.         ifisset($params['postcount_month_atitle']) ) $Calendar->set'postcount_month_atitle'$params['postcount_month_atitle');
  214.         ifisset($params['postcount_month_atitle_one']) ) $Calendar->set'postcount_month_atitle_one'$params['postcount_month_atitle_one');
  215.         ifisset($params['postcount_year_atitle']) ) $Calendar->set'postcount_year_atitle'$params['postcount_year_atitle');
  216.         ifisset($params['postcount_year_atitle_one']) ) $Calendar->set'postcount_year_atitle_one'$params['postcount_year_atitle_one');
  217.         // Link type:
  218.         ifisset($params['link_type']) ) $Calendar->set'link_type'$params['link_type');
  219.         ifisset($params['context_isolation']) ) $Calendar->set'context_isolation'$params['context_isolation');
  220.  
  221.         echo $params['block_start'];
  222.  
  223.         if!empty($params['title']) )
  224.         {    // We want to display a title for the widget block:
  225.             echo $params['block_title_start'];
  226.             echo $params['title'];
  227.             echo $params['block_title_end'];
  228.         }
  229.  
  230.         // CONSTRUCT THE WHERE CLAUSE:
  231.  
  232.         // - - Select a specific Item:
  233.         // $this->ItemQuery->where_ID( $p, $title );
  234.  
  235.         if$Calendar->link_type == 'context' )
  236.         {    // We want to preserve the current context:
  237.             // * - - Restrict to selected blog/categories:
  238.             $Calendar->ItemQuery->where_chapter2$Blog$cat_array$cat_modifier );
  239.  
  240.             // * Restrict to the statuses we want to show:
  241.             $Calendar->ItemQuery->where_visibility$show_statuses );
  242.  
  243.             // Restrict to selected authors:
  244.             $Calendar->ItemQuery->where_author$author );
  245.  
  246.             // Restrict to selected assignees:
  247.             $Calendar->ItemQuery->where_assignees$assgn );
  248.  
  249.             // Restrict to selected satuses:
  250.             $Calendar->ItemQuery->where_statuses$status );
  251.  
  252.             // - - - + * * if a month is specified in the querystring, load that month:
  253.             $Calendar->ItemQuery->where_datestart/* NO m */''/* NO w */''$dstart''$timestamp_min$timestamp_max );
  254.  
  255.             // Keyword search stuff:
  256.             $Calendar->ItemQuery->where_keywords$s$sentence$exact );
  257.  
  258.             // Exclude pages and intros:
  259.             $Calendar->ItemQuery->where_types$types );
  260.         }
  261.         else
  262.         {    // We want to preserve only the minimal context:
  263.             // * - - Restrict to selected blog/categories:
  264.             $Calendar->ItemQuery->where_chapter2$Blogarray()'' );
  265.  
  266.             // * Restrict to the statuses we want to show:
  267.             $Calendar->ItemQuery->where_visibility$show_statuses );
  268.  
  269.             // - - - + * * if a month is specified in the querystring, load that month:
  270.             $Calendar->ItemQuery->where_datestart/* NO m */''/* NO w */''''''$timestamp_min$timestamp_max );
  271.  
  272.             // Exclude pages and intros:
  273.             $Calendar->ItemQuery->where_types'-1000,1500,1520,1530,1570,1600' );
  274.         }
  275.  
  276.         // DISPLAY:
  277.         $Calendar->display);
  278.  
  279.         echo $params['block_end'];
  280.  
  281.         return true;
  282.     }
  283. }
  284.  
  285.  
  286. /**
  287.  * Calendar
  288.  *
  289.  * @package evocore
  290.  */
  291. class Calendar
  292. {
  293.     var $year;
  294.  
  295.     /**
  296.      * The month to display or empty in mode 'year' with no selected month.
  297.      * @var string 
  298.      */
  299.     var $month;
  300.  
  301.     /**
  302.      * 'month' or 'year'
  303.      * @var string 
  304.      */
  305.     var $mode;
  306.  
  307.     var $where;
  308.     /**
  309.      * SQL query string
  310.      * @var string 
  311.      */
  312.     var $request;
  313.     /**
  314.      * Result set
  315.      */
  316.     var $result;
  317.     /**
  318.      * Number of rows in result set
  319.      * @var integer 
  320.      */
  321.     var $result_num_rows;
  322.  
  323.     var $displaycaption;
  324.     var $monthformat;
  325.     var $monthstart;
  326.     var $monthend;
  327.     var $linktomontharchive;
  328.     /**
  329.      * Where to do the navigation
  330.      *
  331.      * 'caption' or 'tfoot';
  332.      *
  333.      * @var string 
  334.      */
  335.     var $navigation = 'tfoot';
  336.  
  337.     var $tablestart;
  338.     var $tableend;
  339.  
  340.     var $rowstart;
  341.     var $rowend;
  342.  
  343.     var $headerdisplay;
  344.     var $headerrowstart;
  345.     var $headerrowend;
  346.     var $headercellstart;
  347.     var $headercellend;
  348.  
  349.     var $cellstart;
  350.     var $cellend;
  351.  
  352.     var $emptycellstart;
  353.     var $emptycellend;
  354.  
  355.     var $emptycellcontent;
  356.  
  357.     /**
  358.      * Do we want to browse years in the caption? True by default for mode == year,
  359.      * false for mode == month (gets set in constructor).
  360.      * @var boolean 
  361.      */
  362.     var $browseyears;
  363.  
  364.     /**
  365.      * Is today in the displayed frame?
  366.      * @var boolean 
  367.      * @access protected
  368.      */
  369.     var $today_is_visible;
  370.  
  371.  
  372.     var $link_type;
  373.     var $context_isolation;
  374.  
  375.     var $params = array);
  376.  
  377.     /**
  378.      * Calendar::Calendar(-)
  379.      *
  380.      * Constructor
  381.      *
  382.      * @param string Month ('YYYYMM'), year ('YYYY'), current ('')
  383.      * @param array Associative array of parameters. Valid keys are:
  384.      *       - 'min_timestamp' : Minimum unix timestamp the user can browse too or 'query' (Default: 2000-01-01)
  385.      *       - 'max_timestamp' : Maximum unix timestamp the user can browse too or 'query' (Default: now + 1 year )
  386.      */
  387.     function Calendar$m ''$params array() )
  388.     {
  389.         global $localtimenow;
  390.  
  391.         $this->dbtable 'T_items__item';
  392.         $this->dbprefix 'post_';
  393.         $this->dbIDname 'post_ID';
  394.  
  395.         // OBJECT THAT WILL BE USED TO CONSTRUCT THE WHERE CLAUSE:
  396.         $this->ItemQuery new ItemQuery$this->dbtable$this->dbprefix$this->dbIDname );    // COPY!!
  397.  
  398.         $localyearnow date'Y'$localtimenow );
  399.         $localmonthnow date'm'$localtimenow );
  400.  
  401.         // Find out which month to display:
  402.         ifempty($m) )
  403.         // Current month (monthly)
  404.             $this->year = $localyearnow;
  405.             $this->month = $localmonthnow;
  406.             $this->mode = 'month';
  407.  
  408.             $this->today_is_visible = true;
  409.         }
  410.         else
  411.         {    // We have requested a specific date
  412.             $this->year = substr($m04);
  413.             if (strlen($m6)
  414.             // no month provided
  415.                 $this->mode = 'year';
  416.  
  417.                 if$this->year == $localyearnow )
  418.                 // we display current year, month gets current
  419.                     $this->month = $localmonthnow;
  420.                 }
  421.                 else
  422.                 // highlight no month, when not current year
  423.                     $this->month = '';
  424.                 }
  425.             }
  426.             else
  427.             {
  428.                 $this->month = substr($m42);
  429.                 $this->mode = 'month';
  430.             }
  431.  
  432.             $this->today_is_visible = $this->year == $localyearnow
  433.                 && empty($this->month|| $this->month == $localmonthnow ) );
  434.         }
  435.  
  436.  
  437.         // Default styling:
  438.         $this->displaycaption = 1;    // set this to 0 if you don't want to display the month name
  439.         $this->monthformat = 'F Y';
  440.         $this->linktomontharchive = true;  // month displayed as link to month' archive
  441.  
  442.         $this->tablestart = '<table class="bCalendarTable" cellspacing="0" summary="Monthly calendar with links to each day\'s posts">'."\n";
  443.         $this->tableend = '</table>';
  444.  
  445.         $this->monthstart = '<caption>';
  446.         $this->monthend = "</caption>\n";
  447.  
  448.         $this->rowstart = '<tr class="bCalendarRow">' "\n";
  449.         $this->rowend = "</tr>\n";
  450.  
  451.         $this->headerdisplay = 'D';     // D => 'Fri'; e => 'F', l (lowercase l) => 'Friday'
  452.         // These codes are twisted because they're the same as for date formats.
  453.         // set this to 0 or '' if you don't want to display the "Mon Tue Wed..." header
  454.  
  455.         $this->headerrowstart = '<thead><tr class="bCalendarRow">' "\n";
  456.         $this->headerrowend = "</tr></thead>\n";
  457.         $this->headercellstart = '<th class="bCalendarHeaderCell" abbr="[abbr]" scope="col" title="[abbr]">';    // please leave [abbr] there !
  458.         $this->headercellend = "</th>\n";
  459.  
  460.         $this->cellstart = '<td class="bCalendarCell">';
  461.         $this->cellend = "</td>\n";
  462.  
  463.         $this->emptycellstart = '<td class="bCalendarEmptyCell">';
  464.         $this->emptycellend = "</td>\n";
  465.         $this->emptycellcontent = '&nbsp;';
  466.  
  467.         $this->linkpostcellstart '<td class="bCalendarLinkPost">';
  468.         $this->linkposttodaycellstart '<td class="bCalendarLinkPostToday">';
  469.         $this->todaycellstart '<td id="bCalendarToday">';
  470.         $this->todaycellstartpost '<td id="bCalendarToday" class="bCalendarLinkPost">';
  471.  
  472.         // Where do we want to have the navigation arrows? tfoot or caption
  473.         $this->navigation = 'tfoot';
  474.  
  475.         // Do we want arrows to move one year at a time?
  476.         $this->browseyears = true;
  477.  
  478.         /**#@+
  479.          * Display number of posts with days/months
  480.          *
  481.          * - set to '' (empty) to disable
  482.          * - %d gets replaced with the number of posts on that day/month
  483.          */
  484.         $this->postcount_month_atitle T_('%d posts');                         // in archive links title tag
  485.         $this->postcount_month_atitle_one T_('1 post');                      //  -- " -- [for single post]
  486.         $this->postcount_year_atitle T_('%d posts');                             // in archive links title tag
  487.         $this->postcount_year_atitle_one T_('1 post');                         // in archive links title tag
  488.         /**#@-*/
  489.  
  490.         // Link type:
  491.         $this->link_type = 'canonic';
  492.         $this->context_isolation = 'm,w,p,title,unit,dstart';
  493.  
  494.         // New style params:
  495.         $this->params = $params;
  496.  
  497.         // Default values:
  498.         ifempty$this->params['min_timestamp') )
  499.         {    // 2000-01-01:
  500.             $this->params['min_timestamp'mktime000112000 );
  501.         }
  502.         ifempty$this->params['max_timestamp') )
  503.         {    // Now + 1 year:
  504.             $this->params['max_timestamp'mktime235959date'm'$localtimenow  ),  date'd'$localtimenow ),  date'Y'$localtimenow )+);
  505.         }
  506.  
  507.     }
  508.  
  509.  
  510.     /*
  511.      * Calendar->set(-)
  512.      *
  513.      * set a variable
  514.      */
  515.     function set$var$value )
  516.     {
  517.         $this->$var $value;
  518.     }
  519.  
  520.  
  521.     /**
  522.      * Display the calendar.
  523.      *
  524.      * @todo If a specific day (mode == month) or month (mode == year) is selected, apply another class (default to some border)
  525.      */
  526.     function display()
  527.     {
  528.         global $DB;
  529.         global $weekday$weekday_abbrev$weekday_letter$month$month_abbrev;
  530.         global $time_difference;
  531.  
  532.         if$this->mode == 'month' )
  533.         {
  534.             $end_of_week ((locale_startofweek(77);
  535.  
  536.             // fplanque>> note: I am removing the searchframe thing because 1) I don't think it's of any use
  537.             // and 2) it's brutally inefficient! If someone needs this it should be implemented with A SINGLE
  538.             // QUERY which gets the last available post (BTW, I think there is already a function for that somwhere)
  539.             // walter>> As we are just counting items, the ORDER BY db_prefix . date_start doesn't matter. And a side effect
  540.             // of that is make queries standart compatible (compatible with other databases than MySQL)
  541.  
  542.             $arc_sql 'SELECT COUNT(DISTINCT '.$this->dbIDname.') AS item_count,
  543.                                                     EXTRACT(DAY FROM '.$this->dbprefix.'datestart) AS myday
  544.                                     FROM ('.$this->dbtable.' INNER JOIN T_postcats ON '.$this->dbIDname.' = postcat_post_ID)
  545.                                         INNER JOIN T_categories ON postcat_cat_ID = cat_ID
  546.                                     WHERE EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) = \''.$this->year.'\'
  547.                                         AND EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) = \''.$this->month.'\'
  548.                                         '.$this->ItemQuery->get_where' AND ' ).'
  549.                                     GROUP BY myday '.$this->ItemQuery->get_group_by', ' );
  550.             // echo $this->ItemQuery->where;
  551.             $arc_result $DB->get_results$arc_sqlARRAY_A );
  552.  
  553.             foreach$arc_result as $arc_row )
  554.             {
  555.                 if!isset$daysinmonthwithposts$arc_row['myday'] ] ) )
  556.                 {
  557.                     $daysinmonthwithposts$arc_row['myday'] ] 0;
  558.                 }
  559.                 // The '+' situation actually only happens when we have a complex GROUP BY above
  560.                 // (multiple categories wcombined with "ALL")
  561.                 $daysinmonthwithposts$arc_row['myday'] ] += $arc_row['item_count'];
  562.             }
  563.  
  564.             $daysinmonth intval(date('t'mktime(000$this->month1$this->year)));
  565.             // echo 'days in month=', $daysinmonth;
  566.  
  567.  
  568.             // caution: offset bug inside (??)
  569.             $datestartofmonth mktime(000$this->month1$this->year );
  570.             // echo date( locale_datefmt(), $datestartofmonth );
  571.             $calendarblah get_weekstartend$datestartofmonthlocale_startofweek() );
  572.             $calendarfirst $calendarblah['start'];
  573.  
  574.  
  575.             $dateendofmonth mktime(000$this->month$daysinmonth$this->year);
  576.             // echo 'end of month: '.date( 'Y-m-d H:i:s', $dateendofmonth );
  577.             $calendarblah get_weekstartend$dateendofmonthlocale_startofweek() );
  578.             $calendarlast $calendarblah['end'];
  579.             // echo date( ' Y-m-d H:i:s', $calendarlast );
  580.  
  581.  
  582.  
  583.             // here the offset bug is corrected
  584.             if( (intval(date('d'$calendarfirst)) 1&& (intval(date('m'$calendarfirst)) == intval($this->month)) )
  585.             {
  586.                 #pre_dump( 'with offset bug', date('Y-m-d', $calendarfirst) );
  587.                 $calendarfirst $calendarfirst 604800 /* 1 week */;
  588.                 #pre_dump( 'without offset bug', date('Y-m-d', $calendarfirst) );
  589.             }
  590.         }
  591.         else
  592.         // mode is 'year'
  593.             // Find months with posts
  594.             $arc_sql '
  595.                 SELECT COUNT(DISTINCT '.$this->dbIDname.') AS item_count, EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) AS mymonth
  596.                   FROM ('.$this->dbtable.' INNER JOIN T_postcats ON '.$this->dbIDname.' = postcat_post_ID)
  597.                  INNER JOIN T_categories ON postcat_cat_ID = cat_ID
  598.                  WHERE EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) = \''.$this->year.'\' '
  599.                        .$this->ItemQuery->get_where' AND ' ).'
  600.                  GROUP BY mymonth '.$this->ItemQuery->get_group_by', ' );
  601.             $arc_result $DB->get_results$arc_sqlARRAY_A );
  602.  
  603.             if$DB->num_rows )
  604.             // OK we have a month with posts! // fp>dh why did you removed that?
  605.                 foreach$arc_result as $arc_row )
  606.                 {
  607.                     $monthswithposts$arc_row['mymonth'] ] $arc_row['item_count'];
  608.                 }
  609.             }
  610.         }
  611.  
  612.  
  613.         // ** display everything **
  614.  
  615.         echo $this->tablestart;
  616.  
  617.         // CAPTION :
  618.  
  619.         if$this->displaycaption )
  620.         // caption:
  621.             echo $this->monthstart;
  622.  
  623.             if$this->navigation == 'caption' )
  624.             {
  625.                 echo implode'&nbsp;'$this->getNavLinks'prev' ) ).'&nbsp;';
  626.             }
  627.  
  628.             if$this->mode == 'month' )
  629.             // MONTH CAPTION:
  630.                 $text date_i18n($this->monthformatmktime(000$this->month1$this->year));
  631.  
  632.                 if$this->linktomontharchive )
  633.                 // chosen month with link to archives
  634.                     echo $this->archive_link$textT_('View monthly archive')$this->year$this->month );
  635.                 }
  636.                 else
  637.                 {
  638.                     echo $text;
  639.                 }
  640.             }
  641.             else
  642.             // YEAR CAPTION:
  643.                 echo date_i18n('Y'mktime(00011$this->year))// display year
  644.             }
  645.  
  646.             if$this->navigation == 'caption' )
  647.             {
  648.                 echo '&nbsp;'.implode'&nbsp;'$this->getNavLinks'next' ) );
  649.             }
  650.  
  651.             echo $this->monthend;
  652.         }
  653.  
  654.         // HEADER :
  655.  
  656.         if!empty($this->headerdisplay&& ($this->mode == 'month') )
  657.         // Weekdays:
  658.             echo $this->headerrowstart;
  659.  
  660.             for$i locale_startofweek()$j $i 7$i $j$i $i 1)
  661.             {
  662.                 echo str_replace('[abbr]'T_($weekday[($i 7)])$this->headercellstart);
  663.                 switch$this->headerdisplay )
  664.                 {
  665.                     case 'e':
  666.                         // e => 'F'
  667.                         echo T_($weekday_letter[($i 7)]);
  668.                         break;
  669.  
  670.                     case 'l':
  671.                         // l (lowercase l) => 'Friday'
  672.                         echo T_($weekday[($i 7)]);
  673.                         break;
  674.  
  675.                     default:    // Backward compatibility: any non emty value will display this
  676.                         // D => 'Fri'
  677.                         echo T_($weekday_abbrev[($i 7)]);
  678.                 }
  679.  
  680.                 echo $this->headercellend;
  681.             }
  682.  
  683.             echo $this->headerrowend;
  684.         }
  685.  
  686.         // FOOTER :
  687.  
  688.         if$this->navigation == 'tfoot' )
  689.         // We want to display navigation in the table footer:
  690.             echo "<tfoot>\n";
  691.             echo "<tr>\n";
  692.             echo '<td colspan="'.( ( $this->mode == 'month' + (int)$this->today_is_visible ).'" id="prev">';
  693.             echo implode'&nbsp;'$this->getNavLinks'prev' ) );
  694.             echo "</td>\n";
  695.  
  696.             if$this->today_is_visible )
  697.             {
  698.                 if$this->mode == 'month' )
  699.                 {
  700.                     echo '<td class="pad">&nbsp;</td>'."\n";
  701.                 }
  702.             }
  703.             else
  704.             {
  705.                 echo '<td colspan="'.$this->mode == 'month' '3' '2' ).'" class="center">'
  706.                             .$this->archive_linkT_('Current')''date('Y')$this->mode == 'month' date('m'NULL ) )
  707.                             .'</td>';
  708.             }
  709.             echo '<td colspan="'.( ( $this->mode == 'month' + (int)$this->today_is_visible ).'" id="next">';
  710.             echo implode'&nbsp;'$this->getNavLinks'next' ) );
  711.             echo "</td>\n";
  712.             echo "</tr>\n";
  713.             echo "</tfoot>\n";
  714.         }
  715.  
  716.         // REAL TABLE DATA :
  717.  
  718.         echo $this->rowstart;
  719.  
  720.         if$this->mode == 'year' )
  721.         {    // DISPLAY MONTHS:
  722.  
  723.             for ($i 1$i 13$i $i 1)
  724.             {    // For each month:
  725.                 ifisset($monthswithposts$i ]) )
  726.                 {
  727.                     if$this->month == $i )
  728.                     {
  729.                         echo $this->todaycellstartpost;
  730.                     }
  731.                     else
  732.                     {
  733.                         echo $this->linkpostcellstart;
  734.                     }
  735.                     if$monthswithposts$i && !empty($this->postcount_year_atitle) )
  736.                     // display postcount
  737.                         $title sprintf($this->postcount_year_atitle$monthswithposts$i ]);
  738.                     }
  739.                     elseif!empty($this->postcount_year_atitle_one) )
  740.                     // display postcount for one post
  741.                         $title sprintf($this->postcount_year_atitle_one1);
  742.                     }
  743.                     else
  744.                     {
  745.                         $title '';
  746.                     }
  747.                     echo $this->archive_linkT_($month_abbrevzeroise($i2])$title$this->year$i );
  748.                 }
  749.                 elseif$this->month == $i )
  750.                 // current month
  751.                     echo $this->todaycellstart;
  752.                     echo T_($month_abbrevzeroise($i2]);
  753.                 }
  754.                 else
  755.                 {
  756.                     echo $this->cellstart;
  757.                     echo T_($month_abbrevzeroise($i2]);
  758.                 }
  759.                 echo $this->cellend;
  760.                 if$i == || $i == )
  761.                 // new row
  762.                     echo $this->rowend.$this->rowstart;
  763.                 }
  764.             }
  765.         }
  766.         else // mode == 'month'
  767.         {    // DISPLAY DAYS of current month:
  768.             $dow 0;
  769.             $last_day = -1;
  770.             $dom_displayed 0// days of month displayed
  771.  
  772.             for$i $calendarfirst$i <= $calendarlast$i $i 86400 )
  773.             // loop day by day (86400 seconds = 24 hours; but not on days where daylight saving changes!)
  774.                 if$dow == )
  775.                 // We need to start a new row:
  776.                     if$dom_displayed >= $daysinmonth )
  777.                     // Last day already displayed!
  778.                         break;
  779.                     }
  780.                     echo $this->rowend;
  781.                     echo $this->rowstart;
  782.                     $dow 0;
  783.                 }
  784.                 $dow++;
  785.  
  786.                 // correct daylight saving ("last day"+86400 would lead to "last day at 23:00")
  787.                 // fp> TODO: use mkdate()
  788.                 whiledate('j'$i== $last_day )
  789.                 {
  790.                     $i += 3600;
  791.                 }
  792.                 $last_day date('j'$i);
  793.  
  794.  
  795.                 if (date('m'$i!= $this->month)
  796.                 // empty cell
  797.                     echo $this->emptycellstart;
  798.                     echo $this->emptycellcontent;
  799.                     echo $this->emptycellend;
  800.                 }
  801.                 else
  802.                 // This day is in this month
  803.                     $dom_displayed++;
  804.                     $calendartoday (date('Ymd',$i== date('Ymd'(time($time_difference)));
  805.  
  806.                     ifisset($daysinmonthwithpostsdate('j'$i]) )
  807.                     {
  808.                         if$calendartoday )
  809.                         {
  810.                             echo $this->todaycellstartpost;
  811.                         }
  812.                         else
  813.                         {
  814.                             echo $this->linkpostcellstart;
  815.                         }
  816.                         if$daysinmonthwithpostsdate('j'$i&& !empty($this->postcount_month_atitle) )
  817.                         // display postcount
  818.                             $title sprintf($this->postcount_month_atitle$daysinmonthwithpostsdate('j'$i]);
  819.                         }
  820.                         elseif!empty($this->postcount_month_atitle_one) )
  821.                         // display postcount for one post
  822.                             $title sprintf($this->postcount_month_atitle_one1);
  823.                         }
  824.                         else
  825.                         {
  826.                             $title '';
  827.                         }
  828.                         echo $this->archive_linkdate('j',$i)$title$this->year$this->monthdate('d',$i) );
  829.                     }
  830.                     elseif ($calendartoday)
  831.                     {
  832.                         echo $this->todaycellstart;
  833.                         echo date('j',$i);
  834.                     }
  835.                     else
  836.                     {
  837.                         echo $this->cellstart;
  838.                         echo date('j',$i);
  839.                     }
  840.                     echo $this->cellend;
  841.                 }
  842.             // loop day by day
  843.         // mode == 'month'
  844.  
  845.         echo $this->rowend;
  846.  
  847.         echo $this->tableend;
  848.  
  849.     }  // display(-)
  850.  
  851.  
  852.     /**
  853.      * Create a link to archive, using either URL params or extra path info.
  854.      *
  855.      * Can make contextual links.
  856.      *
  857.      * @param string 
  858.      * @param string 
  859.      * @param string year
  860.      * @param string month
  861.      * @param string day
  862.      */
  863.     function archive_link$text$title$year$month NULL$day NULL )
  864.     {
  865.     /**
  866.          * @var Blog
  867.          */
  868.         global $Blog;
  869.  
  870.         if$this->link_type == 'context' )
  871.         {    // We want to preserve context:
  872.             $url_params 'm='.$year;
  873.             if!empty$month ) )
  874.             {
  875.                 $url_params .= zeroise($month,2);
  876.                 if!empty$day ) )
  877.                 {
  878.                     $url_params .= zeroise($day,2);
  879.                 }
  880.             }
  881.             return '<a rel="nofollow" href="'.regenerate_url$this->context_isolation$url_params ).'">'.format_to_output($text).'</a>';
  882.         }
  883.         else
  884.         {    // We want a canonic link:
  885.             return $Blog->gen_archive_link$text$title$year$month$day );
  886.         }
  887.     }
  888.  
  889.  
  890.     /**
  891.      * Get links to navigate between month / year.
  892.      *
  893.      * Unless min/max_timestamp='query' has been specified, this will not do any (time consuming!) queries to check where the posts are.
  894.      *
  895.      * @param string 'prev' / 'next'
  896.      * @return array 
  897.      */
  898.     function getNavLinks$direction )
  899.     {
  900.         global $DB$localtimenow;
  901.  
  902.         //pre_dump( 'get_nav_links', $direction );
  903.  
  904.         $r array();
  905.  
  906.         if$this->params['min_timestamp'== 'query' || $this->params['max_timestamp'== 'query' )
  907.         // Do inits:
  908.             // WE NEED SPECIAL QUERY PARAMS WHEN MOVING THOUGH MONTHS ( NO dstart especially! )
  909.             $nav_ItemQuery new ItemQuery$this->dbtable$this->dbprefix$this->dbIDname );    // TEMP object
  910.             // Restrict to selected blog/categories:
  911.             $nav_ItemQuery->where_chapter2$this->ItemQuery->Blog$this->ItemQuery->cat_array$this->ItemQuery->cat_modifier );
  912.             // Restrict to the statuses we want to show:
  913.             $nav_ItemQuery->where_visibility$this->ItemQuery->show_statuses );
  914.             // Restrict to selected authors:
  915.             $nav_ItemQuery->where_author$this->ItemQuery->author );
  916.             // if a month is specified in the querystring, load that month:
  917.             $nav_ItemQuery->where_datestart/* NO m */''/* NO w */''/* NO dstart */''''$this->ItemQuery->timestamp_min$this->ItemQuery->timestamp_max );
  918.             // Keyword search stuff:
  919.             $nav_ItemQuery->where_keywords$this->ItemQuery->keywords$this->ItemQuery->phrase$this->ItemQuery->exact );
  920.             // Exclude pages and intros:
  921.             $nav_ItemQuery->where_types$this->ItemQuery->types );
  922.         }
  923.  
  924.         switch$direction )
  925.         {
  926.             case 'prev':
  927.                 //pre_dump( $this->params['min_timestamp'] );
  928.                 $r['';
  929.  
  930.                 ifempty($this->month) )
  931.                 // if $this->month is empty, we're in mode "year" with no selected month
  932.                     $use_range_month 12;
  933.                     $use_range_day 31;
  934.                 }
  935.                 else
  936.                 {
  937.                     $use_range_month $this->month;
  938.                     $use_range_day 1;    // Note: cannot use current day since all months do not have same number of days
  939.                 }
  940.  
  941.                 /*
  942.                  * << (PREV YEAR)
  943.                  */
  944.                 if$this->browseyears )
  945.                 {    // We want arrows to move one year at a time
  946.                     if$this->params['min_timestamp'== 'query' )
  947.                     {    // Let's query to find the correct year:
  948.                         if$row $DB->get_row(
  949.                                 'SELECT EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) AS year,
  950.                                                 EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) AS month
  951.                                     FROM ('.$this->dbtable.' INNER JOIN T_postcats ON '.$this->dbIDname.' = postcat_post_ID)
  952.                                                 INNER JOIN T_categories ON postcat_cat_ID = cat_ID
  953.                                     WHERE EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) < '.$this->year.'
  954.                                                 '.$nav_ItemQuery->get_where' AND ' )
  955.                                                 .$nav_ItemQuery->get_group_by' GROUP BY ' ).'
  956.                                     ORDER BY EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) DESC, ABS( '.$use_range_month.' - EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) ) ASC
  957.                                     LIMIT 1'OBJECT0'Calendar: find prev year with posts' )
  958.                             )
  959.                         {
  960.                             $prev_year_year $row->year;
  961.                             $prev_year_month $row->month;
  962.                         }
  963.                     }
  964.                     else
  965.                     // Let's see if the previous year is in the desired navigation range:
  966.                         $prev_year_ts mktime000$use_range_month$use_range_day,  $this->year-);
  967.                         if$prev_year_ts >= $this->params['min_timestamp')
  968.                         {
  969.                             $prev_year_year date'Y'$prev_year_ts );
  970.                             $prev_year_month date'm'$prev_year_ts );
  971.                         }
  972.                     }
  973.                 }
  974.  
  975.                 if!empty($prev_year_year) )
  976.                 {    // We have a link to display:
  977.                     $r[$this->archive_link'&lt;&lt;'sprintf(
  978.                                                 $this->mode == 'month'
  979.                                                         ? /* Calendar link title to a month in a previous year */ T_('Previous year (%04d-%02d)')
  980.                                                         : /* Calendar link title to a previous year */ T_('Previous year (%04d)') ),
  981.                                                 $prev_year_year$prev_year_month )$prev_year_year($this->mode == 'month'$prev_year_month NULL ;
  982.                 }
  983.  
  984.  
  985.                 /*
  986.                  * < (PREV MONTH)
  987.                  */
  988.                 if$this->mode == 'month' )
  989.                 // We are browsing months, we'll display arrows to move one month at a time:
  990.                     if$this->params['min_timestamp'== 'query' )
  991.                     {    // Let's query to find the correct month:
  992.                         if$row $DB->get_row(
  993.                                 'SELECT EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) AS month,
  994.                                                 EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) AS year
  995.                                 FROM ('.$this->dbtable.' INNER JOIN T_postcats ON '.$this->dbIDname.' = postcat_post_ID)
  996.                                     INNER JOIN T_categories ON postcat_cat_ID = cat_ID
  997.                                 WHERE
  998.                                 (
  999.                                     EXTACT(YEAR FROM '.$this->dbprefix.'datestart) < '.($this->year).'
  1000.                                     OR ( EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) = '.($this->year).'
  1001.                                                 AND EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) < '.($this->month).'
  1002.                                             )
  1003.                                 )
  1004.                                 '.$nav_ItemQuery->get_where' AND ' )
  1005.                                  .$nav_ItemQuery->get_group_by' GROUP BY ' ).'
  1006.                                 ORDER BY EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) DESC, EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) DESC
  1007.                                 LIMIT 1',
  1008.                                 OBJECT,
  1009.                                 0,
  1010.                                 'Calendar: Find prev month with posts' )
  1011.                             )
  1012.                         {
  1013.                             $prev_month_year $row->year;
  1014.                             $prev_month_month $row->month;
  1015.                         }
  1016.                     }
  1017.                     else
  1018.                     // Let's see if the previous month is in the desired navigation range:
  1019.                         $prev_month_ts mktime000$this->month-11$this->year )// Note: cannot use current day since all months do not have same number of days
  1020.                         if$prev_month_ts >= $this->params['min_timestamp')
  1021.                         {
  1022.                             $prev_month_year date'Y'$prev_month_ts );
  1023.                             $prev_month_month date'm'$prev_month_ts );
  1024.                         }
  1025.                     }
  1026.                 }
  1027.  
  1028.                 if!empty($prev_month_year) )
  1029.                 {    // We have a link to display:
  1030.                     $r[$this->archive_link'&lt;'sprintfT_('Previous month (%04d-%02d)')$prev_month_year$prev_month_month )$prev_month_year$prev_month_month );
  1031.                 }
  1032.                 break;
  1033.  
  1034.  
  1035.             case 'next':
  1036.                 //pre_dump( $this->params['max_timestamp'] );
  1037.  
  1038.                 /*
  1039.                  * > (NEXT MONTH)
  1040.                  */
  1041.                 if$this->mode == 'month' )
  1042.                 // We are browsing months, we'll display arrows to move one month at a time:
  1043.                     if$this->params['max_timestamp'== 'query' )
  1044.                     {    // Let's query to find the correct month:
  1045.                         if$row $DB->get_row(
  1046.                                 'SELECT EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) AS month,
  1047.                                                 EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) AS year
  1048.                                 FROM ('.$this->dbtable.' INNER JOIN T_postcats ON '.$this->dbIDname.' = postcat_post_ID)
  1049.                                     INNER JOIN T_categories ON postcat_cat_ID = cat_ID
  1050.                                 WHERE
  1051.                                 (
  1052.                                     EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) > '.($this->year).'
  1053.                                     OR ( EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) = '.($this->year).'
  1054.                                                 AND EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) > '.($this->month).'
  1055.                                             )
  1056.                                 )
  1057.                                 '.$nav_ItemQuery->get_where' AND ' )
  1058.                                  .$nav_ItemQuery->get_group_by' GROUP BY ' ).'
  1059.                                 ORDER BY EXTRACT(YEAR FROM '.$this->dbprefix.'datestart), EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) ASC
  1060.                                 LIMIT 1',
  1061.                                 OBJECT,
  1062.                                 0,
  1063.                                 'Calendar: Find next month with posts' )
  1064.                             )
  1065.                         {
  1066.                             $next_month_year $row->year;
  1067.                             $next_month_month $row->month;
  1068.                         }
  1069.                     }
  1070.                     else
  1071.                     // Let's see if the next month is in the desired navigation range:
  1072.                         $next_month_ts mktime000$this->month+11,  $this->year )// Note: cannot use current day since all months do not have same number of days
  1073.                         if$next_month_ts <= $this->params['max_timestamp')
  1074.                         {
  1075.                             $next_month_year date'Y'$next_month_ts );
  1076.                             $next_month_month date'm'$next_month_ts );
  1077.                         }
  1078.                     }
  1079.                 }
  1080.  
  1081.                 if!empty($next_month_year) )
  1082.                 {    // We have a link to display:
  1083.                     $r[$this->archive_link'&gt;'sprintfT_('Next month (%04d-%02d)')$next_month_year$next_month_month )$next_month_year$next_month_month );
  1084.                 }
  1085.  
  1086.  
  1087.                 ifempty($this->month) )
  1088.                 // if $this->month is empty, we're in mode "year" with no selected month
  1089.                     $use_range_month 12;
  1090.                     $use_range_day 31;
  1091.                 }
  1092.                 else
  1093.                 {
  1094.                     $use_range_month $this->month;
  1095.                     $use_range_day 1;    // Note: cannot use current day since all months do not have same number of days
  1096.                 }
  1097.  
  1098.                 /*
  1099.                  * >> (NEXT YEAR)
  1100.                  */
  1101.                 if$this->browseyears )
  1102.                 // We want arrows to move one year at a time
  1103.                     if$this->params['max_timestamp'== 'query' )
  1104.                     {    // Let's query to find the correct year:
  1105.                     if$row $DB->get_row(
  1106.                             'SELECT EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) AS year,
  1107.                                             EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) AS month
  1108.                                 FROM ('.$this->dbtable.' INNER JOIN T_postcats ON '.$this->dbIDname.' = postcat_post_ID)
  1109.                                     INNER JOIN T_categories ON postcat_cat_ID = cat_ID
  1110.                                 WHERE EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) > '.$this->year.'
  1111.                                  '.$nav_ItemQuery->get_where' AND ' )
  1112.                                  .$nav_ItemQuery->get_group_by' GROUP BY ' ).'
  1113.                                 ORDER BY EXTRACT(YEAR FROM '.$this->dbprefix.'datestart) ASC, ABS( '.$use_range_month.' - EXTRACT(MONTH FROM '.$this->dbprefix.'datestart) ) ASC
  1114.                                 LIMIT 1'OBJECT0'Calendar: find next year with posts' )
  1115.                         )
  1116.                         {
  1117.                             $next_year_year $row->year;
  1118.                             $next_year_month $row->month;
  1119.                         }
  1120.                     }
  1121.                     else
  1122.                     // Let's see if the next year is in the desired navigation range:
  1123.                         $next_year_ts mktime000$use_range_month$use_range_day,  $this->year+);
  1124.                         if$next_year_ts <= $this->params['max_timestamp')
  1125.                         {
  1126.                             $next_year_year date'Y'$next_year_ts );
  1127.                             $next_year_month date'm'$next_year_ts );
  1128.                         }
  1129.                     }
  1130.  
  1131.                 if!empty($next_year_year) )
  1132.                 {    // We have a link to display:
  1133.                         $r[$this->archive_link'&gt;&gt;'sprintf(
  1134.                                                                     $this->mode == 'month'
  1135.                                                                             ? /* Calendar link title to a month in a following year */ T_('Next year (%04d-%02d)')
  1136.                                                                             : /* Calendar link title to a following year */ T_('Next year (%04d)') ),
  1137.                                                                     $next_year_year$next_year_month )$next_year_year($this->mode == 'month'$next_year_month NULL );
  1138.                     }
  1139.                 }
  1140.                 break;
  1141.         }
  1142.  
  1143.         return $r;
  1144.     }
  1145.  
  1146. }
  1147.  
  1148. /*
  1149.  * $Log: _calendar.plugin.php,v $
  1150.  * Revision 1.59  2010/02/08 17:55:47  efy-yury
  1151.  * copyright 2009 -> 2010
  1152.  *
  1153.  * Revision 1.58  2010/01/30 18:55:36  blueyed
  1154.  * Fix "Assigning the return value of new by reference is deprecated" (PHP 5.3)
  1155.  *
  1156.  * Revision 1.57  2009/06/24 18:47:54  tblue246
  1157.  * Make widget plugin names translatable
  1158.  *
  1159.  * Revision 1.56  2009/05/18 03:59:39  fplanque
  1160.  * minor/doc
  1161.  *
  1162.  * Revision 1.55  2009/03/31 20:24:30  blueyed
  1163.  * Beautify code.
  1164.  *
  1165.  * Revision 1.54  2009/03/08 23:57:47  fplanque
  1166.  * 2009
  1167.  *
  1168.  * Revision 1.53  2009/02/23 05:03:07  sam2kb
  1169.  * Removed duplicate code
  1170.  *
  1171.  * Revision 1.52  2009/01/21 22:36:35  fplanque
  1172.  * Cleaner handling of pages and intros in calendar and archives plugins
  1173.  *
  1174.  * Revision 1.51  2008/03/31 00:27:11  blueyed
  1175.  * Nuke unused  global statements; use global  in loop instead of getter
  1176.  *
  1177.  * Revision 1.50  2008/03/30 14:56:50  fplanque
  1178.  * DST fix
  1179.  *
  1180.  * Revision 1.49  2008/01/21 09:35:41  fplanque
  1181.  * (c) 2008
  1182.  *
  1183.  * Revision 1.48  2007/11/29 21:52:22  fplanque
  1184.  * minor
  1185.  *
  1186.  * Revision 1.47  2007/11/25 18:20:38  fplanque
  1187.  * additional SEO settings
  1188.  *
  1189.  * Revision 1.46  2007/10/09 02:10:50  fplanque
  1190.  * URL fixes
  1191.  *
  1192.  * Revision 1.45  2007/07/01 03:58:08  fplanque
  1193.  * cat_array cleanup/debug
  1194.  *
  1195.  * Revision 1.44  2007/06/23 22:06:47  fplanque
  1196.  * CSS cleanup
  1197.  *
  1198.  * Revision 1.43  2007/06/20 21:42:15  fplanque
  1199.  * implemented working widget/plugin params
  1200.  *
  1201.  * Revision 1.42  2007/05/14 02:43:06  fplanque
  1202.  * Started renaming tables. There probably won't be a better time than 2.0.
  1203.  *
  1204.  * Revision 1.41  2007/04/26 00:11:04  fplanque
  1205.  * (c) 2007
  1206.  *
  1207.  * Revision 1.40  2007/03/29 10:35:40  fplanque
  1208.  * fix
  1209.  *
  1210.  * Revision 1.39  2007/03/25 10:20:02  fplanque
  1211.  * cleaned up archive urls
  1212.  *
  1213.  * Revision 1.38  2007/03/18 16:54:37  waltercruz
  1214.  * Changing the MySQL date functions to the standart (EXTRACT) ones and killing ORDER BY in monthly and year calendar.
  1215.  *
  1216.  * Revision 1.37  2007/02/06 12:49:39  waltercruz
  1217.  * Changing the date queries to the EXTRACT syntax
  1218.  *
  1219.  * Revision 1.36  2007/01/14 01:31:51  fplanque
  1220.  * do not display title by default (bloated)
  1221.  *
  1222.  * Revision 1.35  2007/01/13 18:36:24  fplanque
  1223.  * renamed "Skin Tag" plugins into "Widget" plugins
  1224.  * but otherwise they remain basically the same & compatible
  1225.  *
  1226.  * Revision 1.34  2006/12/26 03:19:12  fplanque
  1227.  * assigned a few significant plugin groups
  1228.  *
  1229.  * Revision 1.33  2006/12/07 23:13:14  fplanque
  1230.  * @var needs to have only one argument: the variable type
  1231.  * Otherwise, I can't code!
  1232.  *
  1233.  * Revision 1.32  2006/11/24 18:27:27  blueyed
  1234.  * Fixed link to b2evo CVS browsing interface in file docblocks
  1235.  *
  1236.  * Revision 1.31  2006/11/03 18:22:26  fplanque
  1237.  * no message
  1238.  *
  1239.  * Revision 1.30  2006/10/29 14:52:56  blueyed
  1240.  * Fixed bug with daylight saving time, which displayed days twice
  1241.  *
  1242.  * Revision 1.29  2006/10/14 19:07:17  blueyed
  1243.  * Removed TODO
  1244.  *
  1245.  * Revision 1.28  2006/10/14 19:05:39  blueyed
  1246.  * Fixed "mktime() expects parameter 4 to be long, string given" warning; doc
  1247.  */
  1248. ?>

Documentation generated on Sat, 06 Mar 2010 04:03:19 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).