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


PHP nf_update_object_meta函数代码示例

本文整理汇总了PHP中nf_update_object_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP nf_update_object_meta函数的具体用法?PHP nf_update_object_meta怎么用?PHP nf_update_object_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: nf_29_update_form_settings

/**
 * Update form settings to the new storage system when the form is viewed for the first time.
 *
 * @since 2.9
 * @return void
 */
function nf_29_update_form_settings($form_id)
{
    global $wpdb;
    // Check to see if an object exists with our form id.
    $type = nf_get_object_type($form_id);
    if ('form' != $type) {
        // We have an object with our form id.
        // Insert a new object.
        $next_id = nf_insert_object($type);
        // Replace all instances of the object ID with our new one.
        $wpdb->update(NF_OBJECT_META_TABLE_NAME, array('object_id' => $next_id), array('object_id' => $form_id));
        $wpdb->update(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, array('parent_id' => $next_id), array('parent_type' => $type, 'parent_id' => $form_id));
        $wpdb->update(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, array('child_id' => $next_id), array('child_type' => $type, 'child_id' => $form_id));
        // Delete the original object
        $wpdb->query('DELETE FROM ' . NF_OBJECTS_TABLE_NAME . ' WHERE id = ' . $form_id);
    }
    $form = $wpdb->get_row('SELECT * FROM ' . NINJA_FORMS_TABLE_NAME . ' WHERE id = ' . $form_id, ARRAY_A);
    $settings = maybe_unserialize($form['data']);
    $settings['date_updated'] = $form['date_updated'];
    $f_id = nf_insert_object('form', $form['id']);
    foreach ($settings as $meta_key => $value) {
        nf_update_object_meta($f_id, $meta_key, $value);
    }
    nf_update_object_meta($f_id, 'status', '');
}
开发者ID:se7ven214,项目名称:Kungfuphp.local,代码行数:31,代码来源:upgrade-functions.php

示例2: nf_29_update_form_settings

/**
 * Update form settings to the new storage system when the form is viewed for the first time.
 *
 * @since 2.9
 * @return void
 */
function nf_29_update_form_settings($form_id)
{
    global $wpdb;
    // Check to see if the conversion has been reset.
    $is_reset = get_option('nf_converted_form_reset', 0);
    // Check to see if an object exists with our form id.
    $type = nf_get_object_type($form_id);
    if ($type) {
        // We have an object with our form id.
        if ($is_reset and 'form' == $type) {
            // Give precedence to the most recent form.
            // Set a new ID for the form being converted.
            $f_id = nf_insert_object('form');
            $fields = $wpdb->get_results("SELECT * FROM " . NINJA_FORMS_FIELDS_TABLE_NAME . " WHERE form_id = " . $form_id, ARRAY_A);
            foreach ($fields as $field) {
                unset($field['id']);
                $field['form_id'] = $f_id;
                // Copy the Fields to the new ID.
                $wpdb->insert(NINJA_FORMS_FIELDS_TABLE_NAME, $field);
            }
            $relationships = $wpdb->get_results("SELECT * FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE parent_id = " . $form_id, ARRAY_A);
            foreach ($relationships as $relationship) {
                unset($relationship['id']);
                // Copy the object related to the form.
                $object = $wpdb->get_results("SELECT * FROM " . NF_OBJECTS_TABLE_NAME . " WHERE id = " . $relationship['child_id'], ARRAY_A);
                unset($object['id']);
                $wpdb->insert(NF_OBJECTS_TABLE_NAME, $object);
                $relationship['child_id'] = $wpdb->insert_id;
                $relationship['parent_id'] = $f_id;
                // Copy the Relationships to the new ID.
                $wpdb->insert(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, $relationship);
            }
        } else {
            // Give precedence to the converting form.
            // Insert a new object.
            $next_id = nf_insert_object($type);
            // Replace all instances of the conflicting object ID with our new one.
            $wpdb->update(NF_OBJECT_META_TABLE_NAME, array('object_id' => $next_id), array('object_id' => $form_id));
            $wpdb->update(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, array('parent_id' => $next_id), array('parent_type' => $type, 'parent_id' => $form_id));
            $wpdb->update(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, array('child_id' => $next_id), array('child_type' => $type, 'child_id' => $form_id));
            // Delete the original (conflicting) object
            $wpdb->query('DELETE FROM ' . NF_OBJECTS_TABLE_NAME . ' WHERE id = ' . $form_id);
        }
    }
    // Get the form from the old table.
    $form = $wpdb->get_row('SELECT * FROM ' . NINJA_FORMS_TABLE_NAME . ' WHERE id = ' . $form_id, ARRAY_A);
    // Set the insert form ID, if not already set.
    $f_id = isset($f_id) ? $f_id : nf_insert_object('form', $form['id']);
    // Unpack the converted form's settings
    $settings = maybe_unserialize($form['data']);
    $settings['date_updated'] = $form['date_updated'];
    foreach ($settings as $meta_key => $value) {
        nf_update_object_meta($f_id, $meta_key, $value);
    }
    nf_update_object_meta($f_id, 'status', '');
}
开发者ID:nihrain,项目名称:accelerate,代码行数:62,代码来源:upgrade-functions.php

