Exemplo n.º 1
0
/**
 * Redirect to another end point of the application
 * using a full query string
 * 
 * @param string $a_request
 * @param integer $a_protocol
 * @return Apine\MVC\RedirectionView
 */
function apine_internal_redirect($a_request, $a_protocol = APINE_PROTOCOL_DEFAULT)
{
    $new_view = new RedirectionView();
    $protocol = isset(Request::server()['SERVER_PROTOCOL']) ? Request::server()['SERVER_PROTOCOL'] : 'HTTP/1.0';
    if (!empty(Request::get()['request']) && $a_request == Request::get()['request']) {
        $new_view->set_header_rule($protocol . ' 302 Moved Temporarily');
    }
    // Remove Trailing slash
    $request = trim($a_request, '/');
    $new_view->set_header_rule('Location: ' . URLHelper::path($request, $a_protocol));
    return $new_view;
}
Exemplo n.º 2
0
/**
 * Return the instance of the URL Helper
 * 
 * @return Apine\MVC\URLHelper
 */
function apine_url_helper()
{
    return Apine\MVC\URLHelper::get_instance();
}
Exemplo n.º 3
0
 /**
  * Append stylesheet to view
  *
  * @param string $a_sheet URL to script
  */
 public function add_stylesheet($a_sheet)
 {
     if ($a_sheet != "") {
         if (file_exists("resources/public/css/{$a_sheet}.css")) {
             $this->_styles[] = URLHelper::resource("resources/public/css/{$a_sheet}.css");
         } else {
             if (file_exists("{$a_sheet}.css")) {
                 $this->_styles[] = URLHelper::resource("{$a_sheet}.css");
             }
         }
     }
 }