本文整理汇总了PHP中KunenaTemplate::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaTemplate::initialize方法的具体用法?PHP KunenaTemplate::initialize怎么用?PHP KunenaTemplate::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaTemplate
的用法示例。
在下文中一共展示了KunenaTemplate::initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Template initialization.
*
* @return void
*/
public function initialize()
{
// Template requires Bootstrap javascript
// Template also requires jQuery framework.
// Load JavaScript.
// Compile CSS from LESS files.
if (jimport('jproofless.jproofless')) {
$jproofLess = JProofLess::getInstance();
$cssFile = KPATH_MEDIA . "/cache/{$this->name}/css/" . $this->name . '.css';
$lessFile = KPATH_COMPONENT_RELATIVE . "/template/{$this->name}/less/{$this->name}.less";
$extraStyle = JPATH_SITE . '/components/com_kunena/template/crypsis/css/custom.css';
$jproofLess->setCssFile($cssFile)->setLessFile($lessFile)->setVariables($this->style_variables)->useStrategy('missingcss')->setExtraContent($extraStyle);
$class = $this;
$jproofLess->getLess()->registerFunction('url', function ($arg) use($class) {
list($type, $q, $values) = $arg;
$value = reset($values);
return "url({$q}{$class->getFile($value, true, 'media', 'media/kunena')}{$q})";
});
// Load template colors settings
$this->ktemplate = KunenaFactory::getTemplate();
$styles = <<<EOF
\t\t/* Kunena Custom CSS */
EOF;
$iconcolor = $this->ktemplate->params->get('IconColor');
if ($iconcolor) {
$styles .= <<<EOF
\t\t.layout#kunena [class*="category"] i,
\t\t.layout#kunena #kwho i.icon-users,
\t\t.layout#kunena#kstats i.icon-bars { color: {$iconcolor}; }
EOF;
}
$iconcolornew = $this->ktemplate->params->get('IconColorNew');
if ($iconcolornew) {
$styles .= <<<EOF
\t\t.layout#kunena [class*="category"] .icon-knewchar { color: {$iconcolornew} !important; }
\t\t.layout#kunena sup.knewchar { color: {$iconcolornew} !important; }
\t\t.layout#kunena .topic-item-unread { border-left-color: {$iconcolornew} !important; }
EOF;
}
$jproofLess->setExtraContent($styles);
$jproofLess->autoCompile();
} else {
// adding an Log message if it is an good choice to install the JProofLess
JLog::add('JProofLess is missing: ' . __FILE__ . ' @see <a target="_blank" href="http://wiki.jproof.de/projects/joomla-library-jproof-less/wiki"><b>Wiki</b></a>', JLog::NOTICE);
// Adding each time the regular already rendered css into the template if the LessCompiler not found
//JFactory::getDocument()->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css');
}
parent::initialize();
}
示例2: before
protected function before()
{
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
if (!$this->exists()) {
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
throw new RuntimeException("Layout '{$this->input->getWord('view')}/{$this->input->getWord('layout', 'default')}' does not exist!", 404);
}
// Load language files.
KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
KunenaFactory::loadLanguage('com_kunena.templates');
KunenaFactory::loadLanguage('com_kunena.models');
KunenaFactory::loadLanguage('com_kunena.views');
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaConfig::getInstance();
$this->document = JFactory::getDocument();
$this->template = KunenaFactory::getTemplate();
$this->template->initialize();
if ($this->me->isAdmin()) {
// Display warnings to the administrator if forum is either offline or debug has been turned on.
if ($this->config->board_offline) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_FORUM_IS_OFFLINE'), 'notice');
}
if ($this->config->debug) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_WARNING_DEBUG'), 'notice');
}
}
if ($this->me->isBanned()) {
// Display warnings to the banned users.
$banned = KunenaUserBan::getInstanceByUserid($this->me->userid, true);
if (!$banned->isLifetime()) {
$this->app->enqueueMessage(JText::sprintf('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS_EXPIRY', KunenaDate::getInstance($banned->expiration)->toKunena('date_today')), 'notice');
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS'), 'notice');
}
}
// Remove base and add canonical link.
$this->document->setBase('');
$this->document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
// Initialize breadcrumb.
$this->breadcrumb = $this->app->getPathway();
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
}
示例3: initialize
public function initialize()
{
// Template requires Mootools 1.4+ framework
$this->loadMootools();
JHtml::_('behavior.tooltip');
// New Kunena JS for default template
$this->addScript('js/plugins.js');
$this->compileLess('main.less', 'kunena.css');
$this->addStyleSheet('css/kunena.css');
if (KunenaFactory::getConfig()->lightbox == 1) {
// Load mediaxboxadvanced library if enabled in configuration
// TODO: replace with bootstrap compatible version
$this->addScript('js/mediaboxAdv.js');
//$this->addStyleSheet ( 'css/mediaboxAdv.css');
}
// Toggler language strings
JFactory::getDocument()->addScriptDeclaration('// <![CDATA[
var kunena_toggler_close = "' . JText::_('COM_KUNENA_TOGGLER_COLLAPSE') . '";
var kunena_toggler_open = "' . JText::_('COM_KUNENA_TOGGLER_EXPAND') . '";
// ]]>');
parent::initialize();
}
示例4: initialize
/**
* Template initialization.
*
* @return void
*/
public function initialize()
{
// Template requires Bootstrap javascript
JHtml::_('bootstrap.framework');
JHtml::_('bootstrap.tooltip', '[data-toggle="tooltip"]');
// Template also requires jQuery framework.
JHtml::_('jquery.framework');
JHtml::_('bootstrap.modal');
// Load JavaScript.
$this->addScript('main.js');
// Compile CSS from LESS files.
$this->compileLess('crypsis.less', 'kunena.css');
$this->addStyleSheet('kunena.css');
$filename = JPATH_SITE . '/components/com_kunena/template/crypsis/css/custom.css';
if (file_exists($filename)) {
$this->addStyleSheet('custom.css');
}
// Load template colors settings
$this->ktemplate = KunenaFactory::getTemplate();
$styles = <<<EOF
\t\t/* Kunena Custom CSS */
EOF;
$iconcolor = $this->ktemplate->params->get('IconColor');
if ($iconcolor) {
$styles .= <<<EOF
\t\t.layout#kunena [class*="category"] i,
\t\t.layout#kunena #kwho i.icon-users,
\t\t.layout#kunena#kstats i.icon-bars { color: {$iconcolor}; }
EOF;
}
$iconcolornew = $this->ktemplate->params->get('IconColorNew');
if ($iconcolornew) {
$styles .= <<<EOF
\t\t.layout#kunena [class*="category"] .icon-knewchar { color: {$iconcolornew} !important; }
\t\t.layout#kunena sup.knewchar { color: {$iconcolornew} !important; }
\t\t.layout#kunena .topic-item-unread { border-left-color: {$iconcolornew} !important; }
EOF;
}
$document = JFactory::getDocument();
$document->addStyleDeclaration($styles);
parent::initialize();
}
示例5: initialize
/**
* Template initialization.
*
* @return void
*/
public function initialize()
{
JHtml::_('bootstrap.framework');
JHtml::_('bootstrap.tooltip', '[data-toggle="tooltip"]');
JHtml::_('jquery.framework');
JHtml::_('bootstrap.modal');
$this->addScript('main.js');
// Compile CSS from LESS files.
$this->compileLess('crypsisb3.less', 'kunena.css');
$this->addStyleSheet('kunena.css');
$filename = JPATH_SITE . '/components/com_kunena/template/crypsisb3/css/custom.css';
if (file_exists($filename)) {
$this->addStyleSheet('custom.css');
}
$this->ktemplate = KunenaFactory::getTemplate();
$fontawesome = $this->ktemplate->params->get('fontawesome');
if ($fontawesome) {
?>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<?php
}
// Load template colors settings
$styles = <<<EOF
\t\t/* Kunena Custom CSS */
EOF;
$iconcolor = $this->ktemplate->params->get('IconColor');
if ($iconcolor) {
$styles .= <<<EOF
\t\t.layout#kunena [class*="category"] i,
\t\t.layout#kunena .glyphicon-topic,
\t\t.layout#kunena #kwho i.icon-users,
\t\t.layout#kunena#kstats i.icon-bars { color: {$iconcolor}; }
EOF;
}
$iconcolornew = $this->ktemplate->params->get('IconColorNew');
if ($iconcolornew) {
$styles .= <<<EOF
\t\t.layout#kunena [class*="category"] .icon-knewchar { color: {$iconcolornew} !important; }
\t\t.layout#kunena sup.knewchar { color: {$iconcolornew} !important; }
\t\t.layout#kunena .topic-item-unread { border-left-color: {$iconcolornew} !important;}
\t\t.layout#kunena .topic-item-unread .glyphicon { color: {$iconcolornew} !important;}
\t\t.layout#kunena .topic-item-unread i.fa { color: {$iconcolornew} !important;}
EOF;
}
$document = JFactory::getDocument();
$document->addStyleDeclaration($styles);
parent::initialize();
}