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


PHP PackageList::get方法代码示例

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


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

示例1: setLocale

 public function setLocale($locale)
 {
     if ($locale == 'en_US' && !Config::get('concrete.misc.enable_translate_locale_en_us')) {
         $this->translate = null;
     } else {
         $this->translate = new Translator();
         $this->translate->setLocale($locale);
         $this->translate->setCache(self::getCache());
         // Core language files
         $languageFile = DIR_LANGUAGES . "/{$locale}/LC_MESSAGES/messages.mo";
         if (!is_file($languageFile)) {
             $languageFile = DIR_LANGUAGES_CORE . "/{$locale}/LC_MESSAGES/messages.mo";
             if (!is_file($languageFile)) {
                 $languageFile = '';
             }
         }
         if ($languageFile !== '') {
             $this->translate->addTranslationFile('gettext', $languageFile);
         }
         // Package language files
         if (Config::get('app.bootstrap.packages_loaded') === true) {
             $pkgList = \Concrete\Core\Package\PackageList::get();
             foreach ($pkgList->getPackages() as $pkg) {
                 $pkg->setupPackageLocalization($locale, $this->translate);
             }
             // Site language files
             static::setupSiteLocalization($this->translate);
         }
     }
     PunicData::setDefaultLocale($locale);
     $event = new \Symfony\Component\EventDispatcher\GenericEvent();
     $event->setArgument('locale', $locale);
     Events::dispatch('on_locale_load', $event);
 }
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:34,代码来源:Localization.php

