本文整理汇总了PHP中JS::error方法的典型用法代码示例。如果您正苦于以下问题:PHP JS::error方法的具体用法?PHP JS::error怎么用?PHP JS::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JS
的用法示例。
在下文中一共展示了JS::error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCode
/**
* Return the code for the placeholder
* @access public
* @static
* @return string
*/
public static function getCode()
{
$cssfiles = array();
// TODO: Unused
// $jsfiles = array();
// $specialcode = array();
$lazyLoadingFiles = array();
$retstring = '';
$jsScripts = array();
if (count(self::$active) > 0) {
// check for lazy dependencies, if there are lazy dependencies, activate cx
// cx provides the lazy loading mechanism
// this should be here because the cx variable have to be set before cx is initialized
foreach (self::$active as $name) {
$data = self::$available[$name];
if (!empty($data['lazyDependencies'])) {
foreach ($data['lazyDependencies'] as $dependency) {
if (!in_array($dependency, self::$active)) {
// if the lazy dependency is not activated so far
$lazyLoadingFiles = array_merge($lazyLoadingFiles, self::$available[$dependency]['jsfiles']);
}
if (!empty(self::$available[$dependency]['cssfiles'])) {
$cssfiles = array_merge($cssfiles, self::$available[$dependency]['cssfiles']);
}
}
}
}
if (!empty($lazyLoadingFiles)) {
JS::activate('cx');
}
// set cx.variables with lazy loading file paths
ContrexxJavascript::getInstance()->setVariable('lazyLoadingFiles', $lazyLoadingFiles, 'contrexx');
// Note the "reverse" here. Dependencies are at the end of the
// array, and must be loaded first!
foreach (array_reverse(self::$active) as $name) {
$data = self::$available[$name];
if (!isset($data['jsfiles']) && !isset($data['versions'])) {
self::$error = "A JS entry should at least contain one js file...";
return false;
}
// get js files which are specified or the js files from first version
if (!isset($data['jsfiles'])) {
// get data from default version and load the files from there
$versionData = end($data['versions']);
$data = array_merge($data, $versionData);
}
$jsScripts[] = self::makeJSFiles($data['jsfiles']);
if (!empty($data['cssfiles'])) {
$cssfiles = array_merge($cssfiles, $data['cssfiles']);
}
if (isset($data['specialcode']) && strlen($data['specialcode']) > 0) {
$jsScripts[] = self::makeSpecialCode(array($data['specialcode']));
}
if (isset($data['makecallback'])) {
self::$data['makecallback']();
}
// Special case cloudrexx-API: fetch specialcode if activated
if ($name == 'cx') {
$jsScripts[] = self::makeSpecialCode(array(ContrexxJavascript::getInstance()->initJs()));
}
}
}
$jsScripts[] = self::makeJSFiles(self::$customJS);
// if jquery is activated, do a noConflict
if (array_search('jquery', self::$active) !== false) {
$jsScripts[] = self::makeSpecialCode('if (typeof jQuery != "undefined") { jQuery.noConflict(); }');
}
$jsScripts[] = self::makeJSFiles(self::$templateJS);
// no conflict for normal jquery version which has been included in template or by theme dependency
$jsScripts[] = self::makeSpecialCode('if (typeof jQuery != "undefined") { jQuery.noConflict(); }');
$retstring .= self::makeCSSFiles($cssfiles);
$retstring .= self::makeCSSFiles(self::$customCSS);
// Add javscript files
$retstring .= implode(' ', $jsScripts);
$retstring .= self::makeJSFiles(self::$customJS);
$retstring .= self::makeSpecialCode(self::$customCode);
return $retstring;
}
示例2: getCode
/**
* Return the code for the placeholder
* @access public
* @static
* @return string
*/
public static function getCode()
{
$cssfiles = array();
// TODO: Unused
// $jsfiles = array();
// $specialcode = array();
$retstring = '';
if (count(self::$active) > 0) {
foreach (self::$active as $name) {
$data = self::$available[$name];
if (!isset($data['jsfiles'])) {
self::$error = "A JS entry should at least contain one js file...";
return false;
}
$retstring .= self::makeJSFiles($data['jsfiles']);
if (!empty($data['cssfiles'])) {
$cssfiles = array_merge($cssfiles, $data['cssfiles']);
}
if (isset($data['specialcode']) && strlen($data['specialcode']) > 0) {
$retstring .= self::makeSpecialCode(array($data['specialcode']));
}
if (isset($data['makecallback'])) {
self::$data['makecallback']();
}
// Special case cloudrexx-API: fetch specialcode if activated
if ($name == 'cx') {
$retstring .= self::makeSpecialCode(array(ContrexxJavascript::getInstance()->initJs()));
}
}
}
$retstring .= self::makeJSFiles(self::$customJS);
$retstring .= self::makeCSSFiles($cssfiles);
$retstring .= self::makeCSSFiles(self::$customCSS);
$retstring .= self::makeSpecialCode(self::$customCode);
return $retstring;
}