当前位置: 首页>>代码示例>>PHP>>正文


PHP JSNTplUtils类代码示例

本文整理汇总了PHP中JSNTplUtils的典型用法代码示例。如果您正苦于以下问题:PHP JSNTplUtils类的具体用法?PHP JSNTplUtils怎么用?PHP JSNTplUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JSNTplUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initial

 /**
  * initialize
  */
 public static function initial()
 {
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $jsnUtils = JSNTplUtils::getInstance();
         $isInstalledSh404Sef = $jsnUtils->checkSH404SEF();
         if ($jsnUtils->isJoomla3()) {
             // JViewLegacy
             JLoader::register('JViewLegacy', JSN_PATH_TPLFRAMEWORK . '/includes/core/j3x/jsntplviewlegacy.php');
             // JModuleHelper
             JLoader::register('JModuleHelper', JSN_PATH_TPLFRAMEWORK . '/includes/core/j3x/jsntplmodulehelper.php');
             //Check if SH404Sef is installed or not. If yes, then do not load jsntplpagination.php
             if (!$isInstalledSh404Sef) {
                 // JPagination
                 JLoader::register('JPagination', JSN_PATH_TPLFRAMEWORK . '/includes/core/j3x/jsntplpagination.php');
             }
         } else {
             // JView
             jimport('joomla.application.component.view');
             JLoader::register('JView', JSN_PATH_TPLFRAMEWORK . '/includes/core/j25/jsntplview.php');
             // JModuleHelper
             jimport('joomla.application.module.helper');
             JLoader::register('JModuleHelper', JSN_PATH_TPLFRAMEWORK . '/includes/core/j25/jsntplmodulehelper.php');
             //Check if SH404Sef is installed or not. If yes, then do not load jsntplpagination.php
             if (!$isInstalledSh404Sef) {
                 // JPagination
                 jimport('joomla.html.pagination');
                 JLoader::register('JPagination', JSN_PATH_TPLFRAMEWORK . '/includes/core/j25/jsntplpagination.php');
             }
         }
     }
 }
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:35,代码来源:jsntplframework.php

示例2: modChrome_jsnmodule

function modChrome_jsnmodule($module, &$params, &$attribs)
{
    if ($module->content) {
        $jsnutils = JSNTplUtils::getInstance();
        $moduleTitleOuput = '<span>' . $module->title . '</span>';
        $moduleClass = $params->get('moduleclass_sfx');
        if (preg_match('/^(.+)?(fa fa-[^\\s]+)(.+)?$/', $params->get('moduleclass_sfx'), $match)) {
            $moduleTitleOuput = '<span class="jsn-moduleicon "><i class="' . $match[2] . '"></i>' . $module->title . '</span>';
            $moduleClass = $match[1] . ' ' . $match[3];
        }
        $beginModuleContainerOutput = '';
        $endModuleContainerOutput = '';
        // Check module class for xHTML output
        if (isset($attribs['class'])) {
            // Check value in attribute class to generate appropriate xHTML code for module title
            if (preg_match("/\\bjsn-duohead\\b/", (string) $attribs['class'])) {
                $moduleTitleOuput = '<span class="jsn-moduleicon">' . $jsnutils->wrapFirstWord($module->title) . '</span>';
            }
            if (preg_match("/\\bjsn-innerhead\\b/", (string) $attribs['class'])) {
                $moduleTitleOuput = '<span class="jsn-moduletitle_inner1"><span class="jsn-moduletitle_inner2">' . $moduleTitleOuput . '</span></span>';
            }
            // Check value in attribute class to generate appropriate xHTML code for module container
            if (preg_match("/\\bjsn-triobox\\b/", (string) $attribs['class'])) {
                $beginModuleContainerOutput = '<div class="jsn-top"><div class="jsn-top_inner"></div></div><div class="jsn-middle"><div class="jsn-middle_inner">';
                $endModuleContainerOutput = '</div></div><div class="jsn-bottom"><div class="jsn-bottom_inner"></div></div>';
            } else {
            }
            if (preg_match("/\\bjsn-roundedbox\\b/", (string) $attribs['class'])) {
                $beginModuleContainerOutput = '<div><div>';
                $endModuleContainerOutput = '</div></div>';
            } else {
            }
        }
        // Generate output code to template
        echo '<div class="' . $moduleClass . ' jsn-modulecontainer' . (isset($attribs['columnClass']) ? ' ' . $attribs['columnClass'] : '') . '"><div class="jsn-modulecontainer_inner">';
        echo $beginModuleContainerOutput;
        if (strpos($moduleClass, 'display-dropdown') !== false && ($module->position == 'mainmenu' || $module->position == 'toolbar')) {
            echo '<h3 class="jsn-moduletitle"><span data-title="' . $module->title . '">' . $moduleTitleOuput . '</span></h3>';
        } else {
            if ($module->showtitle) {
                echo '<h3 class="jsn-moduletitle">' . $moduleTitleOuput . '</h3>';
            }
        }
        echo '<div class="jsn-modulecontent">';
        echo $module->content;
        echo '<div class="clearbreak"></div></div>';
        echo $endModuleContainerOutput;
        echo '</div></div>';
    }
}
开发者ID:vanbumi,项目名称:pencerahan,代码行数:50,代码来源:modules.php

