- Timestamp:
- 2013/08/28 13:26:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/module/Calendar/Util/Uri.php
r23125 r23141 1 1 <?php 2 2 /* vim: set expandtab tabstop=4 shiftwidth=4: */ 3 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 // 4 23 /** 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 24 * @package Calendar 25 * @version $Id: Uri.php,v 1.1 2004/08/16 09:03:55 hfuecks Exp $ 38 26 */ 39 27 … … 42 30 * <code> 43 31 * $Day = new Calendar_Day(2003, 10, 23); 44 * $Uri = new Calendar_Util_Uri('year', 'month', 'day');32 * $Uri = & new Calendar_Util_Uri('year', 'month', 'day'); 45 33 * echo $Uri->prev($Day,'month'); // Displays year=2003&month=10 46 34 * echo $Uri->prev($Day,'day'); // Displays year=2003&month=10&day=22 … … 50 38 * echo $Uri->prev($Day,'day'); // Displays 2003/10/22 51 39 * </code> 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 40 * @package Calendar 41 * @access public 61 42 */ 62 43 class Calendar_Util_Uri … … 89 70 * Constructs Calendar_Decorator_Uri 90 71 * The term "fragment" means <i>name</i> of a calendar GET variables in the URL 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 * 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 99 78 * @access public 100 79 */ … … 106 85 /** 107 86 * Sets the URI fragment names 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 * 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 116 93 * @return void 117 94 * @access public 118 95 */ 119 function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) 120 { 96 function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) { 121 97 if (!is_null($y)) $this->uris['Year'] = $y; 122 98 if (!is_null($m)) $this->uris['Month'] = $m; … … 129 105 /** 130 106 * Gets the URI string for the previous calendar unit 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 * 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) 135 109 * @return string 136 110 * @access public … … 145 119 /** 146 120 * Gets the URI string for the current calendar unit 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 * 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) 151 123 * @return string 152 124 * @access public … … 154 126 function this($Calendar, $unit) 155 127 { 156 128 $method = 'this'.$unit; 157 129 $stamp = $Calendar->{$method}('timestamp'); 158 130 return $this->buildUriString($Calendar, $method, $stamp); … … 161 133 /** 162 134 * Gets the URI string for the next calendar unit 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 * 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) 167 137 * @return string 168 138 * @access public … … 177 147 /** 178 148 * Build the URI string 179 * 180 * @param object $Calendar subclassed from Calendar e.g. Calendar_Month 181 * @param string $method method substring 182 * @param int $stamp timestamp 183 * 149 * @param string method substring 150 * @param int timestamp 184 151 * @return string build uri string 185 152 * @access private … … 193 160 $call = 'stampTo'.$unit; 194 161 $uriString .= $separator; 195 if (!$this->scalar) { 196 $uriString .= $uri.'='; 197 } 162 if (!$this->scalar) $uriString .= $uri.'='; 198 163 $uriString .= $cE->{$call}($stamp); 199 164 $separator = $this->separator;
Note: See TracChangeset
for help on using the changeset viewer.