当前位置: 首页>>代码示例>>PHP>>正文


PHP wpdb::insert方法代码示例

本文整理汇总了PHP中wpdb::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP wpdb::insert方法的具体用法?PHP wpdb::insert怎么用?PHP wpdb::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wpdb的用法示例。


在下文中一共展示了wpdb::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unserialize

 function __toString()
 {
     // if the playlist are saved to db, i load it from db
     $playlist = $this->wpdb->get_row("SELECT ID, url, playlist FROM " . $this->table_name . " WHERE url = '" . $this->url . "'");
     if ($this->wpdb->num_rows > 0) {
         $playlist = unserialize($playlist->playlist);
     } else {
         $playlist = array();
         $code = implode("", file($this->url));
         if ($code == "") {
             $this->errors->add('no_content', __('The url $url are not valid!'));
         }
         preg_match_all("/section-row-track(.+)/", $code, $results);
         for ($i = 0; $i < sizeof($results[0]); $i++) {
             preg_match("/class=\"tracklisttrackname mx-link\">(.+)<\\/a>/U", $results[0][$i], $match);
             $title = $match[1];
             preg_match("/class=\"tracklistartistname mx-link\">(.+)<\\/a>/U", $results[0][$i], $match);
             $artist = $match[1];
             if ($title != "" || $artist != "") {
                 $playlist[] = array("title" => $title, "artist" => $artist);
             }
         }
         $this->wpdb->show_errors();
         // save to db the playlist for this url
         $this->wpdb->insert($this->table_name, array("url" => $this->url, "playlist" => serialize($playlist)), array("%s", "%s"));
     }
     $code = "<h3>Playlist</h3><ul class='mixcloud-embed-playlist'>";
     for ($i = 0; $i < count($playlist); $i++) {
         $code .= "<li><span class='mixcloud-embed-position'>" . ($i + 1) . "</span>";
         $code .= "<span class='mixcloud-embed-artist'>" . $playlist[$i]["artist"] . "</span>";
         $code .= "<span class='mixcloud-embed-title'>" . $playlist[$i]["title"] . "</span></li>";
     }
     $code .= "</ul>";
     return $code;
 }
开发者ID:seoduda,项目名称:Patua,代码行数:35,代码来源:mixcloud-embed-core.php

示例2: add

 /**
  * @param string $email Email address to log
  * @param string|array  $list_ids String or array of list ID's
  * @param array  $data The data that was sent to MailChimp
  * @param int    $success Whether the sign-up succeeded
  * @param string $method The method that was used (form or checkbox)
  * @param string $type The type that was used (form, registration, cf7, etc..)
  * @param int    $related_object_id ID of the related object, if any (form, comment, user, etc..)
  * @param string $url The URl the request originated from
  *
  * @return false|int
  */
 public function add($email, $list_ids, $data = array(), $success = 1, $method = 'form', $type = 'form', $related_object_id = 0, $url = '')
 {
     if (is_array($list_ids)) {
         $list_ids = implode(',', $list_ids);
     }
     return $this->db->insert($this->table_name, array('email' => $email, 'list_ids' => $list_ids, 'success' => $success ? 1 : 0, 'data' => json_encode($data), 'method' => $method, 'type' => $type, 'related_object_ID' => absint($related_object_id), 'url' => $url));
 }
开发者ID:NClaus,项目名称:Ambrose,代码行数:19,代码来源:class-logger.php

示例3: insertSubscriber

 /**
  *
  * @param string $email
  * @param string $name
  *
  * @return false|int|void
  */
 public function insertSubscriber($email, $name = '')
 {
     if (!is_email($email) || $this->emailExists($email)) {
         return false;
     }
     return $this->wpdb->insert($this->table, ['email' => $email, 'name' => $name]);
 }
开发者ID:miniMAC,项目名称:copernico,代码行数:14,代码来源:newsletter.php

示例4: _create

 protected function _create()
 {
     if (($result = $this->_wpdb->insert($this->_table(), $this->_fields)) === FALSE) {
         return FALSE;
     }
     $this->id = $this->_wpdb->insert_id;
     return TRUE;
 }
开发者ID:slavic18,项目名称:cats,代码行数:8,代码来源:fruitframe-db-model.php

