当前位置: 首页>>代码示例>>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;未经允许,请勿转载。