diff options
Diffstat (limited to 'lib/private/legacy/util.php')
-rw-r--r-- | lib/private/legacy/util.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index ab595d885cb..a581397212a 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -64,6 +64,7 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\ILogger; use OCP\IUser; +use OC\AppFramework\Http\Request; class OC_Util { public static $scripts = array(); @@ -687,13 +688,20 @@ class OC_Util { * @param string $tag tag name of the element * @param array $attributes array of attributes for the element * @param string $text the text content for the element + * @param bool $prepend prepend the header to the beginning of the list */ - public static function addHeader($tag, $attributes, $text=null) { - self::$headers[] = array( + public static function addHeader($tag, $attributes, $text = null, $prepend = false) { + $header = array( 'tag' => $tag, 'attributes' => $attributes, 'text' => $text ); + if ($prepend === true) { + array_unshift (self::$headers, $header); + + } else { + self::$headers[] = $header; + } } /** @@ -1371,7 +1379,7 @@ class OC_Util { } // Zend OpCache >= 7.0.0, PHP >= 5.5.0 if (function_exists('opcache_invalidate')) { - $ret = opcache_invalidate($path); + $ret = @opcache_invalidate($path); } } return $ret; @@ -1405,7 +1413,7 @@ class OC_Util { } // Opcache (PHP >= 5.5) if (function_exists('opcache_reset')) { - opcache_reset(); + @opcache_reset(); } } @@ -1521,4 +1529,13 @@ class OC_Util { } } + /** + * is this Internet explorer ? + * + * @return boolean + */ + public static function isIe() { + return preg_match(Request::USER_AGENT_IE, $_SERVER['HTTP_USER_AGENT']) === 1; + } + } |