mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
- various missing js settings added
- overall javascript management routine cleanup (need testing, mainly after clean install)
This commit is contained in:
parent
9bd53420f5
commit
f004297468
@ -193,7 +193,7 @@ else
|
||||
//
|
||||
// F: Grab e107_config, get directory paths and create $e107 object
|
||||
//
|
||||
@include_once(realpath(dirname(__FILE__).'/e107_config.php'));
|
||||
@include(realpath(dirname(__FILE__).'/e107_config.php'));
|
||||
|
||||
if(isset($CLASS2_INCLUDE) && ($CLASS2_INCLUDE!=''))
|
||||
{
|
||||
|
@ -246,9 +246,8 @@ e107::getJs()->renderJs('header', 1);
|
||||
e107::getJs()->renderJs('header_inline', 1);
|
||||
|
||||
// Load Javascript Library consolidation script
|
||||
// TODO - option to call libraries external (admin preferences)
|
||||
$hash = md5(serialize(varset($pref['e_jslib'])).THEME.e_LANGUAGE.ADMIN).'_admin'; //FIXME - hash is wrong, move this to e_jsmanager?
|
||||
echo "<script type='text/javascript' src='".e_FILE_ABS."e_jslib.php?{$hash}'></script>\n";
|
||||
$jslib = e107::getObject('e_jslib', null, e_HANDLER.'jslib_handler.php');
|
||||
$jslib->renderHeader('admin', false);
|
||||
|
||||
// [JSManager] Load JS Includes - Zone 2 - After Library, before CSS
|
||||
e107::getJs()->renderJs('header', 2);
|
||||
|
@ -1134,7 +1134,7 @@ $text .= "
|
||||
array('name'=> 'Scriptaculous + Effects (CDN)', 'path'=> 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js?load=effects'),
|
||||
array('name'=> 'jQuery (CDN)', 'path'=> 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'),
|
||||
array('name'=> 'jQuery UI (CDN)', 'path'=> 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js'),
|
||||
array('name'=> 'e107 Core Minimum', 'path'=> 'e107.js.php'),
|
||||
array('name'=> 'e107 Core Minimum', 'path'=> 'e107.js'),
|
||||
array('name'=> 'e107 Plugin Scripts (TO-DO)', 'path'=> ''), // all js that has been added by Plugins.
|
||||
array('name'=> 'e107 Theme Scripts (TO-DO)', 'path'=> ''), // all js that has been added by Themes.
|
||||
);
|
||||
@ -1150,10 +1150,68 @@ $text .= "
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
<table cellpadding='0' cellspacing='0' class='adminform' style='margin-top: 20px'>
|
||||
<colgroup span='2'>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class='label'>Disable scripts consolidation</td>
|
||||
<td class='control'>
|
||||
".$frm->radio_switch('e_jslib_nocombine', $pref['e_jslib_nocombine'], LAN_YES, LAN_NO)."
|
||||
<div class='smalltext field-help'>If disabled, scripts will be loaded in one consolidated file</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='label'>Enable consolidated scripts zlib compression:</td>
|
||||
<td class='control'>
|
||||
".$frm->radio_switch('e_jslib_gzip', $pref['e_jslib_gzip'], LAN_YES, LAN_NO)."
|
||||
<div class='smalltext field-help'>Used only when script consolidation is enabled</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='label'>Disable consolidated scripts server cache:</td>
|
||||
<td class='control'>
|
||||
".$frm->radio_switch('e_jslib_nocache', $pref['e_jslib_nocache'], LAN_YES, LAN_NO)."
|
||||
<div class='smalltext field-help'>Used only when script consolidation is enabled</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='label'>Disable consolidated scripts browser cache:</td>
|
||||
<td class='control'>
|
||||
".$frm->radio_switch('e_jslib_nobcache', $pref['e_jslib_nobcache'], LAN_YES, LAN_NO)."
|
||||
<div class='smalltext field-help'>Used only when script consolidation is enabled</div>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
$text .= "
|
||||
</tbody></table>
|
||||
".pref_submit('javascript')."
|
||||
</fieldset>";
|
||||
</fieldset>
|
||||
|
||||
<script type='text/javascript'>
|
||||
\$\$('#e-jslib-nocombine', '#e-jslib-nocombine-1').invoke('observe', 'change', function(event) {
|
||||
var element = event.findElement('input'), check = !parseInt(element.value);
|
||||
eHandleJsForm(check);
|
||||
|
||||
});
|
||||
|
||||
var eHandleJsForm = function(enable) {
|
||||
var collection = \$w('e-jslib-gzip e-jslib-nocache e-jslib-nobcache');
|
||||
collection.each(function(id) {
|
||||
var method = enable ? 'enable' : 'disable';
|
||||
\$\$('#' + id, '#' + id + '-1').invoke(method);
|
||||
});
|
||||
};
|
||||
|
||||
eHandleJsForm(".($pref['e_jslib_nocombine'] ? 'false' : 'true').");
|
||||
</script>
|
||||
";
|
||||
|
||||
|
||||
|
||||
@ -1278,17 +1336,3 @@ function prefs_adminmenu()
|
||||
e_admin_menu(LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle page DOM within the page header
|
||||
*
|
||||
* @return string JS source
|
||||
*/
|
||||
function headerjs()
|
||||
{
|
||||
require_once(e_HANDLER.'js_helper.php');
|
||||
$ret = "
|
||||
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
||||
";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
@ -57,11 +57,15 @@
|
||||
<core name="displaythemeinfo">1</core>
|
||||
<core name="download_email">0</core>
|
||||
<core name="e_jslib_browser_cache">0</core>
|
||||
<core name="e_jslib_nobcache">1</core>
|
||||
<core name="e_jslib_nocache">0</core>
|
||||
<core name="e_jslib_gzip">1</core>
|
||||
<core name="e_jslib_nocombine">0</core>
|
||||
<core name="e_jslib_core"><![CDATA[array (
|
||||
'prototype/prototype.js' => 'all',
|
||||
'scriptaculous/scriptaculous.js' => 'all',
|
||||
'scriptaculous/effects.js' => 'all',
|
||||
'e107.js.php' => 'all',
|
||||
'e107.js' => 'all',
|
||||
)]]></core>
|
||||
<core name="e_jslib_plugin"><![CDATA[array ()]]></core>
|
||||
<core name="e_jslib_theme"><![CDATA[array ()]]></core>
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://gnu.org).
|
||||
*
|
||||
@ -25,18 +25,30 @@ else
|
||||
{
|
||||
define('USER_AREA', true); //force user area
|
||||
}
|
||||
// no-cache check
|
||||
if (strpos($_SERVER['QUERY_STRING'], '_nocache') !== FALSE)
|
||||
// no-browser-cache check
|
||||
if (strpos($_SERVER['QUERY_STRING'], '_nobcache') !== FALSE)
|
||||
{
|
||||
define('e_NOCACHE', true); //force admin area
|
||||
define('e_NOCACHE', true); //force no browser cache
|
||||
}
|
||||
else
|
||||
{
|
||||
define('e_NOCACHE', false); //force user area
|
||||
define('e_NOCACHE', false);
|
||||
}
|
||||
|
||||
// no-server-cache check
|
||||
if (strpos($_SERVER['QUERY_STRING'], '_nocache') !== FALSE)
|
||||
{
|
||||
define('e_NOSCACHE', true); //force no system cache
|
||||
}
|
||||
else
|
||||
{
|
||||
define('e_NOSCACHE', false);
|
||||
}
|
||||
|
||||
if(!e_NOCACHE) session_cache_limiter('private');
|
||||
|
||||
$eJslibCacheDir = null;
|
||||
|
||||
//output cache if available before calling the api
|
||||
e_jslib_cache_out();
|
||||
|
||||
@ -45,7 +57,7 @@ e_jslib_cache_out();
|
||||
$_E107['minimal'] = true;
|
||||
|
||||
//call jslib handler, render content
|
||||
require_once ("../class2.php");
|
||||
require_once ("../class2.php");
|
||||
//require_once (e_HANDLER.'jslib_handler.php');
|
||||
//$jslib = new e_jslib();
|
||||
$jslib = e107::getObject('e_jslib', null, e_HANDLER.'jslib_handler.php');
|
||||
@ -142,7 +154,8 @@ function e_jslib_cache_out()
|
||||
*/
|
||||
function e_jslib_is_cache($encoding)
|
||||
{
|
||||
$cacheFile = e_jslib_cache_filename($encoding);
|
||||
//if(!e_NOSCACHE) return '';
|
||||
$cacheFile = e_jslib_cache_filename($encoding);
|
||||
if (is_file($cacheFile) && is_readable($cacheFile))
|
||||
{
|
||||
return $cacheFile;
|
||||
@ -193,11 +206,36 @@ function e_jslib_browser_enc()
|
||||
*/
|
||||
function e_jslib_cache_filename($encoding = '')
|
||||
{
|
||||
|
||||
$cacheDir = './cache/';
|
||||
$cacheDir = e_jslib_cache_path();
|
||||
$hash = $_SERVER['QUERY_STRING'] && $_SERVER['QUERY_STRING'] !== '_nogzip' ? md5(str_replace('_nogzip', '', $_SERVER['QUERY_STRING'])) : 'nomd5';
|
||||
$cacheFile = $cacheDir.'S_e_jslib'.($encoding ? '_'.$encoding : '').'_'.$hash.'.cache.php';
|
||||
|
||||
return $cacheFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve cache system path (doesn't require e107 API)
|
||||
*
|
||||
* @return string path to cache folder
|
||||
*/
|
||||
function e_jslib_cache_path()
|
||||
{
|
||||
global $eJslibCacheDir;
|
||||
|
||||
if(null === $eJslibCacheDir)
|
||||
{
|
||||
include('../e107_config.php');
|
||||
|
||||
if($CACHE_DIRECTORY)
|
||||
{
|
||||
$eJslibCacheDir = '../'.$CACHE_DIRECTORY.'content/';
|
||||
}
|
||||
elseif (isset($E107_CONFIG) && isset($E107_CONFIG['CACHE_DIRECTORY']))
|
||||
{
|
||||
$eJslibCacheDir = '../'.$E107_CONFIG['CACHE_DIRECTORY'].'content/';
|
||||
}
|
||||
else $eJslibCacheDir = '';
|
||||
}
|
||||
return $eJslibCacheDir;
|
||||
}
|
||||
?>
|
2765
e107_files/jslib/e107.js
Normal file
2765
e107_files/jslib/e107.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,14 +2,14 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://gnu.org).
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/jslib_handler.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
* FIXME - re-check and fix all browser cache related code
|
||||
*
|
||||
*/
|
||||
global $pref, $eplug_admin;
|
||||
@ -28,24 +28,47 @@ class e_jslib
|
||||
*/
|
||||
public function renderHeader($where = 'front', $return = false)
|
||||
{
|
||||
// FIXME: convert e107.js.php to pure e107.js file
|
||||
// FIXME: 'e_jslib_browser_cache' used by js_manager - add it together with all new prefs (JS management tab, Site preferences area)
|
||||
// FIXME: option to use external sources (e.g. google) even if JS is combined (script tags for external sources)
|
||||
$ret = '';
|
||||
$ret .= "
|
||||
<script type=\"text/javascript\">
|
||||
var e107Path = {
|
||||
e_IMAGE: '".e_IMAGE_ABS."',
|
||||
SITEURL: '".SITEURL."',
|
||||
SITEURLBASE: '".SITEURLBASE."',
|
||||
e_HTTP: '".e_HTTP."',
|
||||
e_IMAGE_PACK: '".e_IMAGE_ABS."',
|
||||
e_PLUGIN: '".e_PLUGIN_ABS."',
|
||||
e_FILE: '".e_FILE_ABS."',
|
||||
e_MEDIA: '".e_MEDIA_ABS."',
|
||||
e_WEB: '".e_WEB_ABS."',
|
||||
e_ADMIN: '".(deftrue('ADMIN') ? e_ADMIN_ABS : '')."',
|
||||
e_THEME: '".e_THEME_ABS."',
|
||||
THEME: '".e_THEME_ABS."'
|
||||
};
|
||||
</script>
|
||||
";
|
||||
// FIXED: convert e107.js.php to pure e107.js file
|
||||
// FIXED: 'e_jslib_browser_cache' used by js_manager - add it together with all new prefs (JS management tab, Site preferences area)
|
||||
// FIXED: option to use external sources (e.g. google) even if JS is combined (script tags for external sources)
|
||||
if(!e107::getPref('e_jslib_nocombine'))
|
||||
{
|
||||
$hash = md5(serialize(varset($pref['e_jslib'])).e107::getPref('e_jslib_browser_cache', 0).THEME.e_LANGUAGE.ADMIN).'_'.$where;
|
||||
// TODO disable cache in debug mod
|
||||
$hash .= (e107::getPref('e_jslib_nocache') || deftrue('e_NOCACHE') ? '_nocache' : '').(e107::getPref('e_jslib_gzip') ? '' : '_nogzip');
|
||||
$ret = "<script type='text/javascript' src='".e_FILE_ABS."e_jslib.php?{$hash}'></script>\n";
|
||||
if($return) $ret;
|
||||
$hash .= (e107::getPref('e_jslib_nocache')/* || deftrue('e_NOCACHE')*/ ? '_nocache' : '').(!e107::getPref('e_jslib_nobcache') || deftrue('e_NOCACHE') ? '_nobcache' : '').(e107::getPref('e_jslib_gzip') ? '' : '_nogzip');
|
||||
$ret .= "<script type='text/javascript' src='".e_FILE_ABS."e_jslib.php?{$hash}'></script>\n";
|
||||
if($return) return $ret;
|
||||
echo $ret;
|
||||
return;
|
||||
}
|
||||
|
||||
$e_jsmanager = e107::getJs();
|
||||
|
||||
if(!$return)
|
||||
{
|
||||
echo $ret;
|
||||
$ret = '';
|
||||
}
|
||||
// script tags
|
||||
$ret = $e_jsmanager->renderJs('core', null, true, $return);
|
||||
$ret .= $e_jsmanager->renderJs('core', null, true, $return);
|
||||
$ret .= $e_jsmanager->renderJs('plugin', null, true, $return);
|
||||
$ret .= $e_jsmanager->renderJs('theme', null, true, $return);
|
||||
|
||||
@ -195,8 +218,8 @@ class e_jslib
|
||||
* @param integer $lmodified last modfied time
|
||||
*/
|
||||
function set_cache($contents, $encoding = '', $lmodified = 0)
|
||||
{
|
||||
if (e107::getPref('syscachestatus'))
|
||||
{
|
||||
if (e107::getPref('e_jslib_nocache') == '0')
|
||||
{
|
||||
$cacheFile = $this->cache_filename($encoding);
|
||||
if(!$lmodified) $lmodified = time();
|
||||
@ -240,7 +263,7 @@ class e_jslib
|
||||
}
|
||||
|
||||
/**
|
||||
* Create cache filename (doesn't require e107 API)
|
||||
* Create cache filename (require e107 API)
|
||||
*
|
||||
* @param string $encoding
|
||||
* @param string $cacheStr defaults to 'S_e_jslib'
|
||||
@ -248,10 +271,10 @@ class e_jslib
|
||||
*/
|
||||
function cache_filename($encoding = '', $cacheStr = 'S_e_jslib')
|
||||
{
|
||||
$cacheDir = 'cache/';
|
||||
$cacheDir = e_CACHE_CONTENT;
|
||||
$hash = $_SERVER['QUERY_STRING'] && $_SERVER['QUERY_STRING'] !== '_nogzip' ? md5(str_replace('_nogzip', '', $_SERVER['QUERY_STRING'])) : 'nomd5';
|
||||
$cacheFile = $cacheDir . $cacheStr . ($encoding ? '_' . $encoding : '') . '_' . $hash . '.cache.php';
|
||||
|
||||
|
||||
return $cacheFile;
|
||||
}
|
||||
}
|
||||
|
@ -105,9 +105,9 @@ echo "<head>
|
||||
";
|
||||
echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
|
||||
|
||||
e107::meta('copyright',$pref['meta_copyright'][e_LANGUAGE]);
|
||||
e107::meta('author',$pref['meta_author'][e_LANGUAGE]);
|
||||
e107::meta('og:image',$tp->replaceConstants($pref['sitelogo'],'full'));
|
||||
if($pref['meta_copyright'][e_LANGUAGE]) e107::meta('copyright',$pref['meta_copyright'][e_LANGUAGE]);
|
||||
if($pref['meta_author'][e_LANGUAGE]) e107::meta('author',$pref['meta_author'][e_LANGUAGE]);
|
||||
if($pref['sitelogo']) e107::meta('og:image',$tp->replaceConstants($pref['sitelogo'],'full'));
|
||||
|
||||
echo e107::getUrl()->response()->renderMeta()."\n";
|
||||
|
||||
@ -230,7 +230,7 @@ else
|
||||
$e_js->themeCSS('style.css', $css_default);
|
||||
}
|
||||
|
||||
// Support for print and handheld medi - override theme default CSS
|
||||
// Support for print and handheld media - override theme default CSS
|
||||
if(file_exists(THEME."style_mobile.css"))
|
||||
{
|
||||
//echo "<link rel='stylesheet' href='".THEME_ABS."style_mobile.css' type='text/css' media='handheld' />\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user