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


PHP Environment::get方法代码示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $this->Template->content = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     $objNewsletter = \NewsletterModel::findSentByParentAndIdOrAlias(\Input::get('items'), $this->nl_channels);
     if (null === $objNewsletter) {
         throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
     }
     // Overwrite the page title (see #2853 and #4955)
     if ($objNewsletter->subject != '') {
         $objPage->pageTitle = strip_tags(\StringUtil::stripInsertTags($objNewsletter->subject));
     }
     // Add enclosure
     if ($objNewsletter->addFile) {
         $this->addEnclosuresToTemplate($this->Template, $objNewsletter->row(), 'files');
     }
     // Support plain text newsletters (thanks to Hagen Klemp)
     if ($objNewsletter->sendText) {
         $strContent = nl2br_html5($objNewsletter->text);
     } else {
         $strContent = str_ireplace(' align="center"', '', $objNewsletter->content);
     }
     // Parse simple tokens and insert tags
     $strContent = $this->replaceInsertTags($strContent);
     $strContent = \StringUtil::parseSimpleTokens($strContent, array());
     // Encode e-mail addresses
     $strContent = \StringUtil::encodeEmail($strContent);
     $this->Template->content = $strContent;
     $this->Template->subject = $objNewsletter->subject;
 }
开发者ID:contao,项目名称:newsletter-bundle,代码行数:36,代码来源:ModuleNewsletterReader.php

示例2: 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);
 }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:30,代码来源:ModuleQuicknav.php

示例3: 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);
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:34,代码来源:ModuleNavigation.php

