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


PHP ninja_forms_get_form_by_id函数代码示例

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


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

示例1: ninja_forms_preview_link

function ninja_forms_preview_link($form_id = '', $echo = true)
{
    if ($form_id == '') {
        if (isset($_REQUEST['form_id'])) {
            $form_id = absint($_REQUEST['form_id']);
        } else {
            $form_id = '';
        }
    }
    $base = home_url();
    $form_data = ninja_forms_get_form_by_id($form_id);
    $append_page = Ninja_Forms()->form($form_id)->get_setting('append_page');
    if (empty($append_page)) {
        $opt = nf_get_settings();
        if (isset($opt['preview_id'])) {
            $page_id = $opt['preview_id'];
        } else {
            $page_id = '';
        }
    } else {
        $page_id = $append_page;
    }
    if ($echo) {
        $preview_link = '<a target="_blank" href="' . $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id . '">' . __('Preview Form', 'ninja-forms') . '</a>';
    } else {
        $preview_link = $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id;
    }
    return $preview_link;
}
开发者ID:thehereward,项目名称:ninja-forms,代码行数:29,代码来源:form-preview.php

示例2: create

 /**
  * Create a submission.
  * 
  * @access public
  * @since 2.7
  * @return int $sub_id
  */
 public function create($form_id = '')
 {
     // Create Submission
     $post = array('post_status' => 'publish', 'post_type' => 'nf_sub');
     $sub_id = wp_insert_post($post);
     // Add our form ID to the submission
     Ninja_Forms()->sub($sub_id)->update_form_id($form_id);
     // Get the current sequential ID
     $form = ninja_forms_get_form_by_id($form_id);
     if (isset($form['data']['last_sub'])) {
         $seq_num = $form['data']['last_sub'] + 1;
     } else {
         // If we don't have a starting number, start at 1
         $seq_num = 1;
     }
     $seq_num = apply_filters('nf_sub_seq_num', $seq_num, $form_id);
     // Add the sequential ID to the post meta
     Ninja_Forms()->sub($sub_id)->update_seq_num($seq_num);
     // Update our form data with the new "last seq id."
     $form['data']['last_sub'] = $seq_num;
     $args = array('update_array' => array('data' => serialize($form['data'])), 'where' => array('id' => $form_id));
     ninja_forms_update_form($args);
     // Update our sub count
     Ninja_Forms()->form($form_id)->sub_count = $seq_num - 1;
     return $sub_id;
 }
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:33,代码来源:subs.php

示例3: ninja_forms_export_form

function ninja_forms_export_form($form_id)
{
    if ($form_id == '') {
        return;
    }
    $plugin_settings = nf_get_settings();
    $form_row = ninja_forms_get_form_by_id($form_id);
    $data = $form_row['data'];
    $form_title = $data['form_title'];
    $form_row = ninja_forms_serialize_form($form_id);
    $form_title = preg_replace('/[^a-zA-Z0-9-]/', '', $form_title);
    $form_title = str_replace(" ", "-", $form_title);
    if (isset($plugin_settings['date_format'])) {
        $date_format = $plugin_settings['date_format'];
    } else {
        $date_format = 'm/d/Y';
    }
    //$today = date($date_format);
    $current_time = current_time('timestamp');
    $today = date($date_format, $current_time);
    header("Content-type: application/csv");
    header('Content-Disposition: attachment; filename="' . $form_title . '"-"' . $today . '".nff"');
    header("Pragma: no-cache");
    header("Expires: 0");
    echo $form_row;
    die;
}
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:27,代码来源:impexp-forms.php

示例4: ninja_forms_preview_link

