mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Fixes #1344 - ejs_preload legacy javascript removed. Replaced with e107::link($attributes); for adding 'prefetch' and other <link> tags to the head.
This commit is contained in:
parent
61f2712c09
commit
fee3764dff
@ -326,9 +326,6 @@ else
|
||||
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('other','core','plugin','theme','inline');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach($CSSORDER as $val)
|
||||
{
|
||||
$cssId = $val."_css";
|
||||
@ -340,7 +337,7 @@ unset($CSSORDER);
|
||||
|
||||
$e_js->renderCached('css');
|
||||
|
||||
|
||||
$e_js->renderLinks();
|
||||
|
||||
/*
|
||||
$e_js->renderJs('other_css', false, 'css', false);
|
||||
@ -522,8 +519,8 @@ elseif (file_exists(e_BASE."favicon.ico"))
|
||||
|
||||
//
|
||||
// FIXME H: Generate JS for image preloads (do we really need this?)
|
||||
//
|
||||
|
||||
/* @DEPRECATED */
|
||||
/*
|
||||
if ($pref['image_preload'] && is_dir(THEME.'images'))
|
||||
{
|
||||
$ejs_listpics = '';
|
||||
@ -551,7 +548,7 @@ if (isset($script_text) && $script_text)
|
||||
echo $script_text;
|
||||
echo "// -->\n";
|
||||
echo "</script>\n";
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
//
|
||||
@ -642,7 +639,7 @@ echo "</head>\n";
|
||||
$HEADER = ($CUSTOMHEADER[$def]) ? $CUSTOMHEADER[$def] : $HEADER;
|
||||
$FOOTER = ($CUSTOMFOOTER[$def]) ? $CUSTOMFOOTER[$def] : $FOOTER;
|
||||
}
|
||||
elseif($def) // 2.0 themes - we use only $HEADER and $FOOTER arrays.
|
||||
elseif(!empty($def) && is_array($HEADER)) // 2.0 themes - we use only $HEADER and $FOOTER arrays.
|
||||
{
|
||||
// echo " MODE 0.8";
|
||||
if(isset($HEADER[$def]) && isset($FOOTER[$def]))
|
||||
|
@ -1725,6 +1725,20 @@ class e107
|
||||
$jshandler->resetDependency();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a <link> tag to the head of the html document.
|
||||
* @param array $attributes
|
||||
* @example e107::link(array('rel'=>"dns-prefetch", "href" => "http://example-domain.com/"));
|
||||
*/
|
||||
public static function link($attributes=array())
|
||||
{
|
||||
self::getJs()->addLink($attributes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* CSS Common Public Function. Prefered is shortcode script path
|
||||
* @param string $type core|theme|footer|inline|footer-inline|url or any existing plugin_name
|
||||
|
@ -150,6 +150,14 @@ class e_jsmanager
|
||||
*/
|
||||
protected $_index_all = array();
|
||||
|
||||
/**
|
||||
* Registered link tags files by type (core|theme|plugin|other)
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_e_link = array();
|
||||
|
||||
|
||||
/**
|
||||
* Registered CSS files by type (core|theme|plugin|other)
|
||||
*
|
||||
@ -783,6 +791,62 @@ class e_jsmanager
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a <link> tag to the head.
|
||||
* @param array $attributes key>value pairs
|
||||
* @example addLink(array('rel'=>'prefetch', 'href'=>THEME.'images/browsers.png'));
|
||||
*/
|
||||
public function addLink($attributes=array())
|
||||
{
|
||||
if(!empty($attributes))
|
||||
{
|
||||
$this->_e_link[] = $attributes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render all link tags. (other than css)
|
||||
* @return null
|
||||
*/
|
||||
public function renderLinks()
|
||||
{
|
||||
|
||||
if(empty($this->_e_link))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$text = '';
|
||||
|
||||
foreach($this->_e_link as $v)
|
||||
{
|
||||
if(!empty($v['type']))
|
||||
{
|
||||
if($v['type'] == 'text/css' || $v['rel'] == 'stylesheet') // not for this purpose. use e107::css();
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$text .= "\n<link";
|
||||
foreach($v as $key=>$val)
|
||||
{
|
||||
if(!empty($val))
|
||||
{
|
||||
$text .= " ".$key."=\"".$val."\"";
|
||||
}
|
||||
}
|
||||
$text .= " />";
|
||||
|
||||
}
|
||||
|
||||
echo $text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Require JS file(s). Used by corresponding public proxy methods.
|
||||
*
|
||||
|
@ -1249,14 +1249,14 @@ class themeHandler
|
||||
$text .= " </td>
|
||||
</tr>";
|
||||
|
||||
$text .= "
|
||||
/*$text .= "
|
||||
<tr>
|
||||
<td style='vertical-align:top; width:24%;'><b>".TPVLAN_30."</b></td>
|
||||
<td colspan='2' style='vertical-align:top width:auto;'>
|
||||
<input type='radio' name='image_preload' value='1'".($pref['image_preload'] ? " checked='checked'" : "")." /> ".TPVLAN_28."
|
||||
<input type='radio' name='image_preload' value='0'".(!$pref['image_preload'] ? " checked='checked'" : "")." /> ".TPVLAN_29."
|
||||
</td>
|
||||
</tr>";
|
||||
</tr>";*/
|
||||
}
|
||||
|
||||
// New in 0.8 ---- site theme.
|
||||
@ -1909,8 +1909,7 @@ class themeHandler
|
||||
$mes = e107::getMessage();
|
||||
|
||||
//TODO adminlog
|
||||
e107::getConfig()->setPosted('themecss', $_POST['themecss'])->setPosted('image_preload', $_POST['image_preload'])->setPosted('sitetheme_deflayout',
|
||||
$_POST['layout_default']);
|
||||
e107::getConfig()->setPosted('themecss', $_POST['themecss'])->setPosted('sitetheme_deflayout', $_POST['layout_default']);
|
||||
|
||||
$msg = $this->setThemeConfig();
|
||||
if($msg)
|
||||
|
@ -8,21 +8,23 @@ define("BOOTSTRAP", 3);
|
||||
define("FONTAWESOME", 4);
|
||||
define('VIEWPORT', "width=device-width, initial-scale=1.0");
|
||||
|
||||
//e107::js("url", "https://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js");
|
||||
//e107::css('url', 'https://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css');
|
||||
// e107::css('url', "https://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css");
|
||||
|
||||
// @see https://www.cdnperf.com
|
||||
/* @see https://www.cdnperf.com */
|
||||
// Warning: Some bootstrap CDNs are not compiled with popup.js
|
||||
// use https if e107 is using https.
|
||||
|
||||
e107::js("url", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery', 2);
|
||||
e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css');
|
||||
e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.4.0/css/font-awesome.min.css');
|
||||
e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.5.0/css/font-awesome.min.css');
|
||||
|
||||
/* @example prefetch */
|
||||
//e107::link(array('rel'=>'prefetch', 'href'=>THEME.'images/browsers.png'));
|
||||
|
||||
|
||||
|
||||
e107::js("footer-inline", "$('.e-tip').tooltip({container: 'body'})"); // activate bootstrap tooltips.
|
||||
|
||||
// Legacy Stuff.
|
||||
define('OTHERNEWS_COLS',false); // no tables, only divs.
|
||||
define('OTHERNEWS_LIMIT', 3); // Limit to 3.
|
||||
define('OTHERNEWS2_COLS',false); // no tables, only divs.
|
||||
|
Loading…
x
Reference in New Issue
Block a user