本文整理汇总了PHP中yaml函数的典型用法代码示例。如果您正苦于以下问题:PHP yaml函数的具体用法?PHP yaml怎么用?PHP yaml使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yaml函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load
public function load($filepath = null)
{
if (!is_null($filepath)) {
$this->parse(yaml($filepath));
}
return $this->get();
}
开发者ID:sofadesign,项目名称:vincent-helye.com,代码行数:7,代码来源:lemon_index.class.php
示例2: ScConfig
function ScConfig(&$Sc, $variant = NULL)
{
/* Function: ScConfig()
* Constructor.
*/
$this->Sc = $Sc;
// Find config file
$config_file = $Sc->findConfigFile();
if ($config_file === FALSE) {
ScStatus::error('No config file found. You may generate one using `ss makeconfig`.');
return;
}
// Load config file and validate
$this->cwd = dirname($config_file);
$this->_config = yaml($config_file);
if (!is_array($this->_config)) {
ScStatus::error('Configuration file is invalid.');
return;
}
if (!is_null($variant)) {
$vfile = str_replace('.conf', ".{$variant}.conf", $config_file);
if (!is_file($vfile)) {
ScStatus::error("Configuration for variant '{$variant}' not found.");
return;
}
$arr = yaml($vfile);
if (!is_array($arr)) {
ScStatus::error("Configuration for variant '{$variant}' is invalid.");
return;
}
$this->_config = array_merge($this->_config, $arr);
}
}
开发者ID:rstacruz,项目名称:SourceScribe,代码行数:33,代码来源:class.scconfig.php
示例3: __construct
public function __construct($session, $username)
{
//istantiate object properties
$this->session = $session;
$this->sessionTests = yaml($this->session->tests());
$this->resultsFolderPath = $this->getResultsFolderPath($this->session);
$this->username = $username;
}
开发者ID:alkaest2002,项目名称:risky2,代码行数:8,代码来源:testSession.php
示例4: values
public function values()
{
if (is_array($this->value())) {
return $this->value();
} else {
return yaml($this->value());
}
}
开发者ID:idrisyangui,项目名称:kirby-field-repeater,代码行数:8,代码来源:repeater.php
示例5: related
function related($field)
{
global $site;
// parse the field with yaml
$raw = yaml($field);
$related = array();
$pages = $site->pages();
foreach ($raw as $r) {
// make sure to only add found related pages
if ($rel = $pages->find($r)) {
$related[] = $rel;
}
}
return new relatedPages($related);
}
开发者ID:ajmalafif,项目名称:bradshawsguide,代码行数:15,代码来源:related.php
示例6: guestsCount
/**
* Get the number of registered guests
*
* @return int
*/
public function guestsCount()
{
$count = 0;
foreach ($this->children()->find('orders')->children() as $order) {
$guests = yaml($order->guests());
$count += count($guests);
}
return $count;
}
开发者ID:evendev,项目名称:paintcrazy,代码行数:14,代码来源:event.php
示例7: firewall
public static function firewall($params = array())
{
//default options
$defaults = array('ignore' => array(c::get('account.login.folder'), c::get('account.logout.folder')), 'redirect' => site()->find(c::get('account.login.folder'))->url(), 'allow' => array(), 'deny' => array());
//merge defaults options with custom options
$options = array_merge($defaults, $params);
//get active page
$page = site()->activePage();
//if this is a public accessible page (i.e., included in ignore array option)
if (in_array($page->uid(), $options['ignore'])) {
return true;
}
//get current user
$user = Auth::loggedUser();
//if no user is logged in
if (!$user) {
//go to redirection page
go(url($options['redirect']));
}
//set expected schema for firewall allow and deny array
$arraySchema = array('user' => '', 'role' => '');
//throw error if allow array doesn't conform to expected array schema
if (array_diff_key($options['allow'], $arraySchema)) {
throw new Exception('Firewall schema incorrect');
}
//throw error if deny array doesn't conform to expected array schema
if (array_diff_key($options['deny'], $arraySchema)) {
throw new Exception('Firewall schema incorrect');
}
//set default value of $passFirewall
$passFirewall = false;
//*** ALLOWED PAGES LOOP
foreach ($options['allow'] as $key => $value) {
//see if user's username is allowed
if ($allow = str::contains($value, $user->username())) {
break;
}
//see if user's group is allowed
$allow = str::contains($value, $user->role());
}
//*** DENIED PAGES LOOP
foreach ($options['deny'] as $key => $value) {
//see if user's username is denied
if ($deny = str::contains($value, $user->username())) {
break;
}
//see if user's group is denied
$deny = str::contains($value, $user->role());
}
//*** ALLOWED TESTS LOOP
//if we are in the tests folder
if ($page->parent()->uid() == c::get('tests.folder')) {
//get session tests
$allowedTests = yaml(site()->find(implode(DS, array(c::get('sessions.folder'), $user->session())))->tests());
//loop though session's tests
foreach ($allowedTests as $test) {
//if current test is included in session's tests list and user's session status points to it
if ($allowTest = str::lower($page->uid()) == str::lower($test['Test']) && str::lower($page->uid()) == str::lower($user->status())) {
break;
}
}
} else {
//set $allowTest to true since we are not in tests folder
//and hence the firewall acts only on ALLOW and DENY loops
$allowTest = true;
}
//re-determine $passFirewall
$passFirewall = $allow && !$deny && $allowTest;
//if $passFirewall evaluates to false
if (!$passFirewall) {
//go to homepage for logged users.
//Non logged users were redirected to the login page before
go(site()->language()->url());
}
//just in case
return true;
}
开发者ID:alkaest2002,项目名称:risky2,代码行数:77,代码来源:auth.php
示例8: load
protected static function load($username)
{
$username = str::lower($username);
$dir = c::get('root.site') . '/accounts';
$file = $dir . '/' . $username . '.php';
if (!is_dir($dir) || !file_exists($file)) {
return false;
}
$content = file_get_contents($file);
$yaml = yaml($content);
// remove the php direct access protection line
unset($yaml[0]);
return new AuthUser($yaml);
}
开发者ID:scheibome,项目名称:kirbycms-extensions,代码行数:14,代码来源:auth.php
示例9: date_default_timezone_set
<?php
date_default_timezone_set('Europe/Riga');
?>
<section id="schedule" class="section--lightgray js-section">
<div class="section--lightgray__head">
<h1 class="section--lightgray__title"><?php
echo $data->title();
?>
</h1>
</div>
<div class="section--lightgray__body">
<div class="wrapper">
<?php
$day1 = yaml($data->day2());
?>
<?php
if (!empty($day1)) {
?>
<table class="t schedule">
<caption class="schedule__caption"><?php
echo $data->day2_title();
?>
<div class="schedule__desc"><?php
echo $data->day2_desc();
?>
</div>
</caption>
<tbody class="t-body">
<?php
foreach ($day1 as $key => $line) {
开发者ID:psihius,项目名称:webconf,代码行数:31,代码来源:schedule-page.php
示例10: yaml
?>
><?php
echo $menuItem['label'];
?>
</a>
<?php
}
?>
</div>
</div>
</nav>
<nav class="nav navDesktop bg-black u-padd-top-quarter u-padd-btm-quarter" role="navigation">
<div class="l-container">
<?php
$menuItems = yaml($site->menuItems());
?>
<?php
foreach ($menuItems as $menuItem) {
?>
<a class="nav_item text-red" href="<?php
echo $menuItem['hyperlink'];
?>
" <?php
if ($menuItem['target'] == '1') {
?>
target="_blank"<?php
}
?>
><?php
echo $menuItem['label'];
开发者ID:aminalhazwani,项目名称:leanderschwazer.com,代码行数:31,代码来源:navigation.php
示例11: html
?>
<main class="main" role="main">
<div class="col-4-6 last">
<article class="text">
<h1><?php
echo html($page->title());
?>
</h1>
<h2>Available Translations</h2>
<dl>
<?php
$langs = a::sort(yaml($page->languages()), 'lang', 'asc');
?>
<?php
foreach ($langs as $lang) {
?>
<dt class="gamma"><a href="https://github.com/getkirby/panel/blob/master/app/languages/<?php
echo $lang['code'];
?>
.php"><?php
echo $lang['lang'];
?>
</a></dt>
<dd><span>Author: </span><?php
echo $lang['author'];
?>
</dd>
开发者ID:rugk,项目名称:getkirby.com,代码行数:31,代码来源:docs.languages.php
示例12: function
return function ($site, $pages, $page) {
//set variables
$tests = null;
$sessionName = null;
$totalTestingTime = null;
$completedTestingTime = null;
$numberOfTests = null;
$sessionComplete = null;
//get logged user (if any)
if ($user = Auth::loggedUser()) {
//set session name
$sessionName = $user->session();
//if user's session exists
if ($testSession = $pages->find(implode(DS, array(c::get('sessions.folder'), $sessionName)))) {
//get array of session's tests
$testsInSession = yaml($testSession->tests());
//count number of session'a tests
$numberOfTests = count($testsInSession);
//set default test button CSS classes
$testButtonCSSClasses = c::get('test.button.completed');
//set default test button label
$testButtonLabel = l('test.completed');
//get session's tests specifications
foreach ($testsInSession as $test) {
//if current test exists
if ($t = $page->children()->find($test['Test'])) {
//store current test's specifications into array
$testSpecs = $t->content()->toArray();
//update total testing time, by adding current test's time
$totalTestingTime += (int) $testSpecs['minutes'];
//if the currently looping test equals the test stored into user's status field
开发者ID:alkaest2002,项目名称:risky2,代码行数:31,代码来源:tests.php
示例13: foreach
<?php
foreach (page('events')->children() as $event) {
?>
<?php
$is_header_displayed = false;
?>
<?php
foreach (yaml($page->marks()) as $mark_group) {
?>
<!--# loops through all marks -->
<?php
if ($mark_group['event'] == $event->title()->html()) {
?>
<!--# checks to see if the category matches -->
<?php
if ($is_header_displayed == false) {
?>
<!--# displays event header -->
<span><?php
echo $event->title()->html();
?>
</span>
<?php
}
?>
<?php
foreach ($mark_group as $item) {
?>
<!--# shows mark, date and location -->
<?php
开发者ID:antcoop,项目名称:saints-tc,代码行数:31,代码来源:athlete-marks.php
示例14: isset
<!-- Organism: Form Builder -->
<?php
$data = isset($content) ? $content : $page;
/* Zusätzliche Textspalten */
$additional_columns = yaml($data->columns());
$additional_columns = reset($additional_columns);
/* Layoutklassen */
$layout_classes = array();
$layout_classes["bildblock"] = "col-lg-8 col-sm-8 bild";
$layout_classes["textblock"] = "col-lg-4 col-sm-4 text";
/* Layout switcher */
$layout_data = "";
/* Layoutklassen */
$behavior_classes = "";
?>
<div class="clearfix"></div>
<div class='col-sm-12'>
<span class='js-form-status'></span>
</div>
<form class="text form-horizontal contactform js-form" method="POST" action="<?php
echo c::get('settings')['ajax-form-url'];
?>
" name="<?php
echo $data->title();
?>
" enctype="multipart/form-data" novalidate>
开发者ID:cnoss,项目名称:fubix,代码行数:30,代码来源:content--form-builder.php
示例15: yaml
<span class="schedule__action"><?php
echo $line["title"];
?>
</span><?php
}
?>
</td>
</tr><?php
}
?>
</tbody>
</table><?php
}
?>
<?php
$day2 = yaml($data->day2());
?>
<?php
if (!empty($day2)) {
?>
<table class="t schedule">
<caption class="schedule__caption"><?php
echo $data->day2_title();
?>
<div class="schedule__desc"><?php
echo $data->day2_desc();
?>
</div>
</caption>
<tbody class="t-body"><?php
foreach ($day2 as $line) {
开发者ID:psihius,项目名称:webconf,代码行数:31,代码来源:schedule.php
示例16: function
/**
* Splits the field value by the given separator
* @param Field $field The calling Kirby Field instance
* @param string $separator The string to split the field value by
* @return array
*/
field::$methods['split'] = function ($field, $separator = ',') {
return str::split($field->value, $separator);
};
/**
* Parses the field value as yaml and returns an array
* @param Field $field The calling Kirby Field instance
* @return array
*/
field::$methods['yaml'] = function ($field) {
return yaml($field->value);
};
/**
* Checks if the field value is empty
* @param Field $field The calling Kirby Field instance
* @return boolean
*/
field::$methods['empty'] = field::$methods['isEmpty'] = function ($field) {
return empty($field->value);
};
/**
* Checks if the field value is not empty
* @param Field $field The calling Kirby Field instance
* @return boolean
*/
field::$methods['isNotEmpty'] = function ($field) {
开发者ID:kristianhalte,项目名称:super_organic,代码行数:31,代码来源:methods.php
示例17: content
/**
* Generate field content markup
*
* @since 1.0.0
*
* @return string
*/
public function content()
{
/* Zusätzliche Textspalten */
$additional_columns = yaml($this->page()->columns());
$additional_columns = reset($additional_columns);
/* Bildbeschnitt, falls vorhanden */
$image_crop = $this->page()->image_crop() != "" ? $this->page()->image_crop() : "";
$wrapper = new Brick('div');
$wrapper->addClass('layoutswitcher');
$wrapper->data(array('field' => 'layoutswitcher', 'name' => $this->name(), 'page' => $this->page()));
$wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('field' => $this, 'text1' => $this->page()->text(), 'text2' => $additional_columns["text2"], 'text3' => $additional_columns["text3"], 'noc' => intval($additional_columns["noc"]), 'crop' => $image_crop, 'page_tpl' => $this->page()->intendedTemplate())));
return $wrapper;
}
开发者ID:cnoss,项目名称:fubix,代码行数:20,代码来源:layoutswitchersingleton.php
示例18: yaml
echo $service['service'];
?>
</h6>
<p><?php
echo $service['description'];
?>
</p>
<?php
}
?>
</div>
<!-- RIGHT COLUMN -->
<div class="page-content__copy">
<?php
$servicesRight = yaml($page->contentright());
?>
<?php
foreach ($servicesRight as $service) {
?>
<h6><i class="fa fa-asterisk"></i><?php
echo $service['service'];
?>
</h6>
<p><?php
echo $service['description'];
?>
</p>
<?php
}
?>
开发者ID:joslemmons,项目名称:flaire,代码行数:31,代码来源:services.php
示例19: snippet
snippet('info');
?>
</div>
</section>
<section class="team scroll-section" id="team">
<div class="full anim">
<h2>Team</h2>
</div>
<div class="full">
<?php
$team = yaml($page->team());
?>
<?php
foreach ($team as $person) {
?>
<div class="third anim">
<div class="info">
<p><?php
echo $person["name"];
?>
<br/>
<?php
echo $person["role"];
?>
</p>
开发者ID:smongey,项目名称:odfk,代码行数:31,代码来源:home.php
示例20: getTax
public function getTax()
{
// Get all tax categories as an array
$taxCategories = yaml(page('shop')->tax());
$taxes = array();
// Calculate total amount of taxable items
$taxableAmount = 0;
foreach ($this->items as $item) {
$taxableAmount += $item->notax === 1 ? 0 : $item->amount * $item->quantity;
}
foreach ($taxCategories as $taxCategory) {
if ($this->appliesToCountry($taxCategory)) {
$taxes[] = $taxCategory['rate'] * $taxableAmount;
}
}
if (count($taxes) > 0) {
return max($taxes);
}
return 0;
}
开发者ID:jenniferhail,项目名称:kirbypine,代码行数:20,代码来源:Cart.php
注:本文中的yaml函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论