aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-04-23 19:10:32 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-04-23 19:10:32 +0200
commitb042d3a7728037db90a9306c61091be0a8ac42c4 (patch)
tree717691d185a83b603252a8e8de6fb4e5858c65a8 /lib
parent4862652585da1d69d62914659011c53146b21c17 (diff)
HTTP2 optimization
Fast flush HTTP headers, push promise CSS. Requires PHP 5.3+ due to anonymous function. Do not load syles, scripts, and notifications for Ajax requests. https://github.com/FreshRSS/FreshRSS/issues/1089
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/Request.php5
-rw-r--r--lib/Minz/Url.php12
-rw-r--r--lib/lib_rss.php4
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index 81457df9e..f80b707d6 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -137,12 +137,11 @@ class Minz_Request {
/**
* Return the base_url from configuration and add a suffix if given.
*
- * @param $base_url_suffix a string to add at base_url (default: empty string)
* @return the base_url with a suffix.
*/
- public static function getBaseUrl($base_url_suffix = '') {
+ public static function getBaseUrl() {
$conf = Minz_Configuration::get('system');
- $url = rtrim($conf->base_url, '/\\') . $base_url_suffix;
+ $url = rtrim($conf->base_url, '/\\');
return filter_var($url, FILTER_SANITIZE_URL);
}
diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php
index 382437e9a..c7c67123e 100644
--- a/lib/Minz/Url.php
+++ b/lib/Minz/Url.php
@@ -24,11 +24,15 @@ class Minz_Url {
$url_string = '';
if ($absolute) {
- $url_string = Minz_Request::getBaseUrl(PUBLIC_TO_INDEX_PATH);
- if ($url_string === PUBLIC_TO_INDEX_PATH) {
+ $url_string = Minz_Request::getBaseUrl();
+ if ($url_string == '') {
$url_string = Minz_Request::guessBaseUrl();
- } else {
- $url_string .= '/';
+ }
+ if ($isArray) {
+ $url_string .= PUBLIC_TO_INDEX_PATH;
+ }
+ if ($absolute === 'root') {
+ $url_string = parse_url($url_string, PHP_URL_PATH);
}
} else {
$url_string = $isArray ? '.' : PUBLIC_RELATIVE;
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 135115ea5..f89baf9b1 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -548,3 +548,7 @@ function base64url_encode($data) {
function base64url_decode($data) {
return base64_decode(strtr($data, '-_', '+/'));
}
+
+function _i($icon, $url_only = false) {
+ return FreshRSS_Themes::icon($icon, $url_only);
+}