mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
make scriptTag parameter a string for flexibility and clarity
This commit is contained in:
parent
7294ea7847
commit
d27e7e8ee3
@ -63,15 +63,15 @@ class View
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @param bool $async should it execute ASAP or only after HTML got parsed
|
* @param string $attributes additional attributes to add into the script tag
|
||||||
*/
|
*/
|
||||||
private function _scriptTag($file, $async = true)
|
private function _scriptTag($file, $attributes = '')
|
||||||
{
|
{
|
||||||
$sri = array_key_exists($file, $this->_variables['SRI']) ?
|
$sri = array_key_exists($file, $this->_variables['SRI']) ?
|
||||||
' integrity="' . $this->_variables['SRI'][$file] . '"' : '';
|
' integrity="' . $this->_variables['SRI'][$file] . '"' : '';
|
||||||
$suffix = preg_match('#\d.js$#', $file) == 0 ?
|
$suffix = preg_match('#\d.js$#', $file) == 0 ?
|
||||||
'?' . rawurlencode($this->_variables['VERSION']) : '';
|
'?' . rawurlencode($this->_variables['VERSION']) : '';
|
||||||
echo '<script ', $async ? 'async' : 'defer',
|
echo '<script ', $attributes,
|
||||||
' type="text/javascript" data-cfasync="false" src="', $file,
|
' type="text/javascript" data-cfasync="false" src="', $file,
|
||||||
$suffix, '"', $sri, ' crossorigin="anonymous"></script>', PHP_EOL;
|
$suffix, '"', $sri, ' crossorigin="anonymous"></script>', PHP_EOL;
|
||||||
}
|
}
|
||||||
|
@ -42,38 +42,38 @@ if ($SYNTAXHIGHLIGHTING) :
|
|||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<noscript><link type="text/css" rel="stylesheet" href="css/noscript.css" /></noscript>
|
<noscript><link type="text/css" rel="stylesheet" href="css/noscript.css" /></noscript>
|
||||||
<?php $this->_scriptTag('js/jquery-3.7.1.js', false); ?>
|
<?php $this->_scriptTag('js/jquery-3.7.1.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
if ($QRCODE) :
|
if ($QRCODE) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/kjua-0.9.0.js'); ?>
|
<?php $this->_scriptTag('js/kjua-0.9.0.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
if ($ZEROBINCOMPATIBILITY) :
|
if ($ZEROBINCOMPATIBILITY) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/base64-1.7.js'); ?>
|
<?php $this->_scriptTag('js/base64-1.7.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/zlib-1.3.1.js'); ?>
|
<?php $this->_scriptTag('js/zlib-1.3.1.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/base-x-4.0.0.js'); ?>
|
<?php $this->_scriptTag('js/base-x-4.0.0.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/rawinflate-0.3.js'); ?>
|
<?php $this->_scriptTag('js/rawinflate-0.3.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/bootstrap-3.4.1.js', false); ?>
|
<?php $this->_scriptTag('js/bootstrap-3.4.1.js', 'defer'); ?>
|
||||||
<?php
|
<?php
|
||||||
if ($SYNTAXHIGHLIGHTING) :
|
if ($SYNTAXHIGHLIGHTING) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/prettify.js'); ?>
|
<?php $this->_scriptTag('js/prettify.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
if ($MARKDOWN) :
|
if ($MARKDOWN) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/showdown-2.1.0.js'); ?>
|
<?php $this->_scriptTag('js/showdown-2.1.0.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/purify-3.1.3.js'); ?>
|
<?php $this->_scriptTag('js/purify-3.1.3.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/legacy.js'); ?>
|
<?php $this->_scriptTag('js/legacy.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/privatebin.js', false); ?>
|
<?php $this->_scriptTag('js/privatebin.js', 'defer'); ?>
|
||||||
<!-- icon -->
|
<!-- icon -->
|
||||||
<link rel="apple-touch-icon" href="<?php echo I18n::encode($BASEPATH); ?>img/apple-touch-icon.png" sizes="180x180" />
|
<link rel="apple-touch-icon" href="<?php echo I18n::encode($BASEPATH); ?>img/apple-touch-icon.png" sizes="180x180" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
|
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
|
||||||
|
@ -25,39 +25,39 @@ if ($SYNTAXHIGHLIGHTING) :
|
|||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<noscript><link type="text/css" rel="stylesheet" href="css/noscript.css" /></noscript>
|
<noscript><link type="text/css" rel="stylesheet" href="css/noscript.css" /></noscript>
|
||||||
<?php $this->_scriptTag('js/jquery-3.7.1.js', false); ?>
|
<?php $this->_scriptTag('js/jquery-3.7.1.js', 'defer'); ?>
|
||||||
<?php
|
<?php
|
||||||
if ($QRCODE) :
|
if ($QRCODE) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/kjua-0.9.0.js'); ?>
|
<?php $this->_scriptTag('js/kjua-0.9.0.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
if ($ZEROBINCOMPATIBILITY) :
|
if ($ZEROBINCOMPATIBILITY) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/base64-1.7.js'); ?>
|
<?php $this->_scriptTag('js/base64-1.7.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/zlib-1.3.1.js'); ?>
|
<?php $this->_scriptTag('js/zlib-1.3.1.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/base-x-4.0.0.js'); ?>
|
<?php $this->_scriptTag('js/base-x-4.0.0.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/rawinflate-0.3.js'); ?>
|
<?php $this->_scriptTag('js/rawinflate-0.3.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/bootstrap-5.3.3.js'); ?>
|
<?php $this->_scriptTag('js/bootstrap-5.3.3.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/dark-mode-switch.js'); ?>
|
<?php $this->_scriptTag('js/dark-mode-switch.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
if ($SYNTAXHIGHLIGHTING) :
|
if ($SYNTAXHIGHLIGHTING) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/prettify.js'); ?>
|
<?php $this->_scriptTag('js/prettify.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
if ($MARKDOWN) :
|
if ($MARKDOWN) :
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/showdown-2.1.0.js'); ?>
|
<?php $this->_scriptTag('js/showdown-2.1.0.js', 'async'); ?>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/purify-3.1.3.js'); ?>
|
<?php $this->_scriptTag('js/purify-3.1.3.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/legacy.js'); ?>
|
<?php $this->_scriptTag('js/legacy.js', 'async'); ?>
|
||||||
<?php $this->_scriptTag('js/privatebin.js', false); ?>
|
<?php $this->_scriptTag('js/privatebin.js', 'defer'); ?>
|
||||||
<!-- icon -->
|
<!-- icon -->
|
||||||
<link rel="apple-touch-icon" href="<?php echo I18n::encode($BASEPATH); ?>img/apple-touch-icon.png" sizes="180x180" />
|
<link rel="apple-touch-icon" href="<?php echo I18n::encode($BASEPATH); ?>img/apple-touch-icon.png" sizes="180x180" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
|
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
|
||||||
|
@ -21,7 +21,7 @@ if ($SYNTAXHIGHLIGHTING):
|
|||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/jquery-3.7.1.js', false); ?>
|
<?php $this->_scriptTag('js/jquery-3.7.1.js', 'defer'); ?>
|
||||||
<?php
|
<?php
|
||||||
if ($QRCODE):
|
if ($QRCODE):
|
||||||
?>
|
?>
|
||||||
@ -51,7 +51,7 @@ endif;
|
|||||||
?>
|
?>
|
||||||
<?php $this->_scriptTag('js/purify-3.1.3.js'); ?>
|
<?php $this->_scriptTag('js/purify-3.1.3.js'); ?>
|
||||||
<?php $this->_scriptTag('js/legacy.js'); ?>
|
<?php $this->_scriptTag('js/legacy.js'); ?>
|
||||||
<?php $this->_scriptTag('js/privatebin.js', false); ?>
|
<?php $this->_scriptTag('js/privatebin.js', 'defer'); ?>
|
||||||
<!-- icon -->
|
<!-- icon -->
|
||||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||||
|
Loading…
Reference in New Issue
Block a user