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


PHP T3Path类代码示例

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


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


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