當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WireData類代碼示例

本文整理匯總了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;
 }
開發者ID:avatar382,項目名稱:fablab_site,代碼行數:36,代碼來源:PageArray.php

示例2: get

 public function get($key)
 {
     if ($key == 'operator') {
         return $this->getOperator();
     }
     return parent::get($key);
 }
開發者ID:nicolasleon,項目名稱:P21,代碼行數:7,代碼來源:Selector.php

示例3: 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

示例4: 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

示例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);
 }
開發者ID:rzelnik,項目名稱:ProcessWire,代碼行數:11,代碼來源:Process.php

示例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);
 }
開發者ID:arjenblokzijl,項目名稱:IftRunner,代碼行數:26,代碼來源:IftTrigger.php

示例7: __get

 public function __get($key)
 {
     if ($key == 'query') {
         return $this->getQuery();
     } else {
         return parent::__get($key);
     }
 }
開發者ID:posixpascal,項目名稱:TrooperCMS,代碼行數:8,代碼來源:DatabaseQuery.php

示例8: __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

示例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);
 }
開發者ID:ryancramerdesign,項目名稱:ProcessWire-2.0,代碼行數:11,代碼來源:Permission.php

示例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;
 }
開發者ID:kongondo,項目名稱:FieldtypeImageMarker,代碼行數:16,代碼來源:ImageMarker.php

示例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;
 }
開發者ID:ryancramerdesign,項目名稱:ProcessWire-2.0,代碼行數:19,代碼來源:Paths.php

示例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();
 }
開發者ID:Rizsti,項目名稱:Processwire_Compatibility,代碼行數:15,代碼來源:AdminThemeDefaultHelpers.php

示例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;
 }
開發者ID:posixpascal,項目名稱:TrooperCMS,代碼行數:22,代碼來源:AdminThemeDefaultHelpers.php

示例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);
 }
開發者ID:ryancramerdesign,項目名稱:ProcessWire-2.0,代碼行數:26,代碼來源:Config.php

示例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;
 }
開發者ID:bensssyde,項目名稱:FieldtypeEvents,代碼行數:21,代碼來源:Event.php


注:本文中的WireData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。