示例5: saveRuleset

 /**
  * Saves a ruleset to database.
  *
  * @param array $rulesetData The data to save.
  * @param int $rulesetId Primary key of ruleset if it already exists.
  * @return bool|int Id of saved rule on success or false on error.
  */
 public function saveRuleset($rulesetData, $rulesetId = 0)
 {
     if (empty($rulesetData)) {
         return false;
     }
     if (!empty($rulesetId)) {
         $updateResult = $this->wpdb->update($this->wpdb->rulesets, $rulesetData, array('id' => $rulesetId), array('%s', '%d', '%s', '%d', '%d', '%s', '%s', '%d', '%s'), array('%d'));
         return $updateResult === false ? false : $rulesetId;
     } else {
         $this->wpdb->insert($this->wpdb->rulesets, $rulesetData, array('%s', '%d', '%s', '%d', '%d', '%s', '%s', '%d', '%s'));
         $rulesetId = $this->wpdb->insert_id;
         return empty($rulesetId) ? false : $rulesetId;
     }
 }
开发者ID:ProjectArmy,项目名称:wp_wemahu,代码行数:21,代码来源:ruleset.php

示例6: after_save

 public function after_save(Table $table, Record $new_record)
 {
     // Don't save changes to the changes tables.
     if (in_array($table->get_name(), self::table_names())) {
         return false;
     }
     // Save a change for each changed column.
     foreach ($table->get_columns() as $column) {
         $col_name = $column->is_foreign_key() ? $column->get_name() . Record::FKTITLE : $column->get_name();
         $old_val = is_callable(array($this->old_record, $col_name)) ? $this->old_record->{$col_name}() : null;
         $new_val = $new_record->{$col_name}();
         if ($new_val == $old_val) {
             // Ignore unchanged columns.
             continue;
         }
         $data = array('changeset_id' => self::$current_changeset_id, 'change_type' => 'field', 'table_name' => $table->get_name(), 'column_name' => $column->get_name(), 'record_ident' => $new_record->get_primary_key());
         // Daft workaround for https://core.trac.wordpress.org/ticket/15158
         if (!is_null($old_val)) {
             $data['old_value'] = $old_val;
         }
         if (!is_null($new_val)) {
             $data['new_value'] = $new_val;
         }
         // Save the change record.
         $this->wpdb->insert($this->changes_name(), $data);
     }
     // Close the changeset if required.
     if (!self::$keep_changeset_open) {
         $this->close_changeset();
     }
 }
开发者ID:gitter-badger,项目名称:tabulate-1,代码行数:31,代码来源:ChangeTracker.php

