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


PHP static::load方法代碼示例

本文整理匯總了PHP中static::load方法的典型用法代碼示例。如果您正苦於以下問題:PHP static::load方法的具體用法?PHP static::load怎麽用?PHP static::load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在static的用法示例。


在下文中一共展示了static::load方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: makeFromFile

 /**
  * Creates and returns an instance of Ini
  *
  * @param array|mixed $file
  *
  * @return static
  */
 public static function makeFromFile($file)
 {
     $_ini = new static();
     $_ini->setFile($file);
     $_ini->load();
     return $_ini;
 }
開發者ID:rajeshpillai,項目名稱:dfe-common,代碼行數:14,代碼來源:Ini.php

示例2: fetchForUser

 /**
  * Get the current user's wishlist
  *
  * @return \Shop\Models\Wishlists
  */
 public static function fetchForUser()
 {
     $wishlist = new static();
     $identity = \Dsc\System::instance()->get('auth')->getIdentity();
     $session_id = \Dsc\System::instance()->get('session')->id();
     if (!empty($identity->id)) {
         $wishlist->load(array('user_id' => new \MongoId((string) $identity->id)));
         $wishlist->user_id = $identity->id;
         $session_wishlist = static::fetchForSession();
         // if there was no user wishlist but there IS a session wishlist, just add the user_id to the session wishlist and save it
         if (empty($wishlist->id) && !empty($session_wishlist->id)) {
             $wishlist = $session_wishlist;
             $wishlist->user_id = $identity->id;
             $wishlist->save();
         }
         // if there was a user wishlist and there is a session wishlist, merge them and delete the session wishlist
         // if we already did the merge, skip this
         $session_wishlist_merged = \Dsc\System::instance()->get('session')->get('shop.session_wishlist_merged');
         if (!empty($session_wishlist->id) && $session_wishlist->id != $wishlist->id && empty($session_wishlist_merged)) {
             $wishlist->session_id = $session_id;
             $wishlist->merge($session_wishlist->cast());
             $session_wishlist->remove();
             \Dsc\System::instance()->get('session')->set('shop.session_wishlist_merged', true);
         }
         if (empty($wishlist->id)) {
             $wishlist->save();
         }
     }
     return $wishlist;
 }
開發者ID:dioscouri,項目名稱:f3-shop,代碼行數:35,代碼來源:Wishlists.php

示例3: create

 /**
  * Create a thumbnail
  */
 static function create($source, $options = array())
 {
     // Create thumb
     $thumb = new static();
     // Load
     $thumb->load($source);
     // Set properties
     $properties = array('type', 'quality', 'alignX', 'alignY', 'background');
     // Loop
     foreach ($properties as $property) {
         // If set
         if (isset($options[$property])) {
             // Set it
             $thumb->{$property} = $options[$property];
         }
     }
     // If there's width
     if (isset($options['width']) && ($width = $options['width'])) {
         // Set width
         $thumb->width = $width;
     }
     // If there's height
     if (isset($options['height']) && ($height = $options['height'])) {
         // Set height
         $thumb->height = $height;
     }
     // Resize
     $thumb->resize();
     // Render and return
     return $thumb->render();
 }
開發者ID:ronaldborla,項目名稱:thumb,代碼行數:34,代碼來源:Thumb.php

示例4: Factory

 public static function Factory($id = null)
 {
     $obj = new static();
     if ($id) {
         $obj->load($id);
     }
     return $obj;
 }
開發者ID:Acidburn0zzz,項目名稱:OEM,代碼行數:8,代碼來源:Model.php

示例5: getByID

 public static function getByID($avID)
 {
     $uav = new static();
     $uav->load($avID);
     if ($uav->getAttributeValueID() == $avID) {
         return $uav;
     }
 }
開發者ID:meixelsberger,項目名稱:concrete5-5.7.0,代碼行數:8,代碼來源:UserValue.php

