Changeset 461 for trunk/lib/Navigation.inc.php
- Timestamp:
- Feb 6, 2014 11:31:21 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Navigation.inc.php
r396 r461 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 28 28 * and titles, as well as setting page params such as hiding the page title on 29 29 * some pages but not others, and storing vars like the page title itself. 30 * 30 * 31 31 * Note: this class was renamed from "Nav" because of the change in API and to be more descriptive. 32 32 * … … 37 37 38 38 // Configuration parameters for this object. 39 var $_params = array( 39 var $_params = array( 40 40 'head_title' => true, 41 41 'body_title' => true, … … 68 68 * current page added last. Vars can be specified for any page, but only vars 69 69 * from the "current" page will be accessed with Nav::get. 70 * 70 * 71 71 * @access public 72 72 * @param string $title The title of the page. … … 94 94 { 95 95 $app =& App::getInstance(); 96 96 97 97 if (isset($params) && is_array($params)) { 98 98 // Merge new parameters with old overriding only those passed. … … 113 113 { 114 114 $app =& App::getInstance(); 115 115 116 116 if (isset($this->_params[$param])) { 117 117 return $this->_params[$param]; … … 142 142 { 143 143 // Set params of current page. 144 $curr_page =& $this->pages[sizeof($this->pages) - 1]; 144 $curr_page =& $this->pages[sizeof($this->pages) - 1]; 145 145 $curr_page[$key] = $val; 146 146 } … … 157 157 { 158 158 $curr_page =& $this->pages[sizeof($this->pages) - 1]; 159 159 160 160 switch ($key) { 161 161 case 'title' : … … 279 279 * @return mixed The value set for $return, TRUE by default. 280 280 */ 281 function currentPage($page_uri, $return=true) 282 { 283 if (preg_match('/^' . preg_quote(urldecode($page_uri), '/') . '/i', $_SERVER['PHP_SELF'])) { 284 return $return; 285 } 281 function currentPage($test_uri, $true_return=true, $false_return=false, $include_query=true) 282 { 283 $actual_uri = $include_query ? $_SERVER['REQUEST_URI'] : strtok($_SERVER['REQUEST_URI'], '?'); 284 if (preg_match('/^' . preg_quote(urldecode($test_uri), '/') . '$/i', $actual_uri)) { 285 return $true_return; 286 } 287 return $false_return; 286 288 } 287 289
Note: See TracChangeset
for help on using the changeset viewer.