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


PHP Yaml::Parse方法代码示例

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


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

示例1:

 function _parseConfigFile()
 {
     $config_file = $this->configFile();
     if ($config_file && file_exists($config_file)) {
         $this->yaml = Yaml::Parse(file_get_contents($config_file));
     }
 }
开发者ID:wtnabe,项目名称:ga-shikomi-php,代码行数:7,代码来源:config.php

示例2: setConfig

 private function setConfig()
 {
     $all_configurations = Yaml::Parse(file_get_contents($_SERVER['DOCUMENT_ROOT'] . $this->contextData['bundleRoot'] . '/configuration.yml'));
     $this->configuration = $all_configurations[$this->editorName];
     $this->blockTypes = $this->configuration['block_types'];
     $this->customParams = $this->configuration['custom'];
     $this->formParams = $this->configuration['form'];
     $this->templatesDirectory = $this->configuration['templates']['directory'];
     $this->templatesFormat = $this->configuration['templates']['format'];
 }
开发者ID:Broutous,项目名称:PageEditorBundle,代码行数:10,代码来源:PageEditor.php

示例3: enable

 public function enable(\Eccube\Entity\Plugin $plugin, $enable = true)
 {
     $pluginDir = $this->calcPluginDir($plugin->getCode());
     $em = $this->app['orm.em'];
     $plugin->setEnable($enable ? Constant::ENABLED : Constant::DISABLED);
     $em->persist($plugin);
     $em->flush();
     $this->callPluginManagerMethod(Yaml::Parse($pluginDir . '/' . self::CONFIG_YML), $enable ? 'enable' : 'disable');
     return true;
 }
开发者ID:reh-d,项目名称:ec-cube3-test,代码行数:10,代码来源:PluginService.php

