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


PHP Localization::changeLocale方法代码示例

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


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

示例1: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     if (\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale')) {
         return;
     }
     if (!$c) {
         $c = Page::getCurrentPage();
     }
     // don't translate dashboard pages
     $dh = \Core::make('helper/concrete/dashboard');
     if ($dh->inDashboard($c)) {
         return;
     }
     $ms = Section::getBySectionOfSite($c);
     if (!is_object($ms)) {
         $ms = static::getPreferredSection();
     }
     if (!$ms) {
         return;
     }
     $locale = $ms->getLocale();
     if (strlen($locale)) {
         \Localization::changeLocale($locale);
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:Detector.php

示例2: testAndRunInstall

	protected function testAndRunInstall() {
		if (file_exists(DIR_CONFIG_SITE . '/site_install_user.php')) {
			require(DIR_CONFIG_SITE . '/site_install.php');
			@include(DIR_CONFIG_SITE . '/site_install_user.php');
			if (defined('ACTIVE_LOCALE') && Localization::activeLocale() !== ACTIVE_LOCALE) {
				Localization::changeLocale(ACTIVE_LOCALE);
			}
			$e = Loader::helper('validation/error');
			$e = $this->validateDatabase($e);
			if ($e->has()) {
				$this->set('error', $e);
			} else {
				$this->addHeaderItem(Loader::helper('html')->css('jquery.ui.css'));
				$this->addHeaderItem(Loader::helper('html')->javascript('jquery.ui.js'));
				if (defined('INSTALL_STARTING_POINT') && INSTALL_STARTING_POINT) { 
					$spl = Loader::startingPointPackage(INSTALL_STARTING_POINT);
				} else {
					$spl = Loader::startingPointPackage('standard');
				}
				$this->set('installPackage', $spl->getPackageHandle());
				$this->set('installRoutines', $spl->getInstallRoutines());
				$this->set('successMessage', t('Congratulations. concrete5 has been installed. You have been logged in as <b>%s</b> with the password you chose. If you wish to change this password, you may do so from the users area of the dashboard.', USER_SUPER, $uPassword));
			}
		}
	}
开发者ID:nveid,项目名称:concrete5,代码行数:25,代码来源:install.php

示例3: do_update

	public function do_update($pkgHandle = false) {
		$tp = new TaskPermission();
		if ($tp->canInstallPackages()) { 
			if ($pkgHandle) {
				$tests = Package::testForInstall($pkgHandle, false);
				if (is_array($tests)) {
					$tests = Package::mapError($tests);
					$this->set('error', $tests);
				} else {
					$p = Package::getByHandle($pkgHandle);
					$currentLocale = Localization::activeLocale();
					if ($currentLocale != 'en_US') {
						// Prevent the database records being stored in wrong language
						Localization::changeLocale('en_US');
					}
					try {
						$p->upgradeCoreData();
						if ($currentLocale != 'en_US') {
							Localization::changeLocale($currentLocale);
						}
						$p->upgrade();
						$this->set('message', t('The package has been updated successfully.'));
					} catch(Exception $e) {
						$this->set('error', $e);
					}
				}
			}
		}
		$this->view();
	}
开发者ID:nveid,项目名称:concrete5,代码行数:30,代码来源:update.php

示例4: getSiteNameForLocale

 /**
  * Get the localized site name.
  *
  * @param string $locale
  *
  * @return string
  */
 protected function getSiteNameForLocale($locale)
 {
     static $names = array();
     if (!isset($names[$locale])) {
         $prevLocale = \Localization::activeLocale();
         if ($prevLocale !== $locale) {
             \Localization::changeLocale($locale);
         }
         $names[$locale] = tc('SiteName', $this->app->make('config')->get('concrete.site'));
         if ($prevLocale !== $locale) {
             \Localization::changeLocale($prevLocale);
         }
     }
     return $names[$locale];
 }
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:22,代码来源:bulk.php

示例5: changeLocale

 static function changeLocale($locale)
 {
     // change core language to translate e.g. core blocks/themes
     if (strlen($locale)) {
         Localization::changeLocale($locale);
         // site translations
         $loc = Localization::getInstance();
         $loc->addSiteInterfaceLanguage($locale);
         // add package translations
         $pl = PackageList::get();
         $installed = $pl->getPackages();
         foreach ($installed as $pkg) {
             if ($pkg instanceof Package) {
                 $pkg->setupPackageLocalization($locale);
             }
         }
     }
 }
开发者ID:rratcliffe,项目名称:fsen,代码行数:18,代码来源:fsen_localization.php

示例6: testTimeSince

 public function testTimeSince()
 {
     Localization::changeLocale("en_US");
     $minutes = 60;
     $hours = $minutes * 60;
     $days = $hours * 24;
     // time is in the future
     $future = time() + 7;
     $this->assertEquals($this->object->formatDate($future), $this->object->timeSince($future));
     // time is now
     $this->assertEquals("0 seconds", $this->object->timeSince(time()));
     // time is in the past
     $this->assertEquals("7 seconds", $this->object->timeSince(time() - 7));
     $this->assertEquals("3 minutes", $this->object->timeSince(time() - (3 * $minutes + 13)));
     $this->assertEquals("3 minutes, 13 seconds", $this->object->timeSince(time() - (3 * $minutes + 13), 1));
     $this->assertEquals("4 hours", $this->object->timeSince(time() - (4 * $hours + 2 * $minutes)));
     $this->assertEquals("4 hours, 1 minute", $this->object->timeSince(time() - (4 * $hours + 1 * $minutes), 1));
     $this->assertEquals("1 day", $this->object->timeSince(time() - (1 * $days + 1 * $minutes)));
     $this->assertEquals("2 days, 2 hours", $this->object->timeSince(time() - (2 * $days + 2 * $hours), 1));
     $this->assertEquals('145 days', $this->object->timeSince(time() - 145 * $days));
     $this->assertEquals($this->object->formatDate(time() - 367 * $days), $this->object->timeSince(time() - 367 * $days));
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:22,代码来源:DateHelperTest.php

示例7: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
?>

<?php 
if (!is_array($messages)) {
    $messages = array();
}
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
$page = Page::getByID($cID);
$ms = \Concrete\Core\Multilingual\Page\Section\Section::getBySectionOfSite($page);
if (is_object($ms)) {
    Localization::changeLocale($ms->getLocale());
}
$editor = \Concrete\Core\Conversation\Editor\Editor::getActive();
$editor->setConversationObject($args['conversation']);
$val = Loader::helper('validation/token');
$form = Loader::helper('form');
?>

<?php 
Loader::element('conversation/message/add_form', array('blockAreaHandle' => $blockAreaHandle, 'cID' => $cID, 'bID' => $bID, 'editor' => $editor, 'addMessageLabel' => $addMessageLabel, 'attachmentsEnabled' => $attachmentsEnabled, 'displayForm' => $displayForm, 'displayPostingForm' => $displayPostingForm, 'position' => 'top', 'enablePosting' => $enablePosting, 'conversation' => $conversation));
?>


<div class="ccm-conversation-message-list ccm-conversation-messages-<?php 
echo $displayMode;
?>
">
开发者ID:seebaermichi,项目名称:concrete5,代码行数:31,代码来源:display.php

示例8: doInstallBlockType

		/**
		 * installs a block type
		 * @param string $btHandle
		 * @param BlockType $bt
		 * @param string $dir
		 * @param int $btID
		 * @param string $dirDbXml
		 */
		protected function doInstallBlockType($btHandle, $bt, $dir, $btID = 0, $dirDbXml) {
			$db = Loader::db();
			$env = Environment::get();
			$env->clearOverrideCache();
			
			if (file_exists($dir . '/' . $btHandle . '/' . FILENAME_BLOCK_CONTROLLER)) {
				$class = $bt->getBlockTypeClass();
				
				$path = $dirDbXml . '/' . $btHandle;
				if (!class_exists($class)) {
					require_once($dir . '/' . $btHandle . '/' . FILENAME_BLOCK_CONTROLLER);
				}
				
				if (!class_exists($class)) {
					throw new Exception(t("%s not found. Please check that the block controller file contains the correct class name.", $class));
				}
				$bta = new $class;
				
				//Attempt to run the subclass methods (install schema from db.xml, etc.)
				$r = $bta->install($path);

				//Validate
				if ($r === false) {
					return t('Error: Block Type cannot be installed because no db.xml file can be found. Either create a db.xml file for this block type, or remove the $btTable variable from its controller.');
				} else if (!$r->result && $r->message) {
					return $r->message;
				} else if (!$r->result && !$r->message) {
					return t('Error: Block Type cannot be installed due to an unknown database error. Please check that the db.xml file for this block type is formatted correctly.');
				} else if ($message = BlockType::validateInstalledDatabaseTable($bta->getBlockTypeDatabaseTable())) {
					$db->Execute('DROP TABLE IF EXISTS ' . $bta->getBlockTypeDatabaseTable());
					return $message;
				}
				
				$currentLocale = Localization::activeLocale();
				if ($currentLocale != 'en_US') {
					// Prevent the database records being stored in wrong language
					Localization::changeLocale('en_US');
				}

				//Install the block
				$btd = new BlockTypeDB();
				$btd->btHandle = $btHandle;
				$btd->btName = $bta->getBlockTypeName();
				$btd->btDescription = $bta->getBlockTypeDescription();
				$btd->btActiveWhenAdded = $bta->isActiveWhenAdded();
				$btd->btCopyWhenPropagate = $bta->isCopiedWhenPropagated();
				$btd->btIncludeAll = $bta->includeAll();
				$btd->btIsInternal = $bta->isBlockTypeInternal();
				$btd->btInterfaceHeight = $bta->getInterfaceHeight();
				$btd->btInterfaceWidth = $bta->getInterfaceWidth();
				$btd->pkgID = $bt->getPackageID();
				if ($currentLocale != 'en_US') {
					Localization::changeLocale($currentLocale);
				}
				
				if ($btID > 0) {
					$btd->btID = $btID;
					$btDisplayOrder = $db->GetOne('select btDisplayOrder from BlockTypes where btID = ?', array($btID));
					if (!$btDisplayOrder) {
						$btDisplayOrder = 0;
					}
					$btd->btDisplayOrder = $btDisplayOrder;
					$r = $btd->Replace();
				} else {
					if ($bta->isBlockTypeInternal()) {
						$btd->btDisplayOrder = 0;
					} else {
						$btMax = $db->GetOne('select max(btDisplayOrder) from BlockTypes');
						if ($btMax < 1 && $btMax !== '0') {
							$btd->btDisplayOrder = 0;
						} else {
							$btd->btDisplayOrder = $btMax + 1;
						}
					}

					$r = $btd->save();
				}
				
				// now we remove the block type from cache
				$ca = new Cache();
				$ca->delete('blockTypeByID', $btID);
				$ca->delete('blockTypeByHandle', $btHandle);
				$ca->delete('blockTypeList', false);		 	

				if (!$r) {
					return $db->ErrorMsg();
				}
			} else {
				return t("No block found with the handle %s.", $btHandle);
			}
		}
开发者ID:ronlobo,项目名称:concrete5,代码行数:99,代码来源:block_types.php

示例9: testSpecialFormats

 public function testSpecialFormats()
 {
     Localization::changeLocale('en_US');
     $activeUser = User::isLoggedIn() ? new User() : null;
     if ($activeUser) {
         $activeUser->logout();
     }
     $timestamp = time();
     foreach (array('FILENAME', 'FILE_PROPERTIES', 'FILE_VERSIONS', 'FILE_DOWNLOAD', 'PAGE_VERSIONS', 'DASHBOARD_SEARCH_RESULTS_USERS', 'DASHBOARD_SEARCH_RESULTS_FILES', 'DASHBOARD_SEARCH_RESULTS_PAGES', 'DATE_ATTRIBUTE_TYPE_MDY', 'DATE_ATTRIBUTE_TYPE_T') as $formatName) {
         $this->assertEquals($this->object->date(constant("DATE_APP_{$formatName}"), $timestamp), $this->object->formatSpecial($formatName, $timestamp));
     }
     if ($activeUser) {
         User::getByUserID($activeUser->getUserID(), true);
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:15,代码来源:DateHelperTest.php

示例10: install_package

 public function install_package($package)
 {
     $tp = new TaskPermission();
     if ($tp->canInstallPackages()) {
         $p = Loader::package($package);
         if (is_object($p)) {
             if (!$p->showInstallOptionsScreen() || Loader::helper('validation/token')->validate('install_options_selected')) {
                 $tests = Package::testForInstall($package);
                 if (is_array($tests)) {
                     $tests = Package::mapError($tests);
                     $this->set('error', $tests);
                 } else {
                     $currentLocale = Localization::activeLocale();
                     if ($currentLocale != 'en_US') {
                         // Prevent the database records being stored in wrong language
                         Localization::changeLocale('en_US');
                     }
                     try {
                         $u = new User();
                         $pkg = $p->install($this->post());
                         if ($u->isSuperUser() && $p->allowsFullContentSwap() && $this->post('pkgDoFullContentSwap')) {
                             $p->swapContent($this->post());
                         }
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                         $pkg = Package::getByHandle($p->getPackageHandle());
                         $this->redirect('/dashboard/extend/install', 'package_installed', $pkg->getPackageID());
                     } catch (Exception $e) {
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                         if ($p->showInstallOptionsScreen()) {
                             $this->set('showInstallOptionsScreen', true);
                             $this->set('pkg', $p);
                         }
                         $this->set('error', $e);
                     }
                 }
             } else {
                 $this->set('showInstallOptionsScreen', true);
                 $this->set('pkg', $p);
             }
         } else {
             $msg = t('Install failed - invalid package. Check log for details');
             $this->error->add($msg);
             $this->set('error', $this->error);
         }
     } else {
         $this->error->add(t('You do not have permission to install add-ons.'));
         $this->set('error', $this->error);
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:53,代码来源:install.php

示例11: view

 public function view()
 {
     parent::view();
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $nh = Loader::helper('navigation');
     $av = Loader::helper('concrete/avatar');
     $valt = Loader::helper('validation/token');
     $imgHelper = Loader::helper('image');
     /* If no page is passed to edit, create a new page.
      */
     $load = $_REQUEST['load'];
     if (empty($load)) {
         // Find the parent page this should go under
         $cityPage = ($parentCID = $_REQUEST['parentCID']) ? Page::getByID($parentCID) : ($ui->getAttribute('home_city') ?: Page::getByPath('/canada/toronto'));
         $c = $this->getUnstartedWalk($u, $cityPage);
     } else {
         $c = Page::getByPath($load);
         $cityPage = Page::getByID($c->getCollectionParentID());
     }
     $walk_ward = trim((string) $c->getAttribute('walk_wards'));
     $city_wards = $cityPage->getAttribute('city_wards');
     if ($city_wards) {
         $wards = array_map(function ($ward) use($walk_ward) {
             if ($ward->value == $walk_ward) {
                 $ward->selected = true;
             }
             return $ward;
         }, $city_wards->getOptions());
     } else {
         $wards = null;
     }
     // Set the language based on a trail to the city
     /* Set the city language to the first one matched, recursing from where we are */
     $crumbs = $nh->getTrailToCollection($c);
     $crumbs[] = $c;
     // Must check the current page first
     foreach ($crumbs as $crumb) {
         if ($lang = (string) $crumb->getAttribute('lang')) {
             Localization::changeLocale($lang);
             break;
         }
     }
     // Load our city
     $latlng = explode(',', $cityPage->getAttribute('latlng'));
     // If you don't have a lat and a lng, final resort is Toronto. It's at least better than being 400km off the coast of Nigeria.
     if (count((array) $latlng) !== 2) {
         $latlng = [43.653226, -79.3831843];
     }
     // Instantiate as models, for JSON serialization
     $city = new City($cityPage);
     $walk = new Walk($c);
     // Build data needed by frontend
     $this->addToJanesWalk(['city' => $city, 'form' => ['valt' => $valt->generate('upload')], 'walk' => ['name' => (string) $walk, 'data' => $walk, 'url' => $nh->getCollectionURL($c)], 'locale' => ['name' => Localization::activeLocale(), 'translation' => Localization::getActiveTranslateJsonURL()]]);
     // Set the view name
     $this->bodyData['pageViewName'] = 'CreateWalkView';
     $this->set('u', $u);
     $this->set('ui', $ui);
     $this->set('owner', UserInfo::getByID($c->getCollectionUserID()));
     $this->set('nh', $nh);
     $this->set('av', $av);
     $this->set('load', $load);
     $this->set('c', $c);
     $this->set('city', $city);
     $this->set('country', $city->country);
     $this->set('ui_cityorganizer', $city->city_organizer);
     $this->set('imgHelper', $imgHelper);
     $this->set('wards', $wards);
     $this->set('is_nyc', $is_nyc);
     $this->set('lat', $latlng[0]);
     $this->set('lng', $latlng[1]);
     $this->set('bodyData', $this->bodyData);
     // Load JS we need in the form
     $html = Loader::helper('html');
     // Set default stylesheets for libs
     $this->addHeaderItem($html->css('jquery.ui.css'));
     // Set libs we'll need on the page
     $this->addFooterItem(Loader::helper('html')->javascript('jquery.ui.js'));
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:79,代码来源:form.php

示例12: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization()
 {
     // don't translate dashboard pages
     $c = Page::getCurrentPage();
     if ($c instanceof Page && Loader::helper('section', 'multilingual')->section('dashboard')) {
         return;
     }
     $ms = MultilingualSection::getCurrentSection();
     if (is_object($ms)) {
         $locale = $ms->getLocale();
     } else {
         $locale = DefaultLanguageHelper::getSessionDefaultLocale();
     }
     // change core language to translate e.g. core blocks/themes
     if (strlen($locale)) {
         Localization::changeLocale($locale);
     }
     // site translations
     if (is_dir(DIR_LANGUAGES_SITE_INTERFACE)) {
         if (file_exists(DIR_LANGUAGES_SITE_INTERFACE . '/' . $locale . '.mo')) {
             $loc = Localization::getInstance();
             $loc->addSiteInterfaceLanguage($locale);
         }
     }
     // add package translations
     if (strlen($locale)) {
         $ms = MultilingualSection::getByLocale($locale);
         if ($ms instanceof MultilingualSection) {
             $pl = PackageList::get();
             $installed = $pl->getPackages();
             foreach ($installed as $pkg) {
                 if ($pkg instanceof Package) {
                     $pkg->setupPackageLocalization($ms->getLocale());
                 }
             }
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:38,代码来源:default_language.php

示例13: get_environment_info

 public function get_environment_info()
 {
     $activeLocale = Localization::activeLocale();
     if ($activeLocale != 'en_US') {
         Localization::changeLocale('en_US');
     }
     $maxExecutionTime = ini_get('max_execution_time');
     set_time_limit(5);
     $environmentMessage = "# concrete5 Version\n" . APP_VERSION . "\n\n";
     $environmentMessage .= "# concrete5 Packages\n";
     $pla = PackageList::get();
     $pl = $pla->getPackages();
     $packages = array();
     foreach ($pl as $p) {
         if ($p->isPackageInstalled()) {
             $packages[] = $p->getPackageName() . ' (' . $p->getPackageVersion() . ')';
         }
     }
     if (count($packages) > 0) {
         natcasesort($packages);
         $environmentMessage .= implode(', ', $packages);
         $environmentMessage .= ".\n";
     } else {
         $environmentMessage .= "None\n";
     }
     $environmentMessage .= "\n";
     // overrides
     $environmentMessage .= "# concrete5 Overrides\n";
     $fh = Loader::helper('file');
     $overrides = array();
     $ovBlocks = $fh->getDirectoryContents(DIR_FILES_BLOCK_TYPES);
     $ovControllers = $fh->getDirectoryContents(DIR_FILES_CONTROLLERS);
     $ovElements = $fh->getDirectoryContents(DIR_FILES_ELEMENTS);
     $ovHelpers = $fh->getDirectoryContents(DIR_HELPERS);
     $ovJobs = $fh->getDirectoryContents(DIR_FILES_JOBS);
     $ovCSS = $fh->getDirectoryContents(DIR_BASE . '/' . DIRNAME_CSS);
     $ovJS = $fh->getDirectoryContents(DIR_BASE . '/' . DIRNAME_JAVASCRIPT);
     $ovLng = $fh->getDirectoryContents(DIR_BASE . '/' . DIRNAME_LANGUAGES);
     $ovLibs = $fh->getDirectoryContents(DIR_LIBRARIES);
     $ovMail = $fh->getDirectoryContents(DIR_FILES_EMAIL_TEMPLATES);
     $ovModels = $fh->getDirectoryContents(DIR_MODELS);
     $ovSingle = $fh->getDirectoryContents(DIR_FILES_CONTENT);
     $ovThemes = $fh->getDirectoryContents(DIR_FILES_THEMES);
     $ovTools = $fh->getDirectoryContents(DIR_FILES_TOOLS);
     foreach ($ovBlocks as $ovb) {
         $overrides[] = DIRNAME_BLOCKS . '/' . $ovb;
     }
     foreach ($ovControllers as $ovb) {
         $overrides[] = DIRNAME_CONTROLLERS . '/' . $ovb;
     }
     foreach ($ovElements as $ovb) {
         $overrides[] = DIRNAME_ELEMENTS . '/' . $ovb;
     }
     foreach ($ovHelpers as $ovb) {
         $overrides[] = DIRNAME_HELPERS . '/' . $ovb;
     }
     foreach ($ovJobs as $ovb) {
         $overrides[] = DIRNAME_JOBS . '/' . $ovb;
     }
     foreach ($ovJS as $ovb) {
         $overrides[] = DIRNAME_JAVASCRIPT . '/' . $ovb;
     }
     foreach ($ovCSS as $ovb) {
         $overrides[] = DIRNAME_CSS . '/' . $ovb;
     }
     foreach ($ovLng as $ovb) {
         $overrides[] = DIRNAME_LANGUAGES . '/' . $ovb;
     }
     foreach ($ovLibs as $ovb) {
         $overrides[] = DIRNAME_LIBRARIES . '/' . $ovb;
     }
     foreach ($ovMail as $ovb) {
         $overrides[] = DIRNAME_MAIL_TEMPLATES . '/' . $ovb;
     }
     foreach ($ovModels as $ovb) {
         $overrides[] = DIRNAME_MODELS . '/' . $ovb;
     }
     foreach ($ovSingle as $ovb) {
         $overrides[] = DIRNAME_PAGES . '/' . $ovb;
     }
     foreach ($ovThemes as $ovb) {
         $overrides[] = DIRNAME_THEMES . '/' . $ovb;
     }
     foreach ($ovTools as $ovb) {
         $overrides[] = DIRNAME_TOOLS . '/' . $ovb;
     }
     if (count($overrides) > 0) {
         $environmentMessage .= implode(', ', $overrides);
         $environmentMessage .= "\n";
     } else {
         $environmentMessage .= "None\n";
     }
     $environmentMessage .= "\n";
     print $environmentMessage;
     // cache
     $environmentMessage = "# concrete5 Cache Settings\n";
     $environmentMessage .= sprintf("Block Cache - %s\n", ENABLE_BLOCK_CACHE ? 'On' : 'Off');
     $environmentMessage .= sprintf("Overrides Cache - %s\n", ENABLE_OVERRIDE_CACHE ? 'On' : 'Off');
     $environmentMessage .= sprintf("Full Page Caching - %s\n", FULL_PAGE_CACHE_GLOBAL == 'blocks' ? 'On - If blocks on the particular page allow it.' : (FULL_PAGE_CACHE_GLOBAL == 'all' ? 'On - In all cases.' : 'Off'));
     if (FULL_PAGE_CACHE_GLOBAL) {
//.........这里部分代码省略.........
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:101,代码来源:info.php

示例14: setupPackages

 /**
  * Run startup and localization events on any installed packages.
  */
 public function setupPackages()
 {
     $pla = \Concrete\Core\Package\PackageList::get();
     $pl = $pla->getPackages();
     $cl = ClassLoader::getInstance();
     foreach ($pl as $p) {
         if ($p->isPackageInstalled()) {
             $pkg = Package::getClass($p->getPackageHandle());
             if (is_object($pkg)) {
                 $cl->registerPackage($pkg);
                 // handle updates
                 if (Config::get('concrete.misc.enable_auto_update_packages')) {
                     $pkgInstalledVersion = $p->getPackageVersion();
                     $pkgFileVersion = $pkg->getPackageVersion();
                     if (version_compare($pkgFileVersion, $pkgInstalledVersion, '>')) {
                         $currentLocale = Localization::activeLocale();
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale('en_US');
                         }
                         $p->upgradeCoreData();
                         $p->upgrade();
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                     }
                 }
                 $pkg->setupPackageLocalization();
                 if (method_exists($pkg, 'on_start')) {
                     $pkg->on_start();
                 }
             }
         }
     }
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:37,代码来源:Application.php

示例15: do_upgrade

 private function do_upgrade()
 {
     $runMessages = array();
     $prepareMessages = array();
     $currentLocale = Localization::activeLocale();
     if ($currentLocale != 'en_US') {
         // Prevent the database records being stored in wrong language
         Localization::changeLocale('en_US');
     }
     try {
         Cache::flush();
         $this->set_upgrades();
         foreach ($this->upgrades as $ugh) {
             if (method_exists($ugh, 'prepare')) {
                 $prepareMessages[] = $ugh->prepare($this);
             }
             if (isset($ugh->dbRefreshTables) && count($ugh->dbRefreshTables) > 0) {
                 $this->refreshDatabaseTables($ugh->dbRefreshTables);
             }
             if (method_exists($ugh, 'run')) {
                 $runMessages[] = $ugh->run();
             }
         }
         $message = '';
         if (is_array($prepareMessages) && count($prepareMessages)) {
             foreach ($prepareMessages as $m) {
                 if (is_array($m)) {
                     $message .= implode("<br/>", $m);
                 }
             }
         }
         if (is_array($runMessages) && count($runMessages)) {
             foreach ($runMessages as $m) {
                 if (is_array($m)) {
                     $message .= implode("<br/>", $m);
                 }
             }
             if (strlen($message)) {
                 $this->set('had_failures', true);
             }
         }
         $upgrade = true;
         if ($currentLocale != 'en_US') {
             Localization::changeLocale($currentLocale);
         }
     } catch (Exception $e) {
         $upgrade = false;
         if ($currentLocale != 'en_US') {
             Localization::changeLocale($currentLocale);
         }
         $message .= '<div class="alert-message block-message error"><p>' . t('An Unexpected Error occurred while upgrading: %s', $e->getTraceAsString()) . '</p></div>';
     }
     if ($upgrade) {
         $completeMessage .= '<div class="alert-message block-message success"><p>';
         if (defined('APP_VERSION_DISPLAY_IN_HEADER') && APP_VERSION_DISPLAY_IN_HEADER) {
             $completeMessage .= t('Upgrade to %s complete!', sprintf('<b>%s</b>', APP_VERSION));
         } else {
             $completeMessage .= t('Upgrade to latest version complete!');
         }
         $completeMessage .= '</p></div>';
         Config::save('SITE_APP_VERSION', APP_VERSION);
     }
     $this->set('completeMessage', $completeMessage);
     $this->set('message', $message);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:65,代码来源:upgrade.php


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