getPaths() public static method

Gets path information
public static getPaths ( boolean $current = false ) : array
$current boolean Current parameter, useful when using requestAction
return array
Example #1
0
 function __construct($method, $messages)
 {
     $this->controller = new AppController();
     $params = Router::getParams();
     $viewPath = $this->controller->viewPath;
     if (Configure::read('App.theme')) {
         $viewPath = 'errors';
         if ($this->controller->view == 'Theme') {
             $viewPath = 'themed' . DS . Configure::read('App.theme') . DS . 'errors';
         }
     }
     if (Configure::read('debug') == 0) {
         $method = 'error404';
     }
     $checkView = VIEWS . $viewPath . DS . Inflector::underscore($method) . '.ctp';
     if (file_exists($checkView)) {
         $this->controller->_set(Router::getPaths());
         $this->controller->viewPath = $viewPath;
         $this->controller->theme = $appConfigurations['theme'];
         $this->controller->pageTitle = __('Error', true);
         $this->controller->set('message', $messages[0]['url']);
         $this->controller->set('appConfigurations', $appConfigurations);
         $this->controller->render($method);
         e($this->controller->output);
     } else {
         parent::__construct($method, $messages);
     }
 }
Example #2
0
	/**
	 * __construct
	 *
	 * @access public
	 * @return void
	 */
	function __construct() {
		parent::__construct();
		$this->_set(Router::getPaths());
		$this->params = Router::getParams();
		$this->constructClasses();
		$this->Component->initialize($this);
		$this->_set(array('cacheAction' => false, 'viewPath' => 'errors'));
	}
 /**
  * __construct
  *
  * @access public
  * @return void
  */
 function __construct()
 {
     parent::__construct();
     $this->_set(Router::getPaths());
     $this->request = Router::getRequest(false);
     $this->constructClasses();
     $this->Components->trigger('initialize', array(&$this));
     $this->_set(array('cacheAction' => false, 'viewPath' => 'errors'));
 }
Example #4
0
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     if ($this->name == 'CakeError') {
         $this->_set(Router::getPaths());
         $this->request->params = Router::getParams();
         $this->constructClasses();
         $this->startupProcess();
     }
 }
Example #5
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     Croogo::applyHookProperties('Hook.controller_properties');
     parent::__construct();
     if ($this->name == 'CakeError') {
         $this->_set(Router::getPaths());
         $this->params = Router::getParams();
         $this->constructClasses();
         $this->Component->initialize($this);
         $this->beforeFilter();
         $this->Component->triggerCallback('startup', $this);
     }
 }
Example #6
0
 /**
  * 
  */
 function __construct($method, $messages)
 {
     $params = Router::getParams();
     if (($method == 'missingController' || $method == 'missingAction') && file_exists(VIEWS . DS . 'static' . DS . $params['controller'] . ".ctp")) {
         $this->controller =& new AppController();
         $this->controller->_set(Router::getPaths());
         $this->controller->params = $params;
         $this->controller->constructClasses();
         $this->controller->beforeFilter();
         $this->controller->viewPath = 'static';
         $this->controller->render($params['controller']);
         e($this->controller->output);
         exit;
     }
     parent::__construct($method, $messages);
     exit;
 }
Example #7
0
 /**
  * Normalizes a URL for purposes of comparison.  Will strip the base path off
  * and replace any double /'s.  It will not unify the casing and underscoring
  * of the input value.
  *
  * @param mixed $url URL to normalize Either an array or a string url.
  * @return string Normalized URL
  * @access public
  * @static
  */
 function normalize($url = '/')
 {
     if (is_array($url)) {
         $url = Router::url($url);
     } elseif (preg_match('/^[a-z\\-]+:\\/\\//', $url)) {
         return $url;
     }
     $paths = Router::getPaths();
     if (!empty($paths['base']) && stristr($url, $paths['base'])) {
         $url = preg_replace('/^' . preg_quote($paths['base'], '/') . '/', '', $url, 1);
     }
     $url = '/' . $url;
     while (strpos($url, '//') !== false) {
         $url = str_replace('//', '/', $url);
     }
     $url = preg_replace('/(?:(\\/$))/', '', $url);
     if (empty($url)) {
         return '/';
     }
     return $url;
 }
Example #8
0
 /**
  * Normalizes a URL for purposes of comparison
  *
  * @param mixed $url URL to normalize
  * @return string Normalized URL
  * @access public
  */
 function normalize($url = '/')
 {
     if (is_array($url)) {
         $url = Router::url($url);
     }
     $paths = Router::getPaths();
     if (!empty($paths['base']) && stristr($url, $paths['base'])) {
         $url = str_replace($paths['base'], '', $url);
     }
     $url = '/' . $url;
     while (strpos($url, '//') !== false) {
         $url = str_replace('//', '/', $url);
     }
     $url = preg_replace('/(\\/$)/', '', $url);
     if (empty($url)) {
         return '/';
     }
     return $url;
 }
Example #9
0
 /**
  * Normalizes a URL
  *
  * @param string $url URL to normalize
  * @return string Normalized URL
  * @access protected
  */
 function _normalizeURL($url = '/')
 {
     if (is_array($url)) {
         $url = Router::url($url);
     }
     $paths = Router::getPaths();
     if (!empty($paths['base']) && stristr($url, $paths['base'])) {
         $url = r($paths['base'], '', $url);
     }
     $url = '/' . $url . '/';
     while (strpos($url, '//') !== false) {
         $url = r('//', '/', $url);
     }
     return $url;
 }
Example #10
0
 /**
  * Renders the Missing Model class web page.
  *
  * @param unknown_type $params Parameters for controller
  * @access public
  */
 function missingModel($params)
 {
     extract(Router::getPaths());
     extract($params, EXTR_OVERWRITE);
     $this->controller->base = $base;
     $this->controller->viewPath = 'errors';
     $this->controller->webroot = $this->_webroot();
     $this->controller->set(array('model' => $className, 'title' => __('Missing Model', true)));
     $this->controller->render('missingModel');
     exit;
 }
 /**
  * Captura a URL do projeto
  * - protocol://project_server/project_name
  * - http://192.168.56.101/project_name/
  * - http://localhost/project_name/
  *
  * @return string url
  */
 public static function urlProjectFull()
 {
     $urlServer = Router::fullBaseUrl();
     $projectServerPath = Router::getPaths();
     return $urlServer . $projectServerPath['base'];
 }