Пример #1
0
 /**
  * load the command
  *
  * @param string $command
  * @return mixed
  */
 public static function run($command)
 {
     //get params if they exist
     $parts = explode('?', $command);
     $params = null;
     if (is_array($parts) && count($parts) == 2) {
         $command = $parts[0];
         $params = Digitalus_Toolbox_Array::arrayFromGet($parts[1]);
     }
     $cmd = self::loadCommand($command);
     if (is_object($cmd)) {
         $cmd->run($params);
         return $cmd->getResponse();
     } else {
         return $cmd;
     }
 }
Пример #2
0
 /**
  * cleans the uri
  *
  * @param string $uri
  * @return string
  */
 private function _cleanUri($uri)
 {
     $uri = Digitalus_Toolbox_Regex::stripFileExtension($uri);
     $uri = Digitalus_Toolbox_Regex::stripTrailingSlash($uri);
     $uri = urldecode($uri);
     $array = explode('/', $uri);
     $splitPaths = Digitalus_Toolbox_Array::splitOnValue($array, 'p');
     if (is_array($splitPaths)) {
         $uri = implode('/', $splitPaths[0]);
         if (is_array($splitPaths[1])) {
             $this->_params = Digitalus_Toolbox_Array::makeHashFromArray($splitPaths[1]);
         }
     }
     #        return Digitalus_Toolbox_String::stripHyphens($uri);
     return str_replace(' ', '_', trim($uri));
 }