示例4: generate

 /**
  * Logout the current user and redirect
  *
  * @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']['logout'][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 last page visited
     if ($this->redirectBack) {
         $_SESSION['LAST_PAGE_VISITED'] = $this->getReferer();
     }
     $this->import('FrontendUser', 'User');
     $strRedirect = \Environment::get('base');
     // Redirect to last page visited
     if ($this->redirectBack && !empty($_SESSION['LAST_PAGE_VISITED'])) {
         $strRedirect = $_SESSION['LAST_PAGE_VISITED'];
     } elseif ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) {
         $strRedirect = $this->generateFrontendUrl($objTarget->row());
     }
     // Log out and redirect
     if ($this->User->logout()) {
         $this->redirect($strRedirect);
     }
     return '';
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:35,代码来源:ModuleLogout.php

示例5: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     // Overwrite default template
     if ($this->clr_template) {
         $this->Template = new \FrontendTemplate($this->clr_template);
         $this->Template->setData($this->arrData);
     }
     // Subscribe
     if (Input::post('FORM_SUBMIT') == 'clr_subscribe') {
         $this->addSubscriber();
     }
     $blnHasError = false;
     // Error message
     if (strlen($_SESSION['SUBSCRIBE_ERROR'])) {
         $blnHasError = true;
         $this->Template->mclass = 'error';
         $this->Template->message = $_SESSION['SUBSCRIBE_ERROR'];
         $_SESSION['SUBSCRIBE_ERROR'] = '';
     }
     // Confirmation message
     if (strlen($_SESSION['SUBSCRIBE_CONFIRM'])) {
         $this->Template->mclass = 'confirm';
         $this->Template->message = $_SESSION['SUBSCRIBE_CONFIRM'];
         $_SESSION['SUBSCRIBE_CONFIRM'] = '';
     }
     // Default template variables
     $this->Template->email = '';
     $this->Template->submit = specialchars($GLOBALS['TL_LANG']['MSC']['subscribe']);
     $this->Template->emailLabel = $GLOBALS['TL_LANG']['MSC']['emailAddress'];
     $this->Template->action = Environment::get('indexFreeRequest');
     $this->Template->formId = 'clr_subscribe';
     $this->Template->id = $this->id;
     $this->Template->hasError = $blnHasError;
 }
开发者ID:dreebit,项目名称:cleverreach,代码行数:37,代码来源:ModuleClrSubscribe.php

示例6: 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

示例7: 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;
 }
开发者ID:contao,项目名称:newsletter-bundle,代码行数:38,代码来源:ModuleNewsletterList.php

示例8: validateRequest

 /**
  * Call this function to validate the incoming request
  * @todo move the validation in symfony security firewall authentication provider or request_matcher ?
  *
  * __IMPORTANT INFO__ Contao hooks into the kernel request and tests for user authentication, which can result into a
  * redirect / reload if autologin was successful. The request headers should be kept though
  *
  */
 protected function validateRequest()
 {
     // Initialize Contao
     $this->container->get('contao.framework')->initialize();
     // we need to do this for autoloading contao classes
     $req = $this->container->get('request_stack')->getCurrentRequest();
     /* @var $req Request */
     // Only requests from the bridge itself are allowed. Check if the specific header is set
     if ($req->headers->get('x-requested-with') != 'ContaoPhpbbBridge') {
         System::log('Not allowed to access phpbb bridge. Seems not coming fron the bridge. Path: ' . $req->getPathInfo(), __METHOD__, TL_ERROR);
         if (!$this->debug) {
             throw new AccessDeniedException('Not allowed to access phpbb bridge');
         }
     }
     // The bridge also always sets a internal proxy header
     if (!$req->headers->get('x-forwarded-for')) {
         System::log('Not allowed to access phpbb bridge without proxy header', __METHOD__, TL_ERROR);
         if (!$this->debug) {
             throw new AccessDeniedException('Not allowed to access phpbb bridge without proxy header');
         }
     }
     // Make sure we have an internat request
     // we cannot use $req->server->get('REMOTE_ADDR') here, because symfone alters it
     if ($_SERVER['REMOTE_ADDR'] != Environment::get('server')) {
         System::log('IPs did not match. clientIP: ' . $req->getClientIp() . '| EnvClientIp ' . Environment::get('ip') . '| EnvServerIp ' . Environment::get('server'), __METHOD__, TL_ERROR);
         if (!$this->debug) {
             throw new AccessDeniedException('Not allowed to access phpbb bridge without proxy header');
         }
     }
     if ($this->debug) {
         System::log('Origin Request: ' . $req->headers->get('x-requested-origin', '/NotSet'), __METHOD__, TL_ACCESS);
     }
     $req->attributes->set('isInternalForumRequest', true);
     $this->frontendIndex = new FrontendIndex();
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:43,代码来源:ConnectController.php

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

示例10: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     if (!strlen($this->inColumn)) {
         $this->inColumn = 'main';
     }
     $intCount = 0;
     $articles = array();
     $id = $objPage->id;
     $this->Template->request = \Environment::get('request');
     // Show the articles of a different page
     if ($this->defineRoot && $this->rootPage > 0) {
         if (($objTarget = $this->objModel->getRelated('rootPage')) !== null) {
             $id = $objTarget->id;
             $this->Template->request = $this->generateFrontendUrl($objTarget->row());
         }
     }
     // Get published articles
     $objArticles = \ArticleModel::findPublishedByPidAndColumn($id, $this->inColumn);
     if ($objArticles === null) {
         return;
     }
     while ($objArticles->next()) {
         // Skip first article
         if (++$intCount <= intval($this->skipFirst)) {
             continue;
         }
         $cssID = deserialize($objArticles->cssID, true);
         $articles[] = array('link' => $objArticles->title, 'title' => specialchars($objArticles->title), 'id' => $cssID[0] ?: 'article-' . $objArticles->id, 'articleId' => $objArticles->id);
     }
     $this->Template->articles = $articles;
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:36,代码来源:ModuleArticleList.php

示例11: getPageLayout

 public function getPageLayout(PageModel $objPage, LayoutModel &$objLayout, PageRegular $objPageRegular)
 {
     // layout must use ajax layout
     if (!$objLayout->useAjaxLayout) {
         return;
     }
     // request must be ajax
     if (!Environment::get('isAjaxRequest')) {
         return;
     }
     // set custom or default ajax layout
     if ($objLayout->customAjaxLayout) {
         // load custom layout
         if (($objAjaxLayout = LayoutModel::findById($objLayout->customAjaxLayout)) !== null) {
             $objLayout = $objAjaxLayout;
         }
     } else {
         // create default layout
         $pid = $objLayout->pid;
         $objLayout = new LayoutModel();
         $objLayout->pid = $pid;
         $objLayout->rows = '1rw';
         $objLayout->cols = '1cl';
         $objLayout->orderExt = '';
         $objLayout->modules = 'a:1:{i:0;a:3:{s:3:"mod";s:1:"0";s:3:"col";s:4:"main";s:6:"enable";s:1:"1";}}';
         $objLayout->template = 'fe_page_ajax';
         $objLayout->doctype = $objLayout->doctype;
     }
 }
开发者ID:fritzmg,项目名称:contao-ajax-layout,代码行数:29,代码来源:AjaxLayout.php

示例12: 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

示例13: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     // Create the date object
     try {
         if (\Input::get('month')) {
             $this->Date = new \Date(\Input::get('month'), 'Ym');
         } elseif (\Input::get('day')) {
             $this->Date = new \Date(\Input::get('day'), 'Ymd');
         } else {
             $this->Date = new \Date();
         }
     } catch (\OutOfBoundsException $e) {
         throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
     }
     $time = \Date::floorToMinute();
     // Find the boundaries
     $objMinMax = $this->Database->query("SELECT MIN(startTime) AS dateFrom, MAX(endTime) AS dateTo, MAX(repeatEnd) AS repeatUntil FROM tl_calendar_events WHERE pid IN(" . implode(',', array_map('intval', $this->cal_calendar)) . ")" . (!BE_USER_LOGGED_IN ? " AND (start='' OR start<='{$time}') AND (stop='' OR stop>'" . ($time + 60) . "') AND published='1'" : ""));
     /** @var FrontendTemplate|object $objTemplate */
     $objTemplate = new \FrontendTemplate($this->cal_ctemplate);
     // Store year and month
     $intYear = date('Y', $this->Date->tstamp);
     $intMonth = date('m', $this->Date->tstamp);
     $objTemplate->intYear = $intYear;
     $objTemplate->intMonth = $intMonth;
     // Previous month
     $prevMonth = $intMonth == 1 ? 12 : $intMonth - 1;
     $prevYear = $intMonth == 1 ? $intYear - 1 : $intYear;
     $lblPrevious = $GLOBALS['TL_LANG']['MONTHS'][$prevMonth - 1] . ' ' . $prevYear;
     $intPrevYm = intval($prevYear . str_pad($prevMonth, 2, 0, STR_PAD_LEFT));
     // Only generate a link if there are events (see #4160)
     if ($objMinMax->dateFrom !== null && $intPrevYm >= date('Ym', $objMinMax->dateFrom) || $intPrevYm >= date('Ym')) {
         $objTemplate->prevHref = $this->strUrl . '?month=' . $intPrevYm;
         $objTemplate->prevTitle = \StringUtil::specialchars($lblPrevious);
         $objTemplate->prevLink = $GLOBALS['TL_LANG']['MSC']['cal_previous'] . ' ' . $lblPrevious;
         $objTemplate->prevLabel = $GLOBALS['TL_LANG']['MSC']['cal_previous'];
     }
     // Current month
     $objTemplate->current = $GLOBALS['TL_LANG']['MONTHS'][date('m', $this->Date->tstamp) - 1] . ' ' . date('Y', $this->Date->tstamp);
     // Next month
     $nextMonth = $intMonth == 12 ? 1 : $intMonth + 1;
     $nextYear = $intMonth == 12 ? $intYear + 1 : $intYear;
     $lblNext = $GLOBALS['TL_LANG']['MONTHS'][$nextMonth - 1] . ' ' . $nextYear;
     $intNextYm = $nextYear . str_pad($nextMonth, 2, 0, STR_PAD_LEFT);
     // Only generate a link if there are events (see #4160)
     if ($objMinMax->dateTo !== null && $intNextYm <= date('Ym', max($objMinMax->dateTo, $objMinMax->repeatUntil)) || $intNextYm <= date('Ym')) {
         $objTemplate->nextHref = $this->strUrl . '?month=' . $intNextYm;
         $objTemplate->nextTitle = \StringUtil::specialchars($lblNext);
         $objTemplate->nextLink = $lblNext . ' ' . $GLOBALS['TL_LANG']['MSC']['cal_next'];
         $objTemplate->nextLabel = $GLOBALS['TL_LANG']['MSC']['cal_next'];
     }
     // Set the week start day
     if (!$this->cal_startDay) {
         $this->cal_startDay = 0;
     }
     $objTemplate->days = $this->compileDays();
     $objTemplate->weeks = $this->compileWeeks();
     $objTemplate->substr = $GLOBALS['TL_LANG']['MSC']['dayShortLength'];
     $this->Template->calendar = $objTemplate->parse();
 }
