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


PHP Spyc::YAMLDump方法代码示例

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


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

示例1: output

function output()
{
    global $config, $pages, $ums, $blog, $user, $coms, $editor;
    //First Requirements (Components)
    $error = "";
    foreach ($pages['pacedit']['reqs'] as $req) {
        if (!in_array($req, $config['coms'])) {
            $error .= "Component: " . $req . " is missing<br>";
        }
    }
    if ($error != "") {
        $out = $error;
    } else {
        if (!in_array($user['id'], $coms['pacman']['admins'])) {
            $out = "You are not a package manager";
        } else {
            $out = "<h1>Package Manager - Edit</h1>";
            if (!$_GET['pac']) {
                $out .= 'Please Go back and try again';
            } else {
                $com = $_GET['pac'];
                $content = Spyc::YAMLDump($coms[$com]);
                $out .= '<form action="?var=pacsub" method="POST">
					<input type="hidden" value="' . $com . '" name="com" />
					<textarea name="yaml" id="yaml" cols="70" rows="15">' . str_replace("- --\n", '', $content) . '</textarea><input type="submit" value="Save" /></form>';
            }
        }
    }
    return $out;
}
开发者ID:Arcath,项目名称:arcath.net-yaml-cms,代码行数:30,代码来源:edit.php

示例2: edit

 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     //リクエストセット
     if ($this->request->is('post')) {
         //登録処理
         if (!$this->request->data['SiteSetting']['only_session']) {
             unset($this->request->data['SiteSetting']['only_session']);
             $this->Session->write('debug', null);
             //application.ymlに書き込み
             $conf = Spyc::YAMLLoad(APP . 'Config' . DS . 'application.yml');
             $conf['debug'] = (int) $this->request->data['SiteSetting']['debug']['0']['value'];
             $file = new File(APP . 'Config' . DS . $this->appYmlPrefix . 'application.yml', true);
             $file->write(Spyc::YAMLDump($conf));
             $this->SiteManager->saveData();
         } else {
             $this->SiteSetting->validateDeveloper($this->request->data);
             if (!$this->SiteSetting->validationErrors) {
                 $this->Session->write('debug', (int) $this->request->data['SiteSetting']['debug']['0']['value']);
                 $this->NetCommons->setFlashNotification(__d('net_commons', 'Successfully saved.'), array('class' => 'success'));
                 $this->redirect($this->referer());
             } else {
                 $this->NetCommons->handleValidationError($this->SiteSetting->validationErrors);
             }
         }
     } else {
         $this->request->data['SiteSetting'] = $this->SiteSetting->getSiteSettingForEdit(array('SiteSetting.key' => array('debug')));
         $onlySession = $this->Session->read('debug');
         $this->request->data['SiteSetting']['only_session'] = isset($onlySession);
         if ($this->request->data['SiteSetting']['only_session']) {
             $this->request->data['SiteSetting']['debug']['0']['value'] = $onlySession;
         }
     }
 }
开发者ID:NetCommons3,项目名称:SystemManager,代码行数:38,代码来源:DeveloperController.php

示例3: save_data

function save_data($obj)
{
    global $wpdb;
    require_once "../../../../../wp-load.php";
    require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/class/Spyc.php';
    require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/core-files/defines-const.php';
    if (!current_user_can('manage_options')) {
        echo 'ADMIN BABY !!!';
        die;
    }
    /*	echo '<h2>Save</h2>';
    	echo '<pre>';
    	var_dump($obj['data']);
    	echo '</pre>';*/
    $prop_path = GLOBALDATA_PATH . 'template-hierarchy';
    $posttypes_array = Spyc::YAMLLoad($prop_path . '/arguments/' . $obj['ui_page_name'] . '-slots-properties.yaml');
    //var_dump($posttypes_array[$_POST['slotname']]);
    //echo '<br>---<br>';
    //var_dump($_POST['data']);
    $execute_array = array_merge($posttypes_array[$obj['slotname']], $obj['data']);
    //echo '<br>---<br>';
    //var_dump($execute_array);
    $posttypes_array[$obj['slotname']] = $execute_array;
    //var_dump($posttypes_array);
    file_put_contents($prop_path . '/arguments/' . $obj['ui_page_name'] . '-slots-properties.yaml', Spyc::YAMLDump($posttypes_array));
}
开发者ID:johan--,项目名称:UiGEN-Core,代码行数:26,代码来源:properties-manager-save.php