示例3: modChrome_jsnmodule

/**
 * This is a file to add template specific chrome to module rendering.  To use it you would
 * set the style attribute for the given module(s) include in your template to use the style
 * for each given modChrome function.
 *
 * eg.  To render a module mod_test in the sliders style, you would use the following include:
 * <jdoc:include type="module" name="test" style="slider" />
 *
 * This gives template designers ultimate control over how modules are rendered.
 *
 * NOTICE: All chrome wrapping methods should be named: modChrome_{STYLE} and take the same
 * two arguments.
 */
function modChrome_jsnmodule($module, &$params, &$attribs)
{
    $jsnutils = JSNTplUtils::getInstance();
    $moduleTitleOuput = '<span class="jsn-moduleicon">' . $module->title . '</span>';
    $beginModuleContainerOutput = '';
    $endModuleContainerOutput = '';
    // Check module class for xHTML output
    if (isset($attribs['class'])) {
        // Check value in attribute class to generate appropriate xHTML code for module title
        if (preg_match("/\\bjsn-duohead\\b/", (string) $attribs['class'])) {
            $moduleTitleOuput = '<span class="jsn-moduleicon">' . $jsnutils->wrapFirstWord($module->title) . '</span>';
        }
        if (preg_match("/\\bjsn-innerhead\\b/", (string) $attribs['class'])) {
            $moduleTitleOuput = '<span class="jsn-moduletitle_inner1"><span class="jsn-moduletitle_inner2">' . $moduleTitleOuput . '</span></span>';
        }
        // Check value in attribute class to generate appropriate xHTML code for module container
        if (preg_match("/\\bjsn-triobox\\b/", (string) $attribs['class'])) {
            $beginModuleContainerOutput = '<div class="jsn-top"><div class="jsn-top_inner"></div></div><div class="jsn-middle"><div class="jsn-middle_inner">';
            $endModuleContainerOutput = '</div></div><div class="jsn-bottom"><div class="jsn-bottom_inner"></div></div>';
        } else {
        }
        if (preg_match("/\\bjsn-roundedbox\\b/", (string) $attribs['class'])) {
            $beginModuleContainerOutput = '<div><div>';
            $endModuleContainerOutput = '</div></div>';
        } else {
        }
    }
    // Generate output code to template
    echo '<div class="' . $params->get('moduleclass_sfx') . ' jsn-modulecontainer' . (isset($attribs['columnClass']) ? ' ' . $attribs['columnClass'] : '') . '"><div class="jsn-modulecontainer_inner">';
    echo $beginModuleContainerOutput;
    if ($module->showtitle) {
        echo '<h3 class="jsn-moduletitle">' . $moduleTitleOuput . '</h3>';
    }
    echo '<div class="jsn-modulecontent">';
    echo $module->content;
    echo '<div class="clearbreak"></div></div>';
    echo $endModuleContainerOutput;
    echo '</div></div>';
}
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:52,代码来源:modules.php

示例4: array

<?php

