本文整理汇总了PHP中RGFormsModel::get_form_meta方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_form_meta方法的具体用法?PHP RGFormsModel::get_form_meta怎么用?PHP RGFormsModel::get_form_meta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_form_meta方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leads_page
public static function leads_page($form_id)
{
global $wpdb;
//quit if version of wp is not supported
if (!GFCommon::ensure_wp_version()) {
return;
}
$form_id = absint($form_id);
echo GFCommon::get_remote_message();
$action = RGForms::post('action');
$filter = rgget('filter');
$search = stripslashes(rgget('s'));
$page_index = empty($_GET['paged']) ? 0 : intval($_GET['paged']) - 1;
$star = $filter == 'star' ? 1 : null;
$read = $filter == 'unread' ? 0 : null;
$status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
$form = RGFormsModel::get_form_meta($form_id);
$search_criteria['status'] = $status;
if ($star) {
$search_criteria['field_filters'][] = array('key' => 'is_starred', 'value' => (bool) $star);
}
if (!is_null($read)) {
$search_criteria['field_filters'][] = array('key' => 'is_read', 'value' => (bool) $read);
}
$search_field_id = rgget('field_id');
$search_operator = rgget('operator');
if (isset($_GET['field_id']) && $_GET['field_id'] !== '') {
$key = $search_field_id;
$val = stripslashes(rgget('s'));
$strpos_row_key = strpos($search_field_id, '|');
if ($strpos_row_key !== false) {
//multi-row likert
$key_array = explode('|', $search_field_id);
$key = $key_array[0];
$val = $key_array[1] . ':' . $val;
}
if ('entry_id' == $key) {
$key = 'id';
}
$filter_operator = empty($search_operator) ? 'is' : $search_operator;
$field = GFFormsModel::get_field($form, $key);
if ($field) {
$input_type = GFFormsModel::get_input_type($field);
if ($field->type == 'product' && in_array($input_type, array('radio', 'select'))) {
$filter_operator = 'contains';
}
}
$search_criteria['field_filters'][] = array('key' => $key, 'operator' => $filter_operator, 'value' => $val);
}
$update_message = '';
switch ($action) {
case 'delete':
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$lead_id = $_POST['action_argument'];
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_lead($lead_id);
$update_message = esc_html__('Entry deleted.', 'gravityforms');
} else {
$update_message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'bulk':
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$bulk_action = !empty($_POST['bulk_action']) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
$select_all = rgpost('all_entries');
$leads = empty($select_all) ? $_POST['lead'] : GFFormsModel::search_lead_ids($form_id, $search_criteria);
$entry_count = count($leads) > 1 ? sprintf(esc_html__('%d entries', 'gravityforms'), count($leads)) : esc_html__('1 entry', 'gravityforms');
switch ($bulk_action) {
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_leads($leads);
$update_message = sprintf(esc_html__('%s deleted.', 'gravityforms'), $entry_count);
} else {
$update_message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'trash':
RGFormsModel::update_leads_property($leads, 'status', 'trash');
$update_message = sprintf(esc_html__('%s moved to Trash.', 'gravityforms'), $entry_count);
break;
case 'restore':
RGFormsModel::update_leads_property($leads, 'status', 'active');
$update_message = sprintf(esc_html__('%s restored from the Trash.', 'gravityforms'), $entry_count);
break;
case 'unspam':
RGFormsModel::update_leads_property($leads, 'status', 'active');
$update_message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count);
break;
case 'spam':
RGFormsModel::update_leads_property($leads, 'status', 'spam');
$update_message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count);
break;
case 'mark_read':
RGFormsModel::update_leads_property($leads, 'is_read', 1);
$update_message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count);
break;
case 'mark_unread':
RGFormsModel::update_leads_property($leads, 'is_read', 0);
$update_message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count);
break;
//.........这里部分代码省略.........
示例2: gform_column_splits
function gform_column_splits($content, $field, $value, $lead_id, $form_id)
{
if (IS_ADMIN) {
return $content;
}
// only modify HTML on the front end
$form = RGFormsModel::get_form_meta($form_id, true);
$form_class = array_key_exists('cssClass', $form) ? $form['cssClass'] : '';
$form_classes = preg_split('/[\\n\\r\\t ]+/', $form_class, -1, PREG_SPLIT_NO_EMPTY);
$fields_class = array_key_exists('cssClass', $field) ? $field['cssClass'] : '';
$field_classes = preg_split('/[\\n\\r\\t ]+/', $fields_class, -1, PREG_SPLIT_NO_EMPTY);
if (!is_admin()) {
// multi-column form functionality
if ($field['type'] == 'section') {
$form = RGFormsModel::get_form_meta($form_id, true);
// check for the presence of multi-column form classes
$form_class = explode(' ', $form['cssClass']);
$form_class_matches = array_intersect($form_class, array('two-column', 'three-column'));
// check for the presence of section break column classes
$field_class = explode(' ', $field['cssClass']);
$field_class_matches = array_intersect($field_class, array('gform_column'));
// if field is a column break in a multi-column form, perform the list split
if (!empty($form_class_matches) && !empty($field_class_matches)) {
// make sure to target only multi-column forms
// retrieve the form's field list classes for consistency
$form = RGFormsModel::add_default_properties($form);
$description_class = rgar($form, 'descriptionPlacement') == 'above' ? 'description_above' : 'description_below';
// close current field's li and ul and begin a new list with the same form field list classes
return '</li></ul><ul class="gform_fields ' . $form['labelPlacement'] . ' ' . $description_class . ' ' . $field['cssClass'] . '"><li class="gfield gsection empty">';
}
}
}
return $content;
}
示例3: setup_entry
function setup_entry($post_entry)
{
// echo "post array <br>";
// print_r($post_entry);
// echo "<br><br>";
// echo "loading and ids <br><br>";
$return = array();
$return['form_id'] = $post_entry['form_id'];
$form = RGFormsModel::get_form_meta($post_entry['form_id']);
// $counter=0;
// filter array entry with no sub content ex: 1,2,3,4,5,6,7,8
foreach ($form['fields'] as $field) {
// $counter++;
$post_entry_key = 'input_' . $field['id'];
// echo "$counter .) " . $field['id'] . ' = ' . $post_entry[$post_entry_key] . " <br>";
if (array_key_exists($post_entry_key, $post_entry)) {
$return[$field['id']] = $post_entry[$post_entry_key];
}
}
//filter array entry with sub content ex: 200.1, 299.2, 323.3
$entrySub1 = getEntrySub1($post_entry);
foreach ($entrySub1 as $entryId) {
$post_entry_key = 'input_' . $entryId;
if (array_key_exists($post_entry_key, $post_entry)) {
$return[$entryId] = $post_entry[$post_entry_key];
}
}
return $return;
}
示例4: _get_form_strings
function _get_form_strings($form_id)
{
$form = RGFormsModel::get_form_meta($form_id, true);
$form = RGFormsModel::add_default_properties($form);
$string_data = array();
$form_keys = array('title', 'description', 'limitEntriesMessage', 'scheduleMessage', 'postTitleTemplate', 'postContentTemplate', 'confirmation-message', 'autoResponder-subject', 'autoResponder-message', 'button-text');
foreach ($form_keys as $key) {
$parts = explode('-', $key);
if (sizeof($parts) == 1) {
if (isset($form[$key]) && $form[$key] != '') {
$string_data[$key] = $form[$key];
}
} else {
if (isset($form[$parts[0]][$parts[1]]) && $form[$parts[0]][$parts[1]] != '') {
$string_data[$key] = $form[$parts[0]][$parts[1]];
}
}
}
///- Paging Page Names - $form["pagination"]["pages"][i]
$keys = array('label', 'description', 'defaultValue', 'errorMessage');
foreach ($form['fields'] as $id => $field) {
foreach ($keys as $key) {
if (isset($field[$key]) && $field[$key] != '') {
$string_data['field-' . $field['id'] . '-' . $key] = $field[$key];
}
}
switch ($field['type']) {
case 'text':
case 'textarea':
case 'email':
case 'number':
case 'section':
break;
case 'html':
$string_data['field-' . $field['id'] . '-content'] = $field['content'];
break;
case 'page':
$string_data['field-' . $field['id'] . '-nextButton'] = $field['nextButton']['text'];
$string_data['field-' . $field['id'] . '-previousButton'] = $field['previousButton']['text'];
break;
case 'select':
case 'checkbox':
case 'radio':
case 'product':
if (isset($field['choices']) && is_array($field['choices'])) {
foreach ($field['choices'] as $index => $choice) {
$string_data['field-' . $field['id'] . '-choice-' . $choice['value']] = $choice['text'];
}
}
break;
case 'post_custom_field':
$string_data['field-' . $field['id'] . '-customFieldTemplate'] = $field["customFieldTemplate"];
break;
}
}
return $string_data;
}
示例5: ajax_get_view_merge_tag_data
/**
* When the widget View is changed, update the Merge Tag data
*
* @since 1.6
*/
function ajax_get_view_merge_tag_data()
{
if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'gravityview_ajax_widget')) {
exit(false);
}
$form_id = gravityview_get_form_id($_POST['view_id']);
$form = RGFormsModel::get_form_meta($form_id);
$output = array('form' => array('id' => $form['id'], 'title' => $form['title'], 'fields' => $form['fields']), 'mergeTags' => GFCommon::get_merge_tags($form['fields'], '', false));
echo json_encode($output);
exit;
}
示例6: migrate
public function migrate()
{
global $wpdb;
$form_ids = $wpdb->get_col("SELECT id FROM {$wpdb->prefix}rg_form");
foreach ($form_ids as $id) {
$form = RGFormsModel::get_form_meta($id, true);
$this->tm_api->update_form_translations($form, true);
$wpdb->delete($wpdb->prefix . 'icl_translations', array('element_id' => $id, 'element_type' => 'post_gravity_form'));
$this->migrate_old_translated_values($id);
}
}
示例7: gforms_autologin
function gforms_autologin($user_id, $config, $entry, $password)
{
$form = RGFormsModel::get_form_meta($entry['form_id']);
$user_login = apply_filters("gform_username_{$form['id']}", apply_filters('gform_username', GFUser::get_meta_value('username', $config, $form, $entry), $config, $form, $entry), $config, $form, $entry);
$redirect_url = rgars($form, 'confirmation/url') ? rgars($form, 'confirmation/url') : get_bloginfo('home');
//pass the above to the wp_signon function
$result = wp_signon(array('user_login' => $user_login, 'user_password' => $password, 'remember' => false));
if (!is_wp_error($result)) {
wp_redirect($redirect_url);
}
}
示例8: setup_entry
function setup_entry($post_entry)
{
$return = array();
$return['form_id'] = $post_entry['form_id'];
$form = RGFormsModel::get_form_meta($post_entry['form_id']);
foreach ($form['fields'] as $field) {
$post_entry_key = 'input_' . $field['id'];
if (array_key_exists($post_entry_key, $post_entry)) {
$return[$field['id']] = $post_entry[$post_entry_key];
}
}
return $return;
}
示例9: get_pronamic_gf_pay_conditioned_feed_by_form_id
function get_pronamic_gf_pay_conditioned_feed_by_form_id($form_id)
{
$feeds = get_pronamic_gf_pay_feeds_by_form_id($form_id);
if (!empty($feeds)) {
$form = RGFormsModel::get_form_meta($form_id);
foreach ($feeds as $feed) {
if (Pronamic_WP_Pay_Extensions_GravityForms_Util::is_condition_true($form, $feed)) {
return $feed;
}
}
}
return null;
}
示例10: show_salesforce_status
public static function show_salesforce_status()
{
global $pagenow;
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'gf_edit_forms' && !isset($_REQUEST['id'])) {
$activeforms = array();
$forms = RGFormsModel::get_forms();
if (!is_array($forms)) {
return;
}
foreach ($forms as $form) {
$form = RGFormsModel::get_form_meta($form->id);
if (is_array($form) && !empty($form['enableSalesforce'])) {
$activeforms[] = $form['id'];
}
}
if (!empty($activeforms)) {
?>
<style type="text/css">
td a.row-title span.salesforce_enabled {
position: absolute;
background: url('<?php
echo WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__));
?>
/salesforce-16x16.png') right top no-repeat;
height: 16px;
width: 16px;
margin-left: 10px;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('table tbody.user-list tr').each(function() {
if($('td.column-id', $(this)).text() == <?php
echo implode('||', $activeforms);
?>
) {
$('td a.row-title', $(this)).append('<span class="salesforce_enabled" title="<?php
_e('Salesforce integration is enabled for this Form', "gravity-forms-salesforce");
?>
"></span>');
}
});
});
</script>
<?php
}
}
}
示例11: maybe_export
public static function maybe_export()
{
if (isset($_POST['export_lead'])) {
check_admin_referer('rg_start_export', 'rg_start_export_nonce');
//see if any fields chosen
if (empty($_POST['export_field'])) {
GFCommon::add_error_message(__('Please select the fields to be exported', 'gravityforms'));
return;
}
$form_id = $_POST['export_form'];
$form = RGFormsModel::get_form_meta($form_id);
$filename = sanitize_title_with_dashes($form['title']) . '-' . gmdate('Y-m-d', GFCommon::get_local_timestamp(time())) . '.csv';
$charset = get_option('blog_charset');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: text/csv; charset=' . $charset, true);
$buffer_length = ob_get_length();
//length or false if no buffer
if ($buffer_length > 1) {
ob_clean();
}
GFExport::start_export($form);
die;
} else {
if (isset($_POST['export_forms'])) {
check_admin_referer('gf_export_forms', 'gf_export_forms_nonce');
$selected_forms = rgpost('gf_form_id');
if (empty($selected_forms)) {
GFCommon::add_error_message(__('Please select the forms to be exported', 'gravityforms'));
return;
}
$forms = RGFormsModel::get_form_meta_by_id($selected_forms);
$forms = self::prepare_forms_for_export($forms);
$forms['version'] = GFForms::$version;
$forms_json = json_encode($forms);
$filename = 'gravityforms-export-' . date('Y-m-d') . '.json';
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
echo $forms_json;
die;
}
}
}
示例12: widget
function widget($args, $instance)
{
extract($args);
echo $before_widget;
$title = apply_filters('widget_title', $instance['title']);
if ($title) {
echo $before_title . $title . $after_title;
}
$tabindex = is_numeric($instance['tabindex']) ? $instance['tabindex'] : 1;
//creating form
$form = RGFormsModel::get_form_meta($instance['form_id']);
if (empty($instance['disable_scripts']) && !is_admin()) {
RGForms::print_form_scripts($form, $instance['ajax']);
}
$form_markup = RGForms::get_form($instance['form_id'], $instance['showtitle'], $instance['showdescription'], false, null, $instance['ajax'], $tabindex);
//display form
echo $form_markup;
echo $after_widget;
}
示例13: widget
function widget($args, $instance)
{
extract($args);
echo $before_widget;
$title = apply_filters('widget_title', $instance['title']);
if ($title) {
echo $before_title . $title . $after_title;
}
//setting tabindex based on configured value
if (is_numeric($instance['tabindex'])) {
add_filter("gform_tabindex_{$instance['form_id']}", create_function("", "return {$instance['tabindex']};"));
}
//creating form
$form = RGFormsModel::get_form_meta($instance['form_id']);
if (empty($instance["disable_scripts"]) && !is_admin()) {
RGForms::print_form_scripts($form, $instance["ajax"]);
}
$form_markup = RGForms::get_form($instance['form_id'], $instance['showtitle'], $instance['showdescription'], false, null, $instance["ajax"]);
//display form
echo $form_markup;
echo $after_widget;
}
示例14: get_pronamic_gf_pay_conditioned_feed_by_form_id
function get_pronamic_gf_pay_conditioned_feed_by_form_id($form_id, $with_ideal_issuers = false)
{
$feeds = get_pronamic_gf_pay_feeds_by_form_id($form_id);
if (!empty($feeds)) {
$form = RGFormsModel::get_form_meta($form_id);
if ($with_ideal_issuers) {
foreach ($feeds as $feed) {
$gateway = Pronamic_WP_Pay_Plugin::get_gateway($feed->config_id);
if ($gateway && null !== $gateway->get_issuers()) {
return $feed;
}
}
} else {
foreach ($feeds as $feed) {
if (Pronamic_WP_Pay_Extensions_GravityForms_Util::is_condition_true($form, $feed)) {
return $feed;
}
}
}
}
return null;
}
示例15: init_plugin
function init_plugin()
{
$this->options = SPECommon::get_option('property_enquiry_options', array());
if (!IS_ADMIN) {
add_filter("gform_field_value_[propertyid]", array(&$this, 'handle_gf_parameter_value_propertyid'));
add_filter("gform_field_value_[propertyreference]", array(&$this, 'handle_gf_parameter_value_propertyref'));
add_filter("gform_field_value_[propertypermalink]", array(&$this, 'handle_gf_parameter_value_propertypermalink'));
add_filter("gform_field_value_[propertytitle]", array(&$this, 'handle_gf_parameter_value_propertytitle'));
add_filter("gform_field_value_[propertycountry]", array(&$this, 'handle_gf_parameter_value_propertycountry'));
add_filter("gform_field_value_[propertyregion]", array(&$this, 'handle_gf_parameter_value_propertyregion'));
add_filter("gform_field_value_[propertytown]", array(&$this, 'handle_gf_parameter_value_propertytown'));
add_filter("gform_field_value_[propertycontactname]", array(&$this, 'handle_gf_parameter_value_propertycontactname'));
add_filter("gform_field_value_[propertycontacttel]", array(&$this, 'handle_gf_parameter_value_propertycontacttel'));
add_filter("gform_field_value_[propertycontactemail]", array(&$this, 'handle_gf_parameter_value_propertycontactemail'));
} else {
if (class_exists('RGFormsModel')) {
// grab the form
$this->form = RGFormsModel::get_form_meta($this->options['enquiry_form_gf_id']);
$this->fields = $this->form['fields'];
}
}
//$to = apply_filters("gform_notification_email_{$form_id}" , apply_filters("gform_notification_email", $email_to, $lead), $lead);
}