示例3: ninja_forms_import_form

function ninja_forms_import_form($file)
{
    global $wpdb;
    $form = unserialize(trim($file));
    $form_fields = isset($form['field']) ? $form['field'] : null;
    $notifications = isset($form['notifications']) ? $form['notifications'] : null;
    unset($form['field']);
    unset($form['notifications']);
    $form = apply_filters('ninja_forms_before_import_form', $form);
    // Remove our last_sub setting. This is our starting seq_num.
    if (isset($form['data']['last_sub'])) {
        unset($form['data']['last_sub']);
    }
    $form['data'] = serialize($form['data']);
    $wpdb->insert(NINJA_FORMS_TABLE_NAME, $form);
    $form_id = $wpdb->insert_id;
    $form['id'] = $form_id;
    if (is_array($form_fields)) {
        for ($x = 0; $x < count($form_fields); $x++) {
            $form_fields[$x]['form_id'] = $form_id;
            $form_fields[$x]['data'] = apply_filters('nf_before_import_field', $form_fields[$x]['data'], $form_fields[$x]['id']);
            $form_fields[$x]['data'] = serialize($form_fields[$x]['data']);
            $old_field_id = $form_fields[$x]['id'];
            $form_fields[$x]['id'] = NULL;
            $wpdb->insert(NINJA_FORMS_FIELDS_TABLE_NAME, $form_fields[$x]);
            $form_fields[$x]['id'] = $wpdb->insert_id;
            $form_fields[$x]['old_id'] = $old_field_id;
            $form_fields[$x]['data'] = unserialize($form_fields[$x]['data']);
        }
    }
    $form['data'] = unserialize($form['data']);
    $form['field'] = $form_fields;
    $form['notifications'] = $notifications;
    // Insert any notifications we might have.
    if (is_array($notifications)) {
        foreach ($notifications as $n) {
            $n_id = nf_insert_notification($form_id);
            $n = apply_filters('nf_import_notification_meta', $n, $n_id, $form);
            unset($n['conditions']);
            foreach ($n as $meta_key => $meta_value) {
                foreach ($form_fields as $field) {
                    // We need to replace any references to old fields in our notification
                    if ('email_message' == $meta_key) {
                        $meta_value = str_replace('[ninja_forms_field id=' . $field['old_id'] . ']', '[ninja_forms_field id=' . $field['id'] . ']', $meta_value);
                        $meta_value = str_replace('ninja_forms_field_' . $field['old_id'], 'ninja_forms_field_' . $field['id'], $meta_value);
                    } else {
                        $meta_value = preg_replace('/\\bfield_' . $field['old_id'] . '\\b/u', 'field_' . $field['id'], $meta_value);
                    }
                }
                nf_update_object_meta($n_id, $meta_key, $meta_value);
            }
        }
    }
    do_action('ninja_forms_after_import_form', $form);
    return $form['id'];
}
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:56,代码来源:import-export.php

示例4: update_setting

 /**
  * Update a notification setting
  * 
  * @access public
  * @since 2.8
  * @return bool
  */
 public function update_setting($meta_key, $meta_value)
 {
     nf_update_object_meta($this->id, $meta_key, $meta_value);
     return true;
 }