开发者ID:contao,项目名称:calendar-bundle,代码行数:62,代码来源:ModuleCalendar.php

示例14: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $dc = \Contao\Database::getInstance();
     $row = $dc->prepare('SELECT * FROM tl_rs_settings WHERE id = ?')->limit(1)->execute($this->rs_setting)->fetchAssoc();
     $href = '';
     if ($row) {
         $customerid = '6857';
         $lang = $row['language_demo'];
         $speed = $row['speed'];
         $readid = $this->rs_readid ? $this->rs_readid : $this->strColumn;
         $stattype = \Contao\Environment::get('host');
         $url = \Contao\Environment::get('base');
         $url2 = \Contao\Environment::get('requestUri');
         if ($url2 != '/') {
             $url .= substr($url2, 1);
         }
         if ($row['have_license']) {
             $customerid = $row['customer_id'];
             $lang = $row['language'];
         }
         $protocol = \Contao\Environment::get('https');
         $ssl = false;
         if (isset($protocol)) {
             if ('on' == strtolower($protocol)) {
                 $ssl = true;
             }
             if ('1' == $protocol) {
                 $ssl = true;
             }
         }
         if (!$GLOBALS['RS_IN_HEAD']) {
             $GLOBALS['RS_IN_HEAD'] = true;
             if ($ssl) {
                 $GLOBALS['TL_HEAD'][] = '<script src="system/modules/readspeaker/assets/rs_ssl/ReadSpeaker.js?pids=embhl" type="text/javascript"></script>';
             } else {
                 $GLOBALS['TL_HEAD'][] = '<script src="http://f1.eu.readspeaker.com/script/' . $customerid . '/ReadSpeaker.js?pids=embhl" type="text/javascript"></script>';
             }
         }
         $GLOBALS['TL_HEAD'][] = '<script src="system/modules/readspeaker/assets/readspeaker.js"></script>';
         $GLOBALS['TL_HEAD'][] = '<script type="text/javascript">
                                 <!--
                                 window.rsConf = {general: {usePost: true}};
                                 //-->
                                 </script>';
         $href = '';
         if ($ssl) {
             $href .= "https://app.readspeaker.com/cgi-bin/rsent?";
         } else {
             $href .= "http://app.eu.readspeaker.com/cgi-bin/rsent?";
         }
         $href .= "customerid=" . $customerid;
         $href .= "&amp;lang=" . $lang;
         $href .= "&amp;readid=" . $readid;
         $href .= "&amp;url=" . urlencode($url);
         $href .= "&amp;stattype=" . $stattype;
     }
     $this->Template->href = $href;
     $this->Template->button_title = $this->rs_player_title;
 }
开发者ID:joeherold,项目名称:readspeaker,代码行数:62,代码来源:FE_ReadSpeaker.php

示例15: generateUrlPath

 /**
  * Generate the URL path
  *
  * @param PageModel $pageModel
  *
  * @return string
  */
 protected function generateUrlPath(PageModel $pageModel)
 {
     $pageModel->loadDetails();
     if (($rootModel = PageModel::findByPk($pageModel->rootId)) === null) {
         return '';
     }
     return ($rootModel->rootUseSSL ? 'https://' : 'http://') . ($rootModel->domain ?: Environment::get('host')) . TL_PATH . '/' . $pageModel->alias . '/';
 }
开发者ID:derhaeuptling,项目名称:contao-seo-serp-preview,代码行数:15,代码来源:AbstractEngine.php


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