示例7: _record_transaction

 /**
  * Records transaction into database.
  *
  * @access protected
  * @param type $user_id
  * @param type $sub_id
  * @param type $amount
  * @param type $currency
  * @param type $timestamp
  * @param type $paypal_ID
  * @param type $status
  * @param type $note
  */
 protected function _record_transaction($user_id, $sub_id, $amount, $currency, $timestamp, $paypal_ID, $status, $note)
 {
     $data = array('transaction_subscription_ID' => $sub_id, 'transaction_user_ID' => $user_id, 'transaction_paypal_ID' => $paypal_ID, 'transaction_stamp' => $timestamp, 'transaction_currency' => $currency, 'transaction_status' => $status, 'transaction_total_amount' => (int) round($amount * 100), 'transaction_note' => $note, 'transaction_gateway' => $this->gateway);
     $existing_id = $this->db->get_var($this->db->prepare("SELECT transaction_ID FROM " . MEMBERSHIP_TABLE_SUBSCRIPTION_TRANSACTION . " WHERE transaction_paypal_ID = %s LIMIT 1", $paypal_ID));
     if (!empty($existing_id)) {
         $this->db->update(MEMBERSHIP_TABLE_SUBSCRIPTION_TRANSACTION, $data, array('transaction_ID' => $existing_id));
     } else {
         $this->db->insert(MEMBERSHIP_TABLE_SUBSCRIPTION_TRANSACTION, $data);
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:23,代码来源:Gateway.php

示例8: update

 function update()
 {
     $this->dirty = true;
     if ($this->id < 0) {
         $this->add();
     } else {
         $this->db->update(MEMBERSHIP_TABLE_SUBSCRIPTIONS, array('sub_name' => trim(filter_input(INPUT_POST, 'sub_name')), 'sub_description' => trim(filter_input(INPUT_POST, 'sub_description')), 'sub_pricetext' => trim(filter_input(INPUT_POST, 'sub_pricetext')), 'order_num' => filter_input(INPUT_POST, 'sub_order_num', FILTER_VALIDATE_INT)), array('id' => $this->id), array('%s', '%s', '%s', '%d'), array('%d'));
         // Remove the existing rules for this subscription level
         $this->db->delete(MEMBERSHIP_TABLE_SUBSCRIPTION_LEVELS, array('sub_id' => $this->id), array('%d'));
         if (!empty($_POST['level-order'])) {
             $levels = explode(',', $_POST['level-order']);
             $count = 1;
             foreach ((array) $levels as $level) {
                 if (!empty($level)) {
                     // Check if the rule has any information for it.
                     if (isset($_POST['levelmode'][$level])) {
                         $levelmode = esc_attr($_POST['levelmode'][$level]);
                     } else {
                         continue;
                     }
                     if (isset($_POST['levelperiod'][$level])) {
                         $levelperiod = esc_attr($_POST['levelperiod'][$level]);
                     } else {
                         $levelperiod = '';
                     }
                     if (isset($_POST['levelperiodunit'][$level])) {
                         $levelperiodunit = esc_attr($_POST['levelperiodunit'][$level]);
                     } else {
                         $levelperiodunit = '';
                     }
                     if (isset($_POST['levelprice'][$level])) {
                         $levelprice = floatval(esc_attr($_POST['levelprice'][$level]));
                     } else {
                         $levelprice = '';
                     }
                     if (isset($_POST['levelcurrency'][$level])) {
                         $levelcurrency = esc_attr($_POST['levelcurrency'][$level]);
                     } else {
                         $levelcurrency = '';
                     }
                     // Calculate the level id
                     $lev = explode('-', $level);
                     if ($lev[0] == 'level') {
                         $level_id = (int) $lev[1];
                         // write it to the database
                         $this->db->insert(MEMBERSHIP_TABLE_SUBSCRIPTION_LEVELS, array("sub_id" => $this->id, "level_period" => $levelperiod, "sub_type" => $levelmode, "level_price" => $levelprice, "level_currency" => $levelcurrency, "level_order" => $count++, "level_id" => $level_id, "level_period_unit" => $levelperiodunit));
                     }
                 }
             }
         }
         do_action('membership_subscription_update', $this->id);
     }
     return true;
     // for now
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:55,代码来源:Subscription.php

示例9: create_form

 /**
  * Create a new form.
  *
  * @author Jeremy Pry
  *
  * @param array $form_data Data to apply to the new form.
  *
  * @return int|bool The new form ID, or false on failure.
  */
 public function create_form($form_data)
 {
     // Include default form data
     $form_data = yikes_deep_parse_args($form_data, $this->get_form_defaults());
     // If there is an ID set, remove it
     unset($form_data['id']);
     // Prepare the data for the database
     $save_data = $this->prepare_data_for_db($form_data);
     $formats = $this->get_format_array($save_data);
     $result = $this->wpdb->insert($this->prefixed_table_name, $save_data, $formats);
     if (false === $result) {
         return $result;
     }
     return $this->wpdb->insert_id;
 }
开发者ID:yikesinc,项目名称:yikes-inc-easy-mailchimp-extender,代码行数:24,代码来源:class-yikes-inc-easy-mailchimp-extender-forms.php

示例10: create_client

function create_client($subdomain, $client_name, $client_username, $client_email, $client_password)
{
    if ($db = create_db($subdomain) !== false) {
        try {
            $con = new wpdb(MYSQL_ROUTING_USER, MYSQL_ROUTING_PASSWORD, MYSQL_ROUTING_DB, MYSQL_ROUTING_HOST);
            $result = $con->insert('client', array('subdomain' => $subdomain, 'email' => $client_email, 'name' => $client_name, 'admin_username' => $client_username, 'admin_password' => base64_encode($client_password), 'status' => 0, 'db_driver' => 'mysql', 'db_host' => 'localhost', 'db_name' => $db["db_name"], 'db_user' => $db["db_user"], 'db_pass' => $db["db_pass"], 'db_charset' => 'utf8', 'db_collation' => 'utf8_unicode_ci', 'db_prefix' => '', 'created_at' => date("Y-m-d H:i:s")), array('%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));
            if ($result) {
                return true;
            }
        } catch (Exception $e) {
            return false;
        }
    }
    return false;
}
开发者ID:nguyentrongbang,项目名称:oceancrm.vn,代码行数:15,代码来源:functions.php

示例11: actionLicenseSite

 protected function actionLicenseSite($productSlug, $licenseKey)
 {
     $this->requireRequestMethod('POST');
     $license = $this->validateLicenseRequest($productSlug, $licenseKey);
     //Is the license still valid?
     if (!$license->isValid()) {
         if ($license->getStatus() == 'expired') {
             $renewalUrl = $license->get('renewal_url');
             $this->outputError('expired_license', sprintf('This license key has expired. You can still use the plugin (without activating the key), but you will need to %1$srenew the license%2$s to receive updates.', $renewalUrl ? '<a href="' . esc_attr($renewalUrl) . '" target="_blank">' : '', $renewalUrl ? '</a>' : ''), 400);
         } else {
             $this->outputError('invalid_license', 'This license key is invalid or has expired.', 400);
         }
         return;
     }
     $siteUrl = isset($this->post['site_url']) ? strval($this->post['site_url']) : '';
     if (!$this->isValidUrl($siteUrl)) {
         $this->outputError('site_url_expected', "Missing or invalid site URL.", 400);
         return;
     }
     $siteUrl = $this->sanitizeSiteUrl($siteUrl);
     //Maybe the site is already licensed?
     $token = $this->wpdb->get_var($this->wpdb->prepare("SELECT token FROM {$this->tablePrefix}tokens WHERE site_url = %s AND license_id = %d", $siteUrl, $license['license_id']));
     if (!empty($token)) {
         $this->outputResponse(array('site_token' => $token, 'license' => $this->prepareLicenseForOutput($license)));
         return;
     }
     //Check the number of sites already licensed and see if we can add another one.
     if ($license['max_sites'] !== null) {
         $licensedSiteCount = $this->wpdb->get_var($this->wpdb->prepare("SELECT COUNT(*) FROM {$this->tablePrefix}tokens WHERE license_id = %d", $license['license_id']));
         if (intval($licensedSiteCount) >= intval($license['max_sites'])) {
             $upgradeUrl = $license->get('upgrade_url');
             $this->outputError('max_sites_reached', sprintf('You have reached the maximum number of sites allowed by your license. ' . 'To activate it on another site, you need to either %1$supgrade the license%2$s ' . 'or remove it from one of your existing sites in the <span class="%3$s">"Manage Sites"</span> tab.', $upgradeUrl ? '<a href="' . esc_attr($upgradeUrl) . '" target="_blank">' : '', $upgradeUrl ? '</a>' : '', 'ame-open-tab-manage-sites'), 400, $this->prepareLicenseForOutput($license, false));
             return;
         }
     }
     //If the site was already associated with another key, remove that association. Only one key per site.
     $otherToken = $this->wpdb->get_var($this->wpdb->prepare("SELECT tokens.token\n\t\t\t FROM {$this->tablePrefix}tokens AS tokens\n\t\t\t\tJOIN {$this->tablePrefix}licenses AS licenses\n\t\t\t\tON tokens.license_id = licenses.license_id\n\t\t\t WHERE\n\t\t\t\ttokens.site_url = %s\n\t\t\t\tAND licenses.product_slug = %s\n\t\t\t\tAND licenses.license_id <> %d", $siteUrl, $productSlug, $license['license_id']));
     if (!empty($otherToken)) {
         $this->wpdb->delete($this->tablePrefix . 'tokens', array('token' => $otherToken));
     }
     //Everything checks out, lets create a new token.
     $token = $this->generateRandomString(32);
     $this->wpdb->insert($this->tablePrefix . 'tokens', array('license_id' => $license['license_id'], 'token' => $token, 'site_url' => $siteUrl, 'issued_on' => date('Y-m-d H:i:s')));
     //Reload the license to ensure it includes the changes we just made.
     $license = $this->loadLicense($licenseKey);
     $this->outputResponse(array('site_token' => $token, 'license' => $this->prepareLicenseForOutput($license)));
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:47,代码来源:LicenseServer.php

示例12: actionLicenseSite

 protected function actionLicenseSite($productSlug, $licenseKey)
 {
     $this->requireRequestMethod('POST');
     $license = $this->validateLicenseRequest($productSlug, $licenseKey);
     //Is the license still valid?
     if (!$license->isValid()) {
         if ($license->getStatus() == 'expired') {
             $this->outputError('expired_license', 'This license key has expired.', 400);
         } else {
             $this->outputError('invalid_license', 'This license key is invalid or has expired.', 400);
         }
         return;
     }
     $siteUrl = isset($this->post['site_url']) ? strval($this->post['site_url']) : '';
     if (!$this->isValidUrl($siteUrl)) {
         $this->outputError('site_url_expected', "Missing or invalid site URL.", 400);
         return;
     }
     $siteUrl = $this->sanitizeSiteUrl($siteUrl);
     //Maybe the site is already licensed?
     $token = $this->wpdb->get_var($this->wpdb->prepare("SELECT token FROM {$this->tablePrefix}tokens WHERE site_url = %s AND license_id = %d", $siteUrl, $license['license_id']));
     if (!empty($token)) {
         $this->outputResponse(array('site_token' => $token, 'license' => $this->prepareLicenseForOutput($license)));
         return;
     }
     //Check the number of sites already licensed and see if we can add another one.
     if ($license['max_sites'] !== null) {
         $licensedSiteCount = $this->wpdb->get_var($this->wpdb->prepare("SELECT COUNT(*) FROM {$this->tablePrefix}tokens WHERE license_id = %d", $license['license_id']));
         if (intval($licensedSiteCount) >= intval($license['max_sites'])) {
             $this->outputError('max_sites_reached', "You have already reached the maximum number of sites allowed by your license.", 400);
             return;
         }
     }
     //If the site was already associated with another key, remove that association. Only one key per site.
     $otherToken = $this->wpdb->get_var($this->wpdb->prepare("SELECT tokens.token\n\t\t\t FROM {$this->tablePrefix}tokens AS tokens\n\t\t\t\tJOIN {$this->tablePrefix}licenses AS licenses\n\t\t\t\tON tokens.license_id = licenses.license_id\n\t\t\t WHERE\n\t\t\t\ttokens.site_url = %s\n\t\t\t\tAND licenses.product_slug = %s\n\t\t\t\tAND licenses.license_id <> %d", $siteUrl, $productSlug, $license['license_id']));
     if (!empty($otherToken)) {
         $this->wpdb->delete($this->tablePrefix . 'tokens', array('token' => $otherToken));
     }
     //Everything checks out, lets create a new token.
     $token = $this->generateRandomString(32);
     $this->wpdb->insert($this->tablePrefix . 'tokens', array('license_id' => $license['license_id'], 'token' => $token, 'site_url' => $siteUrl, 'issued_on' => date('Y-m-d H:i:s')));
     //Reload the license to ensure it includes the changes we just made.
     $license = $this->loadLicense($licenseKey);
     $this->outputResponse(array('site_token' => $token, 'license' => $this->prepareLicenseForOutput($license)));
 }
开发者ID:rafabrutaldrums,项目名称:siclo,代码行数:45,代码来源:LicenseServer.php

示例13: add_subscription

 public function add_subscription($tosub_id, $tolevel_id = false, $to_order = false, $gateway = 'admin')
 {
     if (!apply_filters('pre_membership_add_subscription', true, $tosub_id, $tolevel_id, $to_order, $this->ID) || $this->on_sub($tosub_id)) {
         return false;
     }
     // grab the level information for this position
     $subscription = Membership_Plugin::factory()->get_subscription($tosub_id);
     $level = $subscription->get_level_at($tolevel_id, $to_order);
     if ($level) {
         $now = current_time('mysql');
         $start = strtotime($now);
         switch ($level->level_period_unit) {
             case 'd':
                 $period = 'days';
                 break;
             case 'w':
                 $period = 'weeks';
                 break;
             case 'm':
                 $period = 'months';
                 break;
             case 'y':
                 $period = 'years';
                 break;
             default:
                 $period = 'days';
                 break;
         }
         //level end date
         $expires = strtotime('+' . $level->level_period . ' ' . $period, $start);
         $expires = gmdate('Y-m-d H:i:s', $expires ? $expires : strtotime('+365 days', $start));
         //subscription end date
         $expires_sub = $this->get_subscription_expire_date($subscription, $tolevel_id);
         $this->_wpdb->insert(MEMBERSHIP_TABLE_RELATIONS, array('user_id' => $this->ID, 'level_id' => $tolevel_id, 'sub_id' => $tosub_id, 'startdate' => $now, 'updateddate' => $now, 'expirydate' => $expires, 'order_instance' => $level->level_order, 'usinggateway' => $gateway));
         // Update users start and expiry meta
         update_user_meta($this->ID, 'start_current_' . $tosub_id, $start);
         update_user_meta($this->ID, 'expire_current_' . $tosub_id, $expires_sub);
         update_user_meta($this->ID, 'using_gateway_' . $tosub_id, $gateway);
         // Update associated role
         $this->set_role(Membership_Model_Level::get_associated_role($level->level_id));
         do_action('membership_add_subscription', $tosub_id, $tolevel_id, $to_order, $this->ID);
     }
     return true;
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:44,代码来源:Member.php

示例14: add

 function add()
 {
     switch ($_POST['periodtype']) {
         case 'd':
             $time = strtotime('+' . $_POST['periodunit'] . ' days') - time();
             break;
         case 'm':
             $time = strtotime('+' . $_POST['periodunit'] . ' months') - time();
             break;
         case 'y':
             $time = strtotime('+' . $_POST['periodunit'] . ' years') - time();
             break;
     }
     $periodstamp = $_POST['periodprepost'] == 'pre' ? -$time : $time;
     if ('join' == $_POST['periodprepost'] || 'exp' == $_POST['periodprepost']) {
         $periodstamp = 0;
     }
     return $this->db->insert(MEMBERSHIP_TABLE_COMMUNICATIONS, array("periodunit" => $_POST['periodunit'], "periodtype" => $_POST['periodtype'], "periodprepost" => $_POST['periodprepost'], "subject" => $_POST['subject'], "message" => stripslashes($_POST['message']), "periodstamp" => $periodstamp, "sub_id" => $_POST['subscription_id']));
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:19,代码来源:class.communication.php

示例15: save

 /**
  * Saves data into the database.
  *
  * @since 2.0.0
  *
  * @param array $data The data to insert into database.
  *
  * @return bool
  * @throws Exception
  */
 public function save($data)
 {
     $time = current_time('mysql');
     // Only save leads if the user has the option checked.
     $option = get_option('optin_monster');
     if (!isset($option['leads']) || isset($option['leads']) && !$option['leads']) {
         throw new Exception(__('The user has chosen not to store leads locally.', 'optin-monster'));
     }
     // Make sure the required fieds exist in the passed data array.
     foreach ($this->required_fields as $key => $value) {
         if (!array_key_exists($value, $data)) {
             throw new Exception(sprintf(__('A value for %s must be passed in the $data array.', 'optin-monster'), $value));
         }
     }
     // Ensure that the lead does not already exist in the DB.
     $exists = $this->find_where('lead_email', $data['lead_email']);
     if (!empty($exists)) {
         throw new Exception(__('The lead already exists in the database.', 'optin-monster'));
     }
     // Add the date modified to the data array
     $data['date_modified'] = $time;
     // If an 'id' is passed, we're going to update the record, else insert.
     if (isset($data['id'])) {
         $id = $data['id'];
         unset($data['id']);
         if (false == $this->db->update($this->table, $data, array('lead_id', $id))) {
             throw new Exception(__('There was an error updating the lead.', 'optin-monster'));
         } else {
             return true;
         }
     } else {
         // This is a new record, so we'll insert the date added.
         $data['date_added'] = $time;
         if (false == $this->db->insert($this->table, $data)) {
             throw new Exception(__('There was an error inserting the lead.', 'optin-monster'));
         } else {
             return true;
         }
     }
 }
开发者ID:venturepact,项目名称:blog,代码行数:50,代码来源:lead-datastore.php


注:本文中的wpdb::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。