开发者ID:HeliWang,项目名称:EngSoc-Website,代码行数:12,代码来源:notification.php

示例5: step

 public function step($step)
 {
     global $ninja_forms_fields;
     // Get our form ID
     $form_id = $this->args['forms'][$step];
     // Bail if we've already converted the notifications for this form.
     if (in_array($form_id, $this->completed_forms)) {
         return false;
     }
     // Grab our form from the database
     $form_settings = Ninja_Forms()->form($form_id)->settings;
     $fields = Ninja_Forms()->form($form_id)->fields;
     $process_fields = array();
     foreach ($fields as $field_id => $field) {
         $label = strip_tags(nf_get_field_admin_label($field_id));
         if (strlen($label) > 30) {
             $tmp_label = substr($label, 0, 30);
         } else {
             $tmp_label = $label;
         }
         $tmp_array = array('value' => $field_id, 'label' => $tmp_label . ' - ID: ' . $field_id);
         $admin_label = $label;
         $label = isset($field['data']['label']) ? $field['data']['label'] : '';
         // Check to see if this field is supposed to be "processed"
         $type = $field['type'];
         if (isset($ninja_forms_fields[$type]['process_field']) && $ninja_forms_fields[$type]['process_field']) {
             $process_fields[$field_id] = array('field_id' => $field_id, 'label' => $label, 'admin_label' => $admin_label);
         }
     }
     // Create a notification for our admin email
     if (isset($form_settings['admin_email_msg']) && !empty($form_settings['admin_email_msg']) || isset($form_settings['admin_email_fields']) && 1 == $form_settings['admin_email_fields']) {
         // Create a notification
         $n_id = nf_insert_notification($form_id);
         // Update our notification type
         nf_update_object_meta($n_id, 'type', 'email');
         // Activate our notification
         Ninja_Forms()->notification($n_id)->activate();
         // Update our notification name
         Ninja_Forms()->notification($n_id)->update_setting('name', __('Admin Email', 'ninja-forms'));
         $admin_mailto = isset($form_settings['admin_mailto']) ? $form_settings['admin_mailto'] : array();
         // Implode our admin email addresses
         $to = implode('`', $admin_mailto);
         // Update our to setting
         Ninja_Forms()->notification($n_id)->update_setting('to', $to);
         // Update our Format Setting
         Ninja_Forms()->notification($n_id)->update_setting('email_format', $form_settings['email_type']);
         // Update our attach csv option
         Ninja_Forms()->notification($n_id)->update_setting('attach_csv', $form_settings['admin_attach_csv']);
         // Update our subject
         $subject = $this->replace_shortcodes($form_settings['admin_subject']);
         Ninja_Forms()->notification($n_id)->update_setting('email_subject', $subject);
         // Update our From Name
         if (isset($form_settings['email_from_name'])) {
             Ninja_Forms()->notification($n_id)->update_setting('from_name', $form_settings['email_from_name']);
         }
         foreach ($fields as $field) {
             if (isset($field['data']['from_name']) && $field['data']['from_name'] == 1) {
                 // Update our From Name
                 Ninja_Forms()->notification($n_id)->update_setting('from_name', 'field_' . $field['id']);
                 break;
             }
         }
         // Update our From Address
         Ninja_Forms()->notification($n_id)->update_setting('from_address', $form_settings['email_from']);
         // Get our reply-to address
         foreach ($fields as $field) {
             if (isset($field['data']['replyto_email']) && $field['data']['replyto_email'] == 1) {
                 Ninja_Forms()->notification($n_id)->update_setting('reply_to', 'field_' . $field['id']);
                 break;
             }
         }
         $email_message = $form_settings['admin_email_msg'];
         // Check to see if the "include list of fields" checkbox was checked.
         if (isset($form_settings['admin_email_fields']) && $form_settings['admin_email_fields'] == 1) {
             $email_message .= '<br />[ninja_forms_all_fields]';
         }
         // Update our email message
         Ninja_Forms()->notification($n_id)->update_setting('email_message', $email_message);
         Ninja_Forms()->notification($n_id)->update_setting('admin_email', true);
     }
     // Create a notification for our user email
     if (!empty($fields)) {
         $addresses = array();
         foreach ($fields as $field_id => $field) {
             if (isset($field['data']['send_email']) && $field['data']['send_email'] == 1) {
                 // Add this field to our $addresses variable.
                 $addresses[] = 'field_' . $field_id;
                 unset($field['data']['send_email']);
                 unset($field['data']['replyto_email']);
                 unset($field['data']['from_name']);
                 $args = array('update_array' => array('data' => serialize($field['data'])), 'where' => array('id' => $field_id));
                 ninja_forms_update_field($args);
             }
         }
         if (!empty($addresses)) {
             // We have a user email, so create a notification
             $n_id = nf_insert_notification($form_id);
             // Update our notification type
             nf_update_object_meta($n_id, 'type', 'email');
             // Activate our notification
//.........这里部分代码省略.........
开发者ID:ramiy,项目名称:ninja-forms,代码行数:101,代码来源:convert-notifications.php

示例6: update_setting

 /**
  * Update a form setting (this doesn't update anything in the database)
  * Changes are only applied to this object.
  * 
  * @access public
  * @since 2.8
  * @param string $setting
  * @param mixed $value
  * @return bool
  */
 public function update_setting($setting, $value)
 {
     $this->settings[$setting] = $value;
     nf_update_object_meta($this->form_id, $setting, $value);
     return true;
 }
开发者ID:umairakhtar123,项目名称:hova,代码行数:16,代码来源:form.php

示例7: nf_insert_notification

/**
 * Insert a notification into the database.
 *
 * Calls nf_insert_object()
 * Calls nf_add_relationship()
 * Calls nf_update_object_meta()
 *
 * @since 2.8
 * @param int $form_id
 * @return int $n_id
 */
function nf_insert_notification($form_id = '')
{
    if (empty($form_id)) {
        return false;
    }
    $n_id = nf_insert_object('notification');
    nf_add_relationship($n_id, 'notification', $form_id, 'form');
    $date_updated = date('Y-m-d', current_time('timestamp'));
    nf_update_object_meta($n_id, 'date_updated', $date_updated);
    return $n_id;
}
开发者ID:se7ven214,项目名称:Kungfuphp.local,代码行数:22,代码来源:functions.php

示例8: save_admin

 /**
  * Save our notifications admin.
  * 
  * @access public
  *
  * @since 2.8
  * @return void
  */
 public function save_admin($form_id, $data)
 {
     if (!isset($data['notification_id']) || empty($data['notification_id'])) {
         return false;
     }
     $n_id = $data['notification_id'];
     $settings = $data['settings'];
     if ('new' == $n_id) {
         $type = $settings['type'];
         $n_id = $this->create($form_id);
         $new = true;
     } else {
         $type = Ninja_Forms()->notification($n_id)->type;
         $new = false;
     }
     $data = Ninja_Forms()->notification_types[$type]->save_admin($n_id, $data);
     foreach ($settings as $meta_key => $meta_value) {
         nf_update_object_meta($n_id, $meta_key, $meta_value);
     }
     do_action('nf_save_notification', $n_id, $data, $new);
     if ($new) {
         $redirect = esc_url_raw(remove_query_arg(array('notification-action')));
         $redirect = esc_url_raw(add_query_arg(array('id' => $n_id, 'notification-action' => 'edit', 'update_message' => urlencode(__('Action Updated', 'ninja-forms'))), $redirect));
         wp_redirect($redirect);
         die;
     }
     return __('Action Updated', 'ninja-forms');
 }
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:36,代码来源:notifications.php

示例9: ninja_forms

 private function ninja_forms()
 {
     if (!is_plugin_active('ninja-forms/ninja-forms.php')) {
         return;
     }
     // Update localized strings in sample contact form
     $contact_form_meta = array('form_title' => __('Contact Form', 'wp-easy-mode'), 'success_msg' => __('Your form has been successfully submitted.', 'wp-easy-mode'), 'user_email_msg' => __('Thank you so much for contacting us. We will get back to you shortly.', 'wp-easy-mode'));
     foreach ($contact_form_meta as $key => $value) {
         nf_update_object_meta(1, $key, $value);
     }
     // Add contact form to WPEM contact page
     $this->add_ninja_form_to_page('contact-%', 1);
     // Create sample quote form
     if ('standard' === $this->site_type) {
         $contact_form_data = ninja_forms_serialize_form(1);
         // Duplicate the sample contact form
         $quote_form_id = ninja_forms_import_form($contact_form_data);
         // Update localized strings in sample quote form
         $quote_form_meta = array('form_title' => __('Request A Quote Form', 'wp-easy-mode'), 'success_msg' => __('Your form has been successfully submitted.', 'wp-easy-mode'), 'user_email_msg' => __('Thank you so much for contacting us. We will get back to you shortly.', 'wp-easy-mode'));
         foreach ($quote_form_meta as $key => $value) {
             nf_update_object_meta($quote_form_id, $key, $value);
         }
         // Add quote form to WPEM estimates page
         $this->add_ninja_form_to_page('estimates', $quote_form_id);
     }
 }
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:26,代码来源:class-wpem-done.php

示例10: nf_cl_form_import

/**
 * Change the field IDs in our notification conditions after we import a form.
 */
function nf_cl_form_import($n, $n_id, $form)
{
    // Bail if we don't have any fields set.
    if (!isset($form['field']) || empty($form['field'])) {
        return $n;
    }
    $fields = array();
    foreach ($form['field'] as $field) {
        $old_id = $field['old_id'];
        $fields[$old_id] = $field['id'];
    }
    // Make sure we have some conditions.
    if (isset($n['conditions'])) {
        // Loop through our conditions, change the field ids, and insert them into the database.
        foreach ($n['conditions'] as $condition) {
            // Make sure that we have criteria set.
            if (!isset($condition['criteria']) || empty($condition['criteria'])) {
                continue;
            }
            // There isn't any criteria set. Skip to the next condition.
            // Insert our condition
            $c_id = nf_cl_insert_condition($n_id);
            // Update our condition meta
            nf_update_object_meta($c_id, 'action', $condition['action']);
            nf_update_object_meta($c_id, 'connector', $condition['connector']);
            // Change our field ids.
            // Loop through our criteria and search for field ids
            foreach ($condition['criteria'] as $cr) {
                // First, we check the param to see if it is a field id.
                if (isset($fields[$cr['param']])) {
                    $cr['param'] = $fields[$cr['param']];
                }
                // Next, check to see if the value is a field id
                if (isset($fields[$cr['value']])) {
                    $cr['value'] = $fields[$cr['param']];
                }
                // Insert our criteria
                $cr_id = nf_cl_insert_criteria($c_id);
                // Update our criteria object meta.
                nf_update_object_meta($cr_id, 'param', $cr['param']);
                nf_update_object_meta($cr_id, 'compare', $cr['compare']);
                nf_update_object_meta($cr_id, 'value', $cr['value']);
            }
        }
        unset($n['conditions']);
    }
    return $n;
}
开发者ID:seancho0420,项目名称:globalink,代码行数:51,代码来源:notifications.php

示例11: save_admin

 /**
  * Save admin edit screen
  *
  * @access public
  * @since 1.0
  * @return void
  */
 public function save_admin($id = '', $data)
 {
     if (isset($data['wh_args']) && is_array($data['wh_args'])) {
         $args = nf_get_object_children($id, 'wh_args');
         foreach ($args as $object_id => $vars) {
             if (!isset($data['wh_args'][$object_id])) {
                 nf_delete_object($object_id);
             }
         }
         if (isset($data['wh_args']['new'])) {
             foreach ($data['wh_args']['new'] as $vars) {
                 $object_id = nf_insert_object('wh_args');
                 nf_update_object_meta($object_id, 'key', $vars['key']);
                 nf_update_object_meta($object_id, 'field', $vars['field']);
                 nf_add_relationship($object_id, 'wh_args', $id, 'notification');
             }
             unset($data['wh_args']['new']);
         }
         foreach ($data['wh_args'] as $object_id => $vars) {
             if (!empty($object_id)) {
                 nf_update_object_meta($object_id, 'key', $vars['key']);
                 nf_update_object_meta($object_id, 'field', $vars['field']);
             }
         }
         unset($data['wh_args']);
     }
     return $data;
 }
开发者ID:voceconnect,项目名称:ninja-forms-webhooks,代码行数:35,代码来源:action-webhooks.php


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