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


PHP Asset::resolveAlias方法代码示例

本文整理汇总了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);
                 }
             }
         }
     }
 }
开发者ID:balitax,项目名称:plansys,代码行数:26,代码来源:Asset.php

示例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));
                 }
             }
         }
     }
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:36,代码来源:Asset.php

示例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;
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:61,代码来源:FormField.php

示例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;
 }
开发者ID:reggi49,项目名称:plansys,代码行数:11,代码来源:MenuTree.php


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