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


PHP Environment::get方法代码示例

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


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

示例1: sendPasswordLink

 /**
  * Send a lost password e-mail
  * @param object
  */
 protected function sendPasswordLink($objMember)
 {
     $objNotification = \NotificationCenter\Model\Notification::findByPk($this->nc_notification);
     if ($objNotification === null) {
         $this->log('The notification was not found ID ' . $this->nc_notification, __METHOD__, TL_ERROR);
         return;
     }
     $confirmationId = md5(uniqid(mt_rand(), true));
     // Store the confirmation ID
     $objMember = \MemberModel::findByPk($objMember->id);
     $objMember->activation = $confirmationId;
     $objMember->save();
     $arrTokens = array();
     // Add member tokens
     foreach ($objMember->row() as $k => $v) {
         $arrTokens['member_' . $k] = $v;
     }
     $arrTokens['recipient_email'] = $objMember->email;
     $arrTokens['domain'] = \Idna::decode(\Environment::get('host'));
     $arrTokens['link'] = \Idna::decode(\Environment::get('base')) . \Environment::get('request') . ($GLOBALS['TL_CONFIG']['disableAlias'] || strpos(\Environment::get('request'), '?') !== false ? '&' : '?') . 'token=' . $confirmationId;
     $objNotification->send($arrTokens);
     $this->log('A new password has been requested for user ID ' . $objMember->id . ' (' . $objMember->email . ')', __METHOD__, TL_ACCESS);
     // Check whether there is a jumpTo page
     if (($objJumpTo = $this->objModel->getRelated('jumpTo')) !== null) {
         $this->jumpToOrReload($objJumpTo->row());
     }
     $this->reload();
 }
开发者ID:seaneble,项目名称:contao-notification_center,代码行数:32,代码来源:ModulePasswordNotificationCenter.php

示例2: run

 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_live_update');
     $objTemplate->updateClass = 'tl_confirm';
     $objTemplate->updateHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdate'];
     $objTemplate->isActive = $this->isActive();
     $strMessage = ' <a href="contao/changelog.php" onclick="Backend.openModalIframe({\'width\':860,\'title\':\'CHANGELOG\',\'url\':this.href});return false" title="' . specialchars($GLOBALS['TL_LANG']['tl_maintenance']['changelog']) . '"><img src="' . TL_FILES_URL . 'system/themes/' . \Backend::getTheme() . '/images/changelog.gif" width="14" height="14" alt="" style="vertical-align:text-bottom;padding-left:3px"></a>';
     // Newer version available
     if (\Config::get('latestVersion') && version_compare(VERSION . '.' . BUILD, \Config::get('latestVersion'), '<')) {
         $objTemplate->updateClass = 'tl_info';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['newVersion'], \Config::get('latestVersion')) . $strMessage;
     } else {
         $objTemplate->updateClass = 'tl_confirm';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['upToDate'], VERSION . '.' . BUILD) . $strMessage;
     }
     // Automatically switch to SSL
     if (\Environment::get('ssl')) {
         \Config::set('liveUpdateBase', str_replace('http://', 'https://', \Config::get('liveUpdateBase')));
     }
     $objTemplate->uid = \Config::get('liveUpdateId');
     $objTemplate->updateServer = \Config::get('liveUpdateBase') . 'index.php';
     // Run the update
     if (\Input::get('token') != '') {
         $this->runLiveUpdate($objTemplate);
     }
     $objTemplate->version = VERSION . '.' . BUILD;
     $objTemplate->liveUpdateId = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdateId'];
     $objTemplate->runLiveUpdate = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['runLiveUpdate']);
     $objTemplate->referer = base64_encode(\Environment::get('base') . \Environment::get('request') . '|' . \Environment::get('server'));
     $objTemplate->updateHelp = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['updateHelp'], '<a href="http://luid.inetrobots.com" target="_blank">Live Update ID</a>');
     $objTemplate->phar = file_exists(TL_ROOT . '/contao/update.phar.php');
     $objTemplate->toLiveUpdate = $GLOBALS['TL_LANG']['tl_maintenance']['toLiveUpdate'];
     return $objTemplate->parse();
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:40,代码来源:LiveUpdate.php

