本文整理汇总了PHP中WireData类的典型用法代码示例。如果您正苦于以下问题:PHP WireData类的具体用法?PHP WireData怎么用?PHP WireData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WireData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:avatar382,项目名称:fablab_site,代码行数:36,代码来源:PageArray.php
示例2: initNavJSON
/**
* Initialize/create the $options array for executeNavJSON() in Process modules
*
* @param array $options
* @return array
*
*/
public function initNavJSON(array $options = array())
{
$page = $this->wire('page');
$templatesArray = array();
$bookmarkFields = array();
$bookmarksArray = array();
$rolesArray = array();
$data = $this->wire('modules')->getModuleConfigData($this->process);
$iconKey = isset($options['iconKey']) ? $options['iconKey'] : '_icon';
$classKey = isset($options['classKey']) ? $options['classKey'] : '_class';
$options['classKey'] = $classKey;
$options['iconKey'] = $iconKey;
if (!isset($options['defaultIcon'])) {
$options['defaultIcon'] = 'arrow-circle-right';
}
foreach ($this->wire('user')->roles as $role) {
if ($role->name == 'guest') {
continue;
}
$value = isset($data["bookmarks"]["_{$role->id}"]) ? $data["bookmarks"]["_{$role->id}"] : array();
if (empty($value)) {
continue;
}
$bookmarkFields[$role->name] = $value;
$rolesArray[$role->name] = $role;
}
$bookmarkFields['bookmarks'] = isset($data['bookmarks']["_0"]) ? $data['bookmarks']["_0"] : array();
$n = 0;
foreach ($bookmarkFields as $name => $bookmarkIDs) {
$bookmarks = count($bookmarkIDs) ? $this->wire('pages')->getById($bookmarkIDs) : array();
// $className = "separator";
$role = isset($rolesArray[$name]) ? $rolesArray[$name] : null;
foreach ($bookmarks as $page) {
if ($this->process == 'ProcessPageEdit' && !$page->editable()) {
continue;
} else {
if ($this->process == 'ProcessPageAdd' && !$page->addable()) {
continue;
} else {
if (!$page->listable()) {
continue;
}
}
}
if (isset($bookmarksArray[$page->id])) {
continue;
}
$icon = $page->template->getIcon();
if (!$icon) {
$icon = $options['defaultIcon'];
}
$page->setQuietly($iconKey, $icon);
// $page->setQuietly($classKey, $className);
$page->setQuietly('_roleName', $role ? $role->name : $this->labels['all']);
$className = '';
$bookmarksArray[$page->id] = $page;
}
$n++;
}
if (empty($options['add'])) {
if ($this->wire('user')->isSuperuser()) {
$options['add'] = 'bookmarks/?role=0';
$options['addLabel'] = $this->labels['bookmarks'];
$options['addIcon'] = 'bookmark-o';
} else {
$options['add'] = null;
}
} else {
if ($this->wire('user')->isSuperuser()) {
$add = new WireData();
$add->set('_icon', 'bookmark-o');
$add->set('title', $this->labels['bookmarks']);
$add->set('id', 'bookmark');
$add->set($classKey, 'highlight separator');
array_unshift($bookmarksArray, $add);
}
}
if (isset($options['items'])) {
$options['items'] = $options['items'] + $bookmarksArray;
} else {
$options['items'] = $bookmarksArray;
}
if (!isset($options['itemLabel'])) {
$options['itemLabel'] = 'title|name';
}
if (!isset($options['sort'])) {
$options['sort'] = false;
}
if (!isset($options['iconKey'])) {
$options['iconKey'] = '_icon';
}
if (empty($options['edit'])) {
$options['edit'] = $this->wire('config')->urls->admin . 'page/edit/?id={id}';
//.........这里部分代码省略.........
开发者ID:posixpascal,项目名称:TrooperCMS,代码行数:101,代码来源:PageBookmarks.php
示例3: get
public function get($key)
{
if ($key == 'operator') {
return $this->getOperator();
}
return parent::get($key);
}
开发者ID:nicolasleon,项目名称:P21,代码行数:7,代码来源:Selector.php
示例4: get
public function get($key)
{
if ($key == 'className' || $key == 'class' || $key == 'name') {
return $this->class;
}
return parent::get($key);
}
开发者ID:avatar382,项目名称:fablab_site,代码行数:7,代码来源:ModulePlaceholder.php
示例5: get
public function get($key)
{
if ($key == 'statusString') {
return str_replace('_', ' ', $this->geocodeStatuses[$this->status]);
}
return parent::get($key);
}
开发者ID:ranzwertig,项目名称:FieldtypeMapMarker,代码行数:7,代码来源:MapMarker.php
示例6: get
/**
* Get a value stored in this Process
*
*/
public function get($key)
{
if (($value = $this->getFuel($key)) !== null) {
return $value;
}
return parent::get($key);
}
开发者ID:rzelnik,项目名称:ProcessWire,代码行数:11,代码来源:Process.php
示例7: 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);
}
开发者ID:arjenblokzijl,项目名称:IftRunner,代码行数:26,代码来源:IftTrigger.php
示例8: __get
public function __get($key)
{
if ($key == 'query') {
return $this->getQuery();
} else {
return parent::__get($key);
}
}
开发者ID:posixpascal,项目名称:TrooperCMS,代码行数:8,代码来源:DatabaseQuery.php
示例9: __set
public function __set($key, $value)
{
if (array_key_exists($key, $this->mail)) {
$this->{$key}($value);
} else {
parent::__set($key, $value);
}
}
开发者ID:Rizsti,项目名称:Processwire_Compatibility,代码行数:8,代码来源:WireMail.php
示例10: 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);
}
开发者ID:ryancramerdesign,项目名称:ProcessWire-2.0,代码行数:11,代码来源:Permission.php
示例11: 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;
}
开发者ID:kongondo,项目名称:FieldtypeImageMarker,代码行数:16,代码来源:ImageMarker.php
示例12: 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;
}
开发者ID:ryancramerdesign,项目名称:ProcessWire-2.0,代码行数:19,代码来源:Paths.php
示例13: __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();
}
开发者ID:Rizsti,项目名称:Processwire_Compatibility,代码行数:15,代码来源:AdminThemeDefaultHelpers.php
示例14: _
/**
* 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;
}
开发者ID:posixpascal,项目名称:TrooperCMS,代码行数:22,代码来源:AdminThemeDefaultHelpers.php
示例15: 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);
}
开发者ID:ryancramerdesign,项目名称:ProcessWire-2.0,代码行数:26,代码来源:Config.php
示例16: 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;
}
开发者ID:bensssyde,项目名称:FieldtypeEvents,代码行数:21,代码来源:Event.php
示例17: getProperty
/**
* Get the language-aware property
*
* @param string $property Either 'title' or 'value'
* @return string
*
*/
protected function getProperty($property)
{
if ($this->wire('languages')) {
$language = $this->wire('user')->language;
if ($language->isDefault()) {
$value = parent::get($property);
} else {
$value = parent::get("{$property}{$language}");
// fallback to default language title if no title present for language
if (!strlen($value)) {
$value = parent::get($property);
}
}
} else {
$value = parent::get($property);
}
if ($this->of) {
$value = $this->wire('sanitizer')->entities($value);
}
return $value;
}
开发者ID:Rizsti,项目名称:Processwire_Compatibility,代码行数:28,代码来源:SelectableOption.php
示例18: __debugInfo
/**
* debugInfo PHP 5.6+ magic method
*
* This is used when you print_r() an object instance.
*
* @return array
*
*/
public function __debugInfo()
{
$info = parent::__debugInfo();
$info['settings'] = $this->settings;
if ($this->prevTable) {
$info['prevTable'] = $this->prevTable;
}
if ($this->prevFieldtype) {
$info['prevFieldtype'] = (string) $this->prevFieldtype;
}
if (!empty($this->trackGets)) {
$info['trackGets'] = $this->trackGets;
}
if ($this->useRoles) {
$info['viewRoles'] = $this->viewRoles;
$info['editRoles'] = $this->editRoles;
}
return $info;
}
开发者ID:posixpascal,项目名称:TrooperCMS,代码行数:27,代码来源:Field.php
示例19: getArray
/**
* Per Saveable interface, get an array of this table's data
*
* We override this so that we can add our roles array to it.
*
*/
public function getArray()
{
$a = parent::getArray();
if ($this->useRoles) {
$a['roles'] = array();
foreach ($this->getRoles() as $role) {
$a['roles'][] = $role->id;
}
} else {
unset($a['roles'], $a['editRoles'], $a['addRoles'], $a['createRoles']);
}
return $a;
}
开发者ID:avatar382,项目名称:fablab_site,代码行数:19,代码来源:Template.php
示例20: removeHook
/**
* Remove a hook by ID
*
* To remove the hook that this event is for, call it with the $hookId argument as null or blank.
*
* @param string|null $hookId
* @return $this
*
*/
public function removeHook($hookId)
{
if (empty($hookId)) {
if ($this->object && $this->id) {
$this->object->removeHook($this->id);
}
return $this;
} else {
return parent::removeHook($hookId);
}
}
开发者ID:posixpascal,项目名称:TrooperCMS,代码行数:20,代码来源:HookEvent.php
注:本文中的WireData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论