本文整理汇总了PHP中AssetModel::JsPath方法的典型用法代码示例。如果您正苦于以下问题:PHP AssetModel::JsPath方法的具体用法?PHP AssetModel::JsPath怎么用?PHP AssetModel::JsPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetModel
的用法示例。
在下文中一共展示了AssetModel::JsPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderMaster
/**
*
*/
public function renderMaster()
{
// Build the master view if necessary
if (in_array($this->_DeliveryType, array(DELIVERY_TYPE_ALL))) {
$this->MasterView = $this->masterView();
// Only get css & ui components if this is NOT a syndication request
if ($this->SyndicationMethod == SYNDICATION_NONE && is_object($this->Head)) {
$CssAnchors = AssetModel::getAnchors();
$this->EventArguments['CssFiles'] =& $this->_CssFiles;
$this->fireEvent('BeforeAddCss');
$ETag = AssetModel::eTag();
$CombineAssets = c('Garden.CombineAssets');
$ThemeType = isMobile() ? 'mobile' : 'desktop';
// And now search for/add all css files.
foreach ($this->_CssFiles as $CssInfo) {
$CssFile = $CssInfo['FileName'];
if (!array_key_exists('Options', $CssInfo) || !is_array($CssInfo['Options'])) {
$CssInfo['Options'] = array();
}
$Options =& $CssInfo['Options'];
// style.css and admin.css deserve some custom processing.
if (in_array($CssFile, $CssAnchors)) {
if (!$CombineAssets) {
// Grab all of the css files from the asset model.
$AssetModel = new AssetModel();
$CssFiles = $AssetModel->getCssFiles($ThemeType, ucfirst(substr($CssFile, 0, -4)), $ETag);
foreach ($CssFiles as $Info) {
$this->Head->addCss($Info[1], 'all', true, $CssInfo);
}
} else {
$Basename = substr($CssFile, 0, -4);
$this->Head->addCss(url("/asset/css/{$ThemeType}/{$Basename}-{$ETag}.css", '//'), 'all', false, $CssInfo['Options']);
}
continue;
}
$AppFolder = $CssInfo['AppFolder'];
$LookupFolder = !empty($AppFolder) ? $AppFolder : $this->ApplicationFolder;
$Search = AssetModel::CssPath($CssFile, $LookupFolder, $ThemeType);
if (!$Search) {
continue;
}
list($Path, $UrlPath) = $Search;
if (isUrl($Path)) {
$this->Head->AddCss($Path, 'all', val('AddVersion', $Options, true), $Options);
continue;
} else {
// Check to see if there is a CSS cacher.
$CssCacher = Gdn::factory('CssCacher');
if (!is_null($CssCacher)) {
$Path = $CssCacher->get($Path, $AppFolder);
}
if ($Path !== false) {
$Path = substr($Path, strlen(PATH_ROOT));
$Path = str_replace(DS, '/', $Path);
$this->Head->addCss($Path, 'all', true, $Options);
}
}
}
// Add a custom js file.
if (arrayHasValue($this->_CssFiles, 'style.css')) {
$this->addJsFile('custom.js');
// only to non-admin pages.
}
$Cdns = array();
if (!c('Garden.Cdns.Disable', false)) {
$Cdns = array('jquery.js' => "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js");
}
// And now search for/add all JS files.
$this->EventArguments['Cdns'] =& $Cdns;
$this->fireEvent('AfterJsCdns');
$this->Head->addScript('', 'text/javascript', false, array('content' => $this->definitionList(false)));
foreach ($this->_JsFiles as $Index => $JsInfo) {
$JsFile = $JsInfo['FileName'];
if (!is_array($JsInfo['Options'])) {
$JsInfo['Options'] = array();
}
$Options =& $JsInfo['Options'];
if (isset($Cdns[$JsFile])) {
$JsFile = $Cdns[$JsFile];
}
$AppFolder = $JsInfo['AppFolder'];
$LookupFolder = !empty($AppFolder) ? $AppFolder : $this->ApplicationFolder;
$Search = AssetModel::JsPath($JsFile, $LookupFolder, $ThemeType);
if (!$Search) {
continue;
}
list($Path, $UrlPath) = $Search;
if ($Path !== false) {
$AddVersion = true;
if (!isUrl($Path)) {
$Path = substr($Path, strlen(PATH_ROOT));
$Path = str_replace(DS, '/', $Path);
$AddVersion = val('AddVersion', $Options, true);
}
$this->Head->addScript($Path, 'text/javascript', $AddVersion, $Options);
continue;
}
//.........这里部分代码省略.........