本文整理汇总了PHP中N2Html::script方法的典型用法代码示例。如果您正苦于以下问题:PHP N2Html::script方法的具体用法?PHP N2Html::script怎么用?PHP N2Html::script使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2Html
的用法示例。
在下文中一共展示了N2Html::script方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOutput
public function getOutput()
{
$output = "";
$globalInline = $this->getGlobalInlineScripts();
if (!empty($globalInline)) {
$output .= N2Html::script($globalInline . "\n");
}
foreach ($this->urls as $url) {
$output .= N2Html::script($url, true) . "\n";
}
if (!N2Platform::$isAdmin && N2Settings::get('async', '0')) {
$jsCombined = new N2CacheCombine('js', N2Settings::get('minify-js', '0') ? 'N2MinifierJS::minify' : false);
foreach ($this->getFiles() as $file) {
if (basename($file) == 'n2.js') {
$output .= N2Html::script(N2Uri::pathToUri($file) . '?' . filemtime($file), true) . "\n";
} else {
$jsCombined->add($file);
}
}
$combinedFile = $jsCombined->make();
$scripts = 'nextend.loadScript("' . N2Uri::pathToUri($combinedFile) . '?' . filemtime($combinedFile) . '");';
$output .= N2Html::script($scripts . "\n");
} else {
if (!N2Platform::$isAdmin && N2Settings::get('combine-js', '0')) {
$jsCombined = new N2CacheCombine('js', N2Settings::get('minify-js', '0') ? 'N2MinifierJS::minify' : false);
foreach ($this->getFiles() as $file) {
$jsCombined->add($file);
}
$combinedFile = $jsCombined->make();
$output .= N2Html::script(N2Uri::pathToUri($combinedFile) . '?' . filemtime($combinedFile), true) . "\n";
} else {
foreach ($this->getFiles() as $file) {
$output .= N2Html::script(N2Uri::pathToUri($file) . '?' . filemtime($file), true) . "\n";
}
}
}
$output .= N2Html::script(N2Localization::toJS() . "\n" . $this->getInlineScripts() . "\n");
return $output;
}
示例2: array
<div id="n2-ss-slider-zoom"></div>
<div class="n2-expert" id="n2-ss-lock">
<i class="n2-i n2-i-unlock"></i>
</div>
</div>
</div>
<div class="n2-td" id="n2-ss-devices">
<div class="n2-controls-panel n2-table n2-table-auto">
<div class="n2-tr">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
$sliderManager = $this->appType->app->get('sliderManager');
$slider = $sliderManager->getSlider();
$slider->setStatic($slideData->get('static-slide', 0));
echo N2Html::tag('div', array('id' => 'smartslider-adjust-height', 'style' => 'overflow: auto; margin: 5px; padding: 5px'), N2Html::tag('div', array(), $sliderManager->render()));
N2Localization::addJS(array('Add', 'Clear', 'in', 'loop', 'out'));
echo N2Html::script("\n nextend.ready(function(\$){\n var cb = function(){\n nextend.smartSlider.startEditor('" . $slider->elementId . "', 'slideslide', " . (defined('N2_IMAGE_UPLOAD_DISABLE') ? 1 : 0) . ", '" . N2Base::getApplication('system')->router->createAjaxUrl(array('browse/upload')) . "', 'slider" . $slider->sliderId . "');\n };\n if(typeof nextend.fontsDeferred !== 'undefined'){\n nextend.fontsDeferred.done(cb);\n }else {\n cb();\n }\n });\n ");
?>
</div>
<?php
?>
<div style="height: 600px;"></div>
示例3: createHTML
public function createHTML($isZIP = true)
{
$this->files = array();
ob_end_clean();
N2AssetsManager::createStack();
N2AssetsPredefined::frontend(true);
ob_start();
N2Base::getApplication("smartslider")->getApplicationType('widget')->render(array("controller" => 'home', "action" => N2Platform::getPlatform(), "useRequest" => false), array($this->sliderId, 'Export as HTML'));
$slidersModel = new N2SmartsliderSlidersModel();
$slider = $slidersModel->get($this->sliderId);
$sliderHTML = ob_get_clean();
$headHTML = '';
$css = N2AssetsManager::getCSS(true);
foreach ($css['url'] as $url) {
$headHTML .= N2Html::style($url, true, array('media' => 'screen, print')) . "\n";
}
array_unshift($css['files'], N2LIBRARYASSETS . '/normalize.css');
foreach ($css['files'] as $file) {
$path = 'css/' . basename($file);
$this->files[$path] = file_get_contents($file);
$headHTML .= N2Html::style($path, true, array('media' => 'screen, print')) . "\n";
}
if ($css['inline'] != '') {
$headHTML .= N2Html::style($css['inline']) . "\n";
}
$js = N2AssetsManager::getJs(true);
if ($js['globalInline'] != '') {
$headHTML .= N2Html::script($js['globalInline']) . "\n";
}
foreach ($js['url'] as $url) {
$headHTML .= N2Html::script($url, true) . "\n";
}
foreach ($js['files'] as $file) {
$path = 'js/' . basename($file);
$this->files[$path] = file_get_contents($file);
$headHTML .= N2Html::script($path, true) . "\n";
}
if ($js['inline'] != '') {
$headHTML .= N2Html::script($js['inline']) . "\n";
}
$sliderHTML = preg_replace_callback('/(src|data-desktop|data-tablet|data-mobile)=["|\'](.*?)["|\']/i', array($this, 'replaceHTMLImage'), $sliderHTML);
$sliderHTML = preg_replace_callback('/url\\(\\s*([\'"]|('))?(\\S*\\.(?:jpe?g|gif|png))([\'"]|('))?\\s*\\)[^;}]*?/i', array($this, 'replaceHTMLBGImage'), $sliderHTML);
$sliderHTML = preg_replace_callback('/(n2-lightbox-urls)=["|\'](.*?)["|\']/i', array($this, 'replaceLightboxImages'), $sliderHTML);
$headHTML = preg_replace_callback('/"([^"]*?\\.(jpg|png|gif|jpeg))"/i', array($this, 'replaceJSON'), $headHTML);
$this->files['index.html'] = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge, chrome=1\">\n<title>" . $slider['title'] . "</title>\n" . $headHTML . "</head>\n<body>\n" . $sliderHTML . "</body>\n</html>";
if (!$isZIP) {
return $this->files;
}
$zip = new N2ZipFile();
foreach ($this->files as $path => $content) {
$zip->addFile($content, $path);
}
ob_end_clean();
header('Content-disposition: attachment; filename=' . preg_replace('/[^a-zA-Z0-9_-]/', '', $slider['title']) . '.zip');
header('Content-type: application/zip');
echo $zip->file();
n2_exit(true);
}