mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-02 11:20:52 +02:00
Url Helper: New current() method - added.
This commit is contained in:
@@ -93,7 +93,7 @@
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function find($url) {
|
public static function find($url) {
|
||||||
$https = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
|
$https = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
|
||||||
$pos = strpos($url, $https);
|
$pos = strpos($url, $https);
|
||||||
if ($pos === false) { $url_output = Option::get('siteurl') . $url; } else { $url_output = $url; }
|
if ($pos === false) { $url_output = Option::get('siteurl') . $url; } else { $url_output = $url; }
|
||||||
return $url_output;
|
return $url_output;
|
||||||
@@ -110,7 +110,22 @@
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function base() {
|
public static function base() {
|
||||||
$https = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
|
$https = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
|
||||||
return $https . rtrim(rtrim($_SERVER['HTTP_HOST'], '\\/') . dirname($_SERVER['PHP_SELF']), '\\/');
|
return $https . rtrim(rtrim($_SERVER['HTTP_HOST'], '\\/') . dirname($_SERVER['PHP_SELF']), '\\/');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets current URL
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* echo Url::current();
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function current() {
|
||||||
|
return (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user