$jsnutils = JSNTplUtils::getInstance();
$doc = $this->_document;
// Count module instances
$doc->hasRight = $jsnutils->countModules('right');
$doc->hasLeft = $jsnutils->countModules('left');
$doc->hasPromo = $jsnutils->countModules('promo');
$doc->hasPromoLeft = $jsnutils->countModules('promo-left');
$doc->hasPromoRight = $jsnutils->countModules('promo-right');
$doc->hasInnerLeft = $jsnutils->countModules('innerleft');
$doc->hasInnerRight = $jsnutils->countModules('innerright');
// Define template colors
$doc->templateColors = array('red', 'green', 'violet', 'orange', 'grey', 'cyan');
if (isset($doc->sitetoolsColorsItems)) {
    $this->_document->templateColors = $doc->sitetoolsColorsItems;
}
// Apply K2 style
if ($jsnutils->checkK2()) {
    $doc->addStylesheet($doc->templateUrl . "/ext/k2/jsn_ext_k2.css");
}
// Start generating custom styles
$customCss = '';
// Process TPLFW v2 parameter
if (isset($doc->customWidth)) {
    if ($doc->customWidth != 'responsive') {
        $customCss .= '
	#jsn-page,
	#jsn-topheader {
		width: ' . $doc->customWidth . ';
		min-width: ' . $doc->customWidth . ';
开发者ID:rodhoff,项目名称:MNW,代码行数:31,代码来源:template_custom.php

示例5: _prepare

 /**
  * Preparing template parameters for the template
  *
  * @return  void
  */
 private function _prepare($loadTemplateCSS, $loadTemplateJS)
 {
     $this->_loadTemplateCSS = $loadTemplateCSS;
     $this->_loadTemplateJS = $loadTemplateJS;
     $templateParams = isset($this->_document->params) ? $this->_document->params : null;
     $templateName = isset($this->_document->template) ? $this->_document->template : null;
     if (empty($templateParams) or empty($templateName) or $templateName == 'system') {
         $templateDetails = JFactory::getApplication()->getTemplate(true);
         $templateParams = $templateDetails->params;
         $templateName = $templateDetails->template;
     }
     // Update show content on frontpage parameter
     $app = JFactory::getApplication();
     $menu = $app->getMenu()->getActive();
     $lang = JFactory::getLanguage();
     $lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR);
     $manifest = JSNTplHelper::getManifest($templateName);
     $this->_document->app = JFactory::getApplication();
     $this->_document->template = $templateName;
     $this->_document->version = JSNTplHelper::getTemplateVersion($templateName);
     $this->_document->isFree = !isset($manifest->edition) || $manifest->edition == 'FREE';
     $this->_document->uri = JFactory::getUri();
     $this->_document->rootUrl = $this->_document->uri->root(true);
     $this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template;
     $columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright');
     // Find customizable columns
     $customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]');
     if (count($customColumns) > 0) {
         $columns = array();
         foreach (end($customColumns)->children() as $column) {
             $columns[] = (string) $column['name'];
         }
     }
     // Add columns to overriable parameter list
     foreach ($columns as $column) {
         $className = $column;
         if (strpos($column, 'column') === 0) {
             $className = substr($column, 6);
         }
         $this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'integer', 'name' => $column);
     }
     // Load template parameters
     $params = $this->loadParams($templateParams->toArray(), $templateName, true);
     // Detect browser information
     $this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo();
     $this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie';
     $this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7;
     // Custom direction from url parameter
     $direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction);
     $this->_document->direction = $direction;
     // Apply custom params
     $params = $this->_overrideCustomParams($params);
     $params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true;
     if ($this->_document->isFree === true) {
         $params['mobileSupport'] = false;
         $params['useCSS3Effect'] = false;
     }
     // Prepare logo parameter
     if ($params['logoColored']) {
         $params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png";
     }
     if ($params['mobileSupport'] == false) {
         $params['desktopSwitcher'] = false;
     }
     if (!preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) {
         $params['logoFile'] = JUri::root(true) . '/' . $params['logoFile'];
     }
     // Prepare color variation to show in site tool
     if ($params['colorSelector'] and !@count($params['sitetoolsColorsItems'])) {
         $params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option');
         if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) {
             $xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml');
             $params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option');
         }
         foreach ($params['sitetoolsColorsItems'] as &$color) {
             $color = (string) $color['value'];
         }
     }
     // Prepare Google Analytics code
     $params['codeAnalytic'] = trim($params['codeAnalytic']);
     if (!empty($params['codeAnalytic'])) {
         if (strpos($params['codeAnalytic'], '<script') === false) {
             $params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic'];
         }
         if (strpos($params['codeAnalytic'], '</script>') === false) {
             $params['codeAnalytic'] = $params['codeAnalytic'] . '</script>';
         }
     }
     // Binding parameters to document object
     $this->_document->params = new JRegistry();
     foreach ($params as $key => $value) {
         $this->_document->params->set($key, $value);
         $this->_document->{$key} = $value;
     }
     // Assign helper object
