本文整理汇总了PHP中WireData类的典型用法代码示例。如果您正苦于以下问题:PHP WireData类的具体用法?PHP WireData怎么用?PHP WireData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WireData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemPropertyValue
/**
* Get the value of $property from $item
*
* Used by the WireArray::sort method to retrieve a value from a Wire object.
* If output formatting is on, we turn it off to ensure that the sorting
* is performed without output formatting.
*
* @param Wire $item
* @param string $property
* @return mixed
*
*/
protected function getItemPropertyValue(Wire $item, $property)
{
if ($item instanceof Page) {
$value = $item->getUnformatted($property);
} else {
if (strpos($property, '.') !== false) {
$value = WireData::_getDot($property, $item);
} else {
if ($item instanceof WireArray) {
$value = $item->getProperty($property);
if (is_null($value)) {
$value = $item->first();
$value = $this->getItemPropertyValue($value, $property);
}
} else {
$value = $item->{$property};
}
}
}
if (is_array($value)) {
$value = implode('|', $value);
}
return $value;
}
示例2: get
public function get($key)
{
if ($key == 'operator') {
return $this->getOperator();
}
return parent::get($key);
}
示例3: get
public function get($key)
{
if ($key == 'className' || $key == 'class' || $key == 'name') {
return $this->class;
}
return parent::get($key);
}
示例4: get
public function get($key)
{
if ($key == 'statusString') {
return str_replace('_', ' ', $this->geocodeStatuses[$this->status]);
}
return parent::get($key);
}
示例5: get
/**
* Get a value stored in this Process
*
*/
public function get($key)
{
if (($value = $this->getFuel($key)) !== null) {
return $value;
}
return parent::get($key);
}
示例6: set
public function set($key, $value)
{
if ($key == 'fieldChanges') {
// convert string changes list of field names to array
if (is_array($value)) {
if (!trim(implode('', $value))) {
$value = array();
}
} else {
$value = explode(' ', $value);
}
// sanitize
foreach ($value as $k => $v) {
$required = strpos($v, '+') === 0;
if ($required) {
$v = ltrim($v, '+');
}
$v = $this->wire('sanitizer')->fieldName($v);
if (empty($v)) {
continue;
}
$value[$k] = ($required ? '+' : '') . $v;
}
}
return parent::set($key, $value);
}
示例7: __get
public function __get($key)
{
if ($key == 'query') {
return $this->getQuery();
} else {
return parent::__get($key);
}
}
示例8: __set
public function __set($key, $value)
{
if (array_key_exists($key, $this->mail)) {
$this->{$key}($value);
} else {
parent::__set($key, $value);
}
}
示例9: set
public function set($key, $value)
{
if ($key == 'id' || $key == 'modules_id') {
$value = (int) $value;
} else {
if ($key == 'name') {
$value = $this->fuel('sanitizer')->name($value);
}
}
return parent::set($key, $value);
}
示例10: get
/**
* Retrieve a value from the ImageMarker: date, location or notes
*
*/
public function get($key)
{
$value = parent::get($key);
// if the page's output formatting is on, then we'll return formatted values
if ($this->page && $this->page->of()) {
// int sanitizer
if ($key == 'info' || $key == 'x' || $key == 'y') {
$value = (int) $value;
}
}
return $value;
}
示例11: get
/**
* Return the requested path variable
*
*/
public function get($key)
{
$value = parent::get($key);
if ($key == 'root') {
return $value;
}
if (!is_null($value)) {
if ($value[0] == '/' || DIRECTORY_SEPARATOR != '/' && $value[1] == ':') {
return $value;
} else {
$value = $this->root . $value;
}
}
return $value;
}
示例12: __construct
public function __construct()
{
if ($this->wire('input')->get('test_notices')) {
$this->message('Message test');
$this->message('Message test debug', Notice::debug);
$this->message('Message test markup <a href="#">example</a>', Notice::allowMarkup);
$this->warning('Warning test');
$this->warning('Warning test debug', Notice::debug);
$this->warning('Warning test markup <a href="#">example</a>', Notice::allowMarkup);
$this->error('Error test');
$this->error('Error test debug', Notice::debug);
$this->error('Error test markup <a href="#">example</a>', Notice::allowMarkup);
}
parent::__construct();
}
示例13: _
/**
* Perform a translation, based on text from shared admin file: /wire/templates-admin/default.php
*
* @param string $text
* @return string
*
*/
public function _($text)
{
static $translate = null;
if (is_null($translate)) {
$translate = $this->wire('languages') !== null;
}
if ($translate === false) {
return $text;
}
$value = __($text, $this->wire('config')->paths->root . 'wire/templates-admin/default.php');
if ($value === $text) {
$value = parent::_($text);
}
return $value;
}
示例14: js
/**
* Set a config field that is shared in Javascript, OR retrieve one or all params already set
*
* Specify only a $key and omit the $value in order to retrieve an existing set value.
* Specify no params to retrieve in array of all existing set values.
*
* @param string $key
* @param mixed $value
*
*/
public function js($key = null, $value = null)
{
if (is_null($key)) {
$data = array();
foreach ($this->jsFields as $field) {
$data[$field] = $this->get($field);
}
return $data;
} else {
if (is_null($value)) {
return in_array($key, $this->jsFields) ? $this->get($key) : null;
}
}
$this->jsFields[] = $key;
return parent::set($key, $value);
}
示例15: get
/**
* Retrieve a value from the event: date, location or notes
*
*/
public function get($key)
{
$value = parent::get($key);
// if the page's output formatting is on, then we'll return formatted values
if ($this->page && $this->page->of()) {
if ($key == 'date') {
// format a unix timestamp to a date string
$value = date(self::dateFormat, $value);
} else {
if ($key == 'location' || $key == 'notes') {
// return entity encoded versions of strings
$value = $this->sanitizer->entities($value);
}
}
}
return $value;
}