本文整理汇总了PHP中Media::getInlineScript方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::getInlineScript方法的具体用法?PHP Media::getInlineScript怎么用?PHP Media::getInlineScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::getInlineScript方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smartyOutputContent
protected function smartyOutputContent($content)
{
$this->context->cookie->write();
if (is_array($content)) {
foreach ($content as $tpl) {
$html = $this->context->smarty->fetch($tpl);
}
} else {
$html = $this->context->smarty->fetch($content);
}
$html = trim($html);
if ($this->controller_type == 'front' && !empty($html)) {
$dom_available = extension_loaded('dom') ? true : false;
if ($dom_available) {
$html = Media::deferInlineScripts($html);
}
$html = trim(str_replace(array('</body>', '</html>'), '', $html)) . "\n";
$this->context->smarty->assign(array('js_def' => Media::getJsDef(), 'js_files' => array_unique($this->js_files), 'js_inline' => $dom_available ? Media::getInlineScript() : array()));
$javascript = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_ . 'javascript.tpl');
echo $html . $javascript . "\t</body>\n</html>";
} else {
echo $html;
}
}
示例2: smartyOutputContent
protected function smartyOutputContent($content)
{
$this->context->cookie->write();
$js_tag = 'js_def';
$this->context->smarty->assign($js_tag, $js_tag);
if (is_array($content)) {
foreach ($content as $tpl) {
$html = $this->context->smarty->fetch($tpl);
}
} else {
$html = $this->context->smarty->fetch($content);
}
$html = trim($html);
if ($this->controller_type == 'front' && !empty($html) && $this->getLayout()) {
$live_edit_content = '';
if (!$this->useMobileTheme() && $this->checkLiveEditAccess()) {
$live_edit_content = $this->getLiveEditFooter();
}
$dom_available = extension_loaded('dom') ? true : false;
$defer = (bool) Configuration::get('PS_JS_DEFER');
if ($defer && $dom_available) {
$html = Media::deferInlineScripts($html);
}
$html = trim(str_replace(array('</body>', '</html>'), '', $html)) . "\n";
$this->context->smarty->assign(array($js_tag => Media::getJsDef(), 'js_files' => $defer ? array_unique($this->js_files) : array(), 'js_inline' => $defer && $dom_available ? Media::getInlineScript() : array()));
$javascript = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_ . 'javascript.tpl');
echo ($defer ? $html . $javascript : str_replace($js_tag, $javascript, $html)) . $live_edit_content . (!isset($this->ajax) || !$this->ajax ? '</body></html>' : '');
} else {
echo $html;
}
}
示例3: smartyOutputContent
/**
* Renders controller templates and generates page content
*
* @param array|string $content Template file(s) to be rendered
* @throws Exception
* @throws SmartyException
*/
protected function smartyOutputContent($content)
{
$this->context->cookie->write();
$html = '';
$js_tag = 'js_def';
$this->context->smarty->assign($js_tag, $js_tag);
if (is_array($content)) {
foreach ($content as $tpl) {
$html .= $this->context->smarty->fetch($tpl, null, $this->getLayout());
}
} else {
$html = $this->context->smarty->fetch($content, null, $this->getLayout());
}
if ($this->controller_type === 'modulefront') {
// Modules do not know about the layout system,
// let's inject their output inside the front-end layout.
$this->context->smarty->assign('content', $html);
$html = $this->context->smarty->fetch('wrapper.tpl');
}
$html = trim($html);
if (in_array($this->controller_type, array('front', 'modulefront')) && !empty($html) && $this->getLayout()) {
$dom_available = extension_loaded('dom') ? true : false;
$defer = (bool) Configuration::get('PS_JS_DEFER');
if ($defer && $dom_available) {
$html = Media::deferInlineScripts($html);
}
$html = trim(str_replace(array('</body>', '</html>'), '', $html)) . "\n";
$this->context->smarty->assign(array($js_tag => Media::getJsDef(), 'js_files' => $defer ? array_unique($this->js_files) : array(), 'js_inline' => $defer && $dom_available ? Media::getInlineScript() : array()));
$javascript = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_ . 'javascript.tpl');
if ($defer) {
echo $html . $javascript . (empty($this->ajax) ? '</body></html>' : '');
} else {
echo preg_replace('/(?<!\\$)' . $js_tag . '/', $javascript, $html) . (empty($this->ajax) ? '</body></html>' : '');
}
} else {
echo $html;
}
}