示例3: run

 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_maintenance_mode');
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->headline = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceMode'];
     $objTemplate->isActive = $this->isActive();
     try {
         $driver = \System::getContainer()->get('lexik_maintenance.driver.factory')->getDriver();
         $isLocked = $driver->isExists();
     } catch (\Exception $e) {
         return '';
     }
     // Toggle the maintenance mode
     if (\Input::post('FORM_SUBMIT') == 'tl_maintenance_mode') {
         if ($isLocked) {
             $driver->unlock();
         } else {
             $driver->lock();
         }
         $this->reload();
     }
     if ($isLocked) {
         $objTemplate->class = 'tl_confirm';
         $objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceEnabled'];
         $objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceDisable'];
     } else {
         $objTemplate->class = 'tl_info';
         $objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceDisabled'];
         $objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceEnable'];
     }
     return $objTemplate->parse();
 }
开发者ID:contao,项目名称:core-bundle,代码行数:38,代码来源:Maintenance.php

示例4: compile

 /**
  * Compile the view
  */
 protected function compile()
 {
     if (!$this->getConfigAttribute('plain')) {
         if ($this->getConfigAttribute('table') === true) {
             $this->setConfigAttribute('table', $this->definition->getName());
         }
         if ($this->getConfigAttribute('id') === true) {
             $this->setConfigAttribute('id', \Input::get('id'));
         }
         $strHref = \Environment::get('script') . '?do=' . \Input::get('do');
         if ($this->view->getHref() != '') {
             $strHref .= '&amp;' . $this->view->getHref();
         }
         $this->setConfigAttribute('rt', \RequestToken::get());
         $attributes = array();
         if ($this->getConfigAttribute('id')) {
             $attributes[] = 'id';
         }
         if ($this->getConfigAttribute('table')) {
             $attributes[] = 'table';
         }
         $attributes[] = 'rt';
         $strHref .= '&amp;' . $this->buildHref($attributes);
         $this->view->setHref($strHref);
     }
 }
开发者ID:netzmacht,项目名称:contao-dcatools,代码行数:29,代码来源:Controller.php

示例5: getConfiguration

 public function getConfiguration($param)
 {
     $dc = Database::getInstance();
     $obj = $dc->prepare('SELECT * FROM tl_rs_settings ORDER BY have_license,language, language_demo ASC')->execute()->fetchAllAssoc();
     $returner = array();
     $error = true;
     $edit_link = '<a href="contao/main.php?do=readspeaker_settings&act=edit&id=%s&amp;rt=%s&ref=%s" title="" class="edit"><img src="system/themes/default/images/edit.gif" width="12" height="16" alt="Edit "></a>';
     if (count($obj) >= 1) {
         $error = false;
         foreach ($obj as $key => $row) {
             if ($row['have_license']) {
                 $returner['ID: ' . $row['customer_id']][$row['id']] = $GLOBALS['TL_LANG']['MSC']['rs_language_codes'][$row['language']] . ' ' . ($row['domain'] ? '[' . $row['domain'] . ']' : '');
                 // . ' ' . ($row['note'] ? '<span class="tl_blue" >[' . $row['note'] . ']</span>' : '');
             } else {
                 $returner['DEMO'][$row['id']] = $GLOBALS['TL_LANG']['MSC']['rs_language_codes'][$row['language_demo']] . ' ' . ($row['domain'] ? '[' . $row['domain'] . ']' : '');
                 // . ' ' . ($row['note'] ? '<span class="tl_blue" >[' . $row['note'] . ']</span>' : '');
             }
         }
     }
     if ($error) {
         $session = $this->Session->get('referer');
         $session[TL_REFERER_ID]['current'] = substr(\Environment::get('requestUri'), strlen(TL_PATH) + 1);
         $this->Session->set('referer', $session);
         Message::addRaw(sprintf($GLOBALS['TL_LANG']['tl_module']['error']['error_no_settings'], REQUEST_TOKEN, TL_REFERER_ID));
     }
     return $returner;
 }
