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


PHP AssetLoadManager::useMinified方法代码示例

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


在下文中一共展示了AssetLoadManager::useMinified方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLoadHTML

 /** 
  * Returns HTML to load registered libraries. Typically you'll output this HTML in the <head> of your page.
  * 
  * @param (RequestHTTP) $po_request - The current request
  * @param array $pa_options Options include:
  *		dontLoadAppAssets = don't load assets specified in the app asset.conf file [default is false]
  * @return string - HTML loading registered libraries
  */
 static function getLoadHTML($po_request, $pa_options = null)
 {
     global $g_asset_config, $g_asset_load_list, $g_asset_complementary;
     $vs_baseurlpath = $po_request->getBaseUrlPath();
     $vs_themeurlpath = $po_request->getThemeUrlPath();
     $vs_default_themeurlpath = $po_request->getDefaultThemeUrlPath();
     $vb_dont_load_app_assets = caGetOption('dontLoadAppAssets', $pa_options, false);
     $vs_themeDirectoryPath = $po_request->getThemeDirectoryPath();
     $vs_default_themeDirectoryPath = $po_request->getDefaultThemeDirectoryPath();
     if (!$g_asset_config) {
         AssetLoadManager::init();
     }
     $vs_buf = '';
     if (is_array($g_asset_load_list)) {
         ksort($g_asset_load_list);
         foreach ($g_asset_load_list as $vn_priority => $va_libs) {
             foreach ($va_libs as $vs_lib => $vs_type) {
                 if ($vb_dont_load_app_assets && $vs_type == 'APP') {
                     continue;
                 }
                 if (AssetLoadManager::useMinified()) {
                     $va_tmp = explode(".", $vs_lib);
                     array_splice($va_tmp, -1, 0, array('min'));
                     $vs_lib = join('.', $va_tmp);
                 }
                 if (preg_match('!(http[s]{0,1}://.*)!', $vs_lib, $va_matches)) {
                     $vs_url = $va_matches[1];
                 } else {
                     if ($vs_type == 'THEME') {
                         if (file_exists("{$vs_themeDirectoryPath}/assets/{$vs_lib}")) {
                             $vs_url = "{$vs_themeurlpath}/assets/{$vs_lib}";
                         } elseif (file_exists("{$vs_default_themeDirectoryPath}/assets/{$vs_lib}")) {
                             $vs_url = "{$vs_default_themeurlpath}/assets/{$vs_lib}";
                         } else {
                             continue;
                         }
                     } else {
                         $vs_url = "{$vs_baseurlpath}/assets/{$vs_lib}";
                     }
                 }
                 if (preg_match('!\\.css$!', $vs_lib)) {
                     $vs_buf .= "<link rel='stylesheet' href='{$vs_url}' type='text/css' media='all'/>\n";
                 } elseif (preg_match('!\\.properties$!', $vs_lib)) {
                     $vs_buf .= "<link rel='resource' href='{$vs_url}' type='application/l10n' />\n";
                 } else {
                     $vs_buf .= "<script src='{$vs_url}' type='text/javascript'></script>\n";
                 }
             }
         }
     }
     if (is_array($g_asset_complementary)) {
         foreach ($g_asset_complementary as $vs_code) {
             $vs_buf .= "<script type='text/javascript'>\n{$vs_code}</script>\n";
         }
     }
     return $vs_buf;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:65,代码来源:AssetLoadManager.php


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