本文整理汇总了PHP中SPLoader::JsFile方法的典型用法代码示例。如果您正苦于以下问题:PHP SPLoader::JsFile方法的具体用法?PHP SPLoader::JsFile怎么用?PHP SPLoader::JsFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPLoader
的用法示例。
在下文中一共展示了SPLoader::JsFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createLangFile
private static function createLangFile()
{
static $loaded = false;
if (!$loaded) {
$lang = array('months' => Sobi::Txt('JS_CALENDAR_MONTHS'), 'monthsShort' => Sobi::Txt('JS_CALENDAR_MONTHS_SHORT'), 'days' => Sobi::Txt('JS_CALENDAR_DAYS'), 'daysShort' => Sobi::Txt('JS_CALENDAR_DAYS_SHORT'), 'daysMin' => Sobi::Txt('JS_CALENDAR_DAYS_MINI'), 'today' => Sobi::Txt('JS_CALENDAR_TODAY'));
$check = md5(serialize($lang));
if (!SPLoader::JsFile('locale.' . Sobi::Lang(false) . '_date_picker', false, true, false) || !stripos(SPFs::read(SPLoader::JsFile('locale.' . Sobi::Lang(false) . '_date_picker', false, false, false)), $check)) {
foreach ($lang as $k => $v) {
$lang[$k] = explode(',', $v);
}
$lang = json_encode($lang);
$c = "\nvar spDatePickerLang={$lang}";
$c .= "\n//{$check}";
SPFs::write(SPLoader::JsFile('locale.' . Sobi::Lang(false) . '_date_picker', false, false, false), $c);
}
}
$loaded = true;
}
示例2: _jsFiles
private function _jsFiles()
{
if (Sobi::Cfg('cache.include_js_files', false) && !defined('SOBIPRO_ADM')) {
if (count($this->_cache['js'])) {
$compression = Sobi::Cfg('cache.compress_js', false);
$comprLevel = Sobi::Cfg('cache.compress_level', 0);
$check = array('section' => Sobi::Section(), 'compress_level' => $comprLevel, 'compress_js' => $compression);
foreach ($this->_cache['js'] as $file) {
$check[$file] = filemtime($file);
}
$check = md5(serialize($check));
if (!SPFs::exists(SOBI_PATH . "/var/js/{$check}.js")) {
$noCompress = explode(',', Sobi::Cfg('cache.js_compress_exceptions'));
$jsContent = "\n/* Created at: " . date(SPFactory::config()->key('date.log_format', 'D M j G:i:s T Y')) . " */\n";
foreach ($this->_cache['js'] as $file) {
$fName = str_replace(SOBI_ROOT, null, $file);
$jsContent .= "\n// ========\n// File: {$fName}\n// ========\n\n";
if ($compression && !in_array(basename($file), $noCompress)) {
$compressor = SPFactory::Instance('env.jspacker', SPFs::read($file), $comprLevel, false, true);
$jsContent .= $compressor->pack();
} else {
$jsContent .= SPFs::read($file);
}
$jsContent .= ";\n";
}
SPFs::write(SOBI_PATH . "/var/js/{$check}.js", $jsContent);
}
$cfile = SPLoader::JsFile('front.var.js.' . $check, false, true, true);
$this->jsFiles[++$this->count] = "\n<script type=\"text/javascript\" src=\"{$cfile}\"></script>";
}
}
return $this->jsFiles;
}