开发者ID:joeherold,项目名称:readspeaker,代码行数:27,代码来源:tl_module.php

示例6: generateRobotsTxts

 /**
  * Generate the robots.txt files
  */
 public static function generateRobotsTxts()
 {
     // delete all existing domain specific robots.txt files
     foreach (scandir(static::getDomainSpecificFolderPath(true)) as $entry) {
         if (!is_dir($entry) && ($pos = strpos($entry, FILE_ROBOTS_TXT_DOMAIN_SPECIFIC_PREFIX)) !== FALSE && $pos == 0 && ($pos = strpos($entry, FILE_ROBOTS_TXT_DOMAIN_SPECIFIC_SUFFIX)) !== FALSE && $pos == strlen($entry) - strlen(FILE_ROBOTS_TXT_DOMAIN_SPECIFIC_SUFFIX)) {
             $filePathOld = static::getDomainSpecificFolderPath(true) . "/" . $entry;
             if (file_exists($filePathOld)) {
                 unlink($filePathOld);
             }
         }
     }
     // create all robots.txt files
     $blnGenerationSuccess = true;
     $objFallbackRootPage = static::getFallbackRootPages();
     while ($objFallbackRootPage->next()) {
         $filePath = TL_ROOT . "/" . FILE_ROBOTS_TXT;
         if (static::isDomainSpecicCreationAllowed($objFallbackRootPage->useDomainSpecificRobotsTxt)) {
             $filePath = static::getDomainSpecificFilePath($objFallbackRootPage->alias, true);
         }
         $fileContent = $objFallbackRootPage->robotsTxtContent;
         if ($objFallbackRootPage->createSitemap && $objFallbackRootPage->sitemapName != '' && $objFallbackRootPage->robotsTxtAddAbsoluteSitemapPath) {
             $strDomain = ($objFallbackRootPage->useSSL ? 'https://' : 'http://') . ($objFallbackRootPage->dns ?: \Environment::get('host')) . TL_PATH . '/';
             $fileContent .= "\n";
             $objRootPage = static::getRootPagesByDns($objFallbackRootPage->dns);
             while ($objRootPage->next()) {
                 $fileContent .= "Sitemap: " . $strDomain . "share/" . $objRootPage->sitemapName . ".xml\n";
             }
         }
         if (file_put_contents($filePath, $fileContent) === FALSE) {
             $blnGenerationSuccess = false;
         }
     }
     return $blnGenerationSuccess;
 }
开发者ID:hofff,项目名称:contao-robots-txt-editor,代码行数:37,代码来源:RobotsTxtEditor.php

示例7: sendPersonalDataEmail

 /**
  * Send the personal data change e-mail
  * @param object
  * @param array
  * @param object
  */
 public function sendPersonalDataEmail($objUser, $arrData, $objModule)
 {
     if (!$objModule->nc_notification) {
         return;
     }
     $arrTokens = array();
     $arrTokens['admin_email'] = $GLOBALS['TL_ADMIN_EMAIL'];
     $arrTokens['domain'] = \Environment::get('host');
     // Support newsletters
     if (in_array('newsletter', $this->Config->getActiveModules())) {
         if (!is_array($arrData['newsletter'])) {
             if ($arrData['newsletter'] != '') {
                 $objChannels = \Database::getInstance()->execute("SELECT title FROM tl_newsletter_channel WHERE id IN(" . implode(',', array_map('intval', (array) $arrData['newsletter'])) . ")");
                 $arrTokens['member_newsletter'] = implode("\n", $objChannels->fetchEach('title'));
             } else {
                 $arrTokens['member_newsletter'] = '';
             }
         }
     }
     // Translate/format old values
     foreach ($_SESSION['PERSONAL_DATA'] as $strFieldName => $strFieldValue) {
         $arrTokens['member_old_' . $strFieldName] = \Haste\Util\Format::dcaValue('tl_member', $strFieldName, $strFieldValue);
     }
     // Translate/format new values
     foreach ($arrData as $strFieldName => $strFieldValue) {
         $arrTokens['member_' . $strFieldName] = \Haste\Util\Format::dcaValue('tl_member', $strFieldName, $strFieldValue);
     }
     $objNotification = \NotificationCenter\Model\Notification::findByPk($objModule->nc_notification);
     if ($objNotification !== null) {
         $objNotification->send($arrTokens);
     }
 }
