本文整理汇总了PHP中AssetModel::CssPath方法的典型用法代码示例。如果您正苦于以下问题:PHP AssetModel::CssPath方法的具体用法?PHP AssetModel::CssPath怎么用?PHP AssetModel::CssPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetModel
的用法示例。
在下文中一共展示了AssetModel::CssPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
//.........这里部分代码省略.........
示例2: _AddCLEditor
private function _AddCLEditor($Sender, $Column = 'Body')
{
static $Added = FALSE;
if ($Added) {
return;
}
// Add the CLEditor to the form
$Options = array('ie' => 'gt IE 6', 'notie' => TRUE);
// Exclude IE6
//$Sender->RemoveJsFile('jquery.autosize.min.js');
$Sender->AddJsFile('jquery.cleditor' . (Debug() ? '' : '.min') . '.js', 'plugins/cleditor', $Options);
$CssInfo = AssetModel::CssPath(FALSE, 'cleditor.css', 'plugins/cleditor');
if ($CssInfo) {
$CssPath = Asset($CssInfo[1]);
}
$Sender->Head->AddString(<<<EOT
<style type="text/css">
a.PreviewButton {
\tdisplay: none !important;
}
</style>
<script type="text/javascript">
\tjQuery(document).ready(function(\$) {
\t\t// Make sure the removal of autogrow does not break anything
\t\t\$.fn.autogrow = function(o) { return; }
\t\t// Attach the editor to comment boxes.
\t\t\$("textarea.BodyBox").livequery(function() {
\t\t\tvar frm = \$(this).closest("form");
\t\t\ted = jQuery(this).cleditor({
width:"100%", height:"100%",
controls: "bold italic strikethrough | font size " +
"style | color highlight removeformat | bullets numbering | outdent indent | " +
"alignleft center alignright | undo redo | " +
"image link unlink | pastetext source",
docType: '<!DOCTYPE html>',
docCSSFile: "{$CssPath}"
})[0];
\t\t\tthis.editor = ed; // Support other plugins!
\t\t\tjQuery(frm).bind("clearCommentForm", {editor:ed}, function(e) {
\t\t\t\tfrm.find("textarea").hide();
\t\t\t\te.data.editor.clear();
\t\t\t});
\t\t});
\t});
</script>
EOT
);
$Added = TRUE;
}