示例4: beforeSave

 function beforeSave($options = array())
 {
     if ($this->data[$this->name]['type'] == 'IssueCustomField' && !empty($this->data['CustomField']['id'])) {
         $assoc_trackers = Set::extract('{n}.CustomFieldsTracker.tracker_id', $this->CustomFieldsTracker->find('all', array('conditions' => array('custom_field_id' => $this->data['CustomField']['id']))));
         $tracker_ids = empty($this->data[$this->name]['tracker_id']) ? array() : $this->data[$this->name]['tracker_id'];
         $this->__add_trackers = array_diff($tracker_ids, $assoc_trackers);
         $this->__del_trackers = array_diff($assoc_trackers, $tracker_ids);
     }
     unset($this->data[$this->name]['tracker_id']);
     App::Import('vendor', 'spyc');
     if (!empty($this->data[$this->name]['possible_values']) && $this->data[$this->name]['field_format'] == 'list') {
         if (empty($this->data[$this->name]['possible_values'][count($this->data[$this->name]['possible_values']) - 1])) {
             unset($this->data[$this->name]['possible_values'][count($this->data[$this->name]['possible_values']) - 1]);
         }
         $this->data[$this->name]['possible_values'] = Spyc::YAMLDump($this->data[$this->name]['possible_values'], true);
     } else {
         $this->data[$this->name]['possible_values'] = '--- []';
     }
     if (empty($this->data[$this->name]['min_length'])) {
         $this->data[$this->name]['min_length'] = 0;
     }
     if (empty($this->data[$this->name]['max_length'])) {
         $this->data[$this->name]['max_length'] = 0;
     }
     return true;
 }
开发者ID:nachtschatt3n,项目名称:candycane,代码行数:26,代码来源:custom_field.php

示例5: beforeSave

 public function beforeSave($options = array())
 {
     if (isset($this->data[$this->name]['type']) && $this->data[$this->name]['type'] == 'IssueCustomField' && !empty($this->data['CustomField']['id'])) {
         $this->bindModel(array('hasMany' => array('CustomFieldsTracker')), false);
         $assoc_trackers = Set::extract('{n}.CustomFieldsTracker.tracker_id', $this->CustomFieldsTracker->find('all', array('conditions' => array('custom_field_id' => $this->data['CustomField']['id']))));
         $tracker_ids = empty($this->data[$this->name]['tracker_id']) ? array() : $this->data[$this->name]['tracker_id'];
         $this->__add_trackers = array_diff($tracker_ids, $assoc_trackers ? $assoc_trackers : array());
         $this->__del_trackers = array_diff($assoc_trackers ? $assoc_trackers : array(), $tracker_ids);
     }
     unset($this->data[$this->name]['tracker_id']);
     App::Import('vendor', 'georgious-cakephp-yaml-migrations-and-fixtures/spyc/spyc');
     if (!empty($this->data[$this->name]['possible_values']) && $this->data[$this->name]['field_format'] == 'list') {
         if (empty($this->data[$this->name]['possible_values'][count($this->data[$this->name]['possible_values']) - 1])) {
             unset($this->data[$this->name]['possible_values'][count($this->data[$this->name]['possible_values']) - 1]);
         }
         $this->data[$this->name]['possible_values'] = Spyc::YAMLDump($this->data[$this->name]['possible_values'], true);
     } else {
         $this->data[$this->name]['possible_values'] = '--- []';
     }
     if (empty($this->data[$this->name]['min_length'])) {
         $this->data[$this->name]['min_length'] = 0;
     }
     if (empty($this->data[$this->name]['max_length'])) {
         $this->data[$this->name]['max_length'] = 0;
     }
     return true;
 }
