本文整理汇总了PHP中e107::getJs方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getJs方法的具体用法?PHP e107::getJs怎么用?PHP e107::getJs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getJs方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
/**
* Collect & output content of all available JS libraries (requires e107 API)
* FIXME
* - cache jslib in a pref on plugin/theme install only (plugin.xml, theme.xml)
* - [done - e_jslib_*] the structure of the cached pref array?
* - [done - js manager] kill all dupps
* - jslib settings - Administration area (compression on/off, admin log on/off
* manual control for included JS - really not sure about this,
* Force Browser Cache refresh - timestamp added to the url hash)
* - how and when to add JS lans for core libraries?
* - [done - js manager] separate methods for collecting & storing JS files (to be used in install/update routines) and output the JS content
*/
function getContent()
{
//global $pref, $eplug_admin, $THEME_JSLIB, $THEME_CORE_JSLIB;
ob_start();
ob_implicit_flush(0);
$e_jsmanager = e107::getJs();
$lmodified = array();
$e_jsmanager->renderJs('core', null, false);
$lmodified[] = $e_jsmanager->getLastModfied('core');
$e_jsmanager->renderJs('plugin', null, false);
$lmodified[] = $e_jsmanager->getLastModfied('plugin');
$e_jsmanager->renderJs('theme', null, false);
$lmodified[] = $e_jsmanager->getLastModfied('theme');
$lmodified[] = $e_jsmanager->getCacheId();
//e107::getPref('e_jslib_browser_cache', 0)
// last modification time for loaded files
$lmodified = max($lmodified);
// send content type
header('Content-type: text/javascript', true);
$this->content_out($lmodified);
// IT CAUSES GREAT TROUBLES ON SOME BROWSERS!
/*
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set('UTC');
}
// send last modified date
if(deftrue('e_NOCACHE')) header('Cache-Control: must-revalidate', true);
if($lmodified) header('Last-modified: '.gmdate("D, d M Y H:i:s", $lmodified).' GMT', true);
//if($lmodified) header('Last-modified: '.gmdate('r', $lmodified), true);
// Expire header - 1 year
$time = time()+ 365 * 86400;
header('Expires: '.gmdate("D, d M Y H:i:s", $time).' GMT', true);
// If-Modified check only if cache disabled
// if cache is enabled, cache file modification date is set to $lmodified
if(!e107::getPref('syscachestatus'))
{
// not modified - send 304 and exit
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $lmodified && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $lmodified)
{
header("HTTP/1.1 304 Not Modified", true);
exit;
}
}
//Output
$this->content_out($lmodified);*/
}
示例2: unset
$cssId = $val . "_css";
e107::getJs()->renderJs($cssId, false, 'css', false);
}
unset($CSSORDER);
e107::getJs()->renderCached('css');
if (deftrue('e_DEVELOPER')) {
echo "\n\n<!-- ======= [JSManager] FOOTER: Remaining JS ======= -->";
}
// [JSManager] Load JS Footer Includes by priority
e107::getJs()->renderJs('footer', true);
e107::getJs()->renderCached('js');
// All JavaScript settings are placed in the footer of the page with the library weight so that inline scripts appear
// afterwards.
e107::getJs()->renderJs('settings');
// [JSManager] Load JS Footer inline code by priority
e107::getJs()->renderJs('footer_inline', true);
//
// G final JS script keeps user and server time in sync.
// It must be the last thing created before sending the page to the user.
//
// see e107.js and class2.php
// This must be done as late as possible in page processing.
$_serverTime = time();
$lastSet = isset($_COOKIE['e107_tdSetTime']) ? intval($_COOKIE['e107_tdSetTime']) : 0;
$_serverPath = e_HTTP;
$_serverDomain = deftrue('MULTILANG_SUBDOMAIN') ? '.' . e_DOMAIN : '';
if (abs($_serverTime - $lastSet) > 120) {
/* update time delay every couple of minutes.
* Benefit: account for user time corrections and changes in internet delays
* Drawback: each update may cause all server times to display a bit different
*/
示例3: array
// echo "<script type='text/javascript'>\n";
// e107::js('footer-inline',"SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}');",'prototype');
//echo "SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}');
// </script>\n";
}
e107::getJs()->renderJs('footer_inline', true);
//
// H Final HTML
//
echo "</body></html>";
//
// I Send the buffered page data, along with appropriate headers
//
// SecretR - EXPERIMENT! SEND CSS data to header. Performance tests in progress.
$tmp = array();
$e_js = e107::getJs();
// Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility
$tmp1 = $e_js->renderJs('other_css', false, 'css', true);
if ($tmp1) {
$tmp['search'][] = '<!-- footer_other_css -->';
$tmp['replace'][] = $tmp1;
}
// Core CSS
$tmp1 = $e_js->renderJs('core_css', false, 'css', true);
if ($tmp1) {
$tmp['search'][] = '<!-- footer_core_css -->';
$tmp['replace'][] = $tmp1;
}
// Plugin CSS
$tmp1 = $e_js->renderJs('plugin_css', false, 'css', true);
if ($tmp1) {
示例4: implode
$body_onload = '';
if (count($js_body_onload)) {
$body_onload = " onload=\"" . implode(" ", $js_body_onload) . "\"";
}
//
// J: Send end of <head> and start of <body>
//
/*
* Fire Event e107:loaded
* core JS available only in Prototype front-end environment
*/
// e_css.php is removed
//\$('e-js-css').remove();
e107::js('inline', "\ndocument.observe('dom:loaded', function () {\ne107Event.trigger('loaded', null, document);\n});\n", 'prototype', 5);
e107::getJs()->renderJs('header_inline', 5);
e107::getJs()->renderCached('js');
echo "</head>\n";
// ---------- New in 2.0 -------------------------------------------------------
if (isset($LAYOUT) && is_array($LAYOUT)) {
foreach ($LAYOUT as $key => $template) {
if ($key == '_header_' || $key == '_footer_') {
continue;
}
if (strpos($template, '{---}') !== false) {
list($hd, $ft) = explode("{---}", $template);
$HEADER[$key] = isset($LAYOUT['_header_']) ? $LAYOUT['_header_'] . $hd : $hd;
$FOOTER[$key] = isset($LAYOUT['_footer_']) ? $ft . $LAYOUT['_footer_'] : $ft;
} else {
e107::getMessage()->addDebug('Missing "{---}" in $LAYOUT["' . $key . '"] ');
}
}
示例5: function
e107::js('inline', "\n\t(" . e_jshelper::toString(LAN_JSCONFIRM) . ").addModLan('core', 'delete_confirm');\n\t(" . e_jshelper::toString(LAN_DELETE) . ").addModLan('core', 'delete');\n\n", 'prototype', 5);
// [JSManager] Load JS Includes - Zone 5 - After theme_head, before e107:loaded trigger
// unobtrusive JS - moved here from external e_css.php
e107::getJs()->renderJs('header', 5);
/*
* Fire Event e107:loaded - Prototype only
*/
//\$('e-js-css').remove();
/*
e107::js('inline',"
document.observe('dom:loaded', function () {
e107Event.trigger('loaded', null, document);
});
",'prototype',5);
*/
e107::getJs()->renderJs('header_inline', 5);
echo "</head>\n<body" . $body_onload . ">\n";
echo getModal();
echo getAlert();
function getModal($caption = '', $type = '')
{
if (deftrue('BOOTSTRAP') === 3) {
return '';
}
if (e_PAGE == 'menus.php' && vartrue($_GET['configure'])) {
return;
}
if (e_PAGE == "image.php") {
// return;
}
return '
示例6: headerCss
function headerCss()
{
$pref = e107::getPref();
echo "<!-- *CSS* -->\n";
$e_js = e107::getJs();
// Core CSS - XXX awaiting for path changes
if (!isset($no_core_css) || !$no_core_css) {
//echo "<link rel='stylesheet' href='".e_FILE_ABS."e107.css' type='text/css' />\n";
$e_js->otherCSS('{e_WEB_CSS}e107.css');
}
if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss']) {
$css_file = file_exists(THEME . 'admin_' . $pref['admincss']) ? 'admin_' . $pref['admincss'] : $pref['admincss'];
//echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
$e_js->themeCSS($css_file);
} elseif (isset($pref['themecss']) && $pref['themecss']) {
$css_file = file_exists(THEME . 'admin_' . $pref['themecss']) ? 'admin_' . $pref['themecss'] : $pref['themecss'];
//echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
$e_js->themeCSS($css_file);
} else {
$css_file = file_exists(THEME . 'admin_style.css') ? 'admin_style.css' : 'style.css';
//echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
$e_js->themeCSS($css_file);
}
$e_js->renderJs('other_css', false, 'css', false);
echo "\n<!-- footer_other_css -->\n";
// Core CSS
$e_js->renderJs('core_css', false, 'css', false);
echo "\n<!-- footer_core_css -->\n";
// Plugin CSS
$e_js->renderJs('plugin_css', false, 'css', false);
echo "\n<!-- footer_plugin_css -->\n";
// Theme CSS
//echo "<!-- Theme css -->\n";
$e_js->renderJs('theme_css', false, 'css', false);
echo "\n<!-- footer_theme_css -->\n";
// Inline CSS - not sure if this should stay at all!
$e_js->renderJs('inline_css', false, 'css', false);
echo "\n<!-- footer_inline_css -->\n";
/*
echo "<!-- Theme css -->\n";
if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && isset($pref['admincss']) && $pref['admincss'] && file_exists(THEME.$pref['admincss'])) {
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? THEME_ABS.'admin_'.$pref['admincss'] : THEME_ABS.$pref['admincss'];
echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
} else if (isset($pref['themecss']) && $pref['themecss'] && file_exists(THEME.$pref['themecss']))
{
$css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? THEME_ABS.'admin_'.$pref['themecss'] : THEME_ABS.$pref['themecss'];
echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
}
else
{
$css_file = file_exists(THEME.'admin_style.css') ? THEME_ABS.'admin_style.css' : THEME_ABS.'style.css';
echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
}
if (!isset($no_core_css) || !$no_core_css) {
echo "<link rel='stylesheet' href='".e_WEB_CSS."e107.css' type='text/css' />\n";
}
* */
}
示例7: include_lan
<?php
if (!defined('e107_INIT')) {
exit;
}
include_lan(e_THEME . "_blank/languages/" . e_LANGUAGE . ".php");
// TODO theme.xml - add them to jslib/php source
e107::getJs()->requireCoreLib('core/decorate.js')->requireCoreLib('core/tabs.js');
//$register_sc[]='FS_ADMIN_ALT_NAV';
$no_core_css = TRUE;
define("STANDARDS_MODE", TRUE);
// TODO - JS/CSS handling via JSManager
function theme_head()
{
$theme_pref = e107::getThemePref();
$ret = '';
$ret .= '
<link rel="stylesheet" href="' . THEME_ABS . 'menu/menu.css" type="text/css" media="all" />
<!--[if IE]>
<link rel="stylesheet" href="' . THEME_ABS . 'ie_all.css" type="text/css" media="all" />
<![endif]-->
<!--[if lte IE 7]>
<script type="text/javascript" src="' . THEME_ABS . 'menu/menu.js"></script>
<![endif]-->
';
$ret .= "\n <script type='text/javascript'>\n /**\n \t* Decorate all tables having e-list class\n \t*/\n e107.runOnLoad( function() {\n \$\$('table.e-list').each(function(element) {\n \te107Utils.Decorate.table(element, { tr_td: 'first last' });\n });\n }, document, true);\n\n </script>";
if (THEME_LAYOUT == "alternate") {
$ret .= "<!-- Include Something --> ";
}
if ($theme_pref['_blank_example'] == 3) {
$ret .= "<!-- Include Something Else --> ";
示例8: getJs
/**
* JS manager
* @return e_jsmanager
*/
function getJs()
{
return e107::getJs();
}
示例9: css
/**
* CSS Common Public Function. Prefered is shortcode script path
* @param string $type core|theme|footer|inline|footer-inline|url or any existing plugin_name
* @param string $data depends on the type - path/url or inline js source
* @param null $dep
* @param string $media any valid media attribute string - http://www.w3schools.com/TAGS/att_link_media.asp
* @param string $preComment possible comment e.g. <!--[if lt IE 7]>
* @param string $postComment possible comment e.g. <![endif]-->
* @param null $dependence
*/
public static function css($type, $data, $dep = null, $media = 'all', $preComment = '', $postComment = '', $dependence = null)
{
if ((strstr($data, 'bootstrap.css') || strstr($data, 'bootstrap.min.css')) && !defined("BOOTSTRAP")) {
define("BOOTSTRAP", true);
}
$jshandler = e107::getJs();
$jshandler->setDependency($dep);
switch ($type) {
case 'core':
// data is path relative to e_FILE/jslib/
$jshandler->coreCSS($data, $media, $preComment, $postComment);
break;
case 'bootstrap':
// data is path relative to e_FILE/jslib/
$jshandler->coreCSS('bootstrap/css/' . $data, $media, $preComment, $postComment);
break;
case 'theme':
// data is path relative to current theme
$jshandler->themeCSS($data, $media, $preComment, $postComment);
break;
case 'inline':
// data is CSS source (without style tags)
$jshandler->inlineCSS($data, $media);
break;
case 'url':
// data is e.g. 'http://cdn.somesite.com/some.css'
$jshandler->otherCSS($data, $media, $preComment, $postComment);
break;
// $type is plugin name
// $type is plugin name
default:
// data is e.g. 'css/myplug.css'
if (self::isInstalled($type)) {
$jshandler->pluginCSS($type, $data, $media, $preComment, $postComment);
}
break;
}
$jshandler->resetDependency();
}
示例10: include_lan
// Generic user-related language defines
include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_usersettings.php');
require_once e_HANDLER . 'ren_help.php';
require_once e_HANDLER . 'user_extended_class.php';
// require_once (e_HANDLER.'user_handler.php');
require_once e_HANDLER . 'validator_class.php';
$ue = new e107_user_extended();
$userMethods = e107::getUserSession();
require_once e_HANDLER . 'ren_help.php';
include_once e107::coreTemplatePath('usersettings');
//correct way to load a core template.
// include_once (e_CORE.'shortcodes/batch/usersettings_shortcodes.php');
$usersettings_shortcodes = e107::getScBatch('usersettings');
e107::js('inline', "\n\t\tfunction addtext_us(sc)\n\t\t{\n\t\t\tdocument.getElementById('dataform').image.value = sc;\n\t\t}\n");
// include JS, headerjs not called in header anymore
$js = e107::getJs();
$js->footerInline(headerjs());
$photo_to_delete = '';
$avatar_to_delete = '';
$ue_fields = '';
$promptPassword = false;
$error = FALSE;
$extraErrors = array();
$eufVals = array();
$savePassword = '';
$inp = USERID;
// Initially assume that user is modifying their own data.
$_uid = false;
// FALSE if user modifying their own data; otherwise ID of data being modified
$adminEdit = FALSE;
// FALSE if editing own data. TRUE if admin edit
示例11: userpicker
/**
* User auto-complete search
*
* @param string $name_fld field name for user name
* @param string $id_fld field name for user id
* @param string $default_name default user name value
* @param integer $default_id default user id
* @param array|string $options [optional] 'readonly' (make field read only), 'name' (db field name, default user_name)
* @return string HTML text for display
*/
function userpicker($name_fld, $id_fld, $default_name, $default_id, $options = array())
{
if (!is_array($options)) {
parse_str($options, $options);
}
$label_fld = str_replace('_', '-', $name_fld) . '-upicker-lable';
//'.$this->text($id_fld, $default_id, 10, array('id' => false, 'readonly'=>true, 'class'=>'tbox number')).'
$ret = '
<div class="e-autocomplete-c">
' . $this->text($name_fld, $default_name, 150, array('id' => false, 'readonly' => vartrue($options['readonly']) ? true : false)) . '
<span id="' . $label_fld . '" class="' . ($default_id ? 'success' : 'warning') . '">Id #' . (int) $default_id . '</span>
' . $this->hidden($id_fld, $default_id, array('id' => false)) . '
<span class="indicator" style="display: none;">
<img src="' . e_IMAGE_ABS . 'generic/loading_16.gif" class="icon action S16" alt="Loading..." />
</span>
<div class="e-autocomplete"></div>
</div>
';
e107::getJs()->requireCoreLib('scriptaculous/controls.js', 2);
//TODO - external JS
e107::getJs()->footerInline("\r\n\t //autocomplete fields\r\n\t \$\$('input[name={$name_fld}]').each(function(el) {\r\n\r\n\t \tif(el.readOnly) {\r\n\t \t\tel.observe('click', function(ev) { ev.stop(); var el1 = ev.findElement('input'); el1.blur(); } );\r\n\t \t\tel.next('span.indicator').hide();\r\n\t \t\tel.next('div.e-autocomplete').hide();\r\n\t \t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tnew Ajax.Autocompleter(el, el.next('div.e-autocomplete'), '" . e_JS . "e_ajax.php', {\r\n\t\t\t\t\t paramName: '{$name_fld}',\r\n\t\t\t\t\t minChars: 2,\r\n\t\t\t\t\t frequency: 0.5,\r\n\t\t\t\t\t afterUpdateElement: function(txt, li) {\r\n\t\t\t\t\t \tif(!\$(li)) return;\r\n\t\t\t\t\t \tvar elnext = el.next('input[name={$id_fld}]'),\r\n\t\t\t\t\t \t\tellab = \$('{$label_fld}');\r\n\t\t\t\t\t \tif(\$(li).id) {\r\n\t\t\t\t\t\t\telnext.value = parseInt(\$(li).id);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\telnext.value = 0\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(ellab)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tellab.removeClassName('warning').removeClassName('success');\r\n\t\t\t\t\t\t\tellab.addClassName((elnext.value ? 'success' : 'warning')).update('Id #' + elnext.value);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t },\r\n\t\t\t\t\t indicator: el.next('span.indicator'),\r\n\t\t\t\t\t parameters: 'ajax_used=1&ajax_sc=usersearch=" . rawurlencode('searchfld=' . str_replace('user_', '', vartrue($options['name'], 'user_name')) . '--srcfld=' . $name_fld) . "'\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t");
return $ret;
}
示例12: array
}
} else {
//hide group, show standard rows
$jshelper->addResponseAction('element-invoke-by-id', array('hide' => 'userclass_type_groups', 'show' => 'userclass_type_standard'));
}
unset($row['userclass_accum']);
$jshelper->addResponseAction('fill-form', $row);
$jshelper->sendResponse('XML');
// $jshelper->sendResponse('JSON'); - another option (tested) - faster transfer!
} else {
e_jshelper::sendAjaxError('500', 'Database read error!');
}
}
exit;
}
e107::getJs()->headerCore('core/admin.js');
/*
* Authorization should be done a bit later!
*/
require_once "auth.php";
$emessage = e107::getMessage();
//---------------------------------------------------
// Set Initial Classes
//---------------------------------------------------
if (isset($_POST['set_initial_classes'])) {
$changed = $pref['init_class_stage'] != intval($_POST['init_class_stage']);
$pref['init_class_stage'] = intval($_POST['init_class_stage']);
$temp = array();
foreach ($_POST['init_classes'] as $ic) {
$temp[] = intval($ic);
}