开发者ID:seaneble,项目名称:contao-notification_center,代码行数:38,代码来源:ContaoHelper.php

示例8: 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:rheintechnology,项目名称:core,代码行数:34,代码来源:ModuleNavigation.php

示例9: run

 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_live_update');
     $objTemplate->updateClass = 'tl_confirm';
     $objTemplate->updateHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdate'];
     $objTemplate->isActive = $this->isActive();
     // Newer version available
     if (\Config::get('latestVersion') && version_compare(VERSION . '.' . BUILD, \Config::get('latestVersion'), '<')) {
         $objTemplate->updateClass = 'tl_info';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['newVersion'], \Config::get('latestVersion'));
     } else {
         $objTemplate->updateClass = 'tl_confirm';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['upToDate'], VERSION . '.' . BUILD);
     }
     // Automatically switch to SSL
     if (\Environment::get('ssl')) {
         \Config::set('liveUpdateBase', str_replace('http://', 'https://', \Config::get('liveUpdateBase')));
     }
     $objTemplate->uid = \Config::get('liveUpdateId');
     $objTemplate->updateServer = \Config::get('liveUpdateBase') . 'index.php';
     // Run the update
     if (\Input::get('token') != '') {
         $this->runLiveUpdate($objTemplate);
     }
     $objTemplate->version = VERSION . '.' . BUILD;
     $objTemplate->liveUpdateId = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdateId'];
     $objTemplate->runLiveUpdate = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['runLiveUpdate']);
     $objTemplate->referer = base64_encode(\Environment::get('base') . \Environment::get('request') . '|' . \Environment::get('server'));
     $objTemplate->updateHelp = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['updateHelp'], '<a href="http://luid.inetrobots.com" target="_blank">Live Update ID</a>');
     $objTemplate->phar = file_exists(TL_ROOT . '/contao/update.phar.php');
     $objTemplate->toLiveUpdate = $GLOBALS['TL_LANG']['tl_maintenance']['toLiveUpdate'];
     return $objTemplate->parse();
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:39,代码来源:LiveUpdate.php

示例10: run

 /**
  * Run the controller and parse the login template
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_login');
     // Show a cookie warning
     if (\Input::get('referer', true) != '' && empty($_COOKIE)) {
         $objTemplate->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
     }
     $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 = 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 = 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->frontendFile = \Environment::get('base');
     $objTemplate->disableCron = \Config::get('disableCron');
     $objTemplate->ie6warning = sprintf($GLOBALS['TL_LANG']['ERR']['ie6warning'], '<a href="http://ie6countdown.com">', '</a>');
     $objTemplate->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $objTemplate->output();
 }
开发者ID:rheintechnology,项目名称:core,代码行数:36,代码来源:BackendIndex.php

示例11: run

 /**
  * Run the controller and parse the template
  */
 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);
     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 = \Environment::get('base');
     }
     // Switch to a particular member (see #6546)
     if (\Input::get('user') && $this->User->isAdmin) {
         $objUser = \MemberModel::findByUsername(\Input::get('user'));
         if ($objUser !== null) {
             $strHash = sha1(session_id() . (!\Config::get('disableIpCheck') ? \Environment::get('ip') : '') . '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', session_id(), \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');
         }
     }
     \Config::set('debugMode', false);
     $objTemplate->output();
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:36,代码来源:BackendPreview.php

示例12: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $arrJumpTo = array();
     $arrNewsletter = array();
     $strRequest = ampersand(\Environment::get('request'), true);
     $objNewsletter = \NewsletterModel::findSentByPids($this->nl_channels);
     if ($objNewsletter !== null) {
         while ($objNewsletter->next()) {
             if (($objTarget = $objNewsletter->getRelated('pid')) === null) {
                 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])) {
                 $objJumpTo = $objTarget->getRelated('jumpTo')->loadDetails();
                 if ($objJumpTo !== null) {
                     $arrJumpTo[$objTarget->jumpTo] = $this->generateFrontendUrl($objJumpTo->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s');
                 } else {
                     $arrJumpTo[$objTarget->jumpTo] = $strUrl;
                 }
             }
             $strUrl = $arrJumpTo[$objTarget->jumpTo];
             $strAlias = $objNewsletter->alias != '' && !\Config::get('disableAlias') ? $objNewsletter->alias : $objNewsletter->id;
             $arrNewsletter[] = array('subject' => $objNewsletter->subject, 'title' => strip_insert_tags($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->channel);
         }
     }
     $this->Template->newsletters = $arrNewsletter;
 }