开发者ID:nagumo,项目名称:candycane,代码行数:27,代码来源:CustomField.php

示例6: preset

 function preset($lang)
 {
     session_start();
     $language = $this->general_model->get_language_by_code($lang);
     if ($language != 0) {
         $_SESSION["language"] = $language;
         $this->data["lang"] = $lang;
     } else {
         $language = $this->general_model->get_language_default();
         if ($language != 0) {
             redirect(base_url() . $language["code"]);
         } else {
             die("System error 1");
         }
     }
     $this->lang->load($lang, $language["language_name"]);
     $_SERVER['DOCUMENT_ROOT'] = dirname(dirname(dirname(__FILE__)));
     //        die($_SERVER["REQUEST_URI"]);
     $this->data['lang_url'] = $_SERVER["REQUEST_URI"];
     $this->data['action'] = $_SERVER["REQUEST_URI"];
     $this->data['redirect'] = $_SERVER["REQUEST_URI"];
     $this->data['settings'] = $this->general_model->get_website_info();
     $this->data['settings']["options"] = $this->general_model->get_website_info_options($language["language_id"]);
     $visitor = $this->general_model->get_duplicate_visitor(session_id(), $_SERVER["REQUEST_URI"]);
     if (count($visitor) == 0) {
         // Get IP address
         if (isset($_SERVER['HTTP_CLIENT_IP']) && !empty($_SERVER['HTTP_CLIENT_IP'])) {
             $ip = $_SERVER['HTTP_CLIENT_IP'];
         } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
         } else {
             $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
         }
         $ip = filter_var($ip, FILTER_VALIDATE_IP);
         $ip = $ip === false ? '0.0.0.0' : $ip;
         $this->load->library('spyc');
         $visitor_data = array("session_id" => session_id(), "user_id" => isset($_SESSION["user"]["user_id"]) ? $_SESSION["user"]["user_id"] : 0, "created_date" => time(), "updated_date" => time(), "user_agent" => Spyc::YAMLDump($_SERVER["HTTP_USER_AGENT"]), "user_ip" => $ip, "language_id" => $language["language_id"], "language_code" => $language["code"], "referrer" => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", "request_url" => $_SERVER['REQUEST_URI'], "count_view" => 1);
         $this->general_model->insert_visitors($visitor_data);
     } else {
         $visitor = @reset($visitor);
         $visitor_data = array("user_id" => isset($_SESSION["user"]["user_id"]) ? $_SESSION["user"]["user_id"] : 0, "updated_date" => time(), "count_view" => $visitor["count_view"] + 1);
         $this->general_model->update_duplicate_visitor(session_id(), $_SERVER["REQUEST_URI"], $visitor_data);
     }
     $data_menu = array();
     $menu = $this->general_model->get_menu();
     $i = 0;
     foreach ($menu as $menu) {
         $data_menu[$i] = array('id' => $menu['page_id'], 'name' => $menu['title_caption'], 'url' => $menu['page_id'] != 0 ? base_url() . $lang . "/page/" . $menu['page_id'] : $menu['menu_url']);
         $i++;
     }
     $this->data['languages'] = $this->general_model->get_languages();
     foreach ($this->data['languages'] as &$value) {
         $url_array = explode("/", $this->data["lang_url"]);
         $url_array[array_search($lang, $url_array)] = $value["code"];
         $value["lang_url"] = implode("/", $url_array);
     }
     $this->data['data_menu'] = $data_menu;
     $this->data['link_contact'] = base_url() . "contact";
 }