function ninja_forms_preview_link($form_id = '', $echo = true)
{
    if ($form_id == '') {
        if (isset($_REQUEST['form_id'])) {
            $form_id = absint($_REQUEST['form_id']);
        } else {
            $form_id = '';
        }
    }
    $base = home_url();
    $form_data = ninja_forms_get_form_by_id($form_id);
    //if( '' == $form_data['data']['append_page'] ) {
    if (!isset($form_data['data']['append_page']) or empty($form_data['data']['append_page'])) {
        // See the comment above about this check. !empty will ensure that it's not either empty quotes or null.
        $opt = get_option('ninja_forms_settings');
        if (isset($opt['preview_id'])) {
            $page_id = $opt['preview_id'];
        } else {
            $page_id = '';
        }
    } else {
        $page_id = $form_data['data']['append_page'];
    }
    if ($echo) {
        $preview_link = '<a target="_blank" href="' . $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id . '">' . __('Preview Form', 'ninja-forms') . '</a>';
    } else {
        $preview_link = $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id;
    }
    return $preview_link;
}
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:30,代码来源:form-preview.php

示例5: ninja_forms_mp_save_form

function ninja_forms_mp_save_form($form_id, $data)
{
    $form_row = ninja_forms_get_form_by_id($form_id);
    $form_data = $form_row['data'];
    if (isset($form_data['multi_part'])) {
        $multi_part = $form_data['multi_part'];
    } else {
        $multi_part = 0;
    }
    if ($data['multi_part'] == 0 and $multi_part == 1) {
        $all_fields = ninja_forms_get_fields_by_form_id($form_id);
        if (is_array($all_fields) and !empty($all_fields)) {
            foreach ($all_fields as $field) {
                if ($field['type'] == '_page_divider') {
                    ninja_forms_delete_field($field['id']);
                }
            }
        }
    } else {
        if ($data['multi_part'] == 1 and $multi_part == 0) {
            $args = array('type' => '_page_divider', 'order' => -1);
            ninja_forms_insert_field($form_id, $args);
        }
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:25,代码来源:form-settings-metabox.php

示例6: ninja_forms_get_form_by_sub_id

function ninja_forms_get_form_by_sub_id($sub_id)
{
    global $wpdb;
    $form_id = Ninja_Forms()->sub($sub_id)->form_id;
    $form_row = ninja_forms_get_form_by_id($form_id);
    return $form_row;
}
开发者ID:idies,项目名称:escience-2016-wp,代码行数:7,代码来源:database.php

示例7: ninja_forms_display_process_message

/**
 * Outputs the HTML for the ajax processing div. Only used when submitting via ajax.
 *
**/
function ninja_forms_display_process_message($form_id)
{
    global $ninja_forms_processing_error, $ninja_forms_processing_response;
    $plugin_settings = nf_get_settings();
    $form_row = ninja_forms_get_form_by_id($form_id);
    $process_label = __($plugin_settings['process_label'], 'ninja-forms');
    if (isset($form_row['data']['ajax'])) {
        $ajax = $form_row['data']['ajax'];
    } else {
        $ajax = 0;
    }
    if ($ajax == 1) {
        ?>
	<div id="ninja_forms_form_<?php 
        echo $form_id;
        ?>
_process_msg" style="display:none;" class="ninja-forms-processing">
		<?php 
        echo $process_label;
        ?>
 <img src="<?php 
        echo NINJA_FORMS_URL;
        ?>
/images/loading.gif" alt="loading">
	</div>
	<?php 
    }
}
开发者ID:ramiy,项目名称:ninja-forms,代码行数:32,代码来源:process-message.php

示例8: nf_check_post

function nf_check_post()
{
    if (isset($_POST['_ninja_forms_display_submit']) and absint($_POST['_ninja_forms_display_submit']) == 1) {
        // If our nonce isn't set, bail
        if (!isset($_POST['_wpnonce'])) {
            return false;
        }
        // If our nonce doesn't validate, bail
        if (!wp_verify_nonce($_POST['_wpnonce'], 'nf_form_' . absint($_POST['_form_id']))) {
            return false;
        }
        $form_row = ninja_forms_get_form_by_id(absint($_POST['_form_id']));
        if (isset($form_row['data']['ajax'])) {
            $ajax = $form_row['data']['ajax'];
        } else {
            $ajax = '';
        }
        if ($ajax != 1) {
            add_action('init', 'ninja_forms_setup_processing_class', 5);
            add_action('init', 'ninja_forms_pre_process', 999);
        } else {
            if ($ajax == 1 and $_REQUEST['action'] == 'ninja_forms_ajax_submit') {
                add_action('init', 'ninja_forms_setup_processing_class', 5);
                add_action('init', 'ninja_forms_pre_process', 999);
            }
        }
    }
}
开发者ID:HeliWang,项目名称:EngSoc-Website,代码行数:28,代码来源:display-form.php

示例9: ninja_forms_mp_display_css

function ninja_forms_mp_display_css($form_id)
{
    $form_row = ninja_forms_get_form_by_id($form_id);
    $form_data = $form_row['data'];
    if (isset($form_data['multi_part']) and $form_data['multi_part'] == 1) {
        wp_enqueue_style('ninja-forms-mp-display', NINJA_FORMS_MP_URL . '/css/ninja-forms-mp-display.css');
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:8,代码来源:scripts.php

示例10: ninja_forms_display_response_message

function ninja_forms_display_response_message($form_id)
{
    global $ninja_forms_processing;
    //	if ( ! is_object( $ninja_forms_processing ) || $ninja_forms_processing->get_form_ID() != $form_id ) {
    //		return false;
    //	}
    $plugin_settings = nf_get_settings();
    $form_row = ninja_forms_get_form_by_id($form_id);
    if (isset($form_row['data']['ajax'])) {
        $ajax = $form_row['data']['ajax'];
    } else {
        $ajax = 0;
    }
    if ($ajax == 0 and (is_object($ninja_forms_processing) and !$ninja_forms_processing->get_all_errors() and !$ninja_forms_processing->get_all_success_msgs())) {
        $display = 'display:none;';
    } else {
        $display = '';
    }
    if (is_object($ninja_forms_processing)) {
        if ($ninja_forms_processing->get_errors_by_location('general')) {
            $class = 'ninja-forms-error-msg';
        } else {
            if ($ninja_forms_processing->get_all_success_msgs()) {
                $class = 'ninja-forms-success-msg';
            } else {
                $class = '';
            }
        }
    } else {
        $class = '';
    }
    $class = apply_filters('ninja_forms_display_response_message_class', $class, $form_id);
    //if ( $class != '' ) {
    echo '<div id="ninja_forms_form_' . $form_id . '_response_msg" style="' . $display . '" class="ninja-forms-response-msg ' . $class . '">';
    if (isset($ninja_forms_processing) && $ninja_forms_processing->get_form_ID() == $form_id) {
        if (is_object($ninja_forms_processing)) {
            if ($ninja_forms_processing->get_form_ID() == $form_id) {
                if ($ninja_forms_processing->get_errors_by_location('general')) {
                    foreach ($ninja_forms_processing->get_errors_by_location('general') as $error) {
                        echo '<div>';
                        echo $error['msg'];
                        echo '</div>';
                    }
                }
                if ($ninja_forms_processing->get_all_success_msgs()) {
                    foreach ($ninja_forms_processing->get_all_success_msgs() as $success) {
                        echo '<div>';
                        echo $success;
                        echo '</div>';
                    }
                }
            }
        }
    }
    echo '</div>';
    //}
}
开发者ID:nihrain,项目名称:accelerate,代码行数:57,代码来源:response-message.php

示例11: ninja_forms_manage_sub_form_check

function ninja_forms_manage_sub_form_check($user_id, $form_id)
{
    $user = get_userdata($user_id);
    $form_row = ninja_forms_get_form_by_id($form_id);
    $form_data = $form_row['data'];
    if (isset($form_data['manage_sub']) and $form_data['manage_sub'] == 1) {
        if (isset($form_data['edit_sub']) and $form_data['edit_sub'] == 1) {
            $edit_setting = true;
        } else {
            $edit_setting = false;
        }
        if (isset($form_data['delete_sub']) and $form_data['delete_sub'] == 1) {
            $delete_setting = true;
        } else {
            $delete_setting = false;
        }
        $edit = false;
        $delete = false;
        if (isset($form_data['sub_edit_user_list']) and $form_data['sub_edit_user_list'] != '') {
            $user_list = explode(',', $form_data['sub_edit_user_list']);
            if (in_array($user_id, $user_list)) {
                $edit = $edit_setting;
                $delete = $delete_setting;
            }
        }
        if (isset($form_data['manage_sub_roles']) and is_array($form_data['manage_sub_roles'])) {
            if (is_object($user) and !empty($user)) {
                foreach ($user->roles as $user_role) {
                    foreach ($user->roles as $user_role) {
                        if (in_array($user_role, $form_data['manage_sub_roles'])) {
                            $edit = $edit_setting;
                            $delete = $delete_setting;
                            break 2;
                        }
                    }
                }
            }
        }
        if (isset($form_data['override_sub_rules']) and $form_data['override_sub_rules'] == 1) {
            $override = true;
        } else {
            $override = false;
        }
        $args = array('edit' => $edit, 'delete' => $delete, 'override' => $override);
        return $args;
    } else {
        return false;
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:49,代码来源:sub-table.php

示例12: ninja_forms_register_field_upload

function ninja_forms_register_field_upload()
{
    $args = array('name' => 'File Upload', 'edit_options' => array(array('type' => 'text', 'name' => 'upload_types', 'label' => '<strong>' . __('Allowed File Types', 'ninja-forms') . '</strong><br/>' . __('Comma Separated List of allowed file types. An empty list means all file types are accepted. (i.e. .jpg, .gif, .png, .pdf) This is not fool-proof and can be tricked, please remember that there is always a danger in allowing users to upload files.'), 'class' => 'widefat'), array('type' => 'text', 'name' => 'upload_rename', 'label' => '<strong>' . __('Rename Uploaded File', 'ninja-forms') . '</strong><br />' . __('Advanced renaming options. If you do not want to rename the files, leave this box blank', 'ninja-forms') . ' <a href="#" class="ninja-forms-rename-help">' . __('Get help renaming files', 'ninja-forms') . '</a>', 'class' => 'widefat'), array('type' => 'checkbox', 'name' => 'media_library', 'label' => __('Add this file to the WordPress Media Library?', 'ninja-forms-uploads')), array('type' => 'checkbox', 'name' => 'email_attachment', 'label' => __('Email file as an attachment to administrators.', 'ninja-forms-uploads'))), 'edit_function' => 'ninja_forms_field_upload_edit', 'display_function' => 'ninja_forms_field_upload_display', 'group' => 'standard_fields', 'edit_label' => true, 'edit_label_pos' => true, 'edit_req' => true, 'edit_custom_class' => true, 'edit_help' => true, 'edit_desc' => true, 'edit_meta' => false, 'sidebar' => 'template_fields', 'edit_conditional' => true, 'conditional' => array('value' => array('type' => 'text')), 'pre_process' => 'ninja_forms_field_upload_pre_process', 'edit_sub_pre_process' => 'ninja_forms_field_upload_pre_process', 'process' => 'ninja_forms_field_upload_process', 'edit_sub_process' => 'ninja_forms_field_upload_process', 'req_validation' => 'ninja_forms_field_upload_req_validation');
    if (isset($_REQUEST['form_id'])) {
        $form_row = ninja_forms_get_form_by_id($_REQUEST['form_id']);
        $form_data = $form_row['data'];
        if (isset($form_data['create_post']) and $form_data['create_post'] == 1) {
            $option = array('type' => 'checkbox', 'name' => 'featured_image', 'label' => __('Set as featured image for the Post.'), 'class' => 'ninja-forms-upload-multi', 'width' => 'wide');
            array_push($args['edit_options'], $option);
        }
    }
    if (function_exists('ninja_forms_register_field')) {
        ninja_forms_register_field('_upload', $args);
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:15,代码来源:file-uploads.php

示例13: ninja_forms_display_open_form_tag

function ninja_forms_display_open_form_tag($form_id)
{
    $form_row = ninja_forms_get_form_by_id($form_id);
    if (isset($form_row['data']['ajax'])) {
        $ajax = $form_row['data']['ajax'];
    } else {
        $ajax = 0;
    }
    if ($ajax == 1) {
        if (is_ssl()) {
            $url = admin_url('admin-ajax.php', 'https');
        } else {
            $url = admin_url('admin-ajax.php', 'http');
        }
        $url = apply_filters('ninja_forms_ajax_url', $url, $form_id);
        $url = add_query_arg('action', 'ninja_forms_ajax_submit', $url);
        //$url = add_query_arg('action', 'test', $url);
    } else {
        $url = '';
    }
    $display = 1;
    $display = apply_filters('ninja_forms_display_form_visibility', $display, $form_id);
    if ($display != 1) {
        $hide_class = " ninja-forms-no-display";
    } else {
        $hide_class = "";
    }
    $form_class = '';
    $form_class = apply_filters('ninja_forms_form_class', $form_class, $form_id);
    if (!empty($form_class)) {
        $form_class = ' ' . $form_class;
    }
    ?>
	<form id="ninja_forms_form_<?php 
    echo $form_id;
    ?>
" enctype="multipart/form-data" method="post" name="" action="<?php 
    echo $url;
    ?>
" class="ninja-forms-form<?php 
    echo $form_class;
    echo $hide_class;
    ?>
">

	<?php 
}
开发者ID:serker72,项目名称:T3S,代码行数:47,代码来源:open-form-tag.php

示例14: ninja_forms_mp_filter_fields

function ninja_forms_mp_filter_fields($field_results, $form_id)
{
    global $ninja_forms_processing;
    if (isset($ninja_forms_processing) and $ninja_forms_processing->get_error('confirm-submit')) {
        return $field_results;
    }
    $form_row = ninja_forms_get_form_by_id($form_id);
    $form_data = $form_row['data'];
    $form_data = apply_filters('ninja_forms_display_form_form_data', $form_data);
    if (isset($form_data['ajax'])) {
        $ajax = $form_data['ajax'];
    } else {
        $ajax = 0;
    }
    $ajax = 1;
    if ($ajax != 1) {
        if (isset($_REQUEST['_current_page'])) {
            $current_page = $_REQUEST['_current_page'];
        } else {
            $current_page = 1;
        }
        if (is_object($ninja_forms_processing) and $ninja_forms_processing->get_extra_value('_current_page') and $form_id == $ninja_forms_processing->get_form_ID()) {
            $current_page = $ninja_forms_processing->get_extra_value('_current_page');
        }
        if (isset($form_data['multi_part'])) {
            $multi_part = $form_data['multi_part'];
        } else {
            $multi_part = 0;
        }
        if ($multi_part == 1) {
            if (is_array($field_results) and !empty($field_results)) {
                $pages = array();
                $x = 0;
                foreach ($field_results as $field) {
                    if ($field['type'] == '_page_divider') {
                        $x++;
                    }
                    $pages[$x][] = $field;
                }
            }
            $page_count = count($pages);
            $field_results = $pages[$current_page];
        }
    }
    return $field_results;
}
开发者ID:emtv,项目名称:hackmsi,代码行数:46,代码来源:filter-fields.php

示例15: ninja_forms_mp_register_edit_field_ul

function ninja_forms_mp_register_edit_field_ul()
{
    if (isset($_REQUEST['form_id'])) {
        $form_id = $_REQUEST['form_id'];
        $form_row = ninja_forms_get_form_by_id($form_id);
        $form_data = $form_row['data'];
        if (isset($form_data['multi_part'])) {
            $multi_part = $form_data['multi_part'];
        } else {
            $multi_part = 0;
        }
        if ($multi_part == 1) {
            remove_action('ninja_forms_edit_field_ul', 'ninja_forms_edit_field_output_ul');
            add_action('ninja_forms_edit_field_ul', 'ninja_forms_edit_field_output_mp_ul');
            add_action('ninja_forms_edit_field_before_ul', 'ninja_forms_edit_field_open_div');
        }
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:18,代码来源:edit-field-ul.php


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