Changeset 464
- Timestamp:
- Feb 8, 2014 2:29:30 AM (10 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Navigation.inc.php
r461 r464 279 279 * @return mixed The value set for $return, TRUE by default. 280 280 */ 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'], '?'); 281 function currentPage($test_uri, $true_return=true, $false_return=false, $strip_query=false) 282 { 283 $actual_uri = $strip_query ? strtok($_SERVER['REQUEST_URI'], '?') : $_SERVER['REQUEST_URI']; 284 $test_uri = $strip_query ? strtok($test_uri, '?') : $test_uri; 284 285 if (preg_match('/^' . preg_quote(urldecode($test_uri), '/') . '$/i', $actual_uri)) { 285 286 return $true_return; -
trunk/lib/Utilities.inc.php
r457 r464 33 33 * @param bool $var_dump Use var_dump instead of print_r. 34 34 */ 35 function dump($var, $display=false, $var_dump=false )35 function dump($var, $display=false, $var_dump=false, $file, $line) 36 36 { 37 37 if (defined('_CLI')) { … … 52 52 } 53 53 54 /** 55 * Return dump as variable. 56 * 57 * @param mixed $var Variable to dump. 58 * @param bool $serialize Remove line-endings. Useful for logging variables. 59 * @return string Dump of var. 60 */ 54 /* 55 * Log a PHP variable to javascript console. Relies on getDump(), below. 56 * 57 * @access public 58 * @param mixed $var The variable to dump. 59 * @param string $prefix A short note to print before the output to make identifying output easier. 60 * @param string $file The value of __FILE__. 61 * @param string $line The value of __LINE__. 62 * @return null 63 * @author Quinn Comendant <quinn@strangecode.com> 64 */ 65 function jsDump($var, $prefix='jsDump', $file='-', $line='-') 66 { 67 if (!empty($var)) { 68 ?> 69 <script type="text/javascript" charset="utf-8"> 70 /* <![CDATA[ */ 71 window.console && console.log('<?php printf('%s: %s (on line %s of %s)', $prefix, str_replace("'", "\\'", getDump($var, true)), $line, $file); ?>'); 72 /* ]]> */ 73 </script> 74 <?php 75 } 76 } 77 78 /* 79 * Return a string version of any variable, optionally serialized on one line. 80 * 81 * @access public 82 * @param mixed $var The variable to dump. 83 * @param bool $serialize If true, remove line-endings. Useful for logging variables. 84 * @return string The dumped variable. 85 * @author Quinn Comendant <quinn@strangecode.com> 86 */ 61 87 function getDump($var, $serialize=false) 62 88 {
Note: See TracChangeset
for help on using the changeset viewer.