本文整理汇总了PHP中Cx\Core\Core\Controller\Cx::instanciate方法的典型用法代码示例。如果您正苦于以下问题:PHP Cx::instanciate方法的具体用法?PHP Cx::instanciate怎么用?PHP Cx::instanciate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Core\Controller\Cx
的用法示例。
在下文中一共展示了Cx::instanciate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSubdirectoryCheck
/**
* Test the subdirectory check in the filesystem class
*/
public function testSubdirectoryCheck()
{
$cx = Cx::instanciate();
$this->assertTrue(MediaSourceManager::isSubdirectory($cx->getWebsitePath() . '/images', 'files/'));
$this->assertFalse(MediaSourceManager::isSubdirectory($cx->getWebsitePath() . '/media', 'files/'));
$this->assertFalse(MediaSourceManager::isSubdirectory($cx->getWebsitePath() . '/images', 'media5/'));
}
示例2: __construct
private function __construct()
{
global $objInit;
$backOrFrontend = $objInit->mode;
// TODO: Unused
// global $objFWUser;
// $langId;
if ($backOrFrontend == "frontend") {
$langId = $objInit->getFrontendLangId();
} else {
//backend
$langId = $objInit->getBackendLangId();
}
$langCode = FWLanguage::getLanguageCodeById($langId);
$this->setVariable(array('path' => ASCMS_PATH_OFFSET . '/' . $langCode . '/', 'basePath' => ASCMS_PATH_OFFSET . '/', 'cadminPath' => \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteBackendPath() . '/', 'mode' => $objInit->mode, 'language' => $langCode, 'csrf' => \Cx\Core\Csrf\Controller\Csrf::code()), 'contrexx');
//let i18n set it's variables
$i18n = new ContrexxJavascriptI18n($langCode);
$i18n->variablesTo($this);
//determine the correct jquery ui css' path.
//the user might have overridden the default css in the theme, so look out for this too.
$jQUiCssPath = 'themes/' . $objInit->getCurrentThemesPath() . '/jquery-ui.css';
//customized css would be here
if ($objInit->mode != 'frontend' || !file_exists(ASCMS_DOCUMENT_ROOT . '/' . $jQUiCssPath)) {
//use standard css
$jQUiCssPath = 'lib/javascript/jquery/ui/css/jquery-ui.css';
}
$this->setVariable(array('jQueryUiCss' => $jQUiCssPath), 'contrexx-ui');
}
示例3: initDefaultCategoryImage
protected function initDefaultCategoryImage()
{
$this->defaultCategoryImage['src'] = \Cx\Core\Core\Controller\Cx::instanciate()->getClassLoader()->getWebFilePath(\Cx\Core\Core\Controller\Cx::instanciate()->getModuleFolderName() . '/Downloads/View/Media/no_picture.gif');
$imageSize = getimagesize(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBasePath() . $this->defaultCategoryImage['src']);
$this->defaultCategoryImage['width'] = $imageSize[0];
$this->defaultCategoryImage['height'] = $imageSize[1];
}
示例4: getPage
/**
* Get the requested Page.
*
* @access public
*/
public function getPage()
{
$_GET['act'] = empty($_GET['act']) ? '' : $_GET['act'];
switch ($_GET['act']) {
case 'lostpw':
$this->showPasswordLost();
break;
case 'resetpw':
$this->showPasswordReset();
break;
case 'verify':
$this->verifyUserAccount();
break;
case 'captcha':
$this->getCaptcha();
break;
default:
$this->showLogin();
break;
}
$this->objTemplate->setVariable('CONTREXX_CHARSET', CONTREXX_CHARSET);
$endcode = $this->objTemplate->get();
// replace links from before contrexx 3
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$ls = new \LinkSanitizer($cx, $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . '/', $endcode);
$endcode = $ls->replace();
echo $endcode;
exit;
}
示例5: preResolve
/**
* Do something before resolving is done
*
* @param \Cx\Core\Routing\Url $request The URL object for this request
*/
public function preResolve(\Cx\Core\Routing\Url $request)
{
if (\Cx\Core\Core\Controller\Cx::instanciate()->getMode() == \Cx\Core\Core\Controller\Cx::MODE_BACKEND) {
$sessionObj = $this->getSession();
$sessionObj->cmsSessionStatusUpdate('backend');
}
}
示例6: __construct
/**
* Constructor
*/
function __construct($name)
{
$this->imagePath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesMediaDirPath() . '/';
$this->imageWebPath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesMediaDirWebPath() . '/';
parent::__construct('.', $name);
parent::getFrontendLanguages();
parent::getSettings();
}
示例7: __construct
function __construct($path)
{
$this->cx = \Cx\Core\Core\Controller\Cx::instanciate();
if (!$path) {
throw new \InvalidArgumentException("Path shouldn't be empty: Given: " . $path);
}
$this->rootPath = rtrim($path, '/');
}
示例8: renderElement
protected function renderElement($title, $level, $hasChilds, $lang, $path, $current, $page)
{
$width = $level * 25;
$spacer = "<img src='" . ASCMS_CORE_MODULE_FOLDER . "/Sitemap/View/Media/spacer.gif' width='{$width}' height='12' alt='' />";
$linkTarget = $page->getLinkTarget();
$this->template->setVariable(array('STYLE' => self::cssPrefix . '_' . $level, 'SPACER' => $spacer, 'NAME' => $title, 'TARGET' => empty($linkTarget) ? '_self' : $linkTarget, 'URL' => \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . $this->virtualLanguageDirectory . $path));
$this->template->parse('sitemap');
}
示例9: __construct
/**
* Constructor
*/
function __construct($name)
{
global $_ARRAYLANG, $_CORELANG, $objTemplate, $_CONFIG;
$this->act = !empty($_GET['act']) ? $_GET['act'] : '';
$this->limit = $_CONFIG['corePagingLimit'];
$this->offset = !empty($_GET['pos']) ? $_GET['pos'] : 0;
parent::__construct(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/MediaDir/View/Template/Backend', $name);
parent::getFrontendLanguages();
}
示例10: preResolve
/**
* Do something before resolving is done
*
* @param \Cx\Core\Routing\Url $request The URL object for this request
*/
public function preResolve(\Cx\Core\Routing\Url $request)
{
global $sessionObj;
if (\Cx\Core\Core\Controller\Cx::instanciate()->getMode() == \Cx\Core\Core\Controller\Cx::MODE_BACKEND) {
if (empty($sessionObj)) {
$sessionObj = \cmsSession::getInstance();
}
$_SESSION->cmsSessionStatusUpdate('backend');
}
}
示例11: __construct
/**
* PHP5 constructor
*
* @global array
* @global array
* @global HTML_Teplate_Sigma
*/
function __construct()
{
global $_ARRAYLANG, $_CORELANG, $objTemplate;
$this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . '/Market/View/Template/Backend');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
$this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$this->mediaPath = $cx->getWebsiteMediaMarketPath() . '/';
$this->mediaWebPath = $cx->getWebsiteMediaMarketWebPath() . '/';
$this->settings = $this->getSettings();
}
示例12: initDefaultCategoryImage
protected function initDefaultCategoryImage()
{
$this->defaultCategoryImage['src'] = ASCMS_DOWNLOADS_IMAGES_WEB_PATH . '/no_picture.gif';
if (file_exists(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteDocumentRootPath() . $this->defaultCategoryImage['src'])) {
$imageSize = getimagesize(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteDocumentRootPath() . $this->defaultCategoryImage['src']);
} else {
$imageSize = getimagesize(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseDocumentRootPath() . $this->defaultCategoryImage['src']);
}
$this->defaultCategoryImage['width'] = $imageSize[0];
$this->defaultCategoryImage['height'] = $imageSize[1];
}
示例13: getPath
/**
* Returns the created path by the given array.
*
* @param array $matches
* @return string created path
*/
private function getPath($matches)
{
// The Shop JS Cart escapes pathes because he loads it via JavaScript.
// For this reason, we replace escaped slashes by slashes.
$matches[\LinkSanitizer::FILE_PATH] = str_replace('\\/', '/', $matches[\LinkSanitizer::FILE_PATH]);
$testPath = explode('?', $matches[\LinkSanitizer::FILE_PATH], 2);
if ($testPath[0] == 'index.php' || $testPath[0] == '' || $testPath[0] == './') {
$ret = ASCMS_INSTANCE_OFFSET;
if (\Env::get('cx')->getMode() == \Cx\Core\Core\Controller\Cx::MODE_BACKEND) {
$ret .= \Cx\Core\Core\Controller\Cx::instanciate()->getBackendFolderName();
}
$ret .= '/';
if (isset($testPath[1])) {
$args = preg_split('/&(amp;)?/', $testPath[1]);
$params = array();
foreach ($args as $arg) {
$split = explode('=', $arg, 2);
$params[$split[0]] = $split[1];
}
// frontend case
if (isset($params['section'])) {
$cmd = '';
if (isset($params['cmd'])) {
$cmd = $params['cmd'];
unset($params['cmd']);
}
$ret = \Cx\Core\Routing\Url::fromModuleAndCmd($params['section'], $cmd);
unset($params['section']);
// backend case
} else {
if (isset($params['cmd'])) {
$ret .= $params['cmd'];
unset($params['cmd']);
if (isset($params['act'])) {
$ret .= '/' . $params['act'];
unset($params['act']);
}
}
}
if (count($params)) {
$ret .= '?' . http_build_query($params);
}
}
return $matches[\LinkSanitizer::ATTRIBUTE_AND_OPEN_QUOTE] . $ret . $matches[\LinkSanitizer::CLOSE_QUOTE];
} else {
if ($this->fileExists(ASCMS_DOCUMENT_ROOT . '/' . $matches[\LinkSanitizer::FILE_PATH])) {
// this is an existing file, do not add virtual language dir
return $matches[\LinkSanitizer::ATTRIBUTE_AND_OPEN_QUOTE] . ASCMS_INSTANCE_OFFSET . '/' . $matches[\LinkSanitizer::FILE_PATH] . $matches[\LinkSanitizer::CLOSE_QUOTE];
} else {
// this is a link to a page, add virtual language dir
return $matches[\LinkSanitizer::ATTRIBUTE_AND_OPEN_QUOTE] . $this->offset . $matches[\LinkSanitizer::FILE_PATH] . $matches[\LinkSanitizer::CLOSE_QUOTE];
}
}
}
示例14: __construct
/**
* Constructor
*/
public function __construct()
{
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$folderPath = $cx->getWebsiteTempPath() . '/Update';
if (!file_exists($folderPath)) {
\Cx\Lib\FileSystem\FileSystem::make_folder($folderPath);
}
if (!file_exists($folderPath . '/' . self::PENDING_DB_UPDATES_YML)) {
\Cx\Lib\FileSystem\FileSystem::copy_file($cx->getCodeBaseCoreModulePath() . '/Update/Data/' . self::PENDING_DB_UPDATES_YML, $folderPath . '/' . self::PENDING_DB_UPDATES_YML);
}
parent::__construct($folderPath . '/' . self::PENDING_DB_UPDATES_YML);
}
示例15: __construct
/**
* Resolves cmd. If it's a node placeholder, search is limited to the node's
* branch
* @param \Cx\Core\ContentManager\Model\Entity\Page $page Current page
*/
public function __construct($page = null)
{
if (!$page) {
$page = \Cx\Core\Core\Controller\Cx::instanciate()->getPage();
}
if (!empty($page->getCmd())) {
// Try to resolve node placeholder
try {
$nodePlaceholder = \Cx\Core\Routing\NodePlaceholder::fromPlaceholder($page->getCmd());
$this->rootPage = $nodePlaceholder->getPage();
} catch (\Cx\Core\Routing\NodePlaceholderException $e) {
}
}
}