Beispiel #1
0
 /**
  * Prepares the route for mapping by splitting (exploding) it
  * to a corresponding atomic parts. These parts are assigned
  * a position which is later used for matching and preparing values.
  *
  * @param Zend_Controller_Front $front Front Controller object
  * @param string $route Map used to match with later submitted URL path
  * @param array $defaults Defaults for map variables with keys as variable names
  * @param array $reqs Regular expression requirements for variables (keys as variable names)
  * @param Zend_Translate $translator Translator to use for this instance
  */
 public function __construct(Zend_Controller_Front $front, $route, $defaults = array(), $reqs = array(), Zend_Translate $translator = null, $locale = null)
 {
     $this->_front = $front;
     $this->_dispatcher = $front->getDispatcher();
     $this->_route = $route;
     parent::__construct($route, $defaults, $reqs, $translator, $locale);
 }
Beispiel #2
0
 public function __construct($route, $defaults = array(), $reqs = array())
 {
     if (preg_match('/\\.\\w*$/', $route, $matches)) {
         $this->_defaultRepresentation = trim($matches[0], '.');
         $route = preg_replace('/(\\.\\w*)?$/', '', $route);
     }
     parent::__construct($route, $defaults, $reqs);
 }
Beispiel #3
0
 public function __construct()
 {
     /* Informações */
     $route = $this->getRoute();
     $defaults = $this->getDefaults();
     /* Construtor */
     parent::__construct($route, $defaults);
 }
Beispiel #4
0
 /**
  * Prepares the route for mapping by splitting (exploding) it
  * to a corresponding atomic parts. These parts are assigned
  * a position which is later used for matching and preparing values.
  *
  * @param string         $route      Map used to match with later submitted URL path
  * @param array          $defaults   Defaults for map variables with keys as variable names
  * @param array          $reqs       Regular expression requirements for variables (keys as variable names)
  * @param string         $tokenVar   Variable name for token
  * @param Zend_Translate $translator Translator to use for this instance
  */
 public function __construct($route, $defaults = array(), $reqs = array(), $tokenVar = 'token', Zend_Translate $translator = null, $locale = null)
 {
     parent::__construct($route, $defaults, $reqs, $translator, $locale);
     $this->_defaults['module'] = 'download';
     if (isset($this->_defaults['token'])) {
         throw new \Zend_Controller_Router_Exception("Route cannot have a default token.");
     }
     if (!in_array($this->_tokenVariable, $this->_variables)) {
         throw new \Zend_Controller_Router_Exception("Route must have a token variable inside route.");
     }
 }
Beispiel #5
0
 /**
  * Prepares the route for mapping by splitting (exploding) it
  * to a corresponding atomic parts. These parts are assigned
  * a position which is later used for matching and preparing values.
  *
  * @param string $route Map used to match with later submitted URL path
  * @param array $variableMap A mapping that maps variables to request parameters
  * @param array $defaults Defaults for map variables with keys as variable names
  * @param array $reqs Regular expression requirements for variables (keys as variable names)
  * @param Zend_Translate $translator Translator to use for this instance
  */
 public function __construct($route, $variableMap = array(), $defaults = array(), $reqs = array(), Zend_Translate $translator = null, $locale = null)
 {
     parent::__construct($route, $defaults, $reqs, $translator, $locale);
     $this->_variableMap = $variableMap;
 }
Beispiel #6
0
    /**
     * Route allowing matching of the HTTP_HOST
     *
     * $host => ':user.*.*' would match SpotSec.Foo.Com
     *
     * @param string $host
     * @param string $route
     * @param array $defaults
     * @param array $reqs
     */
    public function __construct($host, $route, array $defaults = array(), array $reqs = array())
    {
        $host = trim($host, $this->_urlDelimiter);

        if (!empty($host)) {
            // Separate foo.com into array('com', 'foo')
            $domains = array_reverse(explode(self::DOMAIN_SEPARATOR, $host));

            // Parse out url variables
            foreach ($domains as $pos => $part) {
                // Check if :var
                if (substr($part, 0, 1) == $this->_urlVariable) {
                    $name  = substr($part, 1);
                    $regex = isset($reqs[$name]) ? $reqs[$name] : $this->_defaultRegex;

                    // Set to be evaluated later
                    $this->_hostParts[$pos] = array('name' => $name, 'regex' => $regex);
                    $this->_hostVars[]      = $name;
                } else {
                    $this->_hostParts[$pos] = array('regex' => $part);

                    // Increment if not a *.*
                    if ($part !== self::DOMAIN_WILDCARD) {
                        $this->_hostStaticCount++;
                    }
                }
            }
        }

        parent::__construct($route, $defaults, $reqs);
    }
Beispiel #7
0
 /**
  * Prepares the route for mapping by splitting (exploding) it
  * to a corresponding atomic parts. These parts are assigned
  * a position which is later used for matching and preparing values.
  *
  * @param string $route Map used to match with later submitted URL path
  * @param array $defaults Defaults for map variables with keys as variable names
  * @param array $reqs Regular expression requirements for variables (keys as variable names)
  * @param Zend_Translate $translator Translator to use for this instance
  */
 public function __construct($route, $defaults = array(), $reqs = array(), Zend_Translate $translator = null, $locale = null)
 {
     $route = Axis::config('core/backend/route') . $this->_urlDelimiter . $route;
     parent::__construct($route, $defaults, $reqs, $translator, $locale);
 }
 /**
  * Process construct param and call parent::__construct() with params
  *
  * @param array $arguments
  */
 public function __construct(array $arguments)
 {
     parent::__construct($this->_getArgumentValue(self::PARAM_ROUTE, $arguments), $this->_getArgumentValue(self::PARAM_DEFAULTS, $arguments), $this->_getArgumentValue(self::PARAM_REQS, $arguments), $this->_getArgumentValue(self::PARAM_TRANSLATOR, $arguments), $this->_getArgumentValue(self::PARAM_LOCALE, $arguments));
 }
Beispiel #9
0
 public function __construct($route = null, $defaults = array(), $reqs = array())
 {
     $route = 'admin/:module/:action/*';
     $defaults = array('module' => 'admin', 'controller' => 'admin', 'action' => 'index');
     parent::__construct($route, $defaults);
 }