private function setTwigBaseUrl() { // We will set baseUrl as default function to twig engine $this->functions[] = $this->getTwigSimpleFunctionInstance('baseUrl', function () { return Url::getBase(); }); return $this; }
.clear-fix{ height:2em;} a, a:visited {color:#2972A3;} a:hover {color:#72ADD4;} hr {display: block;border: 0; border-top: 1px solid #ccc; } </style> </head> <body> <?php use Cygnite\Common\UrlManager\Url; ?> <div class="wrapper"> <div class="clear-fix"></div> <div role="main" class="content"> <h1>Service Unavailable: 503 (Service Temporarily Unavailable)</h1> <hr> <p> We're sorry! Cannot process your request now. Server is down for maintenance. Please try again later. </p> <p> Please go to our <a href="<?php echo Url::getBase(); ?> ">home page</a>. </p> </div> </div> </body> </html>
private function setCurrentPageUrl() { $controller = Url::segment(1); $method = ''; $method = Url::segment(2) == '' ? 'index' : Url::segment(2); $this->currentPageUrl = Url::getBase() . $controller . '/' . $method; }
/** * This Function is to get the url sitePath with index.php * * @access public * @false $uri * @param $uri * @return string */ public static function sitePath($uri) { $expression = array_filter(explode('/', $_SERVER['REQUEST_URI'])); $index = false !== array_search('index.php', $expression) ? 'index.php/' : ''; return Url::getBase() . $index . $uri; }
/** * We will destroy current user session and return to * application base url */ public function logout($redirect = true) { Session::delete(); $redirect ? Url::redirectTo(Url::getBase()) : ''; }
/** * Generate anchor link * * @false string $url * @false string $name * @false array $attributes * @param $url * @param null $name * @param array $attributes * @return string */ protected function link($url, $name = null, $attributes = array()) { $name = is_null($name) ? $url : $name; list(, $caller) = debug_backtrace(false); if ($this->isFacade($caller)) { return $this->stripCarriage('<a href="' . Url::getBase() . Html::entities($url) . '" ' . $this->addAttributes($attributes) . '>' . Html::entities($name) . '</a>' . PHP_EOL); } $this->assets[strtolower(__FUNCTION__)][] = '<a href="' . Url::getBase() . Html::entities($url) . '" ' . $this->addAttributes($attributes) . '>' . Html::entities($name) . '</a>' . PHP_EOL; return $this->assets[strtolower(__FUNCTION__)]; }
/** * We will set the script into assets array. * * @param $src * @param $attributes */ private function setScript($src, $attributes) { $this->assets[$this->tag[$this->where]][strtolower(__FUNCTION__)][] = (string) static::$script . ' src="' . Url::getBase() . $src . '"' . $this->addAttributes($attributes) . '></script>' . PHP_EOL; }