//.........这里部分代码省略.........
开发者ID:ngogiangthanh,项目名称:damtvnewversion,代码行数:101,代码来源:helper_v1.php

示例6: _prepare

 /**
  * Preparing template parameters for the template
  *
  * @return  void
  */
 private function _prepare($loadTemplateCSS, $loadTemplateJS)
 {
     $this->_loadTemplateCSS = $loadTemplateCSS;
     $this->_loadTemplateJS = $loadTemplateJS;
     $templateParams = isset($this->_document->params) ? $this->_document->params : null;
     $templateName = isset($this->_document->template) ? $this->_document->template : null;
     if (empty($templateParams) or empty($templateName) or $templateName == 'system') {
         $templateDetails = JFactory::getApplication()->getTemplate(true);
         $templateParams = $templateDetails->params;
         $templateName = $templateDetails->template;
     }
     // Get template information
     $this->_template = JSNTplTemplateRecognization::detect($templateName);
     // Update show content on frontpage parameter
     $app = JFactory::getApplication();
     $menu = $app->getMenu()->getActive();
     $lang = JFactory::getLanguage();
     $lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR);
     $manifest = JSNTplHelper::getManifest($templateName);
     $this->_document->app = JFactory::getApplication();
     $this->_document->template = $templateName;
     $this->_document->version = JSNTplHelper::getTemplateVersion($templateName);
     $this->_document->isFree = empty($manifest->edition) || $manifest->edition == 'FREE';
     $this->_document->uri = JFactory::getUri();
     $this->_document->rootUrl = $this->_document->uri->root(true);
     $this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template;
     $columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright');
     // Find customizable columns
     $customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]');
     if (count($customColumns) > 0) {
         $columns = array();
         foreach (end($customColumns)->children() as $column) {
             $columns[] = (string) $column['name'];
         }
     }
     // Add columns to overriable parameter list
     foreach ($columns as $column) {
         $className = $column;
         if (strpos($column, 'column') === 0) {
             $className = substr($column, 6);
         }
         $this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'string', 'name' => $column);
     }
     // Load template parameters
     $params = $this->loadParams($templateParams->toArray(), $templateName, true);
     // Detect browser information
     $this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo();
     $this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie';
     $this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7;
     // Custom direction from url parameter
     $direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction);
     $this->_document->direction = $direction;
     // Apply custom params
     $params = $this->_overrideCustomParams($params);
     $params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true;
     // Prepare logo parameter
     if ($params['logoColored']) {
         $params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png";
     }
     if (!empty($params['logoFile']) and !preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) {
         $params['logoFile'] = JUri::root(true) . '/' . $params['logoFile'];
     }
     // Prepare color variation to show in site tool
     if (!isset($params['sitetoolsColorsItems']) and $colorSettings = json_decode($params['sitetoolsColors'])) {
         if (!count($colorSettings->colors)) {
             $params['sitetoolsColorsItems'] = array();
         }
     }
     if ($params['sitetoolsColors'] and !isset($params['sitetoolsColorsItems'])) {
         $params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option');
         if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) {
             $xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml');
             $params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option');
         }
         if ($params['sitetoolsColorsItems']) {
             foreach ($params['sitetoolsColorsItems'] as &$color) {
                 $color = (string) $color['value'];
             }
         }
         $params['sitetoolsColorsItems'] != false or $params['sitetoolsColorsItems'] = array();
     }
     $params['colorSelector'] = count($params['sitetoolsColorsItems']) ? true : false;
     // Check if site tools has tool to show
     if ($params['sitetoolStyle']) {
         $visible = count($params['sitetoolsColorsItems']);
         if (!$visible) {
             $params['sitetoolStyle'] = false;
         }
     }
     // Prepare Google Analytics code
     $params['codeAnalytic'] = trim($params['codeAnalytic']);
     if (!empty($params['codeAnalytic'])) {
         if (strpos($params['codeAnalytic'], '<script') === false) {
             $params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic'];
         }
//.........这里部分代码省略.........
开发者ID:NallelyFlores89,项目名称:basvec,代码行数:101,代码来源:helper.php


注:本文中的JSNTplUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。