当前位置: 首页>>代码示例>>PHP>>正文


PHP System::getContainer方法代码示例

本文整理汇总了PHP中Contao\System::getContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP System::getContainer方法的具体用法?PHP System::getContainer怎么用?PHP System::getContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contao\System的用法示例。


在下文中一共展示了System::getContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResponse

 /**
  * Return a response object
  *
  * The forum Page usually does not get called because the frontend listener
  * overrides the url for navigation for example. When called directly the layout parts
  * phpBB gets created und pushed to phpbb
  *
  * @see ContaoFrontendListener
  *
  * @param \PageModel $objPage
  * @param boolean $blnCheckRequest
  *
  * @return Response
  */
 public function getResponse($objPage, $blnCheckRequest = false)
 {
     $this->prepare($objPage);
     // prepare the template contents
     $this->Template->main = "%%FORUM%%";
     $style = $this->prepareHeadTags($this->Template->stylesheets);
     $mooScripts = $this->prepareHeadTags($this->Template->mooScripts);
     $framework = $this->prepareHeadTags($this->Template->framework);
     $head = $this->prepareHeadTags($this->Template->head);
     $this->Template->head = "";
     $response = $this->Template->getResponse($blnCheckRequest);
     // layout sections
     $overall_header = '';
     $overall_footer = '';
     $sections = $this->generateLayoutSections($response->getContent());
     // template vars will be replaced with dynamic content on each request
     $overall_header = '{CONTAO_LAYOUT_HEADER}';
     $overall_footer = '{CONTAO_LAYOUT_FOOTER}';
     // If dynamic generation is set and json format requested we can return and leave (no need to generate files)
     if ($this->Input->get('format') == 'json') {
         return new JsonResponse($sections);
     }
     // Generate files for static and generic contents
     $phpbbHeaders = "";
     $phpbbHeaders .= $framework;
     $phpbbHeaders .= $style;
     $phpbbHeaders .= $mooScripts;
     $phpbbHeaders .= $head;
     file_put_contents(__DIR__ . '/../Resources/phpBB/ctsmedia/contaophpbbbridge/styles/all/template/event/overall_header_stylesheets_after.html', $phpbbHeaders);
     file_put_contents(__DIR__ . '/../Resources/phpBB/ctsmedia/contaophpbbbridge/styles/all/template/event/simple_header_stylesheets_after.html', $phpbbHeaders);
     file_put_contents(__DIR__ . '/../Resources/phpBB/ctsmedia/contaophpbbbridge/styles/all/template/event/overall_header_body_before.html', $overall_header);
     file_put_contents(__DIR__ . '/../Resources/phpBB/ctsmedia/contaophpbbbridge/styles/all/template/event/overall_footer_after.html', $overall_footer);
     System::getContainer()->get('phpbb_bridge.connector')->updateConfig(array('contao.body_class' => $this->Template->class));
     return $response;
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:49,代码来源:Forum.php

示例2: run

 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     $arrJobs = array();
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_purge_data');
     $objTemplate->isActive = $this->isActive();
     $objTemplate->message = \Message::generateUnwrapped();
     // Run the jobs
     if (\Input::post('FORM_SUBMIT') == 'tl_purge') {
         $purge = \Input::post('purge');
         if (!empty($purge) && is_array($purge)) {
             foreach ($purge as $group => $jobs) {
                 foreach ($jobs as $job) {
                     list($class, $method) = $GLOBALS['TL_PURGE'][$group][$job]['callback'];
                     $this->import($class);
                     $this->{$class}->{$method}();
                 }
             }
         }
         \Message::addConfirmation($GLOBALS['TL_LANG']['tl_maintenance']['cacheCleared']);
         $this->reload();
     }
     // Tables
     foreach ($GLOBALS['TL_PURGE']['tables'] as $key => $config) {
         $arrJobs[$key] = array('id' => 'purge_' . $key, 'title' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][0], 'description' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][1], 'group' => 'tables', 'affected' => '');
         // Get the current table size
         foreach ($config['affected'] as $table) {
             $objCount = $this->Database->execute("SELECT COUNT(*) AS count FROM " . $table);
             $arrJobs[$key]['affected'] .= '<br>' . $table . ': <span>' . sprintf($GLOBALS['TL_LANG']['MSC']['entries'], $objCount->count) . ', ' . $this->getReadableSize($this->Database->getSizeOf($table), 0) . '</span>';
         }
     }
     $strCachePath = str_replace(TL_ROOT . DIRECTORY_SEPARATOR, '', \System::getContainer()->getParameter('kernel.cache_dir'));
     // Folders
     foreach ($GLOBALS['TL_PURGE']['folders'] as $key => $config) {
         $arrJobs[$key] = array('id' => 'purge_' . $key, 'title' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][0], 'description' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][1], 'group' => 'folders', 'affected' => '');
         // Get the current folder size
         foreach ($config['affected'] as $folder) {
             $total = 0;
             $folder = sprintf($folder, $strCachePath);
             // Only check existing folders
             if (is_dir(TL_ROOT . '/' . $folder)) {
                 $objFiles = Finder::create()->in(TL_ROOT . '/' . $folder)->files();
                 $total = iterator_count($objFiles);
             }
             $arrJobs[$key]['affected'] .= '<br>' . $folder . ': <span>' . sprintf($GLOBALS['TL_LANG']['MSC']['files'], $total) . '</span>';
         }
     }
     // Custom
     foreach ($GLOBALS['TL_PURGE']['custom'] as $key => $job) {
         $arrJobs[$key] = array('id' => 'purge_' . $key, 'title' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][0], 'description' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][1], 'group' => 'custom');
     }
     $objTemplate->jobs = $arrJobs;
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->headline = $GLOBALS['TL_LANG']['tl_maintenance']['clearCache'];
     $objTemplate->job = $GLOBALS['TL_LANG']['tl_maintenance']['job'];
     $objTemplate->description = $GLOBALS['TL_LANG']['tl_maintenance']['description'];
     $objTemplate->submit = \StringUtil::specialchars($GLOBALS['TL_LANG']['tl_maintenance']['clearCache']);
     $objTemplate->help = \Config::get('showHelp') && $GLOBALS['TL_LANG']['tl_maintenance']['cacheTables'][1] != '' ? $GLOBALS['TL_LANG']['tl_maintenance']['cacheTables'][1] : '';
     return $objTemplate->parse();
 }
