- Timestamp:
- 2013/08/26 12:42:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/module/Calendar/Util/Uri.php
r20119 r23125 1 1 <?php 2 2 /* vim: set expandtab tabstop=4 shiftwidth=4: */ 3 // 4 // +----------------------------------------------------------------------+ 5 // | PHP | 6 // +----------------------------------------------------------------------+ 7 // | Copyright (c) 1997-2002 The PHP Group | 8 // +----------------------------------------------------------------------+ 9 // | This source file is subject to version 2.02 of the PHP license, | 10 // | that is bundled with this package in the file LICENSE, and is | 11 // | available at through the world-wide-web at | 12 // | http://www.php.net/license/3_0.txt. | 13 // | If you did not receive a copy of the PHP license and are unable to | 14 // | obtain it through the world-wide-web, please send a note to | 15 // | license@php.net so we can mail you a copy immediately. | 16 // +----------------------------------------------------------------------+ 17 // | Authors: Harry Fuecks <hfuecks@phppatterns.com> | 18 // | Lorenzo Alberton <l dot alberton at quipo dot it> | 19 // +----------------------------------------------------------------------+ 20 // 21 // $Id: Uri.php,v 1.1 2004/08/16 09:03:55 hfuecks Exp $ 22 // 3 23 4 /** 24 * @package Calendar 25 * @version $Id: Uri.php,v 1.1 2004/08/16 09:03:55 hfuecks Exp $ 5 * Contains the Calendar_Util_Uri class 6 * 7 * PHP versions 4 and 5 8 * 9 * LICENSE: Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * @category Date and Time 31 * @package Calendar 32 * @author Harry Fuecks <hfuecks@phppatterns.com> 33 * @author Lorenzo Alberton <l.alberton@quipo.it> 34 * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton 35 * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) 36 * @version CVS: $Id: Uri.php 300729 2010-06-24 12:05:53Z quipo $ 37 * @link http://pear.php.net/package/Calendar 26 38 */ 27 39 … … 30 42 * <code> 31 43 * $Day = new Calendar_Day(2003, 10, 23); 32 * $Uri = &new Calendar_Util_Uri('year', 'month', 'day');44 * $Uri = new Calendar_Util_Uri('year', 'month', 'day'); 33 45 * echo $Uri->prev($Day,'month'); // Displays year=2003&month=10 34 46 * echo $Uri->prev($Day,'day'); // Displays year=2003&month=10&day=22 … … 38 50 * echo $Uri->prev($Day,'day'); // Displays 2003/10/22 39 51 * </code> 40 * @package Calendar 41 * @access public 52 * 53 * @category Date and Time 54 * @package Calendar 55 * @author Harry Fuecks <hfuecks@phppatterns.com> 56 * @author Lorenzo Alberton <l.alberton@quipo.it> 57 * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton 58 * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) 59 * @link http://pear.php.net/package/Calendar 60 * @access public 42 61 */ 43 62 class Calendar_Util_Uri … … 70 89 * Constructs Calendar_Decorator_Uri 71 90 * The term "fragment" means <i>name</i> of a calendar GET variables in the URL 72 * @param string URI fragment for year 73 * @param string (optional) URI fragment for month 74 * @param string (optional) URI fragment for day 75 * @param string (optional) URI fragment for hour 76 * @param string (optional) URI fragment for minute 77 * @param string (optional) URI fragment for second 91 * 92 * @param string $y URI fragment for year 93 * @param string $m (optional) URI fragment for month 94 * @param string $d (optional) URI fragment for day 95 * @param string $h (optional) URI fragment for hour 96 * @param string $i (optional) URI fragment for minute 97 * @param string $s (optional) URI fragment for second 98 * 78 99 * @access public 79 100 */ … … 85 106 /** 86 107 * Sets the URI fragment names 87 * @param string URI fragment for year 88 * @param string (optional) URI fragment for month 89 * @param string (optional) URI fragment for day 90 * @param string (optional) URI fragment for hour 91 * @param string (optional) URI fragment for minute 92 * @param string (optional) URI fragment for second 108 * 109 * @param string $y URI fragment for year 110 * @param string $m (optional) URI fragment for month 111 * @param string $d (optional) URI fragment for day 112 * @param string $h (optional) URI fragment for hour 113 * @param string $i (optional) URI fragment for minute 114 * @param string $s (optional) URI fragment for second 115 * 93 116 * @return void 94 117 * @access public 95 118 */ 96 function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) { 119 function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) 120 { 97 121 if (!is_null($y)) $this->uris['Year'] = $y; 98 122 if (!is_null($m)) $this->uris['Month'] = $m; … … 105 129 /** 106 130 * Gets the URI string for the previous calendar unit 107 * @param object subclassed from Calendar e.g. Calendar_Month 108 * @param string calendar unit ( must be year, month, week, day, hour, minute or second) 131 * 132 * @param object $Calendar subclassed from Calendar e.g. Calendar_Month 133 * @param string $unit calendar unit (year|month|week|day|hour|minute|second) 134 * 109 135 * @return string 110 136 * @access public … … 119 145 /** 120 146 * Gets the URI string for the current calendar unit 121 * @param object subclassed from Calendar e.g. Calendar_Month 122 * @param string calendar unit ( must be year, month, week, day, hour, minute or second) 147 * 148 * @param object $Calendar subclassed from Calendar e.g. Calendar_Month 149 * @param string $unit calendar unit (year|month|week|day|hour|minute|second) 150 * 123 151 * @return string 124 152 * @access public … … 126 154 function this($Calendar, $unit) 127 155 { 128 $method = 'this'.$unit;156 $method = 'this'.$unit; 129 157 $stamp = $Calendar->{$method}('timestamp'); 130 158 return $this->buildUriString($Calendar, $method, $stamp); … … 133 161 /** 134 162 * Gets the URI string for the next calendar unit 135 * @param object subclassed from Calendar e.g. Calendar_Month 136 * @param string calendar unit ( must be year, month, week, day, hour, minute or second) 163 * 164 * @param object $Calendar subclassed from Calendar e.g. Calendar_Month 165 * @param string $unit calendar unit (year|month|week|day|hour|minute|second) 166 * 137 167 * @return string 138 168 * @access public … … 147 177 /** 148 178 * Build the URI string 149 * @param string method substring 150 * @param int timestamp 179 * 180 * @param object $Calendar subclassed from Calendar e.g. Calendar_Month 181 * @param string $method method substring 182 * @param int $stamp timestamp 183 * 151 184 * @return string build uri string 152 185 * @access private … … 160 193 $call = 'stampTo'.$unit; 161 194 $uriString .= $separator; 162 if (!$this->scalar) $uriString .= $uri.'='; 195 if (!$this->scalar) { 196 $uriString .= $uri.'='; 197 } 163 198 $uriString .= $cE->{$call}($stamp); 164 199 $separator = $this->separator;
Note: See TracChangeset
for help on using the changeset viewer.