本文整理汇总了PHP中JS::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP JS::getCode方法的具体用法?PHP JS::getCode怎么用?PHP JS::getCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JS
的用法示例。
在下文中一共展示了JS::getCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showLogin
/**
* Show the login mask.
*
* @access private
* @global array $_ARRAYLANG
* @global FWUser $objFWUser
*/
private function showLogin()
{
global $_CORELANG, $_ARRAYLANG;
$this->objTemplate->addBlockfile('CONTENT_FILE', 'CONTENT_BLOCK', '/core_modules/Login/View/Template/Backend/login.html');
$frontendLink = ASCMS_INSTANCE_OFFSET;
if (empty($frontendLink)) {
$frontendLink = '/';
}
$this->objTemplate->setVariable(array('TITLE' => $_ARRAYLANG['TXT_LOGIN_LOGIN'], 'TXT_LOGIN_LOGIN' => $_ARRAYLANG['TXT_LOGIN_LOGIN'], 'TXT_FRONTEND_LINK' => $_ARRAYLANG['TXT_FRONTEND_LINK'], 'TXT_LOGIN_ENTER_A_LOGIN' => $_ARRAYLANG['TXT_LOGIN_ENTER_A_LOGIN'], 'TXT_LOGIN_ENTER_A_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_ENTER_A_PASSWORD'], 'TXT_LOGIN_ENTER_CAPTCHA' => $_ARRAYLANG['TXT_LOGIN_ENTER_CAPTCHA'], 'TXT_LOGIN_USERNAME' => $_ARRAYLANG['TXT_LOGIN_USERNAME'], 'TXT_LOGIN_PASSWORD' => $_ARRAYLANG['TXT_LOGIN_PASSWORD'], 'TXT_LOGIN_PASSWORD_LOST' => $_ARRAYLANG['TXT_LOGIN_PASSWORD_LOST'], 'TXT_LOGIN_REMEMBER_ME' => $_CORELANG['TXT_CORE_REMEMBER_ME'], 'REDIRECT_URL' => !empty($_POST['redirect']) ? $_POST['redirect'] : ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . substr(getenv('REQUEST_URI'), strlen(\Env::get('cx')->getWebsiteBackendPath())), 'FRONTEND_LINK' => $frontendLink, 'JAVASCRIPT' => \JS::getCode()));
if (\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
$this->objTemplate->setVariable('LOGIN_ERROR_MESSAGE', \FWUser::getFWUserObject()->getErrorMsg());
$this->objTemplate->parse('error_message');
} else {
$this->objTemplate->hideBlock('error_message');
}
if (isset($_SESSION['auth']['loginLastAuthFailed'])) {
$this->objTemplate->setVariable(array('TXT_LOGIN_SECURITY_CODE' => $_ARRAYLANG['TXT_LOGIN_SECURITY_CODE'], 'CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode(3)));
$this->objTemplate->parse('captcha');
} else {
$this->objTemplate->hideBlock('captcha');
}
}
示例2: _setUploadForm
/**
* Shows the upload-form in the filebrowser
*/
function _setUploadForm()
{
global $_ARRAYLANG, $_CONFIG;
//data we want to remember for handling the uploaded files
$data = array();
if (array_key_exists($this->_mediaType, $this->mediaTypePaths)) {
$data['path'] = $this->mediaTypePaths[$this->_mediaType][0] . $this->_path;
$data['webPath'] = $this->mediaTypePaths[$this->_mediaType][1] . $this->_path;
} else {
$data['path'] = ASCMS_CONTENT_IMAGE_PATH . $this->_path;
$data['webPath'] = ASCMS_CONTENT_IMAGE_WEB_PATH . $this->_path;
}
$comboUp = \Cx\Core_Modules\Upload\Controller\UploadFactory::getInstance()->newUploader('exposedCombo');
$comboUp->setFinishedCallback(array(ASCMS_CORE_MODULE_PATH . '/FileBrowser/Controller/FileBrowser.class.php', '\\Cx\\Core_Modules\\FileBrowser\\Controller\\FileBrowser', 'uploadFinished'));
$comboUp->setData($data);
//set instance name to combo_uploader so we are able to catch the instance with js
$comboUp->setJsInstanceName('exposed_combo_uploader');
$this->_objTpl->setVariable(array('COMBO_UPLOADER_CODE' => $comboUp->getXHtml(true)));
//end of uploader button handling
//check if a finished upload caused reloading of the page.
//if yes, we know the added files and want to highlight them
if (!empty($_GET['highlightUploadId'])) {
$key = 'filebrowser_upload_files_' . intval($_GET['highlightUploadId']);
if (isset($_SESSION[$key])) {
$sessionHighlightCandidates = $_SESSION[$key];
//an array with the filenames, set in FileBrowser::uploadFinished
}
//clean up session; we do only highlight once
unset($_SESSION[$key]);
if (is_array($sessionHighlightCandidates)) {
//make sure we don't cause any unexpected behaviour if we lost the session data
$this->highlightedFiles = $sessionHighlightCandidates;
}
}
$objFWSystem = new \FWSystem();
// cannot upload or mkdir in webpages view
if ($this->_mediaType == "webpages") {
return;
}
$this->_objTpl->addBlockfile('FILEBROWSER_UPLOAD', 'fileBrowser_upload', 'module_fileBrowser_upload.html');
$this->_objTpl->setVariable(array('FILEBROWSER_UPLOAD_TYPE' => $this->_mediaType, 'FILEBROWSER_UPLOAD_PATH' => $this->_path, 'FILEBROWSER_MAX_FILE_SIZE' => $objFWSystem->getMaxUploadFileSize(), 'TXT_CREATE_DIRECTORY' => $_ARRAYLANG['TXT_FILEBROWSER_CREATE_DIRECTORY'], 'TXT_UPLOAD_FILE' => $_ARRAYLANG['TXT_FILEBROWSER_UPLOAD_FILE'], 'JAVASCRIPT' => \JS::getCode()));
$this->_objTpl->parse('fileBrowser_upload');
}
示例3: finalize
/**
* Parses the main template in order to finish request
* @todo Remove usage of globals
* @global type $themesPages
* @global null $moduleStyleFile
* @global array $_CONFIG
* @global type $subMenuTitle
* @global type $_CORELANG
* @global type $plainCmd
* @global type $cmd
*/
protected function finalize()
{
global $themesPages, $moduleStyleFile, $_CONFIG, $subMenuTitle, $_CORELANG, $plainCmd, $cmd;
if ($this->mode == self::MODE_FRONTEND) {
// parse system
$parsingTime = $this->stopTimer();
$this->template->setVariable('PARSING_TIME', $parsingTime);
$this->parseGlobalPlaceholders($themesPages['sidebar']);
$this->template->setVariable(array('SIDEBAR_FILE' => $themesPages['sidebar'], 'JAVASCRIPT_FILE' => $themesPages['javascript'], 'BUILDIN_STYLE_FILE' => $themesPages['buildin_style'], 'DATE_YEAR' => date('Y'), 'DATE_MONTH' => date('m'), 'DATE_DAY' => date('d'), 'DATE_TIME' => date('H:i'), 'BUILDIN_STYLE_FILE' => $themesPages['buildin_style'], 'JAVASCRIPT_LIGHTBOX' => '<script type="text/javascript" src="lib/lightbox/javascript/mootools.js"></script>
<script type="text/javascript" src="lib/lightbox/javascript/slimbox.js"></script>', 'JAVASCRIPT_MOBILE_DETECTOR' => '<script type="text/javascript" src="lib/mobiledetector.js"></script>'));
if (!empty($moduleStyleFile)) {
$this->template->setVariable('STYLE_FILE', "<link rel=\"stylesheet\" href=\"{$moduleStyleFile}\" type=\"text/css\" media=\"screen, projection\" />");
}
if (!$this->resolvedPage->getUseSkinForAllChannels() && isset($_GET['pdfview']) && intval($_GET['pdfview']) == 1) {
$pageTitle = $this->resolvedPage->getTitle();
$extenstion = empty($pageTitle) ? null : '.pdf';
$objPDF = new \Cx\Core_Modules\Pdf\Model\Entity\PdfDocument();
$objPDF->SetTitle($pageTitle . $extenstion);
$objPDF->setContent($this->template->get());
$objPDF->Create();
exit;
}
// fetch the parsed webpage
$this->template->setVariable('JAVASCRIPT', 'javascript_inserting_here');
$endcode = $this->template->get();
/**
* Get all javascripts in the code, replace them with nothing, and register the js file
* to the javascript lib. This is because we don't want something twice, and there could be
* a theme that requires a javascript, which then could be used by a module too and therefore would
* be loaded twice.
*/
/* Finds all uncommented script tags, strips them out of the HTML and
* stores them internally so we can put them in the placeholder later
* (see JS::getCode() below)
*/
\JS::findJavascripts($endcode);
/*
* Proposal: Use this
* $endcode = preg_replace_callback('/<script\s.*?src=(["\'])(.*?)(\1).*?\/?>(?:<\/script>)?/i', array('JS', 'registerFromRegex'), $endcode);
* and change JS::registerFromRegex to use index 2
*/
// i know this is ugly, but is there another way
$endcode = str_replace('javascript_inserting_here', \JS::getCode(), $endcode);
// do a final replacement of all those node-urls ({NODE_<ID>_<LANG>}- placeholders) that haven't been captured earlier
$endcode = preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $endcode);
\LinkGenerator::parseTemplate($endcode);
// remove the meta tag X-UA-Compatible if the user agent ist neighter internet explorer nor chromeframe
if (!preg_match('/(msie|chromeframe)/i', $_SERVER['HTTP_USER_AGENT'])) {
$endcode = preg_replace('/<meta.*?X-UA-Compatible.*?>/i', '', $endcode);
}
// replace links from before contrexx 3
$ls = new \LinkSanitizer($this, $this->getCodeBaseOffsetPath() . \Env::get('virtualLanguageDirectory') . '/', $endcode);
$this->endcode = $ls->replace();
} else {
// backend meta navigation
if ($this->template->blockExists('backend_metanavigation')) {
// parse language navigation
if ($this->template->blockExists('backend_language_navigation') && $this->template->blockExists('backend_language_navigation_item')) {
$backendLanguage = \FWLanguage::getActiveBackendLanguages();
if (count($backendLanguage) > 1) {
$this->template->setVariable('TXT_LANGUAGE', $_CORELANG['TXT_LANGUAGE']);
foreach ($backendLanguage as $language) {
$languageUrl = \Env::get('init')->getUriBy('setLang', $language['id']);
$this->template->setVariable(array('LANGUAGE_URL' => contrexx_raw2xhtml($languageUrl), 'LANGUAGE_NAME' => $language['name'], 'LANGUAGE_CSS' => \Env::get('init')->getBackendLangId() == $language['id'] ? 'active' : ''));
$this->template->parse('backend_language_navigation_item');
}
$this->template->parse('backend_language_navigation');
} else {
$this->template->hideBlock('backend_language_navigation');
}
}
$this->template->touchBlock('backend_metanavigation');
}
// page parsing
$parsingTime = $this->stopTimer();
// var_dump($parsingTime);
/*echo ($finishTime[0] - $startTime[0]) . '<br />';
if (!isset($_SESSION['asdf1']) || isset($_GET['reset'])) {
$_SESSION['asdf1'] = 0;
$_SESSION['asdf2'] = 0;
}
echo $_SESSION['asdf1'] . '<br />';
if ($_SESSION['asdf1'] > 0) {
echo $_SESSION['asdf2'] / $_SESSION['asdf1'];
}
$_SESSION['asdf1']++;
$_SESSION['asdf2'] += ($finishTime[0] - $startTime[0]);//*/
$objAdminNav = new \adminMenu($plainCmd);
$objAdminNav->getAdminNavbar();
//.........这里部分代码省略.........
示例4: getFrameXHtml
public function getFrameXHtml()
{
global $_CORELANG;
if (!empty($_SESSION['upload']['handlers'][$this->uploadId]['singleFileMode'])) {
\ContrexxJavascript::getInstance()->setVariable('restrictUpload2SingleFile', true, "upload/widget_{$this->uploadId}");
}
//JS / CSS dependencies
\JS::activate('cx');
\JS::registerCSS('core_modules/Upload/css/uploaders/form/formUploader.css');
\JS::registerJS('core_modules/Upload/js/uploaders/form/formUploader.js');
$uploadPath = $this->getUploadPath('form');
$redirectUrl = '';
if ($this->isBackendRequest) {
$redirectUrl = ASCMS_ADMIN_WEB_PATH . '/index.php?cmd=Upload&act=formUploaderFrameFinished&uploadId=' . $this->uploadId;
} else {
$url = clone \Env::get('cx')->getRequest()->getUrl();
$url->removeAllParams();
$url->setParams(array('section' => 'Upload', 'cmd' => 'formUploaderFrameFinished', 'uploadId' => $this->uploadId));
$redirectUrl = (string) $url;
}
$this->setRedirectUrl($redirectUrl);
$tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
$tpl->setErrorHandling(PEAR_ERROR_DIE);
$tpl->loadTemplateFile('formFrame.html');
$tpl->setVariable('UPLOAD_URL', $uploadPath);
$tpl->setVariable('INCLUDES', \JS::getCode());
$tpl->setVariable('CXJS_INIT_JS', \ContrexxJavascript::getInstance()->initJs());
$tpl->setVariable('UPLOAD_FORM_ADD', $_CORELANG['UPLOAD_FORM_ADD']);
$tpl->setVariable('UPLOAD', $_CORELANG['UPLOAD']);
$tpl->setVariable('UPLOAD_ID', $this->uploadId);
$tpl->setVariable('MAX_FILE_SIZE', \FWSystem::getMaxUploadFileSize() - 1000);
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$ls = new \LinkSanitizer($cx, $cx->getCodeBaseOffsetPath(), $tpl->get());
return $ls->replace();
}
示例5: dirname
require_once dirname(__FILE__) . '/lib/FRAMEWORK/FileSystem/File.class.php';
activateDebugging();
} catch (\Exception $e) {
// don't handle this exception here because we can't print a nice error message
}
require_once UPDATE_CORE . '/cache/cache.class.php';
global $objCache;
$objCache = new \Cx\Core_Modules\Cache\Controller\Cache();
// Start update
$objUpdate = new ContrexxUpdate();
// $_CORELANG has been initialized by the constructor of ContrexxUpdate()
// add language variables of core (will be used by FWUser)
$_CORELANG = array_merge($objInit->loadLanguageData('core'), $_CORELANG);
$output = $objUpdate->getPage();
JS::findJavascripts($output);
$output = str_replace('javascript_inserting_here', JS::getCode(), $output);
die($output);
function fixPaths(&$documentRoot, &$rootOffset)
{
// calculate correct offset path
// turning '/myoffset/somefile.php' into '/myoffset'
/*$rootOffset = '';
$scriptName = str_replace('\\', '/', $_SERVER['SCRIPT_NAME']);
$directories = explode('/', $scriptName);
for ($i = 0; $i < count($directories) - 2; $i++) {
if ($directories[$i] !== '') {
$rootOffset .= '/'.$directories[$i];
}
}*/
// fix wrong offset if another file than index.php was requested
// turning '/myoffset/core_module/somemodule' into '/myoffset'