示例2: loadTranslations

 /**
  * {@inheritDoc}
  */
 public function loadTranslations(TranslatorAdapterInterface $translatorAdapter)
 {
     $config = $this->app->make('config');
     if ($config->get('app.bootstrap.packages_loaded') === true) {
         $pkgList = PackageList::get();
         $translator = $translatorAdapter->getTranslator();
         $locale = $translatorAdapter->getLocale();
         foreach ($pkgList->getPackages() as $pkg) {
             $path = $pkg->getPackagePath() . '/' . DIRNAME_LANGUAGES;
             $languageFile = "{$path}/{$locale}/LC_MESSAGES/messages.mo";
             if (is_file($languageFile)) {
                 $translator->addTranslationFile('gettext', $languageFile);
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:19,代码来源:PackagesTranslationLoader.php

示例3: addDetails

 /**
  * Add the c5 specific debug stuff
  */
 protected function addDetails()
 {
     /**
      * General
      */
     $this->addDataTable('Concrete5', array('Version' => APP_VERSION, 'Installed Version' => Config::get('app.version')));
     /**
      * Cache
      */
     $this->addDataTable('Preferences', array('Block Cache' => Config::get('concrete.cache.blocks') ? 'ON' : 'OFF', 'Overrides Cache' => Config::get('concrete.cache.overrides') ? 'ON' : 'OFF', 'Full Page' => Config::get('concrete.cache.pages') ? 'ON' : 'OFF', 'Full Page Lifetime' => Config::get('concrete.cache.full_page_lifetime', 'default')));
     /**
      * Installed Packages
      */
     $pla = PackageList::get();
     $pl = $pla->getPackages();
     $packages = array();
     foreach ($pl as $p) {
         if ($p->isPackageInstalled()) {
             $packages[$p->getPackageName()] = $p->getPackageVersion();
         }
     }
     $this->addDataTable('Installed Packages', $packages);
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:26,代码来源:ErrorHandler.php

示例4: __construct

 public function __construct()
 {
     $loc = Localization::getInstance();
     $loc->pushActiveContext('system');
     try {
         $app = Facade::getFacadeApplication();
         $config = $app->make('config');
         $maxExecutionTime = ini_get('max_execution_time');
         @set_time_limit(5);
         $this->installed = (bool) $app->isInstalled();
         $this->webRootDirectory = DIR_BASE;
         $this->coreRootDirectory = DIR_BASE_CORE;
         $versions = ['Core Version - ' . $config->get('concrete.version')];
         if ($this->installed) {
             $versions[] = 'Version Installed - ' . $config->get('concrete.version_installed');
         }
         $versions[] = 'Database Version - ' . $config->get('concrete.version_db');
         $this->coreVersions = implode("\n", $versions);
         $packages = [];
         if ($this->installed) {
             foreach (PackageList::get()->getPackages() as $p) {
                 if ($p->isPackageInstalled()) {
                     $packages[] = $p->getPackageName() . ' (' . $p->getPackageVersion() . ')';
                 }
             }
         }
         natcasesort($packages);
         $this->packages = implode(', ', $packages);
         $overrides = Environment::get()->getOverrideList();
         if (empty($overrides)) {
             $this->overrides = '';
         } else {
             $this->overrides = implode(', ', $overrides);
         }
         $cache = [sprintf('Block Cache - %s', $config->get('concrete.cache.blocks') ? 'On' : 'Off'), sprintf('Overrides Cache - %s', $config->get('concrete.cache.overrides') ? 'On' : 'Off'), sprintf('Full Page Caching - %s', $config->get('concrete.cache.pages') == 'blocks' ? 'On - If blocks on the particular page allow it.' : ($config->get('concrete.cache.pages') == 'all' ? 'On - In all cases.' : 'Off'))];
         if ($config->get('concrete.cache.full_page_lifetime')) {
             $cache[] = sprintf("Full Page Cache Lifetime - %s", $config->get('concrete.cache.full_page_lifetime') == 'default' ? sprintf('Every %s (default setting).', $app->make('helper/date')->describeInterval($config->get('concrete.cache.lifetime'))) : ($config->get('concrete.cache.full_page_lifetime') == 'forever' ? 'Only when manually removed or the cache is cleared.' : sprintf('Every %s minutes.', $config->get('concrete.cache.full_page_lifetime_value'))));
         }
         $this->cache = implode("\n", $cache);
         $this->serverSoftware = \Request::getInstance()->server->get('SERVER_SOFTWARE', '');
         $this->serverAPI = PHP_SAPI;
         $this->phpVersion = PHP_VERSION;
         if (function_exists('get_loaded_extensions')) {
             $extensions = @get_loaded_extensions();
         } else {
             $extensions = false;
         }
         if (is_array($extensions)) {
             natcasesort($extensions);
             $this->phpExtensions = implode(', ', $extensions);
         } else {
             $this->phpExtensions = false;
         }
         ob_start();
         phpinfo();
         $buffer = ob_get_clean();
         $phpinfo = [];
         if ($app->isRunThroughCommandLineInterface()) {
             $section = null;
             foreach (preg_split('/[\\r\\n]+/', $buffer) as $line) {
                 $chunks = array_map('trim', explode('=>', $line));
                 switch (count($chunks)) {
                     case 1:
                         if ($chunks[0] === '') {
                             continue;
                         }
                         $section = $chunks[0];
                         break;
                     case 2:
                         if ($section !== null) {
                             $phpinfo[$section][$chunks[0]] = $chunks[1];
                         }
                         break;
                     default:
                         if ($section !== null) {
                             $phpinfo[$section][$chunks[0]] = [$chunks[1], $chunks[2]];
                         }
                         break;
                 }
             }
         } else {
             $section = 'phpinfo';
             $phpinfo[$section] = [];
             if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>)?)?</tr>)#s', $buffer, $matches, PREG_SET_ORDER)) {
                 foreach ($matches as $match) {
                     if ($match[1] !== null && $match[1] !== '') {
                         $section = $match[1];
                         $phpinfo[$section] = [];
                     } elseif (isset($match[3])) {
                         $phpinfo[$section][$match[2]] = isset($match[4]) ? [$match[3], $match[4]] : $match[3];
                     } else {
                         $phpinfo[$section][] = $match[2];
                     }
                 }
             }
         }
         $phpSettings = ["max_execution_time - {$maxExecutionTime}"];
         foreach ($phpinfo as $name => $section) {
             foreach ($section as $key => $val) {
                 if (preg_match('/.*max_execution_time*/', $key)) {
//.........这里部分代码省略.........
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:101,代码来源:Info.php

示例5: 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);
     $ovJobs = $fh->getDirectoryContents(DIR_FILES_JOBS);
     $ovCSS = $fh->getDirectoryContents(DIR_APPLICATION . '/' . DIRNAME_CSS);
     $ovJS = $fh->getDirectoryContents(DIR_APPLICATION . '/' . DIRNAME_JAVASCRIPT);
     $ovLng = $fh->getDirectoryContents(DIR_APPLICATION . '/' . DIRNAME_LANGUAGES);
     $ovMail = $fh->getDirectoryContents(DIR_FILES_EMAIL_TEMPLATES);
     $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 ($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 ($ovMail as $ovb) {
         $overrides[] = DIRNAME_MAIL_TEMPLATES . '/' . $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", Config::get('concrete.cache.blocks') ? 'On' : 'Off');
     $environmentMessage .= sprintf("Overrides Cache - %s\n", Config::get('concrete.cache.overrides') ? 'On' : 'Off');
     $environmentMessage .= sprintf("Full Page Caching - %s\n", Config::get('concrete.cache.pages') == 'blocks' ? 'On - If blocks on the particular page allow it.' : (Config::get('concrete.cache.pages') == 'all' ? 'On - In all cases.' : 'Off'));
     if (Config::get('concrete.cache.full_page_lifetime')) {
         $environmentMessage .= sprintf("Full Page Cache Lifetime - %s\n", Config::get('concrete.cache.full_page_lifetime') == 'default' ? sprintf('Every %s (default setting).', Loader::helper('date')->describeInterval(Config::get('concrete.cache.lifetime'))) : (Config::get('concrete.cache.full_page_lifetime') == 'forever' ? 'Only when manually removed or the cache is cleared.' : sprintf('Every %s minutes.', Config::get('concrete.cache.full_page_lifetime_value'))));
     }
     $environmentMessage .= "\n";
     print $environmentMessage;
     $environmentMessage = "# Server Software\n" . $_SERVER['SERVER_SOFTWARE'] . "\n\n";
     $environmentMessage .= "# Server API\n" . php_sapi_name() . "\n\n";
     $environmentMessage .= "# PHP Version\n" . PHP_VERSION . "\n\n";
     $environmentMessage .= "# PHP Extensions\n";
     if (function_exists('get_loaded_extensions')) {
         $gle = @get_loaded_extensions();
         natcasesort($gle);
         $environmentMessage .= implode(', ', $gle);
//.........这里部分代码省略.........
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:101,代码来源:info.php

示例6: getBlockTypeCustomTemplates

 /**
  * Gets the custom templates available for the current BlockType
  *
  * @return TemplateFile[]
  */
 function getBlockTypeCustomTemplates()
 {
     $btHandle = $this->getBlockTypeHandle();
     $fh = Loader::helper('file');
     $files = array();
     $dir = DIR_FILES_BLOCK_TYPES . "/{$btHandle}/" . DIRNAME_BLOCK_TEMPLATES;
     if (is_dir($dir)) {
         $files = array_merge($files, $fh->getDirectoryContents($dir));
     }
     // NOW, we check to see if this btHandle has any custom templates that have been installed as separate packages
     foreach (PackageList::get()->getPackages() as $pkg) {
         $dir = (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle()) ? DIR_PACKAGES : DIR_PACKAGES_CORE) . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_BLOCKS . '/' . $btHandle . '/' . DIRNAME_BLOCK_TEMPLATES;
         if (is_dir($dir)) {
             $files = array_merge($files, $fh->getDirectoryContents($dir));
         }
     }
     $dir = DIR_FILES_BLOCK_TYPES_CORE . "/{$btHandle}/" . DIRNAME_BLOCK_TEMPLATES;
     if (is_dir($dir)) {
         $files = array_merge($files, $fh->getDirectoryContents($dir));
     }
     $templates = array();
     foreach (array_unique($files) as $file) {
         $templates[] = new TemplateFile($this, $file);
     }
     return TemplateFile::sortTemplateFileList($templates);
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:31,代码来源:BlockType.php

示例7: setupPackageAutoloaders

 /**
  * Register package autoloaders. Has to come BEFORE session calls.
  */
 public function setupPackageAutoloaders()
 {
     $pla = \Concrete\Core\Package\PackageList::get();
     $pl = $pla->getPackages();
     $cl = ClassLoader::getInstance();
     /** @var \Package[] $pl */
     foreach ($pl as $p) {
         $p->registerConfigNamespace();
         if ($p->isPackageInstalled()) {
             $pkg = Package::getClass($p->getPackageHandle());
             if (is_object($pkg) && !$pkg instanceof \Concrete\Core\Package\BrokenPackage) {
                 $cl->registerPackage($pkg);
                 $this->packages[] = $pkg;
             }
         }
     }
 }
开发者ID:bobzepplin,项目名称:dodgeball,代码行数:20,代码来源:Application.php

示例8: mergeTranslationsWithPackages

 public function mergeTranslationsWithPackages(Section $section, Translations $translations)
 {
     foreach (PackageList::get()->getPackages() as $package) {
         /* @var $package \Concrete\Core\Package\Package */
         $baseDir = $package->getPackagePath() . '/' . DIRNAME_LANGUAGES . '/' . $section->getLocale() . '/LC_MESSAGES';
         $poFile = $baseDir . '/messages.po';
         $moFile = $baseDir . '/messages.mo';
         $packageTranslations = null;
         if (is_file($poFile)) {
             $packageTranslations = PoExtractor::fromFile($poFile);
         } elseif (is_file($moFile)) {
             $packageTranslations = MoExtractor::fromFile($moFile);
         }
         if (isset($packageTranslations)) {
             foreach ($translations as $translation) {
                 /* @var $translation \Gettext\Translation */
                 if (!$translation->hasTranslation()) {
                     $packageTranslation = $packageTranslations->find($translation);
                     if ($packageTranslation && $packageTranslation->hasTranslation()) {
                         $translation->mergeWith($packageTranslation);
                     }
                 }
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:26,代码来源:Extractor.php

示例9: computeView

 protected function computeView()
 {
     $bFilename = $this->bFilename;
     $obj = $this->obj;
     // if we've passed in "templates/" as the first part, we strip that off.
     if (strpos($bFilename, 'templates/') === 0) {
         $bFilename = substr($bFilename, 10);
     }
     // The filename might be a directory name with .php-appended (BlockView does that), strip it.
     $bFilenameWithoutDotPhp = $bFilename;
     if (substr($bFilename, -4) === ".php") {
         $bFilenameWithoutDotPhp = substr($bFilename, 0, strlen($bFilename) - 4);
     }
     if ($bFilename) {
         if (is_file(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
             $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
             $bv = new BlockView($obj);
             $this->baseURL = $bv->getBlockURL();
             $this->basePath = $bv->getBlockPath($this->render);
         } else {
             if (is_file(DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
                 $template = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
                 $this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
                 $this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle();
             } else {
                 if (is_dir(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
                     $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render;
                     $this->basePath = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
                     $this->baseURL = REL_DIR_APPLICATION . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
                 } else {
                     if (is_dir(DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
                         $template = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render;
                         $this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
                         $this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
                     } else {
                         if ($bFilename !== $bFilenameWithoutDotPhp) {
                             if (is_dir(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp)) {
                                 $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp . '/' . $this->render;
                                 $this->basePath = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp;
                                 $this->baseURL = REL_DIR_APPLICATION . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp;
                             } else {
                                 if (is_dir(DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp)) {
                                     $template = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp . '/' . $this->render;
                                     $this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp;
                                     $this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilenameWithoutDotPhp;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // we check all installed packages
         if (!isset($template)) {
             $pl = PackageList::get();
             $packages = $pl->getPackages();
             foreach ($packages as $pkg) {
                 $d = '';
                 if (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle())) {
                     $d = DIR_PACKAGES . '/' . $pkg->getPackageHandle();
                 } else {
                     if (is_dir(DIR_PACKAGES_CORE . '/' . $pkg->getPackageHandle())) {
                         $d = DIR_PACKAGES_CORE . '/' . $pkg->getPackageHandle();
                     }
                 }
                 if ($d != '') {
                     $baseStub = is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle()) ? DIR_REL . '/' . DIRNAME_PACKAGES . '/' . $pkg->getPackageHandle() : ASSETS_URL . '/' . DIRNAME_PACKAGES . '/' . $pkg->getPackageHandle();
                     if (is_file($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $bFilename)) {
                         $template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $bFilename;
                         $this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
                         $this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle();
                     } else {
                         if (is_file($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
                             $template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
                             $this->baseURL = $baseStub . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
                             $this->basePath = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
                         } else {
                             if (is_dir($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
                                 $template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render;
                                 $this->baseURL = $baseStub . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
                             }
                         }
                     }
                 }
                 if ($this->baseURL != '') {
                     continue;
                 }
             }
         }
     } else {
         if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '.php')) {
             $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '.php';
             $bv = new BlockView($obj);
             $this->baseURL = $bv->getBlockURL();
             $this->basePath = $bv->getBlockPath($this->render);
         } else {
             if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $this->render)) {
                 $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $this->render;
                 $this->baseURL = REL_DIR_APPLICATION . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
             }
//.........这里部分代码省略.........
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:101,代码来源:BlockViewTemplate.php

示例10: 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();
     /** @var \Package[] $pl */
     foreach ($pl as $p) {
         $p->registerConfigNamespace();
         if ($p->isPackageInstalled()) {
             $pkg = Package::getClass($p->getPackageHandle());
             if (is_object($pkg) && !$pkg instanceof \Concrete\Core\Package\BrokenPackage) {
                 $cl->registerPackage($pkg);
                 // handle updates
                 if (Config::get('concrete.updates.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();
                 }
             }
         }
     }
     Config::set('app.bootstrap.packages_loaded', true);
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:40,代码来源:Application.php

示例11: 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";
     $environmentMessage .= "Core Version - " . \Config::get('concrete.version') . "\n";
     $environmentMessage .= "Version Installed - " . \Config::get('concrete.version_installed') . "\n";
     $environmentMessage .= "Database Version - " . \Config::get('concrete.version_db') . "\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";
     $env = Environment::get();
     $overrides = $env->getOverrideList();
     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", Config::get('concrete.cache.blocks') ? 'On' : 'Off');
     $environmentMessage .= sprintf("Overrides Cache - %s\n", Config::get('concrete.cache.overrides') ? 'On' : 'Off');
     $environmentMessage .= sprintf("Full Page Caching - %s\n", Config::get('concrete.cache.pages') == 'blocks' ? 'On - If blocks on the particular page allow it.' : (Config::get('concrete.cache.pages') == 'all' ? 'On - In all cases.' : 'Off'));
     if (Config::get('concrete.cache.full_page_lifetime')) {
         $environmentMessage .= sprintf("Full Page Cache Lifetime - %s\n", Config::get('concrete.cache.full_page_lifetime') == 'default' ? sprintf('Every %s (default setting).', Core::make('helper/date')->describeInterval(Config::get('concrete.cache.lifetime'))) : (Config::get('concrete.cache.full_page_lifetime') == 'forever' ? 'Only when manually removed or the cache is cleared.' : sprintf('Every %s minutes.', Config::get('concrete.cache.full_page_lifetime_value'))));
     }
     $environmentMessage .= "\n";
     print $environmentMessage;
     $environmentMessage = "# Server Software\n" . $_SERVER['SERVER_SOFTWARE'] . "\n\n";
     $environmentMessage .= "# Server API\n" . php_sapi_name() . "\n\n";
     $environmentMessage .= "# PHP Version\n" . PHP_VERSION . "\n\n";
     $environmentMessage .= "# PHP Extensions\n";
     if (function_exists('get_loaded_extensions')) {
         $gle = @get_loaded_extensions();
         natcasesort($gle);
         $environmentMessage .= implode(', ', $gle);
         $environmentMessage .= ".\n";
     } else {
         $environmentMessage .= "Unable to determine\n";
     }
     print $environmentMessage;
     ob_start();
     phpinfo();
     $section = 'phpinfo';
     $phpinfo = array($section => array());
     if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
         foreach ($matches as $match) {
             if (strlen($match[1])) {
                 $section = $match[1];
                 $phpinfo[$section] = array();
             } elseif (isset($match[3])) {
                 $phpinfo[$section][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
             } else {
                 $phpinfo[$section][] = $match[2];
             }
         }
     }
     $environmentMessage = "\n# PHP Settings\n";
     $environmentMessage .= "max_execution_time - {$maxExecutionTime}\n";
     foreach ($phpinfo as $name => $section) {
         foreach ($section as $key => $val) {
             if (preg_match('/.*max_execution_time*/', $key)) {
                 continue;
             }
             if (!preg_match('/.*limit.*/', $key) && !preg_match('/.*safe.*/', $key) && !preg_match('/.*max.*/', $key)) {
                 continue;
             }
             if (is_array($val)) {
                 $environmentMessage .= "{$key} - {$val['0']}\n";
             } elseif (is_string($key)) {
                 $environmentMessage .= "{$key} - {$val}\n";
             } else {
                 $environmentMessage .= "{$val}\n";
             }
         }
     }
     print $environmentMessage;
//.........这里部分代码省略.........
开发者ID:digideskio,项目名称:concrete5,代码行数:101,代码来源:info.php

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

示例13: inc

 public function inc($file, $args = array())
 {
     extract($args);
     if (!isset($obj)) {
         $obj = $this->getPageTypeComposerControlDraftValue();
         if (!is_object($obj)) {
             $obj = $this->getBlockTypeObject();
         }
     }
     $controller = $this->getController($obj);
     extract($controller->getSets());
     extract($controller->getHelperObjects());
     $label = $this->getPageTypeComposerFormLayoutSetControlObject()->getPageTypeComposerControlDisplayLabel();
     $env = Environment::get();
     $pkg = false;
     if ($obj->getPackageID() > 0) {
         $pkg = Package::getByID($obj->getPackageID());
     }
     $view = $this;
     $r = $env->getRecord(DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $file, $pkg);
     if ($r->exists()) {
         include $r->file;
     } else {
         foreach (PackageList::get()->getPackages() as $pkg) {
             $include = (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle()) ? DIR_PACKAGES : DIR_PACKAGES_CORE) . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $file;
             if (file_exists($include)) {
                 include $include;
             }
         }
     }
 }
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:31,代码来源:BlockControl.php


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