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


PHP FrmAppHelper::is_admin方法代码示例

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


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

示例1: enqueue_css

 public static function enqueue_css($register = 'enqueue')
 {
     global $frm_vars;
     $register_css = $register == 'register';
     if (($frm_vars['load_css'] || $register_css) && !FrmAppHelper::is_admin()) {
         $frm_settings = FrmAppHelper::get_settings();
         if ($frm_settings->load_style == 'none') {
             return;
         }
         $css = apply_filters('get_frm_stylesheet', self::custom_stylesheet());
         if (!empty($css)) {
             $version = FrmAppHelper::plugin_version();
             foreach ((array) $css as $css_key => $file) {
                 if ($register == 'register') {
                     wp_register_style($css_key, $file, array(), $version);
                 }
                 if ('all' == $frm_settings->load_style || $register != 'register') {
                     wp_enqueue_style($css_key);
                 }
                 unset($css_key, $file);
             }
             if ($frm_settings->load_style == 'all') {
                 $frm_vars['css_loaded'] = true;
             }
         }
         unset($css);
     }
 }
开发者ID:tshdvs,项目名称:5thAveBoutique,代码行数:28,代码来源:FrmStylesController.php

示例2: create

 public static function create($values)
 {
     global $wpdb;
     self::sanitize_entry_post($values);
     $values = apply_filters('frm_pre_create_entry', $values);
     if (!isset($values['item_key'])) {
         $values['item_key'] = '';
     }
     $item_name = self::get_new_entry_name($values, $values['item_key']);
     $new_values = array('item_key' => FrmAppHelper::get_unique_key($values['item_key'], $wpdb->prefix . 'frm_items', 'item_key'), 'name' => FrmAppHelper::truncate($item_name, 255, 1, ''), 'ip' => FrmAppHelper::get_ip_address(), 'is_draft' => isset($values['frm_saving_draft']) && $values['frm_saving_draft'] == 1 || isset($values['is_draft']) && $values['is_draft'] == 1 ? 1 : 0, 'form_id' => isset($values['form_id']) ? (int) $values['form_id'] : null, 'post_id' => isset($values['post_id']) ? (int) $values['post_id'] : 0, 'parent_item_id' => isset($values['parent_item_id']) ? (int) $values['parent_item_id'] : 0, 'created_at' => isset($values['created_at']) ? $values['created_at'] : current_time('mysql', 1), 'updated_at' => isset($values['updated_at']) ? $values['updated_at'] : (isset($values['created_at']) ? $values['created_at'] : current_time('mysql', 1)));
     if (is_array($new_values['name'])) {
         $new_values['name'] = reset($new_values['name']);
     }
     if (isset($values['description']) && !empty($values['description'])) {
         $new_values['description'] = maybe_serialize($values['description']);
     } else {
         $new_values['description'] = serialize(array('browser' => FrmAppHelper::get_server_value('HTTP_USER_AGENT'), 'referrer' => FrmAppHelper::get_server_value('HTTP_REFERER')));
     }
     //if(isset($values['id']) and is_numeric($values['id']))
     //    $new_values['id'] = $values['id'];
     if (isset($values['frm_user_id']) && (is_numeric($values['frm_user_id']) || FrmAppHelper::is_admin())) {
         $new_values['user_id'] = $values['frm_user_id'];
     } else {
         $user_ID = get_current_user_id();
         $new_values['user_id'] = $user_ID ? $user_ID : 0;
     }
     $new_values['updated_by'] = isset($values['updated_by']) ? $values['updated_by'] : $new_values['user_id'];
     // don't create duplicate entry
     if (self::is_duplicate($new_values, $values)) {
         return false;
     }
     $query_results = $wpdb->insert($wpdb->prefix . 'frm_items', $new_values);
     if (!$query_results) {
         return false;
     }
     $entry_id = $wpdb->insert_id;
     global $frm_vars;
     if (!isset($frm_vars['saved_entries'])) {
         $frm_vars['saved_entries'] = array();
     }
     $frm_vars['saved_entries'][] = (int) $entry_id;
     if (isset($values['item_meta'])) {
         FrmEntryMeta::update_entry_metas($entry_id, $values['item_meta']);
     }
     self::clear_cache();
     // this is a child entry
     $is_child = isset($values['parent_form_id']) && isset($values['parent_nonce']) && !empty($values['parent_form_id']) && wp_verify_nonce($values['parent_nonce'], 'parent');
     do_action('frm_after_create_entry', $entry_id, $new_values['form_id'], compact('is_child'));
     do_action('frm_after_create_entry_' . $new_values['form_id'], $entry_id, compact('is_child'));
     return $entry_id;
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:51,代码来源:FrmEntry.php

示例3: validate_recaptcha

 public static function validate_recaptcha(&$errors, $field, $args)
 {
     if ($field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters('frm_is_field_hidden', false, $field, stripslashes_deep($_POST))) {
         return;
     }
     $frm_settings = FrmAppHelper::get_settings();
     if (empty($frm_settings->pubkey)) {
         // don't require the captcha if it shouldn't be shown
         return;
     }
     if (!isset($_POST['g-recaptcha-response'])) {
         // If captcha is missing, check if it was already verified
         if (!isset($_POST['recaptcha_checked']) || !wp_verify_nonce($_POST['recaptcha_checked'], 'frm_ajax')) {
             // There was no captcha submitted
             $errors['field' . $args['id']] = __('The captcha is missing from this form', 'formidable');
         }
         return;
     }
     $arg_array = array('body' => array('secret' => $frm_settings->privkey, 'response' => $_POST['g-recaptcha-response'], 'remoteip' => FrmAppHelper::get_ip_address()));
     $resp = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', $arg_array);
     $response = json_decode(wp_remote_retrieve_body($resp), true);
     if (isset($response['success']) && !$response['success']) {
         // What happens when the CAPTCHA was entered incorrectly
         $errors['field' . $args['id']] = !isset($field->field_options['invalid']) || $field->field_options['invalid'] == '' ? $frm_settings->re_msg : $field->field_options['invalid'];
     } else {
         if (is_wp_error($resp)) {
             $error_string = $resp->get_error_message();
             $errors['field' . $args['id']] = __('There was a problem verifying your recaptcha', 'formidable');
             $errors['field' . $args['id']] .= ' ' . $error_string;
         }
     }
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:32,代码来源:FrmEntryValidate.php

示例4: footer_js

 public static function footer_js($location = 'footer')
 {
     global $frm_vars;
     FrmStylesController::enqueue_css();
     if (!FrmAppHelper::is_admin() && $location != 'header' && !empty($frm_vars['forms_loaded'])) {
         //load formidable js
         wp_enqueue_script('formidable');
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:9,代码来源:FrmFormsController.php

示例5: do_action

                                ?>
 <?php 
                                do_action('frm_field_input_html', $field);
                                ?>
 /><?php 
                                if (!isset($atts) || !isset($atts['label']) || $atts['label']) {
                                    echo ' ' . $opt . '</label>';
                                }
                                FrmFieldsHelper::include_other_input(array('other_opt' => $other_opt, 'read_only' => $read_only, 'checked' => $checked, 'name' => $other_args['name'], 'value' => $other_args['value'], 'field' => $field, 'html_id' => $html_id, 'opt_key' => $opt_key));
                                unset($other_opt, $other_args, $checked);
                                ?>
</div>
<?php 
                            }
                        }
                    }
                } else {
                    if ($field['type'] == 'captcha' && !FrmAppHelper::is_admin()) {
                        $frm_settings = FrmAppHelper::get_settings();
                        if (!empty($frm_settings->pubkey)) {
                            FrmFieldsHelper::display_recaptcha($field);
                        }
                    } else {
                        do_action('frm_form_fields', $field, $field_name, compact('errors', 'html_id'));
                        do_action('frm_form_field_' . $field['type'], $field, $field_name, compact('errors', 'html_id'));
                    }
                }
            }
        }
    }
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:31,代码来源:input.php

