本文整理汇总了PHP中Contao\Config::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::get方法的具体用法?PHP Config::get怎么用?PHP Config::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contao\Config
的用法示例。
在下文中一共展示了Config::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var PageModel $objPage */
global $objPage;
// Set the trail and level
if ($this->defineRoot && $this->rootPage > 0) {
$trail = array($this->rootPage);
$level = 0;
} else {
$trail = $objPage->trail;
$level = $this->levelOffset > 0 ? $this->levelOffset : 0;
}
$lang = null;
$host = null;
// Overwrite the domain and language if the reference page belongs to a differnt root page (see #3765)
if ($this->defineRoot && $this->rootPage > 0) {
$objRootPage = \PageModel::findWithDetails($this->rootPage);
// Set the language
if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
$lang = $objRootPage->rootLanguage;
}
// Set the domain
if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
$host = $objRootPage->domain;
}
}
$this->Template->request = ampersand(\Environment::get('indexFreeRequest'));
$this->Template->skipId = 'skipNavigation' . $this->id;
$this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
$this->Template->items = $this->renderNavigation($trail[$level], 1, $host, $lang);
}
示例2: run
/**
* Run the controller and parse the template
*
* @return Response
*/
public function run()
{
/** @var \BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_preview');
$objTemplate->base = \Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = specialchars($GLOBALS['TL_LANG']['MSC']['fePreview']);
$objTemplate->charset = \Config::get('characterSet');
$objTemplate->site = \Input::get('site', true);
$objTemplate->switchHref = \System::getContainer()->get('router')->generate('contao_backend_switch');
if (\Input::get('url')) {
$objTemplate->url = \Environment::get('base') . \Input::get('url');
} elseif (\Input::get('page')) {
$objTemplate->url = $this->redirectToFrontendPage(\Input::get('page'), \Input::get('article'), true);
} else {
$objTemplate->url = \System::getContainer()->get('router')->generate('contao_root', [], UrlGeneratorInterface::ABSOLUTE_URL);
}
// Switch to a particular member (see #6546)
if (\Input::get('user') && $this->User->isAdmin) {
$objUser = \MemberModel::findByUsername(\Input::get('user'));
if ($objUser !== null) {
$strHash = $this->getSessionHash('FE_USER_AUTH');
// Remove old sessions
$this->Database->prepare("DELETE FROM tl_session WHERE tstamp<? OR hash=?")->execute(time() - \Config::get('sessionTimeout'), $strHash);
// Insert the new session
$this->Database->prepare("INSERT INTO tl_session (pid, tstamp, name, sessionID, ip, hash) VALUES (?, ?, ?, ?, ?, ?)")->execute($objUser->id, time(), 'FE_USER_AUTH', \System::getContainer()->get('session')->getId(), \Environment::get('ip'), $strHash);
// Set the cookie
$this->setCookie('FE_USER_AUTH', $strHash, time() + \Config::get('sessionTimeout'), null, null, false, true);
$objTemplate->user = \Input::post('user');
}
}
return $objTemplate->getResponse();
}
示例3: insertProSearchLegend
/**
* @param $strName
* @return null
*/
public function insertProSearchLegend($strName)
{
$activeTables = deserialize(Config::get('searchIndexModules'));
$coreModulesArr = $activeTables ? $activeTables : array();
if (in_array($strName, $coreModulesArr) && $GLOBALS['TL_DCA'][$strName]) {
if (!$this->createColsIfNotExist($strName)) {
return null;
}
$palletesArr = $GLOBALS['TL_DCA'][$strName]['palettes'] ? $GLOBALS['TL_DCA'][$strName]['palettes'] : array();
static::loadLanguageFile('tl_prosearch_data');
// legend label setzen
$GLOBALS['TL_LANG'][$strName]['prosearch_legend'] = $GLOBALS['TL_LANG']['tl_prosearch_data']['prosearch_legend'];
foreach ($palletesArr as $k => $pallete) {
if ($k == '__selector__') {
continue;
}
$palleteArr = explode(';', $pallete);
if (count($palleteArr) == 1) {
$GLOBALS['TL_DCA'][$strName]['palettes'][$k] .= ';' . static::palettesStr();
} else {
$GLOBALS['TL_DCA'][$strName]['palettes'][$k] = str_replace($palleteArr[0], $palleteArr[0] . ';' . static::palettesStr(), $GLOBALS['TL_DCA'][$strName]['palettes'][$k]);
}
}
$GLOBALS['TL_DCA'][$strName]['config']['onload_callback'][] = array('ProSearchPalette', 'getAvailabletags');
foreach ($this->getFields() as $field => $method) {
$GLOBALS['TL_DCA'][$strName]['fields'][$field] = call_user_func(array('ProSearchPalette', $method));
}
}
}
示例4: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['eventreader'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Set the item from the auto_item parameter
if (!isset($_GET['events']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
\Input::setGet('events', \Input::get('auto_item'));
}
// Do not index or cache the page if no event has been specified
if (!\Input::get('events')) {
/** @var PageModel $objPage */
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
$this->cal_calendar = $this->sortOutProtected(\StringUtil::deserialize($this->cal_calendar));
// Do not index or cache the page if there are no calendars
if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) {
/** @var PageModel $objPage */
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
return parent::generate();
}
示例5: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var PageModel $objPage */
global $objPage;
$lang = null;
$host = null;
// Start from the website root if there is no reference page
if (!$this->rootPage) {
$this->rootPage = $objPage->rootId;
} else {
$objRootPage = \PageModel::findWithDetails($this->rootPage);
// Set the language
if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
$lang = $objRootPage->rootLanguage;
}
// Set the domain
if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
$host = $objRootPage->domain;
}
}
$this->Template->formId = 'tl_quicknav_' . $this->id;
$this->Template->targetPage = $GLOBALS['TL_LANG']['MSC']['targetPage'];
$this->Template->button = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['go']);
$this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicknav'];
$this->Template->request = ampersand(\Environment::get('request'), true);
$this->Template->items = $this->getQuicknavPages($this->rootPage, 1, $host, $lang);
}
示例6: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var PageModel $objPage */
global $objPage;
$arrJumpTo = array();
$arrNewsletter = array();
$strRequest = ampersand(\Environment::get('request'), true);
$objNewsletter = \NewsletterModel::findSentByPids($this->nl_channels);
if ($objNewsletter !== null) {
while ($objNewsletter->next()) {
/** @var NewsletterChannelModel $objTarget */
if (!($objTarget = $objNewsletter->getRelated('pid')) instanceof NewsletterChannelModel) {
continue;
}
$jumpTo = intval($objTarget->jumpTo);
// A jumpTo page is not mandatory for newsletter channels (see #6521) but required for the list module
if ($jumpTo < 1) {
throw new \Exception("Newsletter channels without redirect page cannot be used in a newsletter list");
}
$strUrl = $strRequest;
if (!isset($arrJumpTo[$objTarget->jumpTo])) {
if (($objJumpTo = $objTarget->getRelated('jumpTo')) instanceof PageModel) {
/** @var PageModel $objJumpTo */
$arrJumpTo[$objTarget->jumpTo] = $objJumpTo->getFrontendUrl(\Config::get('useAutoItem') ? '/%s' : '/items/%s');
} else {
$arrJumpTo[$objTarget->jumpTo] = $strUrl;
}
}
$strUrl = $arrJumpTo[$objTarget->jumpTo];
$strAlias = $objNewsletter->alias ?: $objNewsletter->id;
$arrNewsletter[] = array('subject' => $objNewsletter->subject, 'title' => \StringUtil::stripInsertTags($objNewsletter->subject), 'href' => sprintf($strUrl, $strAlias), 'date' => \Date::parse($objPage->dateFormat, $objNewsletter->date), 'datim' => \Date::parse($objPage->datimFormat, $objNewsletter->date), 'time' => \Date::parse($objPage->timeFormat, $objNewsletter->date), 'channel' => $objNewsletter->pid);
}
}
$this->Template->newsletters = $arrNewsletter;
}
示例7: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var PageModel $objPage */
global $objPage;
$lang = null;
$host = null;
// Start from the website root if there is no reference page
if (!$this->rootPage) {
$this->rootPage = $objPage->rootId;
} else {
$objRootPage = \PageModel::findWithDetails($this->rootPage);
// Set the language
if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
$lang = $objRootPage->rootLanguage;
}
// Set the domain
if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
$host = $objRootPage->domain;
}
}
$this->showLevel = 0;
$this->hardLimit = false;
$this->levelOffset = 0;
$this->Template->items = $this->renderNavigation($this->rootPage, 1, $host, $lang);
}
示例8: run
/**
* Run the controller and parse the login template
*
* @return Response
*/
public function run()
{
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_login');
$strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], \Config::get('websiteTitle'));
$objTemplate->theme = \Backend::getTheme();
$objTemplate->messages = \Message::generate();
$objTemplate->base = \Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->languages = \System::getLanguages(true);
$objTemplate->title = \StringUtil::specialchars($strHeadline);
$objTemplate->charset = \Config::get('characterSet');
$objTemplate->action = ampersand(\Environment::get('request'));
$objTemplate->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
$objTemplate->headline = $strHeadline;
$objTemplate->curLanguage = \Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
$objTemplate->curUsername = \Input::post('username') ?: '';
$objTemplate->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
$objTemplate->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
$objTemplate->loginButton = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
$objTemplate->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
$objTemplate->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
$objTemplate->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
$objTemplate->default = $GLOBALS['TL_LANG']['MSC']['default'];
$objTemplate->jsDisabled = $GLOBALS['TL_LANG']['MSC']['jsDisabled'];
return $objTemplate->getResponse();
}
示例9: generate
/**
* Redirect to an internal page
*
* @param \PageModel $objPage
*/
public function generate($objPage)
{
// Forward to the jumpTo or first published page
if ($objPage->jumpTo) {
/** @var \PageModel $objNextPage */
$objNextPage = $objPage->getRelated('jumpTo');
} else {
$objNextPage = \PageModel::findFirstPublishedRegularByPid($objPage->id);
}
// Forward page does not exist
if ($objNextPage === null) {
$this->log('Forward page ID "' . $objPage->jumpTo . '" does not exist', __METHOD__, TL_ERROR);
throw new ForwardPageNotFoundException('Forward page not found');
}
$strForceLang = null;
// Check the target page language (see #4706)
if (\Config::get('addLanguageToUrl')) {
$objNextPage->loadDetails();
// see #3983
$strForceLang = $objNextPage->language;
}
$strGet = '';
$strQuery = \Environment::get('queryString');
$arrQuery = array();
// Extract the query string keys (see #5867)
if ($strQuery != '') {
$arrChunks = explode('&', $strQuery);
foreach ($arrChunks as $strChunk) {
list($k, ) = explode('=', $strChunk, 2);
$arrQuery[] = $k;
}
}
// Add $_GET parameters
if (!empty($_GET)) {
foreach (array_keys($_GET) as $key) {
if (\Config::get('addLanguageToUrl') && $key == 'language') {
continue;
}
// Ignore the query string parameters (see #5867)
if (in_array($key, $arrQuery)) {
continue;
}
// Ignore the auto_item parameter (see #5886)
if ($key == 'auto_item') {
$strGet .= '/' . \Input::get($key);
} else {
$strGet .= '/' . $key . '/' . \Input::get($key);
}
}
}
// Append the query string (see #5867)
if ($strQuery != '') {
$strQuery = '?' . $strQuery;
}
$this->redirect($this->generateFrontendUrl($objNextPage->row(), $strGet, $strForceLang) . $strQuery, $objPage->redirect == 'temporary' ? 302 : 301);
}
示例10: __construct
/**
* Constructor
*/
public function __construct()
{
try {
$this->apiKey = Config::get('clr_api_key');
$this->soap = new SoapClient(Config::get('clr_wsdl_url'));
} catch (Exception $e) {
$this->log('Kein API-Key oder WSDL-File für cleverreach.de in den Einstellungen hinterlegt', 'CleverReach::construct', TL_ERROR);
}
parent::__construct();
}
示例11: run
/**
* Run the controller and parse the template
*
* @return Response
*/
public function run()
{
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_alerts');
$objTemplate->theme = \Backend::getTheme();
$objTemplate->base = \Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['systemMessages']);
$objTemplate->charset = \Config::get('characterSet');
$objTemplate->messages = \Message::generateUnwrapped() . \Backend::getSystemMessages();
return $objTemplate->getResponse();
}
示例12: rebuild
/**
* Rebuild the cache and return true on success, false otherwise
*
* @param ProviderInterface $dataProvider
* @param ContentModel $contentElement
*
* @return bool
*/
public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement)
{
$factory = new Factory($dataProvider);
if (($video = $factory->createVideo($contentElement->vimeo_videoId)) === null) {
return false;
}
if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($contentElement->vimeo_videoId) === null) {
return false;
}
if ($dataProvider->getVideoImage($contentElement->vimeo_videoId, Config::get('vimeo_imageIndex')) === null) {
return false;
}
return true;
}
示例13: generate
/**
* @return string
*/
public function generate()
{
// translation
$bStr = $GLOBALS['TL_LANG']['MSC']['ajaxSearchIndex']['button'];
// load active modules
$activeModules = deserialize(Config::get('searchIndexModules'));
// encode to json
$json = json_encode($activeModules);
// set to global js varaible
$GLOBALS['TL_MOOTOOLS'][] = '<script>var proSearchActiveModules = ' . $json . ';</script>';
// load js
$GLOBALS['TL_JAVASCRIPT'][] = $GLOBALS['PS_PUBLIC_PATH'] . 'JsIndex.js|static';
return '<div class="index_list"><ul class="ul"></ul></div><div class="ajaxSearchIndex"><a class="tl_submit" style="margin-bottom: 5px; margin-top: 5px" onclick="Backend.getScrollOffset();return AjaxRequest.ajaxSearchIndex()">' . $bStr . '</a></div>';
}
示例14: getForwardUrl
/**
* Return the URL to the jumpTo or first published page
*
* @param PageModel $objPage
*
* @return string
*
* @throws ForwardPageNotFoundException
*/
private function getForwardUrl($objPage)
{
if ($objPage->jumpTo) {
/** @var PageModel $objNextPage */
$objNextPage = $objPage->getRelated('jumpTo');
} else {
$objNextPage = \PageModel::findFirstPublishedRegularByPid($objPage->id);
}
// Forward page does not exist
if (!$objNextPage instanceof PageModel) {
$this->log('Forward page ID "' . $objPage->jumpTo . '" does not exist', __METHOD__, TL_ERROR);
throw new ForwardPageNotFoundException('Forward page not found');
}
$strGet = '';
$strQuery = \Environment::get('queryString');
$arrQuery = array();
// Extract the query string keys (see #5867)
if ($strQuery != '') {
$arrChunks = explode('&', $strQuery);
foreach ($arrChunks as $strChunk) {
list($k) = explode('=', $strChunk, 2);
$arrQuery[] = $k;
}
}
// Add $_GET parameters
if (!empty($_GET)) {
foreach (array_keys($_GET) as $key) {
if (\Config::get('addLanguageToUrl') && $key == 'language') {
continue;
}
// Ignore the query string parameters (see #5867)
if (in_array($key, $arrQuery)) {
continue;
}
// Ignore the auto_item parameter (see #5886)
if ($key == 'auto_item') {
$strGet .= '/' . \Input::get($key);
} else {
$strGet .= '/' . $key . '/' . \Input::get($key);
}
}
}
// Append the query string (see #5867)
if ($strQuery != '') {
$strQuery = '?' . $strQuery;
}
return $objNextPage->getAbsoluteUrl($strGet) . $strQuery;
}
示例15: run
/**
* Run the controller
*
* @return Response
*/
public function run()
{
$objResponse = new Response();
// Do not run if there is POST data or the last execution was less than a minute ago
if (!empty($_POST) || $this->hasToWait()) {
return $objResponse;
}
$arrLock = array();
$arrIntervals = array('monthly', 'weekly', 'daily', 'hourly', 'minutely');
// Store the current timestamps
$arrCurrent = array('monthly' => date('Ym'), 'weekly' => date('YW'), 'daily' => date('Ymd'), 'hourly' => date('YmdH'), 'minutely' => date('YmdHi'));
// Get the timestamps from tl_cron
$objLock = $this->Database->query("SELECT * FROM tl_cron WHERE name !='lastrun'");
while ($objLock->next()) {
$arrLock[$objLock->name] = $objLock->value;
}
// Create the database entries
foreach ($arrIntervals as $strInterval) {
if (!isset($arrLock[$strInterval])) {
$arrLock[$strInterval] = 0;
$this->Database->query("INSERT INTO tl_cron (name, value) VALUES ('{$strInterval}', 0)");
}
}
// Run the jobs
foreach ($arrIntervals as $strInterval) {
$intCurrent = $arrCurrent[$strInterval];
// Skip empty intervals and jobs that have been executed already
if (empty($GLOBALS['TL_CRON'][$strInterval]) || $arrLock[$strInterval] == $intCurrent) {
continue;
}
// Update the database before the jobs are executed, in case one of them fails
$this->Database->query("UPDATE tl_cron SET value={$intCurrent} WHERE name='{$strInterval}'");
// Add a log entry if in debug mode (see #4729)
if (\Config::get('debugMode')) {
$this->log('Running the ' . $strInterval . ' cron jobs', __METHOD__, TL_CRON);
}
foreach ($GLOBALS['TL_CRON'][$strInterval] as $callback) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}();
}
// Add a log entry if in debug mode (see #4729)
if (\Config::get('debugMode')) {
$this->log(ucfirst($strInterval) . ' cron jobs complete', __METHOD__, TL_CRON);
}
}
return $objResponse;
}