本文整理汇总了PHP中JavascriptLoadManager::init方法的典型用法代码示例。如果您正苦于以下问题:PHP JavascriptLoadManager::init方法的具体用法?PHP JavascriptLoadManager::init怎么用?PHP JavascriptLoadManager::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JavascriptLoadManager
的用法示例。
在下文中一共展示了JavascriptLoadManager::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLoadHTML
/**
* Returns HTML to load registered libraries. Typically you'll output this HTML in the <head> of your page.
*
* @param $ps_baseurlpath (string) - URL path containing the application's "js" directory.
* @return string - HTML loading registered libraries
*/
static function getLoadHTML($ps_baseurlpath)
{
global $g_javascript_config, $g_javascript_load_list, $g_javascript_complementary;
if (!$g_javascript_config) {
JavascriptLoadManager::init();
}
$vs_buf = '';
if (is_array($g_javascript_load_list)) {
foreach ($g_javascript_load_list as $vs_lib => $vn_x) {
if (preg_match('!(http[s]{0,1}://.*)!', $vs_lib, $va_matches)) {
$vs_url = $va_matches[1];
} else {
$vs_url = "{$ps_baseurlpath}/js/{$vs_lib}";
}
if (preg_match('!\\.css$!', $vs_lib)) {
$vs_buf .= "<link rel='stylesheet' href='{$vs_url}' type='text/css' media='screen'/>\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_javascript_complementary)) {
foreach ($g_javascript_complementary as $vs_code) {
$vs_buf .= "<script type='text/javascript'>\n" . $vs_code . "</script>\n";
}
}
return $vs_buf;
}