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


PHP Configure::dump方法代码示例

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


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

示例1: testDumpPartial

 /**
  * Test dumping only some of the data.
  *
  * @return void
  */
 public function testDumpPartial()
 {
     Configure::config('test_Engine', new PhpConfig(TMP));
     Configure::write('Error', ['test' => 'value']);
     $result = Configure::dump('config_test', 'test_Engine', ['Error']);
     $this->assertTrue($result > 0);
     $result = file_get_contents(TMP . 'config_test.php');
     $this->assertContains('<?php', $result);
     $this->assertContains('return ', $result);
     $this->assertContains('Error', $result);
     $this->assertNotContains('debug', $result);
     if (file_exists(TMP . 'config_test.php')) {
         unlink(TMP . 'config_test.php');
     }
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:20,代码来源:ConfigureTest.php

示例2: snapshot


//.........这里部分代码省略.........
             $ContentTypesTable = TableRegistry::get('SnapshotContentTypes');
         }
         if (!TableRegistry::exists('SnapshotLanguages')) {
             $LanguagesTable = TableRegistry::get('SnapshotLanguages', ['table' => 'languages']);
         } else {
             $LanguagesTable = TableRegistry::get('SnapshotLanguages');
         }
         if (!TableRegistry::exists('SnapshotOptions')) {
             $OptionsTable = TableRegistry::get('SnapshotOptions', ['table' => 'options']);
         } else {
             $OptionsTable = TableRegistry::get('SnapshotOptions');
         }
         $PluginTable->schema(['value' => 'serialized']);
         $OptionsTable->schema(['value' => 'serialized']);
         $plugins = $PluginTable->find()->select(['name', 'package', 'status'])->order(['ordering' => 'ASC', 'name' => 'ASC'])->all();
         $contentTypes = $ContentTypesTable->find()->select(['slug'])->all();
         $languages = $LanguagesTable->find()->where(['status' => 1])->order(['ordering' => 'ASC'])->all();
         $options = $OptionsTable->find()->select(['name', 'value'])->where(['autoload' => 1])->all();
         foreach ($contentTypes as $contentType) {
             $snapshot['content_types'][] = $contentType->slug;
         }
         foreach ($options as $option) {
             $snapshot['options'][$option->name] = $option->value;
         }
         foreach ($languages as $language) {
             list($languageCode, $countryCode) = localeSplit($language->code);
             $snapshot['languages'][$language->code] = ['name' => $language->name, 'locale' => $language->code, 'code' => $languageCode, 'country' => $countryCode, 'direction' => $language->direction, 'icon' => $language->icon];
         }
     } else {
         $plugins = [];
         foreach (Plugin::scan() as $plugin => $path) {
             $plugins[] = new Entity(['name' => $plugin, 'status' => true, 'package' => 'quickapps-plugins']);
         }
     }
     $folder = new Folder(QUICKAPPS_CORE . 'src/Aspect/');
     foreach ($folder->read(false, false, true)[1] as $classFile) {
         $className = basename(preg_replace('/\\.php$/', '', $classFile));
         if (!in_array($className, ['AppAspect', 'Aspect'])) {
             $snapshot['aspects'][] = "CMS\\Aspect\\{$className}";
         }
     }
     foreach ($plugins as $plugin) {
         $pluginPath = false;
         if (isset(Plugin::scan()[$plugin->name])) {
             $pluginPath = Plugin::scan()[$plugin->name];
         }
         if ($pluginPath === false) {
             Debugger::log(sprintf('Plugin "%s" was found in DB but QuickAppsCMS was unable to locate its root directory.', $plugin->name));
             continue;
         }
         if (!Plugin::validateJson("{$pluginPath}/composer.json")) {
             Debugger::log(sprintf('Plugin "%s" has a corrupt "composer.json" file (%s).', $plugin->name, "{$pluginPath}/composer.json"));
             continue;
         }
         $aspectsPath = "{$pluginPath}/src/Aspect/";
         $eventsPath = "{$pluginPath}/src/Event/";
         $fieldsPath = "{$pluginPath}/src/Field/";
         $helpFiles = glob($pluginPath . '/src/Template/Element/Help/help*.ctp');
         $isTheme = str_ends_with($plugin->name, 'Theme');
         $status = (bool) $plugin->status;
         $humanName = '';
         $aspects = [];
         $eventListeners = [];
         $fields = [];
         $subspaces = [$aspectsPath => 'Aspect', $eventsPath => 'Event', $fieldsPath => 'Field'];
         $varnames = [$aspectsPath => 'aspects', $eventsPath => 'eventListeners', $fieldsPath => 'fields'];
         foreach ([$aspectsPath, $eventsPath, $fieldsPath] as $path) {
             if (is_dir($path)) {
                 $Folder = new Folder($path);
                 foreach ($Folder->read(false, false, true)[1] as $classFile) {
                     $className = basename(preg_replace('/\\.php$/', '', $classFile));
                     $subspace = $subspaces[$path];
                     $varname = $varnames[$path];
                     $namespace = "{$plugin->name}\\{$subspace}\\";
                     ${$varname}[] = $namespace . $className;
                 }
             }
         }
         if (is_readable("{$pluginPath}composer.json")) {
             $json = (array) json_decode(file_get_contents("{$pluginPath}composer.json"), true);
             if (!empty($json['extra']['human-name'])) {
                 $humanName = $json['extra']['human-name'];
             }
         }
         if (empty($humanName)) {
             $humanName = (string) Inflector::humanize((string) Inflector::underscore($plugin->name));
             if ($isTheme) {
                 $humanName = trim(str_replace_last('Theme', '', $humanName));
             }
         }
         $snapshot['plugins'][$plugin->name] = ['name' => $plugin->name, 'humanName' => $humanName, 'package' => $plugin->package, 'isTheme' => $isTheme, 'hasHelp' => !empty($helpFiles), 'hasSettings' => is_readable($pluginPath . '/src/Template/Element/settings.ctp'), 'aspects' => $aspects, 'eventListeners' => $eventListeners, 'fields' => $fields, 'status' => $status, 'path' => $pluginPath];
         if ($status) {
             $snapshot['aspects'] = array_merge($snapshot['aspects'], $aspects);
         }
     }
     Configure::write('QuickApps', $snapshot);
     if (!Configure::dump('snapshot', 'QuickApps', ['QuickApps'])) {
         die('QuickAppsCMS was unable to create a snapshot file, check that PHP have permission to write to the "/tmp" directory.');
     }
 }
开发者ID:quickapps-plugins,项目名称:cms,代码行数:101,代码来源:functions.php


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