示例4: loadPlugin

 public function loadPlugin()
 {
     // プラグインディレクトリを探索.
     $basePath = __DIR__ . '/../../app/Plugin';
     $finder = Finder::create()->in($basePath)->directories()->depth(0);
     $finder->sortByName();
     // ハンドラ優先順位をdbから持ってきてハッシュテーブルを作成
     $priorities = array();
     $handlers = $this['orm.em']->getRepository('Eccube\\Entity\\PluginEventHandler')->getHandlers();
     foreach ($handlers as $handler) {
         if ($handler->getPlugin()->getEnable() && !$handler->getPlugin()->getDelFlg()) {
             $priority = $handler->getPriority();
         } else {
             // Pluginがdisable、削除済みの場合、EventHandlerのPriorityを全て0とみなす
             $priority = \Eccube\Entity\PluginEventHandler::EVENT_PRIORITY_DISABLED;
         }
         $priorities[$handler->getPlugin()->getClassName()][$handler->getEvent()][$handler->getHandler()] = $priority;
     }
     // プラグインをロードする.
     // config.yml/event.ymlの定義に沿ってインスタンスの生成を行い, イベント設定を行う.
     foreach ($finder as $dir) {
         //config.ymlのないディレクトリは無視する
         if (!file_exists($dir->getRealPath() . '/config.yml')) {
             continue;
         }
         $config = Yaml::parse($dir->getRealPath() . '/config.yml');
         $plugin = $this['orm.em']->getRepository('Eccube\\Entity\\Plugin')->findOneBy(array('code' => $config['code']));
         // const
         if (isset($config['const'])) {
             $this['config'] = $this->share($this->extend('config', function ($eccubeConfig) use($config) {
                 $eccubeConfig[$config['code']] = array('const' => $config['const']);
                 return $eccubeConfig;
             }));
         }
         if ($plugin && $plugin->getEnable() == Constant::DISABLED) {
             // プラグインが無効化されていれば読み込まない
             continue;
         }
         // Type: Event
         if (isset($config['event'])) {
             $class = '\\Plugin\\' . $config['code'] . '\\' . $config['event'];
             $subscriber = new $class($this);
             if (file_exists($dir->getRealPath() . '/event.yml')) {
                 foreach (Yaml::Parse($dir->getRealPath() . '/event.yml') as $event => $handlers) {
                     foreach ($handlers as $handler) {
                         if (!isset($priorities[$config['event']][$event][$handler[0]])) {
                             // ハンドラテーブルに登録されていない(ソースにしか記述されていない)ハンドラは一番後ろにする
                             $priority = \Eccube\Entity\PluginEventHandler::EVENT_PRIORITY_LATEST;
                         } else {
                             $priority = $priorities[$config['event']][$event][$handler[0]];
                         }
                         // 優先度が0のプラグインは登録しない
                         if (\Eccube\Entity\PluginEventHandler::EVENT_PRIORITY_DISABLED != $priority) {
                             $this['eccube.event.dispatcher']->addListener($event, array($subscriber, $handler[0]), $priority);
                         }
                     }
                 }
             }
         }
         // Type: ServiceProvider
         if (isset($config['service'])) {
             foreach ($config['service'] as $service) {
                 $class = '\\Plugin\\' . $config['code'] . '\\ServiceProvider\\' . $service;
                 $this->register(new $class($this));
             }
         }
     }
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:68,代码来源:Application.php

示例5: getYamlParameters

 /**
  * @return mixed
  */
 protected function getYamlParameters()
 {
     $configFile = $this->getParametersPath();
     $parameters = Yaml::Parse(file_get_contents($configFile));
     return $parameters['parameters'];
 }
开发者ID:csbill,项目名称:csbill,代码行数:9,代码来源:SettingsLoader.php

示例6: createConfigYamlFile

 private function createConfigYamlFile($data)
 {
     $fs = new Filesystem();
     $config_file = $this->config_path . '/config.yml';
     if ($fs->exists($config_file)) {
         $fs->remove($config_file);
     }
     $auth_magic = Str::random(32);
     $allowHost = Str::convertLineFeed($data['admin_allow_hosts']);
     if (empty($allowHost)) {
         $adminAllowHosts = array();
     } else {
         $adminAllowHosts = explode("\n", $allowHost);
     }
     $target = array('${AUTH_MAGIC}', '${SHOP_NAME}', '${ECCUBE_INSTALL}', '${FORCE_SSL}');
     $replace = array($auth_magic, $data['shop_name'], '0', $data['admin_force_ssl']);
     $fs = new Filesystem();
     $content = str_replace($target, $replace, file_get_contents($this->dist_path . '/config.yml.dist'));
     $fs->dumpFile($config_file, $content);
     $config = Yaml::Parse($config_file);
     $config['admin_allow_host'] = $adminAllowHosts;
     $yml = Yaml::dump($config);
     file_put_contents($config_file, $yml);
     return $this;
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:25,代码来源:InstallController.php

示例7: enable

 public function enable(\Eccube\Entity\Plugin $plugin, $enable = true)
 {
     $em = $this->app['orm.em'];
     try {
         $pluginDir = $this->calcPluginDir($plugin->getCode());
         $em->getConnection()->beginTransaction();
         $plugin->setEnable($enable ? Constant::ENABLED : Constant::DISABLED);
         $em->persist($plugin);
         $this->callPluginManagerMethod(Yaml::Parse($pluginDir . '/' . self::CONFIG_YML), $enable ? 'enable' : 'disable');
         $em->flush();
         $em->getConnection()->commit();
     } catch (\Exception $e) {
         $em->getConnection()->rollback();
         throw $e;
     }
     return true;
 }
开发者ID:geany-y,项目名称:LikeNiko,代码行数:17,代码来源:PluginService.php

示例8: readYml

 public function readYml($yml)
 {
     return Yaml::Parse($yml);
 }
开发者ID:kao0ru,项目名称:ec-cube,代码行数:4,代码来源:PluginService.php


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