- Timestamp:
- Aug 14, 2014 8:29:47 AM (10 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Navigation.inc.php
r484 r485 198 198 199 199 /** 200 * Returns the path from root up to the current page as an array. 201 * 202 * @access public 203 * @param string $key Which value to use in the path (usually head_title or body_title or just title). 204 * @return mixed Path (string) or false if path param is not set. 205 */ 206 public function getPathArray($key='title') 207 { 208 $path = array(); 209 if ($this->getParam('path')) { 210 foreach ($this->pages as $page) { 211 $path[] = strip_tags($page[$key]); 212 } 213 } 214 return $path; 215 } 216 217 /** 200 218 * Returns the text path from root up to the current page, separated by the 201 219 * path_delimiter. … … 207 225 public function getPath($key='title') 208 226 { 209 if ($this->getParam('path')) { 210 $path = ''; 211 $pathmark = ''; 227 228 $path = $this->getPathArray(); 229 return empty($path) ? '' : join(oTxt($this->getParam('path_delimiter'), true), $path); 230 } 231 232 /** 233 * Returns the breadcrumbs from the root page to the current page. 234 * Breadcrumbs are the text path with pages titles linked to that page. 235 * 236 * @access public 237 * @return string Breadcrumbs or empty string if breadcrumbs param not set. 238 */ 239 public function getBreadcrumbsArray() 240 { 241 $app =& App::getInstance(); 242 243 if ($this->getParam('breadcrumbs')) { 244 $breadcrumbs = array(); 245 $crumb_count = sizeof($this->pages); 212 246 foreach ($this->pages as $page) { 213 $path .= oTxt($pathmark . strip_tags($page[$key]), true); 214 $pathmark = $this->getParam('path_delimiter'); 215 } 216 return $path; 247 if ($crumb_count <= $this->getParam('chop_breadcrumbs')) { 248 // Stop gathering crumbs. 249 break; 250 } 251 if ($crumb_count <= 1) { 252 // The last crumb. 253 if ('' == trim($page['url']) || $crumb_count <= $this->getParam('chop_breadcrumb_links')) { 254 // A crumb with no link. 255 $breadcrumbs[] = array( 256 'url' => false, 257 'title' => sprintf($this->getParam('last_crumb_format'), $page['title']) 258 ); 259 } else if ($crumb_count > $this->getParam('chop_breadcrumb_links')) { 260 // A normal linked crumb. 261 $breadcrumbs[] = array( 262 'url' => $page['url'], 263 'title' => sprintf($this->getParam('last_crumb_format'), $page['title']) 264 ); 265 } 266 } else { 267 if ('' == trim($page['url'])) { 268 // A crumb with no link. 269 $breadcrumbs[] = array( 270 'url' => false, 271 'title' => $page['title'] 272 ); 273 } else { 274 // A normal linked crumb. 275 $breadcrumbs[] = array( 276 'url' => $page['url'], 277 'title' => $page['title'] 278 ); 279 } 280 } 281 $crumb_count--; 282 } 283 return $breadcrumbs; 217 284 } else { 218 return false;285 return array(); 219 286 } 220 287 } … … 247 314 } else if ($crumb_count > $this->getParam('chop_breadcrumb_links')) { 248 315 // A normal linked crumb. 249 $breadcrumbs[] = '<a href="' . $ app->oHREF($page['url']). '">' . sprintf($this->getParam('last_crumb_format'), oTxt($page['title'], true)) . '</a>';316 $breadcrumbs[] = '<a href="' . $page['url'] . '">' . sprintf($this->getParam('last_crumb_format'), oTxt($page['title'], true)) . '</a>'; 250 317 } 251 318 } else { … … 255 322 } else { 256 323 // A normal linked crumb. 257 $breadcrumbs[] = '<a href="' . $ app->oHREF($page['url']). '">' . oTxt($page['title'], true) . '</a>';324 $breadcrumbs[] = '<a href="' . $page['url'] . '">' . oTxt($page['title'], true) . '</a>'; 258 325 } 259 326 } -
trunk/lib/Upload.inc.php
r484 r485 82 82 // Enforce valid upload_path parameter. 83 83 if (isset($params['upload_path'])) { 84 $ params['upload_path']= realpath($params['upload_path']);84 $upload_path = realpath($params['upload_path']); 85 85 // Source must be directory. 86 if (!is_dir($ params['upload_path'])) {87 $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $ params['upload_path']), LOG_NOTICE, __FILE__, __LINE__);86 if (!is_dir($upload_path)) { 87 $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $upload_path), LOG_NOTICE, __FILE__, __LINE__); 88 88 if (version_compare(PHP_VERSION, '5.0.0', '>=')) { 89 89 // Recursive. 90 mkdir($ params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);90 mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true); 91 91 } else { 92 mkdir($ params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'));92 mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms')); 93 93 } 94 if (!is_dir($ params['upload_path'])) {94 if (!is_dir($upload_path)) { 95 95 $app->logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 96 96 trigger_error(sprintf('Upload directory invalid: %s', $params['upload_path']), E_USER_ERROR); … … 98 98 } 99 99 // Source must be writable. 100 if (!is_writable($ params['upload_path'])) {100 if (!is_writable($upload_path)) { 101 101 $app->logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 102 102 trigger_error(sprintf('Upload directory not writable: %s', $params['upload_path']), E_USER_ERROR); … … 197 197 if (is_array($custom_file_name) && sizeof($custom_file_name) == 1) { 198 198 // Is an array, but just one value. Pull it out. 199 $ custom_file_name = current($custom_file_name);199 $file_name = current($custom_file_name); 200 200 $this->_raiseMsg(sprintf(_("The file %s has been renamed to %s."), $files['name'][$i], $file_name), MSG_NOTICE, __FILE__, __LINE__); 201 201 $app->logMsg(sprintf('Using custom file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__); … … 520 520 $app =& App::getInstance(); 521 521 522 if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && $this->getParam('display_messages') & $type> 0)) {522 if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && ($this->getParam('display_messages') & $type) > 0)) { 523 523 $app->raiseMsg($message, $type, $file, $line); 524 524 } -
trunk/lib/Utilities.inc.php
r479 r485 139 139 * @param string $text Text to clean. 140 140 * @param bool $preserve_html If set to true, oTxt will not translate <, >, ", or ' 141 * characters into HTML entities. This allows HTML to pass through un munged.142 * @return string Cleanedtext.141 * characters into HTML entities. This allows HTML to pass through undisturbed. 142 * @return string HTML-safe text. 143 143 */ 144 144 function oTxt($text, $preserve_html=false)
Note: See TracChangeset
for help on using the changeset viewer.