示例6: esc_attr

    echo esc_attr($id);
    ?>
" /><?php 
}
if ($values['fields']) {
    foreach ($values['fields'] as $field) {
        if (apply_filters('frm_show_normal_field_type', true, $field['type'])) {
            echo FrmFieldsHelper::replace_shortcodes($field['custom_html'], $field, $errors, $form);
        } else {
            do_action('frm_show_other_field_type', $field, $form, array('action' => $form_action));
        }
        do_action('frm_get_field_scripts', $field, $form, $form->id);
    }
}
$frm_settings = FrmAppHelper::get_settings();
if (FrmAppHelper::is_admin()) {
    ?>
<div class="frm_form_field form-field">
<label class="frm_primary_label"><?php 
    _e('Entry Key', 'formidable');
    ?>
</label>
<input type="text" name="item_key" value="<?php 
    echo esc_attr($values['item_key']);
    ?>
" />
</div>
<?php 
} else {
    ?>
<input type="hidden" name="item_key" value="<?php 
开发者ID:EyesX,项目名称:formidable-forms,代码行数:31,代码来源:form.php

示例7: get_file_name

 public static function get_file_name($media_ids, $short = true)
 {
     $value = '';
     foreach ((array) $media_ids as $media_id) {
         if (!is_numeric($media_id)) {
             continue;
         }
         $attachment = get_post($media_id);
         if (!$attachment) {
             continue;
         }
         $url = wp_get_attachment_url($media_id);
         $label = $short ? basename($attachment->guid) : $url;
         $action = FrmAppHelper::simple_get('action', 'sanitize_title');
         $frm_action = FrmAppHelper::simple_get('frm_action', 'sanitize_title');
         if ($frm_action == 'csv' || $action == 'frm_entries_csv') {
             if (!empty($value)) {
                 $value .= ', ';
             }
         } else {
             if (FrmAppHelper::is_admin()) {
                 $url = '<a href="' . esc_url($url) . '">' . $label . '</a>';
                 if (strpos(FrmAppHelper::simple_get('page', 'sanitize_title'), 'formidable') === 0) {
                     $url .= '<br/><a href="' . esc_url(admin_url('media.php') . '?action=edit&attachment_id=' . $media_id) . '">' . __('Edit Uploaded File', 'formidable') . '</a>';
                 }
             } else {
                 if (!empty($value)) {
                     $value .= "<br/>\r\n";
                 }
             }
         }
         $value .= $url;
         unset($media_id);
     }
     return $value;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:36,代码来源:FrmProFieldsHelper.php

示例8: esc_attr

    echo esc_attr($id);
    ?>
" /><?php 
}
if ($values['fields']) {
    foreach ($values['fields'] as $field) {
        if (apply_filters('frm_show_normal_field_type', true, $field['type'])) {
            echo FrmFieldsHelper::replace_shortcodes($field['custom_html'], $field, $errors, $form);
        } else {
            do_action('frm_show_other_field_type', $field, $form, array('action' => $form_action));
        }
        do_action('frm_get_field_scripts', $field, $form, $form->id);
    }
}
$frm_settings = FrmAppHelper::get_settings();
if (FrmAppHelper::is_admin() && !$frm_settings->lock_keys) {
    ?>
<div class="frm_form_field form-field">
<label class="frm_primary_label"><?php 
    _e('Entry Key', 'formidable');
    ?>
</label>
<input type="text" name="item_key" value="<?php 
    echo esc_attr($values['item_key']);
    ?>
" />
</div>
<?php 
} else {
    ?>
<input type="hidden" name="item_key" value="<?php 
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:31,代码来源:form.php

示例9: get_current_user_id

_container" class="frm_form_field form-field frm_top_container">
<label class="frm_primary_label"><?php 
        echo $field['name'];
        ?>
:</label> <?php 
        echo $field['value'];
        ?>
</div>
<?php 
    }
    $field['html_id'] = $html_id;
    FrmProFieldsHelper::insert_hidden_fields($field, $field_name, $field['value']);
} else {
    if ($field['type'] == 'user_id') {
        $user_ID = get_current_user_id();
        $value = is_numeric($field['value']) || FrmAppHelper::is_admin() && $_POST && isset($_POST['item_meta'][$field['id']]) || isset($args['action']) && $args['action'] == 'update' ? $field['value'] : ($user_ID ? $user_ID : '');
        echo '<input type="hidden" id="' . esc_attr($html_id) . '" name="' . esc_attr($field_name) . '" value="' . esc_attr($value) . '"/>' . "\n";
        unset($value);
    } else {
        if ($field['type'] == 'break') {
            global $frm_vars;
            $post_form_id = FrmAppHelper::get_post_param('form_id', 0, 'absint');
            if (isset($frm_vars['prev_page'][$field['form_id']]) && $frm_vars['prev_page'][$field['form_id']] == $field['field_order']) {
                echo FrmFieldsHelper::replace_shortcodes($field['custom_html'], $field, array(), $form);
                ?>
<input type="hidden" name="frm_next_page" class="frm_next_page" id="frm_next_p_<?php 
                echo isset($frm_vars['prev_page'][$field['form_id']]) ? $frm_vars['prev_page'][$field['form_id']] : 0;
                ?>
" value="" />
<?php 
                if ($field['form_id'] == $post_form_id && !defined('DOING_AJAX')) {
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:31,代码来源:show-other.php

示例10: add_field_class

 public static function add_field_class($class, $field)
 {
     if ($field['type'] == 'scale' && FrmField::is_option_true($field, 'star')) {
         $class .= ' star';
     } else {
         if ($field['type'] == 'date') {
             $class .= ' frm_date';
         } else {
             if ($field['type'] == 'file' && FrmField::is_option_true($field, 'multiple')) {
                 $class .= ' frm_multiple_file';
             }
         }
     }
     // Hide the "No files selected" text if files are selected
     if ($field['type'] == 'file' && !FrmField::is_option_empty($field, 'value')) {
         $class .= ' frm_transparent';
     }
     if (!FrmAppHelper::is_admin() && FrmField::is_option_true($field, 'autocom') && ($field['type'] == 'select' || $field['type'] == 'data' && isset($field['data_type']) && $field['data_type'] == 'select') && !empty($field['options']) && !FrmField::is_read_only($field)) {
         global $frm_vars;
         $frm_vars['chosen_loaded'] = true;
         $class .= ' frm_chzn';
         $style = FrmStylesController::get_form_style($field['form_id']);
         if ($style && 'rtl' == $style->post_content['direction']) {
             $class .= ' chosen-rtl';
         }
     }
     return $class;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:28,代码来源:FrmProFieldsController.php

示例11: foreach

<?php

// Check if field is read only
$disabled = FrmField::is_read_only($field) && !FrmAppHelper::is_admin() ? ' disabled="disabled"' : '';
// Dynamic Dropdowns
if ($field['data_type'] == 'select') {
    if (!empty($field['options'])) {
        ?>
<select <?php 
        echo $disabled;
        ?>
 name="<?php 
        echo esc_attr($field_name);
        ?>
" id="<?php 
        echo esc_attr($html_id);
        ?>
" <?php 
        do_action('frm_field_input_html', $field);
        ?>
>
<?php 
        if ($field['options']) {
            foreach ($field['options'] as $opt_key => $opt) {
                $selected = $field['value'] == $opt_key || in_array($opt_key, (array) $field['value']) ? ' selected="selected"' : '';
                ?>
<option value="<?php 
                echo esc_attr($opt_key);
                ?>
"<?php 
                echo $selected;
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:31,代码来源:data-options.php

示例12: load_hooks

 public static function load_hooks()
 {
     add_action('init', 'FrmProAppController::create_taxonomies', 0);
     add_action('frm_after_install', 'FrmProDb::upgrade');
     add_filter('wpmu_drop_tables', 'FrmProAppController::drop_tables');
     add_shortcode('frm_set_get', 'FrmProAppController::set_get');
     add_shortcode('frm-set-get', 'FrmProAppController::set_get');
     add_action('genesis_init', 'FrmProAppController::load_genesis');
     // Displays Controller
     add_action('init', 'FrmProDisplaysController::register_post_types', 0);
     add_action('before_delete_post', 'FrmProDisplaysController::before_delete_post');
     add_filter('the_content', 'FrmProDisplaysController::get_content', 8);
     // Display Shortcodes
     add_shortcode('display-frm-data', 'FrmProDisplaysController::get_shortcode', 1);
     // Entries Controller
     if (!FrmAppHelper::is_admin()) {
         add_action('wp_footer', 'FrmProEntriesController::enqueue_footer_js', 19);
         add_action('wp_footer', 'FrmProEntriesController::footer_js', 20);
     }
     add_filter('frm_data_sort', 'FrmProEntriesController::data_sort', 20);
     add_action('widgets_init', 'FrmProEntriesController::register_widgets');
     add_filter('frm_update_entry', 'FrmProEntriesController::check_draft_status', 10, 2);
     add_action('frm_after_create_entry', 'FrmProEntriesController::remove_draft_hooks', 1);
     add_action('frm_process_entry', 'FrmProEntriesController::process_update_entry', 10, 4);
     add_filter('frm_prepare_data_before_db', 'FrmProEntryMeta::prepare_data_before_db', 10, 3);
     add_action('frm_display_form_action', 'FrmProEntriesController::edit_update_form', 10, 5);
     add_action('frm_submit_button_action', 'FrmProEntriesController::ajax_submit_button');
     add_filter('frm_success_filter', 'FrmProEntriesController::get_confirmation_method', 10, 3);
     add_action('frm_success_action', 'FrmProEntriesController::confirmation', 10, 5);
     add_action('deleted_post', 'FrmProEntriesController::delete_entry');
     add_action('trashed_post', 'FrmProEntriesController::trashed_post');
     add_action('untrashed_post', 'FrmProEntriesController::trashed_post');
     add_filter('frmpro_fields_replace_shortcodes', 'FrmProEntriesController::filter_shortcode_value', 10, 3);
     add_filter('frm_display_value_custom', 'FrmProEntriesController::filter_display_value', 1, 3);
     add_filter('frm_display_value_atts', 'FrmProEntriesController::display_value_atts', 10, 2);
     add_action('frm_after_create_entry', 'FrmProEntriesController::maybe_set_cookie', 20, 2);
     add_filter('frm_setup_edit_entry_vars', 'FrmProEntriesController::setup_edit_vars');
     // Entry and Meta Helpers
     add_filter('frm_show_new_entry_page', 'FrmProEntriesHelper::allow_form_edit', 10, 2);
     add_filter('frm_email_value', 'FrmProEntryMetaHelper::email_value', 10, 3);
     // Entry Shortcodes
     add_shortcode('formresults', 'FrmProEntriesController::get_form_results');
     add_shortcode('frm-search', 'FrmProEntriesController::get_search');
     add_shortcode('frm-entry-links', 'FrmProEntriesController::entry_link_shortcode');
     add_shortcode('frm-entry-edit-link', 'FrmProEntriesController::entry_edit_link');
     add_shortcode('frm-entry-update-field', 'FrmProEntriesController::entry_update_field');
     add_shortcode('frm-entry-delete-link', 'FrmProEntriesController::entry_delete_link');
     add_shortcode('frm-field-value', 'FrmProEntriesController::get_field_value_shortcode');
     add_shortcode('frm-show-entry', 'FrmProEntriesController::show_entry_shortcode');
     add_shortcode('frm-alt-color', 'FrmProEntriesController::change_row_color');
     // Trigger entry model
     add_action('frm_validate_form_creation', 'FrmProEntry::validate', 10, 5);
     add_filter('frm_pre_create_entry', 'FrmProEntry::mod_other_vals', 10, 1);
     add_filter('frm_pre_update_entry', 'FrmProEntry::mod_other_vals', 10, 1);
     add_filter('frm_pre_create_entry', 'FrmProEntry::save_sub_entries', 20, 2);
     add_filter('frm_pre_update_entry', 'FrmProEntry::save_sub_entries', 20, 2);
     add_action('frm_after_duplicate_entry', 'FrmProEntry::duplicate_sub_entries', 10, 3);
     add_action('frm_after_create_entry', 'FrmProEntry::update_parent_id', 10, 2);
     // Trigger entry meta model
     add_filter('frm_add_entry_meta', 'FrmProEntryMeta::before_save');
     add_filter('frm_update_entry_meta', 'FrmProEntryMeta::before_save');
     add_filter('frm_validate_field_entry', 'FrmProEntryMeta::validate', 10, 4);
     // Fields Controller
     add_filter('frm_show_normal_field_type', 'FrmProFieldsController::show_normal_field', 10, 2);
     add_filter('frm_normal_field_type_html', 'FrmProFieldsController::normal_field_html', 10, 2);
     add_filter('frm_field_type', 'FrmProFieldsController::change_type', 9, 2);
     add_filter('frm_field_value_saved', 'FrmProFieldsController::use_field_key_value', 10, 3);
     add_action('frm_field_input_html', 'FrmProFieldsController::input_html', 10, 2);
     add_filter('frm_field_classes', 'FrmProFieldsController::add_field_class', 20, 2);
     // Fields Helper
     add_filter('frm_posted_field_ids', 'FrmProFieldsHelper::posted_field_ids');
     add_filter('frm_other_custom_html', 'FrmProFieldsHelper::get_default_html', 10, 2);
     add_filter('frm_get_display_value', 'FrmProFieldsHelper::get_display_value', 10, 3);
     add_filter('frm_pro_available_fields', 'FrmProFieldsHelper::modify_available_fields', 10);
     add_filter('frm_get_parent_child_field_helpers', 'FrmProFieldsHelper::maybe_get_parent_child_field_helpers', 10, 3);
     add_filter('frm_is_field_hidden', 'FrmProFieldsHelper::route_to_is_field_hidden', 10, 3);
     add_filter('frm_get_current_page', 'FrmProFieldsHelper::get_current_page', 10, 3);
     // Form Actions Controller
     add_action('frm_registered_form_actions', 'FrmProFormActionsController::register_actions');
     add_filter('frm_email_control_settings', 'FrmProFormActionsController::email_action_control');
     add_action('frm_after_update_entry', 'FrmProFormActionsController::trigger_update_actions', 10, 2);
     add_action('frm_before_destroy_entry', 'FrmProFormActionsController::trigger_delete_actions', 20, 2);
     // Forms Controller
     add_action('formidable_shortcode_atts', 'FrmProFormsController::formidable_shortcode_atts', 10, 2);
     add_filter('frm_replace_content_shortcodes', 'FrmProFormsController::replace_content_shortcodes', 10, 3);
     add_filter('frm_conditional_shortcodes', 'FrmProFormsController::conditional_options');
     add_filter('frm_user_shortcodes', 'FrmProFormsController::user_options');
     add_filter('frm_validate_entry', 'FrmProFormsHelper::can_submit_form_now', 15, 2);
     // trigger form model
     add_filter('frm_validate_form', 'FrmProFormsController::validate', 10, 2);
     // Posts model
     add_action('frm_trigger_wppost_action', 'FrmProPost::save_post', 10, 3);
     add_action('frm_before_destroy_entry', 'FrmProPost::destroy_post', 10, 2);
     // Stats Controller
     add_shortcode('frm-graph', 'FrmProStatisticsController::graph_shortcode');
     add_shortcode('frm-stats', 'FrmProStatisticsController::stats_shortcode');
     add_action('frm_form_action_reports', 'FrmProStatisticsController::show', 9);
     // notification model
     add_filter('frm_notification_attachment', 'FrmProNotification::add_attachments', 1, 3);
     // XML Controller
//.........这里部分代码省略.........
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:101,代码来源:FrmProHooksController.php

示例13: user_can_submit_form

 /**
  * @since 2.0.8
  * @return boolean
  */
 public static function user_can_submit_form($form)
 {
     $admin_entry = FrmAppHelper::is_admin();
     $can_submit = true;
     if ($form->options['single_entry_type'] == 'cookie' && isset($_COOKIE['frm_form' . $form->id . '_' . COOKIEHASH])) {
         $can_submit = $admin_entry ? true : false;
     } else {
         if ($form->options['single_entry_type'] == 'ip') {
             if (!$admin_entry) {
                 $prev_entry = FrmEntry::getAll(array('it.form_id' => $form->id, 'it.ip' => FrmAppHelper::get_ip_address()), '', 1);
                 if ($prev_entry) {
                     $can_submit = false;
                 }
             }
         } else {
             if (($form->options['single_entry_type'] == 'user' || isset($form->options['save_draft']) && $form->options['save_draft'] == 1) && !$form->editable) {
                 $user_ID = get_current_user_id();
                 if ($user_ID) {
                     $meta = FrmProEntriesHelper::check_for_user_entry($user_ID, $form, $form->options['single_entry_type'] != 'user');
                     if ($meta) {
                         $can_submit = false;
                     }
                 }
             }
         }
     }
     return $can_submit;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:32,代码来源:FrmProFormsHelper.php

示例14: do_action

<?php 
}
do_action('frm_entry_form', $form, $form_action, $errors);
global $frm_vars;
// close open section div
if (isset($frm_vars['div']) && $frm_vars['div']) {
    echo "</div>\n";
    unset($frm_vars['div']);
}
// close open collapsible toggle div
if (isset($frm_vars['collapse_div']) && $frm_vars['collapse_div']) {
    echo "</div>\n";
    unset($frm_vars['collapse_div']);
}
echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form);
if (has_action('frm_entries_footer_scripts')) {
    ?>
<script type="text/javascript">
<?php 
    do_action('frm_entries_footer_scripts', $values['fields'], $form);
    ?>
</script><?php 
}
if (!$form->is_template && $form->status == 'published' && !FrmAppHelper::is_admin()) {
    unset($values['fields']);
    FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values);
}
?>
</fieldset>
</div>
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:30,代码来源:form.php

示例15: process_entry

 public static function process_entry($errors = '', $ajax = false)
 {
     $form_id = FrmAppHelper::get_post_param('form_id', '', 'absint');
     if (FrmAppHelper::is_admin() || empty($_POST) || empty($form_id) || !isset($_POST['item_key'])) {
         return;
     }
     global $frm_vars;
     $form = FrmForm::getOne($form_id);
     if (!$form) {
         return;
     }
     $params = FrmForm::get_params($form);
     if (!isset($frm_vars['form_params'])) {
         $frm_vars['form_params'] = array();
     }
     $frm_vars['form_params'][$form->id] = $params;
     if (isset($frm_vars['created_entries'][$form_id])) {
         return;
     }
     if ($errors == '') {
         $errors = FrmEntryValidate::validate($_POST);
     }
     /**
      * Use this filter to add trigger actions and add errors after
      * all other errors have been processed
      * @since 2.0.6
      */
     $errors = apply_filters('frm_entries_before_create', $errors, $form);
     $frm_vars['created_entries'][$form_id] = array('errors' => $errors);
     if (empty($errors)) {
         $_POST['frm_skip_cookie'] = 1;
         if ($params['action'] == 'create') {
             if (apply_filters('frm_continue_to_create', true, $form_id) && !isset($frm_vars['created_entries'][$form_id]['entry_id'])) {
                 $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create($_POST);
             }
         }
         do_action('frm_process_entry', $params, $errors, $form, array('ajax' => $ajax));
         unset($_POST['frm_skip_cookie']);
     }
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:40,代码来源:FrmEntriesController.php


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