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


PHP ElggEntity::create方法代碼示例

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


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

示例1: create

 /**
  * {@inheritdoc}
  */
 protected function create()
 {
     global $CONFIG;
     $guid = parent::create();
     $name = sanitize_string($this->name);
     $username = sanitize_string($this->username);
     $password = sanitize_string($this->password);
     $salt = sanitize_string($this->salt);
     $email = sanitize_string($this->email);
     $language = sanitize_string($this->language);
     $query = "INSERT into {$CONFIG->dbprefix}users_entity\n\t\t\t(guid, name, username, password, salt, email, language)\n\t\t\tvalues ({$guid}, '{$name}', '{$username}', '{$password}', '{$salt}', '{$email}', '{$language}')";
     $result = $this->getDatabase()->insertData($query);
     if ($result === false) {
         // TODO(evan): Throw an exception here?
         return false;
     }
     return $guid;
 }
開發者ID:sephiroth88,項目名稱:Elgg,代碼行數:21,代碼來源:ElggUser.php

示例2: create

 /**
  * {@inheritdoc}
  */
 protected function create()
 {
     global $CONFIG;
     $guid = parent::create();
     if (!$guid) {
         // @todo this probably means permission to create entity was denied
         // Is returning false the correct thing to do
         return false;
     }
     $title = sanitize_string($this->title);
     $description = sanitize_string($this->description);
     $query = "INSERT into {$CONFIG->dbprefix}objects_entity\n\t\t\t(guid, title, description) values ({$guid}, '{$title}', '{$description}')";
     $result = $this->getDatabase()->insertData($query);
     if ($result === false) {
         // TODO(evan): Throw an exception here?
         return false;
     }
     return $guid;
 }
開發者ID:thehereward,項目名稱:Elgg,代碼行數:22,代碼來源:ElggObject.php

示例3: create

 /**
  * {@inheritdoc}
  */
 protected function create()
 {
     global $CONFIG;
     $guid = parent::create();
     $name = sanitize_string($this->name);
     $description = sanitize_string($this->description);
     $query = "INSERT into {$CONFIG->dbprefix}groups_entity" . " (guid, name, description) values ({$guid}, '{$name}', '{$description}')";
     $result = $this->getDatabase()->insertData($query);
     if ($result === false) {
         // TODO(evan): Throw an exception here?
         return false;
     }
     return $guid;
 }
開發者ID:sephiroth88,項目名稱:Elgg,代碼行數:17,代碼來源:ElggGroup.php

示例4: create

 /**
  * {@inheritdoc}
  */
 protected function create()
 {
     global $CONFIG;
     $guid = parent::create();
     $name = sanitize_string($this->attributes['name']);
     $description = sanitize_string($this->attributes['description']);
     $url = sanitize_string($this->attributes['url']);
     $query = "INSERT into {$CONFIG->dbprefix}sites_entity\n\t\t\t(guid, name, description, url) values ({$guid}, '{$name}', '{$description}', '{$url}')";
     $result = $this->getDatabase()->insertData($query);
     if ($result === false) {
         // TODO(evan): Throw an exception here?
         return false;
     }
     // make sure the site guid is set to self if not already set
     if (!$this->site_guid) {
         $this->site_guid = $guid;
         $this->getDatabase()->updateData("UPDATE {$CONFIG->dbprefix}entities\n\t\t\t\tSET site_guid = {$guid} WHERE guid = {$guid}");
     }
     return $guid;
 }
開發者ID:Twizanex,項目名稱:GuildWoW,代碼行數:23,代碼來源:ElggSite.php

示例5: create

 /**
  * {@inheritdoc}
  */
 protected function create()
 {
     $guid = parent::create();
     if (!$guid) {
         // @todo this probably means permission to create entity was denied
         // Is returning false the correct thing to do
         return false;
     }
     $dbprefix = elgg_get_config('dbprefix');
     $query = "INSERT INTO {$dbprefix}objects_entity\n\t\t\t(guid, title, description)\n\t\t\tVALUES\n\t\t\t(:guid, :title, :description)";
     $params = [':guid' => (int) $guid, ':title' => (string) $this->title, ':description' => (string) $this->description];
     $result = $this->getDatabase()->insertData($query, $params);
     if ($result === false) {
         // TODO(evan): Throw an exception here?
         return false;
     }
     return $guid;
 }
開發者ID:elgg,項目名稱:elgg,代碼行數:21,代碼來源:ElggObject.php

示例6: create

 /** @override */
 protected function create()
 {
     global $CONFIG;
     $guid = parent::create();
     $title = sanitize_string($this->title);
     $description = sanitize_string($this->description);
     $query = "INSERT into {$CONFIG->dbprefix}objects_entity\n\t\t\t(guid, title, description) values ({$guid}, '{$title}', '{$description}')";
     $result = insert_data($query);
     if ($result === false) {
         // TODO(evan): Throw an exception here?
         return false;
     }
     return $guid;
 }
開發者ID:nogsus,項目名稱:Elgg,代碼行數:15,代碼來源:ElggObject.php

示例7: create

 /** @override */
 protected function create()
 {
     global $CONFIG;
     $guid = parent::create();
     $name = sanitize_string($this->attributes['name']);
     $description = sanitize_string($this->attributes['description']);
     $url = sanitize_string($this->attributes['url']);
     $query = "INSERT into {$CONFIG->dbprefix}sites_entity\n\t\t\t(guid, name, description, url) values ({$guid}, '{$name}', '{$description}', '{$url}')";
     $result = insert_data($query);
     if ($result === false) {
         // TODO(evan): Throw an exception here?
         return false;
     }
     return $guid;
 }
開發者ID:nogsus,項目名稱:Elgg,代碼行數:16,代碼來源:ElggSite.php


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