开发者ID:contao,项目名称:core-bundle,代码行数:65,代码来源:PurgeData.php

示例3: purgePageCache

 /**
  * Overwrite for Automator::purgePageCache
  * Makes sure the forum layout is regenerated
  */
 public function purgePageCache()
 {
     $automator = new Automator();
     $automator->purgePageCache();
     System::getContainer()->get('phpbb_bridge.connector')->generateForumLayoutFiles();
     $this->log('Purged the phpbb forum cache', __METHOD__, TL_CRON);
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:11,代码来源:ForumMaintenance.php

示例4: 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();
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:38,代码来源:BackendPreview.php

示例5: __construct

 /**
  * Get the session data
  */
 protected function __construct()
 {
     if (PHP_SAPI == 'cli') {
         $this->session = new SymfonySession(new MockArraySessionStorage());
     } else {
         $this->session = \System::getContainer()->get('session');
     }
     $this->sessionBag = $this->session->getBag($this->getSessionBagKey());
 }
开发者ID:contao,项目名称:core-bundle,代码行数:12,代码来源:Session.php

示例6: generate

 /**
  * Generate the widget and return it as string
  *
  * @return string
  */
 public function generate()
 {
     $arrOptions = array();
     if (!$this->multiple && count($this->arrOptions) > 1) {
         $this->arrOptions = array($this->arrOptions[0]);
     }
     // The "required" attribute only makes sense for single checkboxes
     if ($this->mandatory && !$this->multiple) {
         $this->arrAttributes['required'] = 'required';
     }
     /** @var AttributeBagInterface $objSessionBag */
     $objSessionBag = \System::getContainer()->get('session')->getBag('contao_backend');
     $state = $objSessionBag->get('checkbox_groups');
     // Toggle the checkbox group
     if (\Input::get('cbc')) {
         $state[\Input::get('cbc')] = isset($state[\Input::get('cbc')]) && $state[\Input::get('cbc')] == 1 ? 0 : 1;
         $objSessionBag->set('checkbox_groups', $state);
         $this->redirect(preg_replace('/(&(amp;)?|\\?)cbc=[^& ]*/i', '', \Environment::get('request')));
     }
     $blnFirst = true;
     $blnCheckAll = true;
     foreach ($this->arrOptions as $i => $arrOption) {
         // Single dimension array
         if (is_numeric($i)) {
             $arrOptions[] = $this->generateCheckbox($arrOption, $i);
             continue;
         }
         $id = 'cbc_' . $this->strId . '_' . \StringUtil::standardize($i);
         $img = 'folPlus.svg';
         $display = 'none';
         if (!isset($state[$id]) || !empty($state[$id])) {
             $img = 'folMinus.svg';
             $display = 'block';
         }
         $arrOptions[] = '<div class="checkbox_toggler' . ($blnFirst ? '_first' : '') . '"><a href="' . $this->addToUrl('cbc=' . $id) . '" onclick="AjaxRequest.toggleCheckboxGroup(this,\'' . $id . '\');Backend.getScrollOffset();return false">' . \Image::getHtml($img) . '</a>' . $i . '</div><fieldset id="' . $id . '" class="tl_checkbox_container checkbox_options" style="display:' . $display . '"><input type="checkbox" id="check_all_' . $id . '" class="tl_checkbox" onclick="Backend.toggleCheckboxGroup(this, \'' . $id . '\')"> <label for="check_all_' . $id . '" style="color:#a6a6a6"><em>' . $GLOBALS['TL_LANG']['MSC']['selectAll'] . '</em></label>';
         // Multidimensional array
         foreach ($arrOption as $k => $v) {
             $arrOptions[] = $this->generateCheckbox($v, standardize($i) . '_' . $k);
         }
         $arrOptions[] = '</fieldset>';
         $blnFirst = false;
         $blnCheckAll = false;
     }
     // Add a "no entries found" message if there are no options
     if (empty($arrOptions)) {
         $arrOptions[] = '<p class="tl_noopt">' . $GLOBALS['TL_LANG']['MSC']['noResult'] . '</p>';
         $blnCheckAll = false;
     }
     if ($this->multiple) {
         return sprintf('<fieldset id="ctrl_%s" class="tl_checkbox_container%s"><legend>%s%s%s%s</legend><input type="hidden" name="%s" value="">%s%s</fieldset>%s', $this->strId, $this->strClass != '' ? ' ' . $this->strClass : '', $this->mandatory ? '<span class="invisible">' . $GLOBALS['TL_LANG']['MSC']['mandatory'] . ' </span>' : '', $this->strLabel, $this->mandatory ? '<span class="mandatory">*</span>' : '', $this->xlabel, $this->strName, $blnCheckAll ? '<input type="checkbox" id="check_all_' . $this->strId . '" class="tl_checkbox" onclick="Backend.toggleCheckboxGroup(this,\'ctrl_' . $this->strId . '\')' . ($this->onclick ? ';' . $this->onclick : '') . '"> <label for="check_all_' . $this->strId . '" style="color:#a6a6a6"><em>' . $GLOBALS['TL_LANG']['MSC']['selectAll'] . '</em></label><br>' : '', str_replace('<br></fieldset><br>', '</fieldset>', implode('<br>', $arrOptions)), $this->wizard);
     } else {
         return sprintf('<div id="ctrl_%s" class="tl_checkbox_single_container%s"><input type="hidden" name="%s" value="">%s</div>%s', $this->strId, $this->strClass != '' ? ' ' . $this->strClass : '', $this->strName, str_replace('<br></div><br>', '</div>', implode('<br>', $arrOptions)), $this->wizard);
     }
 }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:59,代码来源:CheckBox.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->getFramework()->initialize();
     $output->writeln('Clearing Forum Cache');
     System::getContainer()->get('phpbb_bridge.connector')->clearForumCache();
     // Generate the layout if not explicitly asked for cache only
     if (!$input->getOption('cache-only')) {
         $output->writeln('Generating Layout Files');
         System::getContainer()->get('phpbb_bridge.connector')->generateForumLayoutFiles();
     }
     return 0;
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:12,代码来源:CacheCommand.php

示例8: __construct

 /**
  * Establish the database connection
  *
  * @param array $arrConfig The configuration array
  *
  * @throws \Exception If a connection cannot be established
  */
 protected function __construct(array $arrConfig)
 {
     // Deprecated since Contao 4.0, to be removed in Contao 5.0
     if (!empty($arrConfig)) {
         @trigger_error('Passing a custom configuration to Database::__construct() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
         $arrParams = array('driver' => \System::getContainer()->getParameter('database_driver'), 'host' => $arrConfig['dbHost'], 'port' => $arrConfig['dbPort'], 'user' => $arrConfig['dbUser'], 'password' => $arrConfig['dbPass'], 'dbname' => $arrConfig['dbDatabase']);
         $this->resConnection = DriverManager::getConnection($arrParams);
     } else {
         $this->resConnection = \System::getContainer()->get('database_connection');
     }
     if (!is_object($this->resConnection)) {
         throw new \Exception(sprintf('Could not connect to database (%s)', $this->error));
     }
 }
开发者ID:contao,项目名称:core-bundle,代码行数:21,代码来源:Database.php

示例9: __construct

 /**
  * Initialize the object
  */
 public function __construct()
 {
     // Load the user object before calling the parent constructor
     $this->import('FrontendUser', 'User');
     parent::__construct();
     // Check whether a user is logged in
     define('BE_USER_LOGGED_IN', $this->getLoginStatus('BE_USER_AUTH'));
     define('FE_USER_LOGGED_IN', $this->getLoginStatus('FE_USER_AUTH'));
     // No back end user logged in
     if (!$_SESSION['DISABLE_CACHE']) {
         // Maintenance mode (see #4561 and #6353)
         if (\Config::get('maintenanceMode') && !\System::getContainer()->get('kernel')->isDebug()) {
             throw new ServiceUnavailableException('This site is currently down for maintenance. Please come back later.');
         }
     }
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:19,代码来源:FrontendIndex.php

示例10: validate

 /**
  * Validate a token
  *
  * @param string $strToken The request token
  *
  * @return boolean True if the token matches the stored one
  */
 public static function validate($strToken)
 {
     // The feature has been disabled
     if (\Config::get('disableRefererCheck') || defined('BYPASS_TOKEN_CHECK')) {
         return true;
     }
     // Check against the whitelist (thanks to Tristan Lins) (see #3164)
     if (\Config::get('requestTokenWhitelist')) {
         $strHostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
         foreach (\Config::get('requestTokenWhitelist') as $strDomain) {
             if ($strDomain == $strHostname || preg_match('/\\.' . preg_quote($strDomain, '/') . '$/', $strHostname)) {
                 return true;
             }
         }
     }
     $container = \System::getContainer();
     return $container->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($container->getParameter('contao.csrf_token_name'), $strToken));
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:25,代码来源:RequestToken.php

示例11: getResponse

 /**
  * Return a response object
  *
  * The forum Page usually does not get called because the frontend listener
  * overrides the url for navigation for example. When called directly the layout parts
  * phpBB gets created und pushed to phpbb
  *
  * @see ContaoFrontendListener
  *
  * @param \PageModel $objPage
  * @param boolean    $blnCheckRequest
  *
  * @return Response
  */
 public function getResponse($objPage, $blnCheckRequest = false)
 {
     $this->prepare($objPage);
     //dump($this->Template);
     $this->Template->main = "%%FORUM%%";
     $headTags = $this->Template->head;
     $this->Template->head = "";
     $response = $this->Template->getResponse($blnCheckRequest);
     $style = preg_replace('/href\\=\\"(?!http|\\/)/', 'href="/', $this->Template->replaceDynamicScriptTags($this->Template->stylesheets));
     $headTags = preg_replace('/href\\=\\"(?!http|\\/)/', 'href="/', $this->Template->replaceDynamicScriptTags($headTags));
     $headTags = preg_replace('/src\\=\\"(?!http|\\/)/', 'href="/', $headTags);
     // @todo Add framework, mooscripts etc?
     $phpbbHeaders = "";
     $phpbbHeaders .= $style;
     $phpbbHeaders .= $headTags;
     file_put_contents(__DIR__ . '/../Resources/phpBB/ctsmedia/contaophpbbbridge/styles/all/template/event/overall_header_stylesheets_after.html', $phpbbHeaders);
     //dump($phpbbHeaders);
     //dump($this->Template->class);
     $html = $response->getContent();
     // Ajust link paths
     $html = preg_replace('/href\\=\\"(?!http|\\/)/', 'href="/', $html);
     // Ajust src paths
     $html = preg_replace('/src\\=\\"(?!http|\\/)/', 'src="/', $html);
     $html = preg_replace('/content\\=\\"(?!http|\\/)/', 'content="/', $html);
     $parts = explode("%%FORUM%%", $html);
     $overall_header = $parts[0];
     $overall_footer = $parts[1];
     $overall_header = preg_replace('/<\\!DOC.*/i', '', $overall_header);
     $overall_header = preg_replace('/<html.*/i', '', $overall_header);
     $overall_header = preg_replace('/<body.*/i', '', $overall_header);
     $overall_header = preg_replace('/<head>.*<\\/head>/s', '', $overall_header);
     $overall_footer = preg_replace('/<\\/body.*/i', '', $overall_footer);
     $overall_footer = preg_replace('/<\\/html.*/i', '', $overall_footer);
     //dump($overall_footer);
     //dump($this->Template);
     //dump($html);
     file_put_contents(__DIR__ . '/../Resources/phpBB/ctsmedia/contaophpbbbridge/styles/all/template/event/overall_header_body_before.html', $overall_header);
     file_put_contents(__DIR__ . '/../Resources/phpBB/ctsmedia/contaophpbbbridge/styles/all/template/event/overall_footer_after.html', $overall_footer);
     System::getContainer()->get('phpbb_bridge.connector')->updateConfig(array('contao.body_class' => $this->Template->class));
     return $response;
 }
开发者ID:BogusCurry,项目名称:contao-phpbb-bridge-bundle,代码行数:55,代码来源:Forum.php

示例12: setNewPassword

 /**
  * Set the new password
  */
 protected function setNewPassword()
 {
     $objMember = \MemberModel::findOneByActivation(\Input::get('token'));
     if ($objMember === null || $objMember->login == '') {
         $this->strTemplate = 'mod_message';
         /** @var FrontendTemplate|object $objTemplate */
         $objTemplate = new \FrontendTemplate($this->strTemplate);
         $this->Template = $objTemplate;
         $this->Template->type = 'error';
         $this->Template->message = $GLOBALS['TL_LANG']['MSC']['accountError'];
         return;
     }
     $strTable = $objMember->getTable();
     // Initialize the versioning (see #8301)
     $objVersions = new \Versions($strTable, $objMember->id);
     $objVersions->setUsername($objMember->username);
     $objVersions->setUserId(0);
     $objVersions->setEditUrl('contao/main.php?do=member&act=edit&id=%s&rt=1');
     $objVersions->initialize();
     // Define the form field
     $arrField = $GLOBALS['TL_DCA']['tl_member']['fields']['password'];
     /** @var Widget $strClass */
     $strClass = $GLOBALS['TL_FFL']['password'];
     // Fallback to default if the class is not defined
     if (!class_exists($strClass)) {
         $strClass = 'FormPassword';
     }
     /** @var Widget $objWidget */
     $objWidget = new $strClass($strClass::getAttributesFromDca($arrField, 'password'));
     // Set row classes
     $objWidget->rowClass = 'row_0 row_first even';
     $objWidget->rowClassConfirm = 'row_1 odd';
     $this->Template->rowLast = 'row_2 row_last even';
     /** @var SessionInterface $objSession */
     $objSession = \System::getContainer()->get('session');
     // Validate the field
     if (strlen(\Input::post('FORM_SUBMIT')) && \Input::post('FORM_SUBMIT') == $objSession->get('setPasswordToken')) {
         $objWidget->validate();
         // Set the new password and redirect
         if (!$objWidget->hasErrors()) {
             $objSession->set('setPasswordToken', '');
             $objMember->tstamp = time();
             $objMember->activation = '';
             $objMember->password = $objWidget->value;
             $objMember->save();
             // Create a new version
             if ($GLOBALS['TL_DCA'][$strTable]['config']['enableVersioning']) {
                 $objVersions->create();
             }
             // HOOK: set new password callback
             if (isset($GLOBALS['TL_HOOKS']['setNewPassword']) && is_array($GLOBALS['TL_HOOKS']['setNewPassword'])) {
                 foreach ($GLOBALS['TL_HOOKS']['setNewPassword'] as $callback) {
                     $this->import($callback[0]);
                     $this->{$callback[0]}->{$callback[1]}($objMember, $objWidget->value, $this);
                 }
             }
             // Redirect to the jumpTo page
             if (($objTarget = $this->objModel->getRelated('reg_jumpTo')) instanceof PageModel) {
                 /** @var PageModel $objTarget */
                 $this->redirect($objTarget->getFrontendUrl());
             }
             // Confirm
             $this->strTemplate = 'mod_message';
             /** @var FrontendTemplate|object $objTemplate */
             $objTemplate = new \FrontendTemplate($this->strTemplate);
             $this->Template = $objTemplate;
             $this->Template->type = 'confirm';
             $this->Template->message = $GLOBALS['TL_LANG']['MSC']['newPasswordSet'];
             return;
         }
     }
     $strToken = md5(uniqid(mt_rand(), true));
     $objSession->set('setPasswordToken', $strToken);
     $this->Template->formId = $strToken;
     $this->Template->fields = $objWidget->parse();
     $this->Template->action = \Environment::get('indexFreeRequest');
     $this->Template->slabel = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['setNewPassword']);
 }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:81,代码来源:ModulePassword.php

示例13: navigation

 /**
  * Generate the navigation menu and return it as array
  *
  * @param boolean $blnShowAll
  *
  * @return array
  */
 public function navigation($blnShowAll = false)
 {
     /** @var AttributeBagInterface $objSessionBag */
     $objSessionBag = \System::getContainer()->get('session')->getBag('contao_backend');
     $arrModules = array();
     $session = $objSessionBag->all();
     // Toggle nodes
     if (\Input::get('mtg')) {
         $session['backend_modules'][\Input::get('mtg')] = isset($session['backend_modules'][\Input::get('mtg')]) && $session['backend_modules'][\Input::get('mtg')] == 0 ? 1 : 0;
         $objSessionBag->replace($session);
         \Controller::redirect(preg_replace('/(&(amp;)?|\\?)mtg=[^& ]*/i', '', \Environment::get('request')));
     }
     foreach ($GLOBALS['BE_MOD'] as $strGroupName => $arrGroupModules) {
         if (!empty($arrGroupModules) && ($strGroupName == 'system' || $this->hasAccess(array_keys($arrGroupModules), 'modules'))) {
             $arrModules[$strGroupName]['icon'] = 'modMinus.gif';
             $arrModules[$strGroupName]['title'] = specialchars($GLOBALS['TL_LANG']['MSC']['collapseNode']);
             $arrModules[$strGroupName]['label'] = ($label = is_array($GLOBALS['TL_LANG']['MOD'][$strGroupName]) ? $GLOBALS['TL_LANG']['MOD'][$strGroupName][0] : $GLOBALS['TL_LANG']['MOD'][$strGroupName]) != false ? $label : $strGroupName;
             $arrModules[$strGroupName]['href'] = \Controller::addToUrl('mtg=' . $strGroupName);
             // Do not show the modules if the group is closed
             if (!$blnShowAll && isset($session['backend_modules'][$strGroupName]) && $session['backend_modules'][$strGroupName] < 1) {
                 $arrModules[$strGroupName]['modules'] = false;
                 $arrModules[$strGroupName]['icon'] = 'modPlus.gif';
                 $arrModules[$strGroupName]['title'] = specialchars($GLOBALS['TL_LANG']['MSC']['expandNode']);
             } else {
                 foreach ($arrGroupModules as $strModuleName => $arrModuleConfig) {
                     // Check access
                     if ($strModuleName == 'undo' || $this->hasAccess($strModuleName, 'modules')) {
                         $arrModules[$strGroupName]['modules'][$strModuleName] = $arrModuleConfig;
                         $arrModules[$strGroupName]['modules'][$strModuleName]['title'] = specialchars($GLOBALS['TL_LANG']['MOD'][$strModuleName][1]);
                         $arrModules[$strGroupName]['modules'][$strModuleName]['label'] = ($label = is_array($GLOBALS['TL_LANG']['MOD'][$strModuleName]) ? $GLOBALS['TL_LANG']['MOD'][$strModuleName][0] : $GLOBALS['TL_LANG']['MOD'][$strModuleName]) != false ? $label : $strModuleName;
                         $arrModules[$strGroupName]['modules'][$strModuleName]['icon'] = !empty($arrModuleConfig['icon']) ? sprintf(' style="background-image:url(\'%s%s\')"', TL_ASSETS_URL, $arrModuleConfig['icon']) : '';
                         $arrModules[$strGroupName]['modules'][$strModuleName]['class'] = 'navigation ' . $strModuleName;
                         $arrModules[$strGroupName]['modules'][$strModuleName]['href'] = TL_SCRIPT . '?do=' . $strModuleName . '&amp;ref=' . TL_REFERER_ID;
                         // Mark the active module and its group
                         if (\Input::get('do') == $strModuleName) {
                             $arrModules[$strGroupName]['class'] = ' trail';
                             $arrModules[$strGroupName]['modules'][$strModuleName]['class'] .= ' active';
                         }
                     }
                 }
             }
         }
     }
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['getUserNavigation']) && is_array($GLOBALS['TL_HOOKS']['getUserNavigation'])) {
         foreach ($GLOBALS['TL_HOOKS']['getUserNavigation'] as $callback) {
             $this->import($callback[0]);
             $arrModules = $this->{$callback[0]}->{$callback[1]}($arrModules, $blnShowAll);
         }
     }
     return $arrModules;
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:59,代码来源:BackendUser.php

示例14: generateInternalCache

 /**
  * Generate the internal cache
  */
 public function generateInternalCache()
 {
     $container = \System::getContainer();
     $command = new ContaoCacheWarmer($container->get('filesystem'), $container->get('contao.resource_finder'), $container->get('contao.resource_locator'), $container->getParameter('kernel.root_dir'), $container->get('database_connection'), $container->get('contao.framework'));
     $command->warmUp(\System::getContainer()->getParameter('kernel.cache_dir'));
     // Add a log entry
     $this->log('Generated the internal cache', __METHOD__, TL_CRON);
 }
开发者ID:bytehead,项目名称:core-bundle,代码行数:11,代码来源:Automator.php

示例15: getAbsoluteUrl

 /**
  * Generate an absolute URL depending on the current rewriteURL setting
  *
  * @param string $strParams An optional string of URL parameters
  *
  * @return string An absolute URL that can be used in the front end
  */
 public function getAbsoluteUrl($strParams = null)
 {
     $this->loadDetails();
     $objUrlGenerator = \System::getContainer()->get('contao.routing.url_generator');
     $strUrl = $objUrlGenerator->generate(($this->alias ?: $this->id) . $strParams, array('_locale' => $this->rootLanguage, '_domain' => $this->domain, '_ssl' => (bool) $this->rootUseSSL), UrlGeneratorInterface::ABSOLUTE_URL);
     $strUrl = $this->applyLegacyLogic($strUrl, $strParams);
     return $strUrl;
 }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:15,代码来源:PageModel.php


注:本文中的Contao\System::getContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。