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


PHP Spyc::YAMLLoadString方法代码示例

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


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

示例1: read

 public function read()
 {
     if (file_exists($this->file)) {
         $configuration = file_get_contents($this->file);
         $this->registry = \Spyc::YAMLLoadString($configuration);
     }
 }
开发者ID:aoloe,项目名称:php-configuration,代码行数:7,代码来源:Configuration.php

示例2: fromYaml

 /**
  * Convert YAML to Array using Spyc converter
  *
  * @param   string  $data   Data to convert
  *
  * @return  array
  */
 public final function fromYaml($data)
 {
     if (!is_string($data)) {
         throw new Exception("Invalid data for YAML deserialization");
     }
     return \Spyc::YAMLLoadString($data);
 }
开发者ID:comodojo,项目名称:dispatcher.framework,代码行数:14,代码来源:Deserialization.php

示例3: parseSpyc

 /**
  * @param string $sYamlString
  * @return array|null
  */
 protected function parseSpyc($sYamlString)
 {
     $aData = null;
     if ($this->loadSpycYamlParser()) {
         $aData = Spyc::YAMLLoadString($sYamlString);
     }
     return $aData;
 }
开发者ID:Wikipraca,项目名称:Wikipraca-WikiSquare,代码行数:12,代码来源:icwp-yaml.php

示例4: parse

 public function parse($file)
 {
     $contents = file_get_contents($file);
     preg_match_all('#(?m)/\\*\\s*(^---(\\s*$.*?)^\\.\\.\\.)\\s*#sm', $contents, $comment);
     if (!isset($comment[2]) || !isset($comment[2][0]) || !$comment[2][0]) {
         throw new ForgeJSParserException('Couldn\'t find required YAML header in JS file.');
     }
     $yaml = preg_replace('/$([\\s]+)-/m', '$1 -', trim($comment[2][0]));
     $this->meta = Spyc::YAMLLoadString($yaml);
     return $this->meta;
 }
开发者ID:holyshared,项目名称:developer-package,代码行数:11,代码来源:plugin_parser.php

示例5: getTemplateOptions

 /**
  * Get template option menu.   
  * 
  * @access public
  * @return void
  */
 public function getTemplateOptions()
 {
     $this->app->loadClass('Spyc', true);
     $folders = glob($this->app->getTplRoot() . '*');
     foreach ($folders as $folder) {
         $templateName = str_replace($this->app->getTplRoot(), '', $folder);
         $config = Spyc::YAMLLoadString(file_get_contents($folder . DS . 'doc' . DS . $this->app->getClientLang() . '.yaml'));
         $templates[$templateName] = $config['name'];
     }
     return $templates;
 }
开发者ID:AlenWon,项目名称:chanzhieps,代码行数:17,代码来源:model.php

示例6: unserialize

 /**
  * Un-serializes the fields.
  *
  * @param Base\Model $resource Currently processed resource.
  *
  * @static
  * @access public
  *
  * @return void
  */
 public static function unserialize(Base\Model $resource)
 {
     foreach (self::$serializedFields as $field => $type) {
         switch ($type) {
             case 'json':
                 $resource->{$field} = json_decode($resource->{$field}, true);
                 break;
             case 'yaml':
                 $resource->{$field} = \Spyc::YAMLLoadString($resource->{$field});
                 break;
             case 'serialize':
                 $resource->{$field} = unserialize($resource->{$field});
                 break;
         }
     }
 }
开发者ID:weareathlon,项目名称:silla.io,代码行数:26,代码来源:serialization.php

示例7: beforeSave

 function beforeSave()
 {
     parent::beforeSave();
     if ($this->validate()) {
         if ($this->widget) {
             $this->widget = serialize(Spyc::YAMLLoadString($this->widget));
         }
         if ($this->rules) {
             $this->rules = serialize(Spyc::YAMLLoadString($this->rules));
         }
         if ($this->automodel) {
             $this->automodel = serialize(Spyc::YAMLLoadString($this->automodel));
         }
     }
     return true;
 }
开发者ID:hiproz,项目名称:mincms,代码行数:16,代码来源:NodeField.php

