本文整理汇总了PHP中Asset::resolveAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::resolveAlias方法的具体用法?PHP Asset::resolveAlias怎么用?PHP Asset::resolveAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset
的用法示例。
在下文中一共展示了Asset::resolveAlias方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerJS
public static function registerJS($includeJS)
{
if (is_string($includeJS)) {
$includeJS = [$includeJS];
}
if (!empty($includeJS)) {
foreach ($includeJS as $js) {
$jspath = realpath(Asset::resolveAlias($js));
if (is_dir($jspath)) {
$path = Asset::publish($jspath);
$files = glob($jspath . "/*");
foreach ($files as $p) {
if (pathinfo($p, PATHINFO_EXTENSION) != "js") {
continue;
}
$p = str_replace($jspath, '', realpath($p));
Yii::app()->clientScript->registerScriptFile($path . str_replace("\\", "/", $p), CClientScript::POS_END);
}
} else {
if (is_file($jspath)) {
Yii::app()->clientScript->registerScriptFile(Asset::publish($jspath), CClientScript::POS_END);
}
}
}
}
}
示例2: registerCSS
public static function registerCSS($includeCSS)
{
if (is_string($includeCSS)) {
$includeCSS = [$includeCSS];
}
if (!empty($includeCSS)) {
foreach ($includeCSS as $css) {
$path = Asset::resolveAlias($css);
if (is_file($path . ".css")) {
$file = $path . ".css";
if (strpos($file, Setting::getRootPath()) === 0) {
$file = substr($file, strlen(Setting::getRootPath()));
$file = Yii::app()->baseUrl . $file;
}
Yii::app()->clientScript->registerCssFile($file);
continue;
}
$csspath = realpath($path);
if (is_dir($csspath)) {
$path = Asset::publish($csspath);
$files = glob($csspath . "/*");
foreach ($files as $p) {
if (pathinfo($p, PATHINFO_EXTENSION) != "css") {
continue;
}
$p = str_replace($csspath, '', realpath($p));
Yii::app()->clientScript->registerCssFile($path . str_replace("\\", "/", $p));
}
} else {
if (is_file($csspath)) {
Yii::app()->clientScript->registerCssFile(Asset::publish($csspath));
}
}
}
}
}
示例3: renderEditorScript
public function renderEditorScript()
{
$html = [];
$includeJS = $this->includeEditorJS();
if (!empty($includeJS)) {
foreach ($includeJS as $js) {
$jspath = Asset::resolveAlias($js);
if (!$jspath) {
$class = get_class($this);
$jspath = realpath(Yii::getPathOfAlias("application.components.ui.FormFields.{$class}") . '/' . $js);
} else {
if (!is_dir($jspath)) {
$jspath = realpath($js);
}
}
if (is_dir($jspath)) {
$path = Asset::publish($jspath);
$files = glob($jspath . "/*");
foreach ($files as $p) {
if (pathinfo($p, PATHINFO_EXTENSION) != "js") {
continue;
}
$p = str_replace($jspath, '', realpath($p));
$html[] = $path . str_replace("\\", "/", $p);
}
} else {
if (is_file($jspath)) {
$html[] = Asset::publish($jspath);
}
}
}
}
$includeCSS = $this->includeEditorCSS();
if (!empty($includeCSS)) {
foreach ($includeCSS as $css) {
$csspath = Asset::resolveAlias($css);
if (!$csspath) {
$class = get_class($this);
$csspath = realpath(Yii::getPathOfAlias("application.components.ui.FormFields.{$class}") . '/' . $css);
} else {
$csspath = realpath($css);
}
if (is_dir($csspath)) {
$path = Asset::publish($csspath);
$files = glob($csspath . "/*");
foreach ($files as $p) {
if (pathinfo($p, PATHINFO_EXTENSION) != "css") {
continue;
}
$p = str_replace($csspath, '', realpath($p));
$html[] = $path . str_replace("\\", "/", $p);
}
} else {
if (is_file($csspath)) {
$html[] = Asset::publish($csspath);
}
}
}
}
return $html;
}
示例4: getOptions
public static function getOptions($alias)
{
$path = Asset::resolveAlias($alias . ".php");
ob_start();
include $path;
ob_get_clean();
if (!isset($options)) {
$options = ['mode' => 'normal'];
}
return $options;
}