开发者ID:iCodr8,项目名称:core,代码行数:36,代码来源:ModuleNewsletterList.php

示例13: registerViewAssets

 public function registerViewAssets()
 {
     $al = \AssetList::getInstance();
     $v = \View::getInstance();
     $env = \Environment::get();
     $identifier = 'menuitem/' . $this->menuItem->getHandle() . '/view';
     foreach (array('CSS' => 'view.css', 'JAVASCRIPT' => 'view.js') as $t => $i) {
         $r = $env->getRecord(DIRNAME_MENU_ITEMS . '/' . $this->menuItem->getHandle() . '/' . $i, $this->menuItem->getPackageHandle());
         if ($r->exists()) {
             switch ($t) {
                 case 'CSS':
                     $asset = new CssAsset($identifier);
                     $asset->setAssetURL($r->url);
                     $asset->setAssetPath($r->file);
                     $al->registerAsset($asset);
                     $v->requireAsset('css', $identifier);
                     break;
                 case 'JAVASCRIPT':
                     $asset = new JavascriptAsset($identifier);
                     $asset->setAssetURL($r->url);
                     $asset->setAssetPath($r->file);
                     $al->registerAsset($asset);
                     $v->requireAsset('javascript', $identifier);
                     break;
             }
         }
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:28,代码来源:Controller.php

示例14: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->Template->size = '';
     // Set the size
     if ($this->playerSize != '') {
         $size = deserialize($this->playerSize);
         if (is_array($size)) {
             $this->Template->size = ' width="' . $size[0] . '" height="' . $size[1] . '"';
         }
     }
     $this->Template->poster = false;
     // Optional poster
     if ($this->posterSRC != '') {
         if (($objFile = \FilesModel::findByUuid($this->posterSRC)) !== null) {
             $this->Template->poster = $objFile->path;
         }
     }
     // Check for SSL (see #6900)
     $protocol = \Environment::get('ssl') ? 'https://' : 'http://';
     $objFile = new \stdClass();
     $objFile->mime = 'video/x-youtube';
     $objFile->path = $protocol . 'www.youtube.com/watch?v=' . $this->youtube;
     $this->Template->isVideo = true;
     $this->Template->files = array($objFile);
     $this->Template->autoplay = $this->autoplay;
 }
开发者ID:iCodr8,项目名称:core,代码行数:29,代码来源:ContentYouTube.php

示例15: 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&amp;table=tl_module&amp;act=edit&amp;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) {
         /** @var \PageModel $objTarget */
         $strRedirect = $objTarget->getFrontendUrl();
     }
     // Log out and redirect
     if ($this->User->logout()) {
         $this->redirect($strRedirect);
     }
     return '';
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:36,代码来源:ModuleLogout.php


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