开发者ID:jemmy655,项目名称:nodcms,代码行数:59,代码来源:pages.php

示例7: beautifyYAML

 /**
  * Pretty-print YAML
  *
  * @return bool|null|string
  */
 public function beautifyYAML()
 {
     $decoded = $this->getYamlData();
     if (!is_array($decoded)) {
         return null;
     }
     return Spyc::YAMLDump($decoded, 4, 0);
 }
开发者ID:valhallasw,项目名称:mediawiki-extensions-OpenStackManager,代码行数:13,代码来源:YamlContent.php

示例8: export_format

 /**
  * Returns the formatted config file contents.
  *
  * @param   array   $content  config array
  * @return  string  formatted config file contents
  */
 protected function export_format($contents)
 {
     if (!function_exists('spyc_load')) {
         import('spyc/spyc', 'vendor');
     }
     $this->prep_vars($contents);
     return \Spyc::YAMLDump($contents);
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:14,代码来源:yml.php

示例9: save

 public function save()
 {
     self::purge($this);
     if (file_put_contents($this->path, Spyc::YAMLDump($this))) {
         cache::getInstance()->config = $this;
     }
     return $this;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:8,代码来源:class.config.php

示例10: beforeSave

 /**
  * beforeSave
  *
  */
 function beforeSave()
 {
     //pr($this->data);
     if (isset($this->data['UserPreference']['pref'])) {
         $this->data['UserPreference']['others'] = Spyc::YAMLDump($this->data['UserPreference']['pref']);
     }
     #    self.others ||= {}
     return true;
 }
开发者ID:gildonei,项目名称:candycane,代码行数:13,代码来源:UserPreference.php

示例11: writeLog

 public function writeLog($data)
 {
     if (sizeof($data) > 0) {
         $yaml = \Spyc::YAMLDump($data, 4, 60);
         $fh = fopen(DOC_ROOT . '/logs/paypal', "a");
         fwrite($fh, $yaml);
         fclose($fh);
     }
 }
开发者ID:mikejw,项目名称:elib-experimental,代码行数:9,代码来源:PaypalController.php

示例12: save

 public function save()
 {
     $fp = fopen($this->fileName, 'w+');
     fputs($fp, Spyc::YAMLDump($this->toArray(), true, 0));
     fclose($fp);
     if ($this->useCache == true) {
         $this->writeCache();
     }
 }
开发者ID:afzet,项目名称:cake-cart,代码行数:9,代码来源:axial.configuration.yaml.php

示例13: save

 public function save()
 {
     // If settings is null
     //  -> means the file was never loaded because no setting was changed
     //  -> means no need to save
     if ($this->settings === null) {
         return;
     }
     $yaml = Spyc::YAMLDump($this->settings);
 }
开发者ID:justmoon,项目名称:codestewart,代码行数:10,代码来源:configfile.class.php

示例14: prepare_job

function prepare_job($workdir, $info)
{
    $BASE = $info['BASE'];
    mkdir($workdir);
    $fp = fopen("{$workdir}/info.yaml", 'w');
    fwrite($fp, Spyc::YAMLDump($info));
    fclose($fp);
    system("chmod 777 -R {$workdir}");
    return $workdir;
}
开发者ID:jluzhhy,项目名称:Cross-microrna,代码行数:10,代码来源:runtimelib.php

示例15: ui_save_data_grid

function ui_save_data_grid($obj)
{
    if (current_user_can('manage_options')) {
        //var_dump($obj['yaml']);
        require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/core-files/defines-const.php';
        file_put_contents(GLOBALDATA_PATH . 'uigen-data-grids/' . $obj['filename'], Spyc::YAMLDump($obj['yaml']));
    } else {
        echo '<span>Error:ui_save_data_grid is admin method. Login as admin</span>';
    }
}
开发者ID:johan--,项目名称:UiGEN-Core,代码行数:10,代码来源:ajax_data_grid.php


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