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