本文整理汇总了PHP中Env::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::get方法的具体用法?PHP Env::get怎么用?PHP Env::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preContentLoad
public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $_CONFIG, $objNewsML, $arrMatches, $page_template, $themesPages, $cl;
// Set NewsML messages
if ($_CONFIG['feedNewsMLStatus'] == '1') {
if (preg_match_all('/{NEWSML_([0-9A-Z_-]+)}/', \Env::get('cx')->getPage()->getContent(), $arrMatches)) {
/** @ignore */
if ($cl->loadFile(\Env::get('cx')->getCodeBaseModulePath() . '/Feed/Controller/NewsML.class.php')) {
$objNewsML = new NewsML();
$objNewsML->setNews($arrMatches[1], \Env::get('cx')->getPage()->getContent());
}
}
if (preg_match_all('/{NEWSML_([0-9A-Z_-]+)}/', $page_template, $arrMatches)) {
/** @ignore */
if ($cl->loadFile(\Env::get('cx')->getCodeBaseModulePath() . '/Feed/Controller/NewsML.class.php')) {
$objNewsML = new NewsML();
$objNewsML->setNews($arrMatches[1], $page_template);
}
}
if (preg_match_all('/{NEWSML_([0-9A-Z_-]+)}/', $themesPages['index'], $arrMatches)) {
/** @ignore */
if ($cl->loadFile(\Env::get('cx')->getCodeBaseModulePath() . '/Feed/Controller/NewsML.class.php')) {
$objNewsML = new NewsML();
$objNewsML->setNews($arrMatches[1], $themesPages['index']);
}
}
}
}
示例2: testGetAfterSet
function testGetAfterSet()
{
Env::set(Env::PROD);
$this->assertEquals(Env::get(), Env::PROD);
$this->assertTrue(Env::isProd());
$this->assertFalse(Env::isTest());
}
示例3: __construct
/**
* Constructor
* the class JsonLink handles, the link status whether the link is resolved or not.
*/
public function __construct()
{
$this->em = \Env::get('em');
if ($this->em) {
$this->linkRepo = $this->em->getRepository('\\Cx\\Core_Modules\\LinkManager\\Model\\Entity\\Link');
}
}
示例4: preRender
protected function preRender($lang)
{
if ($this->template->placeholderExists('LEVELS_FULL') || $this->template->placeholderExists('levels_full')) {
$this->rootNode = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node')->getRoot();
}
$this->realPreRender($lang);
}
示例5: mediasourceLoad
/**
* @param MediaSourceManager $mediaBrowserConfiguration
*/
public function mediasourceLoad(MediaSourceManager $mediaBrowserConfiguration)
{
global $_ARRAYLANG;
\Env::get('init')->loadLanguageData('Contact');
$mediaType = new MediaSource('attach', $_ARRAYLANG['TXT_CONTACT_UPLOADS'], array($this->cx->getWebsiteImagesAttachPath(), $this->cx->getWebsiteImagesAttachWebPath()));
$mediaBrowserConfiguration->addMediaType($mediaType);
}
示例6: __construct
/**
* Constructor
*
* @param ADONewConnection
* @param \Cx\Core\Html\Sigma
* @param string $act
* @param object $init
* @global array Configuration
*/
function __construct($act, $template, $db, $init)
{
parent::__construct($act, $template);
$this->pageId = isset($_GET['id']) ? intval($_GET['id']) : 0;
$this->cmd = $act;
$this->defaultAct = 'showHistory';
switch ($this->act) {
case 'new':
case 'updated':
case 'unvalidated':
$this->act = 'showHistory';
break;
case 'deleted':
$this->act = 'showHistoryDeleted';
break;
}
$this->em = \Env::get('em');
$this->tpl = $template;
$this->db = $db;
$this->nodeRepo = $this->em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node');
$this->pageRepo = $this->em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
$this->logRepo = $this->em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\LogEntry');
if (isset($_GET['pos'])) {
$this->intPos = intval($_GET['pos']);
}
$this->tpl->setVariable(array('CONTENT_TITLE' => $this->strPageTitle, 'CONTENT_OK_MESSAGE' => $this->strOkMessage, 'CONTENT_STATUS_MESSAGE' => implode("<br />\n", $this->strErrMessage)));
$this->setNavigation();
}
示例7: preFinalize
/**
* @param Sigma $template
*/
public function preFinalize(Sigma $template)
{
if (count($this->mediaBrowserInstances) == 0) {
return;
} else {
global $_ARRAYLANG;
/**
* @var $init \InitCMS
*/
$init = \Env::get('init');
$init->loadLanguageData('MediaBrowser');
foreach ($_ARRAYLANG as $key => $value) {
if (preg_match("/TXT_FILEBROWSER_[A-Za-z0-9]+/", $key)) {
\ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser');
}
}
$thumbnailsTemplate = new Sigma();
$thumbnailsTemplate->loadTemplateFile($this->cx->getCoreModuleFolderName() . '/MediaBrowser/View/Template/Thumbnails.html');
$thumbnailsTemplate->setVariable('TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE', sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE']));
foreach (UploaderConfiguration::getInstance()->getThumbnails() as $thumbnail) {
$thumbnailsTemplate->setVariable(array('THUMBNAIL_NAME' => sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_' . strtoupper($thumbnail['name']) . '_SIZE'], $thumbnail['size']), 'THUMBNAIL_ID' => $thumbnail['id'], 'THUMBNAIL_SIZE' => $thumbnail['size']));
$thumbnailsTemplate->parse('thumbnails');
}
\ContrexxJavascript::getInstance()->setVariable('thumbnails_template', $thumbnailsTemplate->get(), 'mediabrowser');
\JS::activate('mediabrowser');
\JS::registerJS('core_modules/MediaBrowser/View/Script/mediabrowser.js');
}
}
示例8: __construct
/**
* Initialize this interface
*
* Loads all commands
* @param \Cx\Core\Core\Controller\Cx $cx Cloudrexx main class
*/
public function __construct($cx)
{
$this->cx = $cx;
\Env::get('ClassLoader')->loadFile(ASCMS_CORE_PATH . '/Typing/Model/Entity/AutoBoxedObject.class.php');
\Env::get('ClassLoader')->loadFile(ASCMS_CORE_PATH . '/Typing/Model/Entity/Primitives.class.php');
$this->commands = array('db' => new DbCommand($this), 'import' => new ImportCommand($this), 'create' => new CreateCommand($this), 'uninstall' => new UninstallCommand($this), 'activate' => new ActivateCommand($this), 'deactivate' => new DeactivateCommand($this), 'move' => new MoveCommand($this), 'copy' => new CopyCommand($this), 'remove' => new RemoveCommand($this), 'test' => new TestCommand($this), 'export' => new ExportCommand($this));
}
示例9: showPrices
public function showPrices()
{
global $_ARRAYLANG;
$prices = $this->priceRepository->findAll();
if (empty($prices)) {
$prices = new \Cx\Modules\Pim\Model\Entity\Price();
}
$view = new \Cx\Core\Html\Controller\ViewGenerator($prices, array('header' => $_ARRAYLANG['TXT_MODULE_PIM_ACT_PRICE'], 'validate' => function ($formGenerator) {
// this validation checks whether already a price for the currency and product exists
$data = $formGenerator->getData()->toArray();
$currency = $data['currency'];
$product = $data['product'];
$priceRepository = \Env::get('cx')->getDb()->getEntityManager()->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Price');
$prices = $priceRepository->createQueryBuilder('p')->where('p.currency = ?1')->setParameter(1, $currency)->andWhere('p.product = ?2')->setParameter(2, $product);
$prices = $prices->getQuery()->getResult();
if (!empty($data['editid']) && count($prices) > 1) {
return false;
}
if (empty($data['editid']) && count($prices) > 0) {
return false;
}
return true;
}, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)));
$this->template->setVariable('PRICES_CONTENT', $view->render());
}
示例10: load
/**
* Load your component.
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $_CORELANG, $subMenuTitle, $objTemplate;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
$objJobs = new Jobs(\Env::get('cx')->getPage()->getContent());
\Env::get('cx')->getPage()->setContent($objJobs->getJobsPage());
if ($page->getCmd() === 'details') {
$objJobs->getPageTitle(\Env::get('cx')->getPage()->getTitle());
\Env::get('cx')->getPage()->setTitle($objJobs->jobsTitle);
\Env::get('cx')->getPage()->setContentTitle($objJobs->jobsTitle);
\Env::get('cx')->getPage()->setMetaTitle($objJobs->jobsTitle);
}
break;
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
$objTemplate = $this->cx->getTemplate();
\Permission::checkAccess(148, 'static');
$subMenuTitle = $_CORELANG['TXT_JOBS_MANAGER'];
$objJobsManager = new JobsManager();
$objJobsManager->getJobsPage();
break;
default:
break;
}
}
示例11: load
/**
* Load your component.
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $objTemplate, $sessionObj;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
if (!isset($sessionObj) || !is_object($sessionObj)) {
$sessionObj = \cmsSession::getInstance();
}
$objLogin = new \Cx\Core_Modules\Login\Controller\Login(\Env::get('cx')->getPage()->getContent());
$pageTitle = \Env::get('cx')->getPage()->getTitle();
$pageMetaTitle = \Env::get('cx')->getPage()->getMetatitle();
\Env::get('cx')->getPage()->setContent($objLogin->getContent($pageMetaTitle, $pageTitle));
break;
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
if (\FWUser::getFWUserObject()->objUser->login(true)) {
\Cx\Core\Csrf\Controller\Csrf::header('location: index.php');
}
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
$objTemplate = $this->cx->getTemplate();
$objLoginManager = new \Cx\Core_Modules\Login\Controller\LoginManager();
$objLoginManager->getPage();
break;
default:
break;
}
}
示例12: getClient
private static function getClient()
{
if (!self::$_client) {
self::$_client = new GuzzleHttp\Client(array('base_uri' => Env::get('github_api_url', 'https://api.github.com')));
}
return self::$_client;
}
示例13: postResolve
/**
* Do something after resolving is done
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function postResolve(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $plainCmd, $cmd, $_CORELANG;
// CSRF code needs to be even in the login form. otherwise, we
// could not do a super-generic check later.. NOTE: do NOT move
// this above the "new cmsSession" line!
Csrf::add_code();
// CSRF protection.
// Note that we only do the check as long as there's no
// cmd given; this is so we can reload the main screen if
// the check has failed somehow.
// fileBrowser is an exception, as it eats CSRF codes like
// candy. We're doing \Cx\Core\Csrf\Controller\Csrf::check_code() in the relevant
// parts in the module instead.
// The CSRF code needn't to be checked in the login module
// because the user isn't logged in at this point.
// TODO: Why is upload excluded? The CSRF check doesn't take place in the upload module!
if (!empty($plainCmd) && !empty($cmd) and !in_array($plainCmd, array('FileBrowser', 'Upload', 'Login', 'Home'))) {
// Since language initialization in in the same hook as this
// and we cannot define the order of module-processing,
// we need to check if language is already initialized:
if (!is_array($_CORELANG) || !count($_CORELANG)) {
$objInit = \Env::get('init');
$objInit->_initBackendLanguage();
$_CORELANG = $objInit->loadLanguageData('core');
}
Csrf::check_code();
}
}
示例14: mediasourceLoad
/**
* @param MediaSourceManager $mediaBrowserConfiguration
*/
public function mediasourceLoad(MediaSourceManager $mediaBrowserConfiguration)
{
global $_ARRAYLANG;
\Env::get('init')->loadLanguageData('MediaBrowser');
$mediaType = new MediaSource('files', $_ARRAYLANG['TXT_FILEBROWSER_FILES'], array($this->cx->getWebsiteImagesContentPath(), $this->cx->getWebsiteImagesContentWebPath()), array(), 1);
$mediaBrowserConfiguration->addMediaType($mediaType);
}
示例15: registerYamlSettingEventListener
public static function registerYamlSettingEventListener()
{
$evm = \Env::get('cx')->getEvents();
$yamlSettingEventListener = new \Cx\Core\Config\Model\Event\YamlSettingEventListener();
$evm->addModelListener(\Doctrine\ORM\Events::preUpdate, 'Cx\\Core\\Setting\\Model\\Entity\\YamlSetting', $yamlSettingEventListener);
$evm->addModelListener('postFlush', 'Cx\\Core\\Setting\\Model\\Entity\\YamlSetting', $yamlSettingEventListener);
}