本文整理汇总了PHP中T3Path类的典型用法代码示例。如果您正苦于以下问题:PHP T3Path类的具体用法?PHP T3Path怎么用?PHP T3Path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了T3Path类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: compile
public static function compile($source, $path, $todir, $importdirs)
{
// call Less to compile
$parser = new lessc();
$parser->setImportDir(array_keys($importdirs));
$parser->setPreserveComments(true);
$output = $parser->compile($source);
// update url
$arr = preg_split(T3Less::$rsplitbegin . T3Less::$kfilepath . T3Less::$rsplitend, $output, -1, PREG_SPLIT_DELIM_CAPTURE);
$output = '';
$file = $relpath = '';
$isfile = false;
foreach ($arr as $s) {
if ($isfile) {
$isfile = false;
$file = $s;
$relpath = T3Less::relativePath($todir, dirname($file));
$output .= "\n#" . T3Less::$kfilepath . "{content: \"{$file}\";}\n";
} else {
$output .= ($file ? T3Path::updateUrl($s, $relpath) : $s) . "\n\n";
$isfile = true;
}
}
return $output;
}
开发者ID:Tommar,项目名称:remate,代码行数:25,代码来源:legacy.less.php
示例2: getOptions
/**
* Method to get the list of files for the field options.
* Specify the target directory with a directory attribute
* Attributes allow an exclude mask and stripping of extensions from file name.
* Default attribute may optionally be set to null (no file) or -1 (use a default).
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
$table = JTable::getInstance('Style', 'TemplatesTable', array());
$table->load((int) JFactory::getApplication()->input->getInt('id'));
// update path to this template
$path = (string) $this->element['directory'];
if (!is_dir($path)) {
// process path in template
$options = array();
$vals = array();
// get all path in template
$paths = T3Path::getAllPath($path);
foreach ($paths as $path) {
$this->directory = $this->element['directory'] = $path;
$tmps = parent::getOptions();
foreach ($tmps as $tmp) {
if (in_array($tmp->value, $vals)) {
continue;
}
$vals[] = $tmp->value;
$options[] = $tmp;
}
}
return $options;
}
return parent::getOptions();
}
开发者ID:ForAEdesWeb,项目名称:AEW9,代码行数:37,代码来源:t3folderlist.php
示例3: _load
/**
* Load hook file
*
* @return void
*/
function _load()
{
if (defined('_T3_HOOK_CUSTOM')) {
return;
}
define('_T3_HOOK_CUSTOM', 1);
//include hook. Get all path to hook.php in themes
$paths = T3Path::getPath('hook.php', true);
if (is_array($paths)) {
foreach ($paths as $path) {
include $path;
}
}
}
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:19,代码来源:hook.php
示例4: gzip
function gzip()
{
$file = JRequest::getVar('file');
//clean filepath
$file = preg_replace('#[?\\#]+.*$#', '', $file);
//check exists
$filepath = T3Path::path(dirname($file)) . DS . basename($file);
if (!is_file($filepath)) {
echo "File {$file} {$filepath} not exist";
return;
}
$type = strtolower(JRequest::getCmd('type', 'css'));
//$type must be in css or js
if (!in_array($type, array('css', 'js'))) {
echo "Type {$type} not support";
return;
}
//make sure the type of $file is the same with $type
if (!preg_match('#\\.' . $type . '$#', $filepath)) {
echo "Type {$type} not match";
return;
}
jimport('joomla.filesystem.file');
$data = @JFile::read($filepath);
if (!$data) {
echo "File {$filepath} empty";
return;
}
if ($type == 'js') {
$type = 'javascript';
}
JResponse::setHeader('Content-Type', "text/{$type};", true);
//set cache time
JResponse::setHeader('Cache-Control', "private", true);
$offset = 365 * 24 * 60 * 60;
//whenever the content is changed, the file name is changed also. Therefore we could set the cache time long.
JResponse::setHeader('Expires', gmdate("D, d M Y H:i:s", time() + $offset) . " GMT", true);
JResponse::allowCache(true);
JResponse::setBody($data);
echo JResponse::toString(1);
}
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:41,代码来源:ajaxsite.php
示例5: getT3Themes
function getT3Themes($template)
{
$themes = array();
$themes["engine.default"] = T3Path::path(T3_BASETHEME, false);
$path = T3Path::path(T3_TEMPLATE_CORE) . DS . 'themes';
$_themes = @JFolder::folders($path);
if (is_array($_themes)) {
foreach ($_themes as $theme) {
$themes["core.{$theme}"] = T3Path::path(T3_TEMPLATE_CORE, false) . DS . 'themes' . DS . $theme;
}
}
$path = T3Path::path(T3_TEMPLATE_LOCAL) . DS . 'themes';
if (is_dir($path)) {
$_themes = @JFolder::folders($path);
if (is_array($_themes)) {
foreach ($_themes as $theme) {
$themes["local.{$theme}"] = T3Path::path(T3_TEMPLATE_LOCAL, false) . DS . 'themes' . DS . $theme;
}
}
}
return $themes;
}
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:22,代码来源:preload.php
示例6: loadBlock
/**
* Load block content
*
* @param $block string
* Block name - the real block is tpls/blocks/[blockname].php
*
* @return string Block content
*/
function loadBlock($block, $vars = array())
{
if (!$this->_block) {
$this->_block = $block;
}
$path = T3Path::getPath('tpls/system/' . $block . '.php');
if (!$path) {
$path = T3Path::getPath('tpls/blocks/' . $block . '.php');
}
ob_start();
if ($path) {
include $path;
} else {
echo "<div class=\"error\">Block [{$block}] not found!</div>";
}
$content = ob_get_contents();
ob_end_clean();
if (isset($vars['spl'])) {
$content = preg_replace('#(<[A-Za-z]+[^>^\\/]*)>#', '\\1 data-original="' . $block . '"' . (isset($vars['spl']) ? ' data-spotlight="' . $vars['name'] . '"' : '') . '>', $content, 1);
$this->_block = null;
}
echo isset($vars['spl']) ? $content : "<div class=\"t3-admin-layout-section\">" . $content . "</div>";
}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:31,代码来源:templatelayout.php
示例7: optimizecss
//.........这里部分代码省略.........
}
$stylesheets = array($url => $stylesheet); // empty - begin a new group
$selcounts = $selcount;
} else {
$stylesheets[$url] = $stylesheet;
$selcounts += $selcount;
}
} else {
// first get all the stylsheets up to this point, and get them into
// the items array
if(count($stylesheets)){
$cssgroup = array();
$groupname = array();
foreach ( $stylesheets as $gurl => $gsheet ) {
$cssgroup[$gurl] = $gsheet;
$groupname[] = $gurl;
}
$cssgroup['groupname'] = implode('', $groupname);
$cssgroups[] = $cssgroup;
}
//mark ignore current stylesheet
$cssgroup = array($url => $stylesheet, 'ignore' => true);
$cssgroups[] = $cssgroup;
$stylesheets = array(); // empty - begin a new group
}
}
if(count($stylesheets)){
$cssgroup = array();
$groupname = array();
foreach ( $stylesheets as $gurl => $gsheet ) {
$cssgroup[$gurl] = $gsheet;
$groupname[] = $gurl;
}
$cssgroup['groupname'] = implode('', $groupname);
$cssgroups[] = $cssgroup;
}
//======================= Group css ================= //
$output = array();
foreach ($cssgroups as $cssgroup) {
if(isset($cssgroup['ignore'])){
unset($cssgroup['ignore']);
foreach ($cssgroup as $furl => $fsheet) {
$output[$furl] = $fsheet;
}
} else {
$groupname = 'css-' . substr(md5($cssgroup['groupname']), 0, 5) . '.css';
$groupfile = $outputpath . '/' . $groupname;
$grouptime = JFile::exists($groupfile) ? @filemtime($groupfile) : -1;
$rebuild = $grouptime < 0; //filemtime == -1 => rebuild
unset($cssgroup['groupname']);
foreach ($cssgroup as $furl => $fsheet) {
if(!$rebuild && @filemtime($fsheet['path']) > $grouptime){
$rebuild = true;
}
}
if($rebuild){
$cssdata = array();
foreach ($cssgroup as $furl => $fsheet) {
$cssdata[] = "\n\n/*===============================";
$cssdata[] = $furl;
$cssdata[] = "================================================================================*/";
$cssmin = Minify_CSS_Compressor::process($fsheet['data']);
$cssmin = T3Path::updateUrl($cssmin, T3Path::relativePath($outputurl, dirname($furl)));
$cssdata[] = $cssmin;
}
$cssdata = implode("\n", $cssdata);
JFile::write($groupfile, $cssdata);
@chmod($groupfile, 0644);
}
$output[$outputurl . '/' . $groupname] = array(
'mime' => 'text/css',
'media' => null,
'attribs' => array()
);
}
}
//apply the change make change
$doc->_styleSheets = $output;
}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:101,代码来源:minify.php
示例8: defined
/**
* ------------------------------------------------------------------------
* JA T3v2 System Plugin for J3.x
* ------------------------------------------------------------------------
* Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
* @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
* Author: J.O.O.M Solutions Co., Ltd
* Websites: http://www.joomlart.com - http://www.joomlancers.com
* ------------------------------------------------------------------------
*/
// No direct access
defined('_JEXEC') or die;
$t3_based_path = JPATH_SITE . DS . 'templates' . DS . T3_ACTIVE_TEMPLATE . DS;
$layout = str_replace($t3_based_path, '', $t3_current_layout);
$layout_path = T3Path::getPath($layout);
if (!$layout_path) {
//Detect if it is module or component
$parts = explode(DS, $layout, 4);
$type = '';
if (isset($parts[1])) {
$type = $parts[1];
}
if ($type) {
if (preg_match('/^com_/', $type)) {
//component
$layout_path = JPATH_SITE . DS . 'components' . DS . $parts[1] . DS . 'views' . DS . $parts[2] . DS . 'tmpl' . DS . $parts[3];
} else {
if (preg_match('/^mod_/', $type)) {
//component
$layout_path = JPATH_SITE . DS . 'modules' . DS . $parts[1] . DS . 'tmpl' . DS . $parts[2];
开发者ID:ashanrupasinghe,项目名称:slbcv2,代码行数:30,代码来源:html.php
示例9: defined
* This file may not be redistributed in whole or significant part.
* ------------------------------------------------------------------------
*/
defined('_JEXEC') or die;
// parse jdoc after render
$params->set('parse-jdoc', 1);
// use with T3
$t3doc = T3::getApp();
$doc = JFactory::getDocument();
// get params
$tplparams = JFactory::getApplication()->getTemplate(true)->params;
$sitename = $tplparams->get('sitename');
$slogan = $tplparams->get('slogan', '');
$logotype = $tplparams->get('logotype', 'text');
$logoimage = $logotype == 'image' ? $tplparams->get('logoimage', T3Path::getUrl('images/logo.png', '', true)) : '';
$logoimgsm = $logotype == 'image' && $tplparams->get('enable_logoimage_sm', 0) ? $tplparams->get('logoimage_sm', T3Path::getUrl('images/logo-sm.png', '', true)) : false;
$logolink = $tplparams->get('logolink');
if (!$sitename) {
$sitename = JFactory::getConfig()->get('sitename');
}
$headright = $doc->countModules('head-search or languageswitcherload or right-menu') || $tplparams->get('addon_offcanvas_enable');
// get logo url
$logourl = JURI::base(true);
if ($logolink == 'page') {
$logopageid = $tplparams->get('logolink_id');
$_item = JFactory::getApplication()->getMenu()->getItem($logopageid);
if ($_item) {
$logourl = JRoute::_('index.php?Itemid=' . $logopageid);
}
}
// Header Params
开发者ID:jamielaff,项目名称:als_projects,代码行数:31,代码来源:style-4.php
示例10: replaceContent
/**
* Popup prepare content method
*
* @param string $bodyContent The body string content.
*
* @return string The replaced body string content
*/
function replaceContent($bodyContent)
{
// Build HTML params area
$xmlFile = T3Path::path(T3_CORE) . DS . 'params' . DS . "jatoolbar.xml";
if (!file_exists($xmlFile)) {
return $bodyContent;
}
$str = "";
$configform = JForm::getInstance('params', $xmlFile, array('control' => 'jform'));
$fieldSets = $configform->getFieldsets('params');
$html = '';
foreach ($fieldSets as $name => $fieldSet) {
$html .= '<div class="panel">
<h3 id="jatoolbar-page" class="jpane-toggler title">
<a href="#"><span>' . JText::_($fieldSet->label) . '</span></a>
</h3>';
$html .= '
<div class="jpane-slider content">
<fieldset class="panelform">';
if (isset($fieldSet->description) && trim($fieldSet->description)) {
$html .= '<div class="block-des">' . JText::_($fieldSet->description) . '</div>';
}
$html .= ' <ul class="adminformlist">';
foreach ($configform->getFieldset($name) as $field) {
$html .= '<li>';
$html .= $field->label;
$html .= $field->input;
$html .= '</li>';
}
$html .= '</ul>
</fieldset>
</div>
</div>';
}
preg_match_all("/<div class=\"panel\">([\\s\\S]*?)<\\/div>/i", $bodyContent, $arr);
$bodyContent = str_replace($arr[0][count($arr[0]) - 1] . '</div>', $arr[0][count($arr[0]) - 1] . '</div>' . $html, $bodyContent);
return $bodyContent;
}
开发者ID:ashanrupasinghe,项目名称:slbcv2,代码行数:45,代码来源:util.php
示例11: addStylesheet
public static function addStylesheet($lesspath)
{
// build less vars, once only
static $vars_built = false;
$t3less = T3Less::getInstance();
if (!$vars_built) {
self::buildVars();
$vars_built = true;
}
$app = JFactory::getApplication();
$tpl = $app->getTemplate(true);
$theme = $tpl->params->get('theme');
$doc = JFactory::getDocument();
if (defined('T3_THEMER')) {
// in Themer mode, using js to parse less for faster
$doc->addStylesheet(JURI::base(true) . '/' . T3Path::cleanPath($lesspath), 'text/less');
// Add lessjs to process lesscss
$doc->addScript(T3_URL . '/js/less-1.3.3.js');
} else {
// in development mode, using php to compile less for a better view of development
if (preg_match('#(template(-responsive)?.less)#', $lesspath)) {
// Development mode is on, try to include less file inside folder less/
// get the less content
$lessContent = JFile::read(JPATH_ROOT . '/' . $lesspath);
$path = dirname($lesspath);
// parse less content
if (preg_match_all('#^\\s*@import\\s+"([^"]*)"#im', $lessContent, $matches)) {
foreach ($matches[1] as $url) {
if ($url == 'vars.less') {
continue;
}
$url = $path . '/' . $url;
$cssurl = $t3less->buildCss(T3Path::cleanPath($url));
$doc->addStyleSheet($cssurl);
}
}
} else {
$cssurl = $t3less->buildCss(T3Path::cleanPath($lesspath));
$doc->addStyleSheet($cssurl);
}
// check and add theme less
if ($theme && !preg_match('#bootstrap#', $lesspath)) {
$themepath = str_replace('/less/', '/less/themes/' . $theme . '/', $lesspath);
if (is_file(JPATH_ROOT . '/' . $themepath)) {
$cssurl = $t3less->buildCss(T3Path::cleanPath($themepath));
$doc->addStyleSheet($cssurl);
}
}
}
}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:50,代码来源:less.php
示例12: updateUrl
public static function updateUrl($css, $src)
{
self::$srcurl = $src;
$css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/', array('T3Path', 'replaceurl'), $css);
$css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/', array('T3Path', 'replaceurl'), $css);
return $css;
}
开发者ID:Tommar,项目名称:vino2,代码行数:7,代码来源:path.php
示例13: findBlock
/**
* Find block path
*
* @param string $block Block name
*
* @return string Block layout path
*/
function findBlock($block)
{
$pathobj = T3Path::getInstance();
$file = 'blocks' . DS . $block . '.php';
return $pathobj->getPath($file);
}
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:13,代码来源:path.php
示例14:
?>
;
</script>
<jdoc:include type="head" />
<?php
if (T3Common::mobile_device_detect() == 'iphone') {
?>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=1;" />
<meta name="apple-touch-fullscreen" content="YES" />
<?php
}
?>
<?php
if (T3Common::mobile_device_detect()) {
?>
<meta name="HandheldFriendly" content="true" />
<?php
}
?>
<link href="<?php
echo T3Path::getUrl('images/favicon.ico');
?>
" rel="shortcut icon" type="image/x-icon" />
<?php
JHTML::stylesheet('templates/system/css/system.css');
JHTML::stylesheet('templates/system/css/general.css');
开发者ID:ashanrupasinghe,项目名称:slbcv2,代码行数:31,代码来源:head.php
示例15: purge
public static function purge()
{
// Initialize some variables
$input = JFactory::getApplication()->input;
$layout = $input->getCmd('layout');
$template = $input->getCmd('template');
if (!$layout) {
return self::error(JText::_('T3_LAYOUT_UNKNOW_ACTION'));
}
// delete custom layout
$layoutfile = T3Path::getLocalPath('tpls/' . $layout . '.php');
$initfile = T3Path::getLocalPath('etc/layout/' . $layout . '.ini');
// delete default layout
$defaultlayoutfile = T3_TEMPLATE_PATH . '/tpls/' . $layout . '.php';
$defaultinitfile = T3_TEMPLATE_PATH . '/etc/layout/' . $layout . '.ini';
if (!@JFile::delete($layoutfile) || !@JFile::delete($defaultlayoutfile) || !@JFile::delete($initfile) || !@JFile::delete($defaultinitfile)) {
return self::error(JText::_('T3_LAYOUT_DELETE_FAIL'));
} else {
return self::response(array('successful' => JText::_('T3_LAYOUT_DELETE_SUCCESSFULLY'), 'layout' => $layout, 'type' => 'delete'));
}
}
开发者ID:grlf,项目名称:eyedock,代码行数:21,代码来源:layout.php
示例16: _clean
/**
* Clean T3 cache
* If $t3assets > 0, deleted all cached content in defaultgroup
* If $t3assets > 1, deleted all cached content in assets group
* If $t3assets > 2, deleted all cached content in css/js optimize folder
*
* @param int $t3assets Level cache
*
* @return void
*/
private function _clean($t3assets = 0)
{
$cache = $this->cache;
// Clear cache in default group folder
if ($t3assets > 0) {
$cache->clean();
}
// Clear cache in assets folder
if ($t3assets > 1) {
$cache->clean(self::T3_CACHE_ASSETS);
}
if ($t3assets > 2) {
//clean t3-assets folder, the cache for js/css
$templates = T3Common::get_active_templates();
//T3Common::log(var_export($templates, true));
foreach ($templates as $template) {
$file = T3Path::path("templates/{$template}") . DS . 'params.ini';
if (is_file($file)) {
$content = file_get_contents($file);
$params = new JParameter($content);
$cache_path = $params->get('optimize_folder', 't3-assets');
$path = T3Path::path($cache_path);
//T3Common::log($path);
if (is_dir($path)) {
@JFolder::delete($path);
}
}
}
}
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:40,代码来源:cache.php
示例17: getListFooter
/**
* Return the pagination footer.
*
* @return string Pagination footer.
*
* @since 11.1
*/
public function getListFooter()
{
$app = JFactory::getApplication();
$list = array();
$list['prefix'] = $this->prefix;
$list['limit'] = $this->limit;
$list['limitstart'] = $this->limitstart;
$list['total'] = $this->total;
$list['limitfield'] = $this->getLimitBox();
$list['pagescounter'] = $this->getPagesCounter();
$list['pageslinks'] = $this->getPagesLinks();
// T3: detect if chrome pagination.php in template or in plugin
$chromePath = T3Path::getPath('html/pagination.php');
// $chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/pagination.php';
if (file_exists($chromePath)) {
include_once $chromePath;
if (function_exists('pagination_list_footer')) {
return pagination_list_footer($list);
}
}
return $this->_list_footer($list);
}
开发者ID:grlf,项目名称:eyedock,代码行数:29,代码来源:pagination.php
示例18: addExtraAssets
/**
* Add some other condition assets (css, javascript)
*/
function addExtraAssets()
{
$base = JURI::base(true);
$regurl = '#(http|https)://([a-zA-Z0-9.]|%[0-9A-Za-z]|/|:[0-9]?)*#iu';
foreach (array(T3_PATH, T3_TEMPLATE_PATH) as $bpath) {
//full path
$afile = $bpath . '/etc/assets.xml';
if (is_file($afile)) {
//load xml
$axml = JFactory::getXML($afile);
//parse stylesheets first if exist
if ($axml) {
foreach ($axml as $node => $nodevalue) {
//ignore others node
if ($node == 'stylesheets' || $node == 'scripts') {
foreach ($nodevalue->file as $file) {
$compatible = $file['compatible'];
if ($compatible) {
$parts = explode(' ', $compatible);
$operator = '=';
//exact equal to
$operand = $parts[1];
if (count($parts) == 2) {
$operator = $parts[0];
$operand = $parts[1];
}
//compare with Joomla version
if (!version_compare(JVERSION, $operand, $operator)) {
continue;
}
}
$url = (string) $file;
if (substr($url, 0, 2) == '//') {
//external link
} else {
if ($url[0] == '/') {
//absolute link from based folder
$url = is_file(JPATH_ROOT . $url) ? $base . $url : false;
} else {
if (!preg_match($regurl, $url)) {
//not match a full url -> sure internal link
$url = T3Path::getUrl($url);
// so get it
}
}
}
if ($url) {
if ($node == 'stylesheets') {
$this->addStylesheet($url);
} else {
$this->addScript($url);
}
}
}
}
}
}
}
}
}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:63,代码来源:template.php
示例19: getThemePath
/**
* Get theme path
*
* @param string $name Theme name
* @param bool $local Indicate theme is local or not
*
* @return string
*/
public static function getThemePath($name, $local = true)
{
$path = T3Path::path(T3_TEMPLATE);
// Check template use newest folder structure or not
// If themes is exists, considered as template use newest folder structure
if (@is_dir($path . DS . 'themes')) {
$path .= DS . 'themes' . DS . $name;
} else {
if ($local) {
$path .= DS . 'local' . DS . 'themes' . DS . $name;
} else {
$path .= DS . 'core' . DS . 'themes' . DS . $name;
}
}
return $path;
}
开发者ID:ashanrupasinghe,项目名称:slbcv2,代码行数:24,代码来源:common.php
示例20: addExtraAssets
/**
* Add some other condition assets (css, javascript). Use to parse /etc/assets.xml
*
* @return null
*/
function addExtraAssets()
{
$base = JURI::base(true);
$regurl = '#(http|https)://([a-zA-Z0-9.]|%[0-9A-Za-z]|/|:[0-9]?)*#iu';
$afiles = T3Path::getAllPath('etc/assets.xml');
foreach ($afiles as $afile) {
if (is_file($afile)) {
//load xml
$axml = JFactory::getXML($afile);
//process if exist
if ($axml) {
foreach ($axml as $node => $nodevalue) {
//ignore others node
if ($node == 'stylesheets' || $node == 'scripts') {
foreach ($nodevalue->file as $file) {
$compatible = (string) $file['compatible'];
if ($compatible) {
$parts = explode(' ', $compatible);
$operator = '=';
//exact equal to
$operand = $parts[0];
if (count($parts) == 2) {
$operator = $parts[0];
$operand = $parts[1];
}
//compare with Joomla version
if (!version_compare(JVERSION, $operand, $operator)) {
continue;
}
}
$url = (string) $file;
if (substr($url, 0, 2) == '//') {
//external link
} else {
if ($url[0] == '/') {
//absolute link from based folder
$url = is_file(JPATH_ROOT . $url) ? $base . $url : false;
} else {
if (!preg_match($regurl, $url)) {
//not match a full url -> sure internal link
$url = T3Path::getUrl($url);
// so get it
}
}
}
if ($url) {
if ($node == 'stylesheets') {
$type = $file['type'] ? (string) $file['type'] : 'text/css';
$media = $file['media'] ? (string) $file['media'] : null;
$this->addStylesheet($url, $type, $media);
} else {
$type = $file['type'] ? (string) $file['type'] : 'text/javascript';
$defer = $file['defer'] ? (bool) $file['defer'] : false;
$async = $file['async'] ? (bool) $file['async'] : false;
$this->addScript($url, $type, $defer, $async);
}
}
}
}
}
}
}
}
// template extended styles
$aparams = $this->_tpl->params->toArray();
$extras = array();
$itemid = JFactory::getApplication()->input->get('Itemid');
foreach ($aparams as $name => $value) {
if (preg_match('/^theme_extras_(.+)$/', $name, $m)) {
$extras[$m[1]] = $value;
}
}
if (count($extras)) {
foreach ($extras as $extra => $pages) {
if (!is_array($pages) || !count($pages) || in_array(0, $pages)) {
continue;
// disabled
}
if (in_array(-1, $pages) || in_array($itemid, $pages)) {
// load this style
$this->addCss('extras/' . $extra);
}
}
}
}
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:90,代码来源:template.php
注:本文中的T3Path类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论