Пример #1
0
 static function ParseUri($uri = "")
 {
    // use the default PHP function to get the path
    $path = parse_url($uri, PHP_URL_PATH);       
    
    // split path
    $splitPath = explode('/', $path); 
    
    // sanitize elements
    foreach($splitPath as $key=>$value)
    {
       $value = urldecode($value);
       $splitPath[$key] = Sanitizer::Sanitize($value, Sanitizer::ALPHANUMERIC);
    }
    
    // remove empty elements
    $splitPath = array_filter($splitPath);
    
    $output = Array();
    $i = 0;
    foreach($splitPath as $v)
    {
       if( $i == 0 )
       {
          // Capitalize the controller
          $output['controller'] = ucwords($v);
       }
       else
       {
          $output[$i-1] = $v;
       }
       ++$i;
    }           
    
    return $output;      
 }
Пример #2
0
 public function Display($templateName, $data = Array())
 {
    // sanitize template name
    $templateName = ucwords(Sanitizer::Sanitize($templateName, Sanitizer::ALPHANUMERIC));      
    $this->DisplayTemplate($templateName, $data);      
 }