示例6: getByID

 public static function getByID($akID)
 {
     $ak = new static();
     $ak->load($akID);
     if ($ak->getAttributeKeyID() > 0) {
         return $ak;
     }
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:8,代碼來源:FileKey.php

示例7: create

 /**
  * โหลด template
  * ครั้งแรกจะตรวจสอบไฟล์จาก module ถ้าไม่พบ จะใช้ไฟล์จาก owner
  *
  * @param string $owner ชื่อโมดูลที่ติดตั้ง
  * @param string $module ชื่อโมดูล
  * @param string $name ชื่อ template ไม่ต้องระบุนามสกุลของไฟล์
  * @return \static
  *
  * @assert ('', '', 'FileNotFound')->isEmpty() [==] true
  */
 public static function create($owner, $module, $name)
 {
     $obj = new static();
     $obj->skin = $obj->load($owner, $module, $name);
     $obj->items = array();
     $obj->num = -1;
     return $obj;
 }
開發者ID:goragod,項目名稱:php-framework-benchmark,代碼行數:19,代碼來源:Template.php

示例8: saveAndGetId

 /**
  * Save link preview model and return id
  * @param $post
  * @return integer|null
  */
 public static function saveAndGetId($post)
 {
     $model = new static();
     if ($model->load($post) && $model->save()) {
         return $model->id;
     }
     return null;
 }
開發者ID:yii2song,項目名稱:yii2-link-preview,代碼行數:13,代碼來源:LinkPreviewModel.php

示例9: create

 /**
  * โหลด template
  * ครั้งแรกจะตรวจสอบไฟล์จาก module ถ้าไม่พบ จะใช้ไฟล์จาก owner
  *
  * @param string $owner ชื่อโมดูลที่ติดตั้ง
  * @param string $module ชื่อโมดูล
  * @param string $name ชื่อ template ไม่ต้องระบุนามสกุลของไฟล์
  * @param int $cols 0 (default) แสดงผลแบบปกติ มากกว่า 0 แสดงผลด้วยกริด
  * @return \static
  */
 public static function create($owner, $module, $name, $cols = 0)
 {
     $obj = new static();
     $obj->skin = $obj->load($owner, $module, $name);
     $obj->items = array();
     $obj->cols = (int) $cols;
     $obj->num = $obj->cols;
     return $obj;
 }
開發者ID:roongr2k7,項目名稱:kotchasan,代碼行數:19,代碼來源:template.php

示例10: userIsInGroup

 /**
  * Check if a user is in a group
  * @param int $group_id
  * @param int $user_id
  * @return bool
  */
 public static function userIsInGroup($group_id, $user_id = null)
 {
     $f3 = \Base::instance();
     if ($user_id === null) {
         $user_id = $f3->get("user.id");
     }
     $group = new static();
     $group->load(array('user_id = ? AND group_id = ?', $user_id, $group_id));
     return $group->id ? true : false;
 }
開發者ID:Rayne,項目名稱:phproject,代碼行數:16,代碼來源:group.php

示例11: cancel

 /**
  * Cancel the invoice
  * @return static
  * @throws UnsavedException
  */
 public function cancel()
 {
     if (!$this->saved()) {
         throw new UnsavedException();
     }
     $path = $this->router->path([$this->_id, 'cancel']);
     $response = $this->client->get($path);
     $cancelInvoice = new static($this->client, true);
     $cancelInvoice->load($response['id']);
     return $cancelInvoice;
 }
開發者ID:voov,項目名稱:billingo-api-datamapper,代碼行數:16,代碼來源:Invoices.php

示例12: setVal

 /**
  * Set a configuration value
  * @param  string $key
  * @param  mixed  $value
  * @return Config
  */
 public static function setVal($key, $value)
 {
     $f3 = \Base::instance();
     $f3->set($key, $value);
     $item = new static();
     $item->load(array('attribute = ?', $key));
     $item->attribute = $key;
     $item->value = $value;
     $item->save();
     return $item;
 }
開發者ID:phemmyster,項目名稱:phproject,代碼行數:17,代碼來源:config.php

示例13: createByXml

 /**
  * @param string $xml
  * @return static
  */
 public static function createByXml($xml)
 {
     $model = new static();
     $attributes = ToolsHelper::xmlToArray($xml);
     foreach ($attributes as $name => $value) {
         if ($value instanceof SimpleXMLElement) {
             unset($attributes[$name]);
         }
     }
     $model->load($attributes, '');
     return $model;
 }
開發者ID:dw250100785,項目名稱:yii2-oauth,代碼行數:16,代碼來源:BaseModel.php

示例14: getList

 static function getList($sql = NULL)
 {
     $db = Registry::getInstance()->get(static::DB);
     $recordset = $db->getRecordset($sql ? $sql : 'SELECT * FROM `' . static::TABLE . '` ORDER BY `name`');
     $list = [];
     while ($record = $recordset->fetch()) {
         $entity = new static();
         $entity->load($record);
         $list[$entity->id] = $entity;
     }
     return $list;
 }
開發者ID:jne21,項目名稱:hatatool,代碼行數:12,代碼來源:SimpleObject.php

示例15: loadById

 /**
  * Load a DAO by its ID(s)
  *
  * @param ...$id
  *
  * @return static
  * @throws DaoNotFoundException
  */
 public static function loadById(...$id)
 {
     $dao = new static();
     /**
      * @var $dao AbstractDao
      */
     $dao->hydrateDao(array_combine($dao->getDaoIDProperties(), $id));
     /**
      * @var $dao LsdTrait
      */
     $dao->load();
     return $dao;
 }
開發者ID:packaged,項目名稱:dal,代碼行數:21,代碼來源:LSDTrait.php


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