示例8: getStorage

	public function getStorage()
	{
	    if(empty($this->_storage))
		{
			try 
			{
				KLoader::load('com://admin/learn.library.spyc.spyc');
				$this->_storage = Spyc::YAMLLoadString(parent::getStorage());
			}
			catch(KException $e)
			{
				throw new ComLearnDatabaseTableException($e->getMessage());
			}
		}
		
		return $this->_storage;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:17,代码来源:yaml.php

示例9: load

 public static function load($string, $forgiving = false)
 {
     if (substr($string, 0, 3) != '---') {
         $string = "---\n{$string}";
     }
     try {
         // if syck is available use it
         if (extension_loaded('syck')) {
             return syck_load($string);
         }
         // if not, use the symfony YAML parser
         $yaml = new sfYamlParser();
         return $yaml->parse($string);
     } catch (Exception $e) {
         if ($forgiving) {
             // if YAML document is not correct,
             // but we're forgiving, use the Spyc parser
             return Spyc::YAMLLoadString($string);
         }
         throw new Wikidot_Yaml_Exception("Can't parse the YAML string." . $e->getMessage());
     }
 }
开发者ID:jbzdak,项目名称:wikidot,代码行数:22,代码来源:Yaml.php

示例10: yamlToArray

 /**
  * Преобразует YAML в массив
  * @param string $yaml
  * @return array
  */
 public static function yamlToArray($yaml)
 {
     cmsCore::loadLib('spyc.class');
     return Spyc::YAMLLoadString($yaml);
 }
开发者ID:alexeyaa,项目名称:icms2,代码行数:10,代码来源:model.php

示例11: processProjects

 private function processProjects()
 {
     $url = "https://raw.githubusercontent.com/openstack/governance/master/reference/projects.yaml";
     $response = null;
     try {
         $response = $this->client->get($url);
     } catch (Exception $ex) {
         echo $ex->getMessage() . PHP_EOL;
         SS_Log::log($ex->getMessage(), SS_Log::WARN);
     }
     if (is_null($response)) {
         return;
     }
     if ($response->getStatusCode() != 200) {
         return;
     }
     $body = $response->getBody();
     if (is_null($body)) {
         return;
     }
     $content = $body->getContents();
     if (empty($content)) {
         return;
     }
     try {
         $projects = Spyc::YAMLLoadString($content);
         foreach ($projects as $project_name => $info) {
             $component = OpenStackComponent::get()->filter('CodeName', ucfirst($project_name))->first();
             if (is_null($component)) {
                 $component = OpenStackComponent::get()->filter('Name', ucfirst($project_name))->first();
             }
             echo sprintf('processing component %s', $project_name) . PHP_EOL;
             if (is_null($component)) {
                 echo sprintf('component %s not found!', $project_name) . PHP_EOL;
                 continue;
             }
             $ptl = isset($info['ptl']) ? $info['ptl'] : null;
             $wiki = isset($info['url']) ? $info['url'] : null;
             $tags = isset($info['tags']) ? $info['tags'] : [];
             $ptl_member = null;
             if (!empty($ptl)) {
                 if (is_array($ptl) && isset($ptl['name'])) {
                     $ptl_names = preg_split("/\\s/", $ptl['name']);
                     $fname = $ptl_names[0];
                     $lname = $ptl_names[1];
                 } else {
                     $ptl_names = preg_split("/\\s/", $ptl);
                     $fname = $ptl_names[0];
                     $lname = $ptl_names[1];
                 }
                 $email = isset($ptl['email']) ? trim($ptl['email']) : null;
                 echo sprintf('PTL %s %s (%s)', $fname, $lname, $email) . PHP_EOL;
                 if (!empty($email)) {
                     $ptl_member = Member::get()->filter(array('Email' => $email))->first();
                 }
                 if (is_null($ptl_member)) {
                     $ptl_member = Member::get()->filter(array('FirstName' => $fname, 'Surname' => $lname))->first();
                 }
             }
             $team_diverse_affiliation = false;
             $is_service = false;
             $has_stable_branches = false;
             $tc_approved_release = false;
             $release_milestones = false;
             $release_intermediary = false;
             $release_independent = false;
             $starter_kit = false;
             $vulnerability_managed = false;
             $follows_standard_deprecation = false;
             $supports_upgrade = false;
             $supports_rolling_upgrade = false;
             foreach ($tags as $tag) {
                 if ($tag === "team:diverse-affiliation") {
                     $team_diverse_affiliation = true;
                 }
             }
             $deliverables = isset($info['deliverables']) ? $info['deliverables'] : array();
             $service_info = isset($deliverables[$project_name]) ? $deliverables[$project_name] : array();
             $service_tags = isset($service_info['tags']) ? $service_info['tags'] : array();
             foreach ($service_tags as $tag) {
                 if ($tag === "type:service") {
                     $is_service = true;
                 }
                 if ($tag === "stable:follows-policy") {
                     $has_stable_branches = true;
                 }
                 if ($tag === "release:cycle-with-milestones") {
                     $release_milestones = true;
                 }
                 if ($tag === "release:cycle-with-intermediary") {
                     $release_intermediary = true;
                 }
                 if ($tag === "release:independent") {
                     $release_independent = true;
                 }
                 if ($tag === "tc-approved-release") {
                     $tc_approved_release = true;
                 }
                 if ($tag === "starter-kit:compute") {
                     $starter_kit = true;
//.........这里部分代码省略.........
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:101,代码来源:IngestOpenStackComponentsDataCronTask.php

示例12: ThemeDisplayController

	<button type="button" class="btn btn-default btn-sm" style="width:100%; margin-bottom:5px">Flow Form</button><br/>
	<button type="button" class="btn btn-default btn-sm" style="width:100%; margin-bottom:5px">Form Filters</button><br/>
	<button type="button" class="btn btn-default btn-sm" style="width:100%; margin-bottom:5px">Data Grid</button><br/>
-->
<div style="float:left;">
<h2>Slot List</h2> 
</div>
<div style="float:right; margin-top:16px">
<span style="font-size:20px" class="debuger-all-options glyphicon glyphicon-align-justify"></span>
</div>
<br style="clear:both">
<?php 
require_once "../../../../../wp-load.php";
require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/core-files/defines-const.php';
require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/class/Spyc.php';
$all_properties = Spyc::YAMLLoadString($_POST['yaml']);
$listYaml = $all_properties[key($all_properties)]['ui_slot_list_name'];
if ($listYaml == '') {
    $listYaml = 'slot-list';
}
$slotList = Spyc::YAMLLoad(GLOBALDATA_PATH . 'template-hierarchy/schemas/' . $listYaml . '.yaml');
global $DTDC;
require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/class/display-controller.class.php';
@($DTDC = new ThemeDisplayController($post->ID));
$DTDC->args = $slotList;
require_once TEMPLATEPATH . '/theme-template-parts/flow/basic-test-flow.php';
@(require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/class/send-post-data_eachwalker.class.php');
global $SPD;
$SPD = new SendPostData($data_arg);
$DTDC->postFormObject = $SPD;
foreach ($slotList as $key => $value) {
开发者ID:johan--,项目名称:UiGEN-Core,代码行数:31,代码来源:get-template-part-list.php

示例13: getYamlData

 /**
  * Decodes the YAML into a PHP associative array.
  * @return array
  */
 public function getYamlData()
 {
     return Spyc::YAMLLoadString($this->getNativeData(), true);
 }
开发者ID:valhallasw,项目名称:mediawiki-extensions-OpenStackManager,代码行数:8,代码来源:YamlContent.php

示例14: die

<?php

/* Get the yaml file and parse it. */
if (count($argv) != 2) {
    die("please set the yaml file.\n");
}
$filename = $argv[1];
if (!is_file($filename)) {
    die("the yaml file doesn't exit\n");
}
include '../../lib/spyc/spyc.class.php';
$extension = Spyc::YAMLLoadString(file_get_contents($filename));
/* Basic info checking. */
if (empty($extension['name'])) {
    die("name field must be set\n");
}
if (empty($extension['code'])) {
    die("code field must be set\n");
}
if (!preg_match('/^[a-zA-Z0-9_]{1}[a-zA-Z0-9_]{1,}[a-zA-Z0-9_]{1}$/', $extension['code'])) {
    die("code shoulde be letter, nubmer and _\n");
}
if (!preg_match('/^(extension|patch|theme)$/', $extension['type'])) {
    die("type shoulde be extension, patch or theme\n");
}
if (empty($extension['abstract'])) {
    die("abstract field must be set\n");
}
/* desc and install fields checking. */
if (is_array($extension['desc'])) {
    die("desc should be a string, please check your yaml synatax\n");
开发者ID:fanscky,项目名称:HTPMS,代码行数:31,代码来源:checkyaml.php

示例15: decode

 public static function decode($input)
 {
     return Spyc::YAMLLoadString($input);
 }
开发者ID:joeke,项目名称:modx-minify,代码行数:4,代码来源:yaml.php


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