Commit 115a67ce authored by Kevin Stover's avatar Kevin Stover

Merge branch 'release/v2.5.2'

parents 9c637e2a ec99f8ef
#Contribute To Ninja Forms
(adapted from Easy Digital Downloads)
## Getting Started
* Submit a ticket for your issue, assuming one does not already exist.
* Raise it on our [Issue Tracker](https://github.com/wpninjas/ninja-forms/issues)
* Clearly describe the issue, including steps to reproduce the bug (if applicable).
* If it's a bug, make sure you fill in the earliest version that you know has the issue as well as the version of WordPress you're using.
## Making Changes
* Fork the Ninja Forms repository on GitHub
* From the `develop` branch on your forked repository, create a new branch and make your changes
* It is suggested that your new branch use the naming convention `issue/{issue#}` e.g. `issue/190`
* Ensure you stick to the [WordPress Coding Standards](http://codex.wordpress.org/WordPress_Coding_Standards)
* When committing, use a [well-formed](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message) [commit](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) [message](http://who-t.blogspot.com/2009/12/on-commit-messages.html)
* Push the changes to your fork and submit a pull request to the `develop` branch of the Ninja Forms repository
## Code Documentation
* We're working on making sure that every function is documented well and follows the WordPress inline documentation standards based on phpDoc
* The WordPress Inline Documentation Standards (with examples) can be found [here](http://make.wordpress.org/core/handbook/inline-documentation-standards/php-documentation-standards/)
* Please make sure that every function is documented so that our API Documentation will be complete
* If you're adding/editing a function in a class, make sure to add `@access {private|public|protected}`
* Finally, please use tabs and not spaces. The tab indent size should be 4 for all Ninja Forms code.
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
# Additional Resources
* [Official Ninja Forms Developer Blog](http://make.ninjaforms.com/)
* [Ninja Forms Developer API](http://ninjaforms.com/documentation/developer-api/)
* Ninja Forms Developer Chat: [Gitter](https://gitter.im/wpninjas/ninja-forms) or [#ninjaforms](http://webchat.freenode.net?channels=%23ninjaforms) on freenode IRC
* [GitHub Help — Forking](https://help.github.com/articles/fork-a-repo)
* [GitHub Help — Syncing a Fork](https://help.github.com/articles/syncing-a-fork)
* [GitHub Help — Pull Requests](https://help.github.com/articles/using-pull-requests#before-you-begin)
\ No newline at end of file
# Ninja Forms
[Contributors](https://github.com/wpninjas/ninja-forms/graphs/contributors)
Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
Requires at least: 3.6
Tested up to: 3.8.1
Stable tag: 2.5.1
License: GPLv2 or later
Forms created with a simple drag and drop interface. Contact forms, Email collection forms, or any other form you want on your WordPress site.
## Description
Ninja Forms is the ultimate FREE form creation solution for WordPress. Build WordPress Forms within minutes using Ninja Forms powerful forms creation page. It allows you to easily and quickly design complex forms through a drag and drop interface and absolutely no code. But for you developers it has a ton of hooks and filters so you can do absolutely anything with this powerful form building framework.
This review of Ninja Forms was done by Pippin Williamson:
[youtube http://www.youtube.com/watch?v=hVfPmKzqYpk]
Here are just a few of the things you will find in Ninja Forms:
* Custom input masks allow you to restrict user input in your forms for things like phone numbers, currency, and dates.
* Manage, Edit, and Export form user submissions.
* Save fields as favorites and re-use them in multiple forms.
* Export and Import forms and favorite fields.
* Set required fields.
* Add a datepicker to text fields.
* Email form results to any number of pre-determined email addresses, as well as specific messages to the user filling out the form.
* Customize form emails with the WordPress editor.
* Anti-Spam field.
* Extremely developer friendly.
* Submit your form by reloading the page or asynchronously with AJAX.
* Please note that if you are using a version of PHP lower than 5.3, you may experience some problems using AJAX Submissions. These can be minimized by using simple success/error messages without any quotes or special characters.
## Demo Site
Please feel free to visit our [demo site](http://demo.wpninjas.com/ninja-forms/) where you can test the features of Ninja Forms and all of our extensions.
## Extensions
* [PayPal Express](http://ninjaforms.com/downloads/paypal-express/) - Accept payments using PayPal Express and Ninja Forms!
* [Front-End Editor](http://ninjaforms.com/downloads/front-end-editor/) - Give your users the ability to create, edit, or delete posts, pages, or any custom post type and allow your users to edit their Ninja Forms submissions all from the front-end. Also included is front-end profile editing, custom registration forms, login and password resetting, all without needing to see the default, WordPress branded login page.
* [File Uploads](http://ninjaforms.com/downloads/file-uploads/) - Allow users to upload files and store those files within a searchable database.
* [Multi-Part Forms](http://ninjaforms.com/downloads/multi-part-forms/) - Break up those long, complex forms into multiple pages.
* [Save User Progress](http://ninjaforms.com/downloads/save-user-progress/) - Let your users save their progress and return later to finish filling out the form.
* [Conditional Logic](http://ninjaforms.com/downloads/conditional-logic/) - Create "smart" forms that show or hide fields based upon user input. Even add a value to a dropdown list when a user selects a specific value from another list.
* [Front-End Posting](http://ninjaforms.com/downloads/front-end-posting/) - Use Ninja Forms to create posts from the front-end. These can be added to any post type, including custom post types, and users can select categories and tags.
* [Layout & Styles](http://ninjaforms.com/downloads/layout-styles/) - Use Ninja Forms to create amzing form layouts and styles right from your WordPress admin.
* [MailChimp](http://ninjaforms.com/downloads/mail-chimp/) - The MailChimp extension allows you to quickly create newsletter signup forms for your MailChimp account using the power and flexibility that Ninja Forms provides.
* [Campaign Monitor](http://ninjaforms.com/downloads/campaign-monitor/) - The Campaign Monitor extension allows you to quickly create newsletter signup forms for your Campaign Monitor account using the power and flexibility that Ninja Forms provides.
* [User Analytics](http://ninjaforms.com/downloads/user-analytics/) - The User Analytics extension will help website owners understand how hot a lead is based on extra data automatically collected about the user.
* [Constant Contact](http://ninjaforms.com/downloads/constant-contact/) - The Constant Contact extension allows you to quickly create newsletter signup forms for your Constant Contact account using the power and flexibility that Ninja Forms provides.
* [Pushover](http://ninjaforms.com/downloads/pushover/) - When email and SMS notifications just do not cut it, send yourself push notifications of form submissions with Pushover. Pushover makes it easy to send real-time notifications to your Android and iOS devices.
* [Freshbooks](http://ninjaforms.com/downloads/freshbooks/) - Automatically insert Ninja Forms data right into Freshbooks when your potential clients submit forms. Go from lead to invoice that much quicker by having the information already in your favorite invoicing application.
We have several other extensions in the works.
If you're a developer and would like to talk about creating some premium extensions for Ninja Forms, send us an email: info@wpninjas.com.
## Contributing
If you're a developer and want to help make Ninja Forms better, you're in the right place! We know contributing to a project can be intimidating; sometimes it’s hard to tell how to get involved. We believe Ninja Forms is a perfect community to get involved in. In our experience, everyone involved with the project has been amazing and helpful. :)
So here are some [friendly guidelines](https://github.com/wpninjas/ninja-forms/blob/master/CONTRIBUTING.md).
__Please Note:__ GitHub is for bug reports and contributions only - if you have a support question or a request for a customisation, go to our [Ninja Forms Support](http://ninjaforms.com/documentation/using-ninja-forms/faq-troubleshooting/) instead.
## Screenshots
To see up to date screenshots, visit [Ninja Forms.com](http://ninjaforms.com/).
## Installation
This section describes how to install the plugin and get it working.
1. Upload the `ninja-forms` directory to your `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Visit the 'Forms' menu item in your admin sidebar
Shortcodes have been re-implemented. They are used like so: `[ninja_forms_display_form id=3]` where 3 is the ID number of the form you want to display.
## Use
For help and video tutorials, please visit our website: [Ninja Forms Documentation](http://ninjaforms.com/documentation/intro/)
## Requested Features
If you have any feature requests, please feel free to visit [ninjaforms.com](http://ninjaforms.com) and let us know about it.
\ No newline at end of file
......@@ -176,7 +176,7 @@ function ninja_forms_activation(){
'req_div_label' => __('Fields marked with a * are required.', 'ninja-forms'),
'req_field_symbol' => '*',
'req_error_label' => __( 'Please ensure all required fields are completed.', 'ninja-forms' ),
'req_field_error' => __( 'This is a required field', 'ninja-forms' ),
'req_field_error' => __( 'This is a required field.', 'ninja-forms' ),
'spam_error' => __( 'Please answer the anti-spam question correctly.', 'ninja-forms' ),
'honeypot_error' => __('If you are a human, please leave this field blank.', 'ninja-forms' ),
'timed_submit_error' => __('If you are a human, please slow down.', 'ninja-forms' ),
......@@ -208,11 +208,13 @@ function ninja_forms_activation(){
$opt = $plugin_settings;
}
$preview_page = get_page_by_title( 'ninja_forms_preview_page' );
$title = ninja_forms_get_preview_page_title();
$preview_page = get_page_by_title( $title );
if( !$preview_page ) {
// Create preview page object
$preview_post = array(
'post_title' => 'ninja_forms_preview_page',
'post_title' => $title,
'post_content' => 'This is a preview of how this form will appear on your website',
'post_status' => 'draft',
'post_type' => 'page'
......@@ -296,7 +298,7 @@ function ninja_forms_activation(){
ninja_forms_add_starter_form();
}
}
function ninja_forms_activation_old_forms_check(){
......@@ -627,11 +629,21 @@ function ninja_forms_starter_form_exists() {
* @returns int
*/
function ninja_forms_add_starter_form() {
// load starter form
$file = file_get_contents( NINJA_FORMS_DIR . "/includes/forms/starter-form.nff" );
$file = apply_filters( 'ninja_forms_starter_form_contents', $file );
// load starter form
$file = file_get_contents( NINJA_FORMS_DIR . "/includes/forms/starter-form.nff" );
$file = apply_filters( 'ninja_forms_starter_form_contents', $file );
// create new form
ninja_forms_import_form( $file );
// create new form
ninja_forms_import_form( $file );
}
/*
* Get the preview page title
*
* @since 2.5.2
* @returns string
*/
function ninja_forms_get_preview_page_title() {
return apply_filters( 'ninja_forms_preview_page_title', 'ninja_forms_preview_page' );
}
......@@ -165,7 +165,7 @@ function ninja_forms_output_tab_metabox($form_id = '', $slug, $metabox){
}
?>
<tr <?php if( $tr_class != '' ){ ?>class="<?php echo $tr_class;?>"<?php } ?> <?php if( $style != '' ){ ?> style="<?php echo $style;?>"<?php }?>>
<tr id="row_<?php echo $name;?>" <?php if( $tr_class != '' ){ ?>class="<?php echo $tr_class;?>"<?php } ?> <?php if( $style != '' ){ ?> style="<?php echo $style;?>"<?php }?>>
<?php if ( $s['type'] == 'desc' AND ! $label ) { ?>
<td colspan="2">
<?php } else { ?>
......
......@@ -124,17 +124,19 @@ function ninja_forms_tab_view_subs(){
$end = $limit;
}
$args = array(
$args = apply_filters( 'ninja_forms_view_subs_args', array(
'form_id' => $form_id,
'begin_date' => $begin_date,
'end_date' => $end_date,
'limit' => $start.','.$limit,
//'status' => 1,
'status' => 1,
//'11' => '05/06/2012',
);
) );
$sub_count = ninja_forms_get_sub_count( $args );
$sub_count = apply_filters( 'ninja_forms_view_subs_count', $sub_count );
$sub_results = ninja_forms_get_subs( $args );
$sub_results = apply_filters( 'ninja_forms_view_subs_results', $sub_results );
......@@ -257,7 +259,7 @@ function ninja_forms_tab_view_subs(){
<?php
}
?>
</div>
<table border="1px" class="wp-list-table widefat fixed posts">
<?php
//Grab the first few fields attached to our form so that we can create column headers.
......@@ -532,7 +534,7 @@ function ninja_forms_edit_sub_save_values(){
$sub_id = $ninja_forms_processing->get_form_setting( 'sub_id' );
$form_id = $ninja_forms_processing->get_form_ID();
$user_id = $ninja_forms_processing->get_user_ID();
//$user_id = $ninja_forms_processing->get_user_ID();
$sub_row = ninja_forms_get_sub_by_id( $sub_id );
if( isset( $sub_row['status'] ) ){
......@@ -558,7 +560,7 @@ function ninja_forms_edit_sub_save_values(){
$args = array(
'form_id' => $form_id,
'user_id' => $user_id,
//'user_id' => $user_id,
'status' => $status,
'action' => $action,
'data' => serialize( $sub_data ),
......@@ -718,7 +720,7 @@ function ninja_forms_sub_table_row_actions_edit( $row_actions, $data, $sub_id, $
// turn on the output buffer
ob_start();
?>
<span class="edit"><a href="<?php echo $edit_link;?>" id="ninja_forms_sub_<?php echo $sub['id'];?>" class="ninja-forms-view-sub"><?php _e('Edit', 'ninja-forms' ); ?></a></span>
<span class="edit"><a href="<?php echo $edit_link;?>" id="ninja_forms_sub_<?php echo $sub_id;?>" class="ninja-forms-view-sub"><?php _e('Edit', 'ninja-forms' ); ?></a></span>
<?php
$action = ob_get_clean();
......
......@@ -170,6 +170,8 @@ function ninja_forms_tab_form_list($form_id, $data){
$subs_link = admin_url( 'admin.php?page=ninja-forms-subs&form_id='.$form_id );
$export_link = esc_url( add_query_arg( array( 'export_form' => 1, 'form_id' => $form_id ) ) );
$duplicate_link = esc_url( add_query_arg( array( 'duplicate_form' => 1, 'form_id' => $form_id ) ) );
$shortcode = apply_filters ( "ninja_forms_form_list_shortcode", "[ninja_forms_display_form id=" . $form_id . "]", $form_id );
$template_function = apply_filters ( "ninja_forms_form_list_template_function", "<pre>if( function_exists( 'ninja_forms_display_form' ) ){ ninja_forms_display_form( " . "$form_id" . " ); }</pre>", $form_id );
?>
<tr id="ninja_forms_form_<?php echo $form_id;?>_tr">
<th scope="row" class="check-column">
......@@ -189,10 +191,10 @@ function ninja_forms_tab_form_list($form_id, $data){
</div>
</td>
<td>
[ninja_forms_display_form id=<?php echo $form_id;?>]
<?php echo $shortcode; ?>
</td>
<td>
<pre>if( function_exists( 'ninja_forms_display_form' ) ){ ninja_forms_display_form( <?php echo $form_id;?> ); }</pre>
<?php echo $template_function; ?>
</td>
<td>
<?php echo $date_updated;?>
......@@ -242,4 +244,4 @@ function ninja_forms_save_form_list( $data ){
}
return $update_message;
}
}
\ No newline at end of file
}
......@@ -83,7 +83,7 @@ function ninja_forms_register_form_settings_basic_email_metabox(){
add_action( 'admin_init', 'ninja_forms_register_form_settings_basic_email_metabox' );
function ninja_forms_register_form_settings_admin_email_metabox(){
$args = array(
$args = apply_filters( 'ninja_forms_form_settings_admin_email', array(
'page' => 'ninja-forms',
'tab' => 'form_settings',
'slug' => 'admin_email',
......@@ -124,14 +124,14 @@ function ninja_forms_register_form_settings_admin_email_metabox(){
'default_value' => 0,
),
),
);
));
ninja_forms_register_tab_metabox($args);
}
add_action( 'admin_init', 'ninja_forms_register_form_settings_admin_email_metabox' );
function ninja_forms_register_form_settings_user_email_metabox(){
$args = array(
$args = apply_filters( 'ninja_forms_form_settings_user_email', array(
'page' => 'ninja-forms',
'tab' => 'form_settings',
'slug' => 'user_email',
......@@ -156,7 +156,7 @@ function ninja_forms_register_form_settings_user_email_metabox(){
'label' => __( 'Include a list of fields?', 'ninja-forms' ),
),
),
);
));
ninja_forms_register_tab_metabox($args);
}
......@@ -213,7 +213,7 @@ function ninja_forms_register_form_settings_basic_metabox(){
$ajax_style = '';
}
$args = array(
$args = apply_filters( 'ninja_forms_form_settings_basic', array(
'page' => 'ninja-forms',
'tab' => 'form_settings',
'slug' => 'basic_settings',
......@@ -306,12 +306,12 @@ function ninja_forms_register_form_settings_basic_metabox(){
'name' => 'sub_limit_msg',
'type' => 'rte',
'label' => __( 'Limit Reached Message', 'ninja-forms' ),
'desc' => __( 'Please enter a message that you would displayed when this form has reached it&#39;s submission limit and will not accept new submissions.', 'ninja-forms' ),
'desc' => __( 'Please enter a message that you want displayed when this form has reached its submission limit and will not accept new submissions.', 'ninja-forms' ),
//'default_value' => __( 'Submissions are closed.', 'ninja-forms' ),
'tr_class' => '',
),
),
);
));
ninja_forms_register_tab_metabox($args);
}
......
......@@ -50,8 +50,8 @@ add_action( 'ninja_forms_display_before_field', 'ninja_forms_add_field_desc', 10
function ninja_forms_display_field_desc( $field_id, $data ){
$plugin_settings = nf_get_settings();
if ( isset( $data['desc_text'] ) ) {
if ( ( isset( $data['show_desc'] ) and $data['show_desc'] == 1 ) and isset( $data['desc_text'] ) ) {
echo '<div class="ninja-forms-field-description">';
echo do_shortcode( wpautop( $data['desc_text'] ) );
echo '</div>';
......
......@@ -181,7 +181,7 @@ function ninja_forms_get_field_wrap_class($field_id){
if(isset($data['label_pos'])){
$label_pos = $data['label_pos'];
}else{
$label_pos = 'left';
$label_pos = 'above';
}
$field_wrap_class .= " label-".$label_pos;
......@@ -210,7 +210,7 @@ function ninja_forms_get_field_wrap_class($field_id){
break;
}
}
return apply_filters( 'ninja_forms_display_field_wrap_class', $field_wrap_class, $field_id );
return apply_filters( 'ninja_forms_display_field_wrap_class', $field_wrap_class, $field_id, $field_row );
}
......@@ -306,5 +306,5 @@ function ninja_forms_get_field_class( $field_id ) {
$field_class .= " input-limit";
}
return apply_filters( 'ninja_forms_display_field_class', $field_class, $field_id );
return apply_filters( 'ninja_forms_display_field_class', $field_class, $field_id, $field_row );
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ function ninja_forms_display_field_help( $field_id, $data ){
$help_text = '';
}
$help_text = htmlentities( $help_text );
$help_text = htmlspecialchars( $help_text );
if($show_help){
?>
......
......@@ -22,13 +22,12 @@ function ninja_forms_inside_label_hidden( $field_id, $data ){
$req_symbol = '';
}
if($req == 1){
if( $req == 1 ){
$req_span = "<span class='ninja-forms-req-symbol'>$req_symbol</span>";
}else{
$req_span = '';
}
echo $req_span;
?>
<input type="hidden" id="ninja_forms_field_<?php echo $field_id;?>_label_hidden" value="<?php echo $label;?>">
<?php
......
......@@ -54,7 +54,7 @@ function ninja_forms_display_field_label( $field_id, $data ){
$label_class = apply_filters( 'ninja_forms_label_class', $label_class, $field_id );
if ( $display_label ) {
if ( $req == 1 ) {
if ( $req == 1 && $req_symbol != '' && $label_pos != 'inside' ) {
$req_span = "<span class='ninja-forms-req-symbol'>$req_symbol</span>";
} else {
$req_span = '';
......@@ -108,7 +108,6 @@ function ninja_forms_display_label_inside( $data, $field_id ){
if ( isset ( $data['req'] ) and $data['req'] == 1 and $data['label_pos'] == 'inside' ) {
$data['label'] .= ' '.$req_symbol;
$data['req'] = 0;
}
if ( isset( $data['label'] ) ) {
......@@ -117,12 +116,11 @@ function ninja_forms_display_label_inside( $data, $field_id ){
$label = '';
}
$label = strip_tags( $label );
$data['label'] = $label;
if ( $field_type != '_list' ) {
if ( $label_pos == 'inside' ) {
$label = strip_tags( $label );
$data['label'] = $label;
if ( isset ( $ninja_forms_loading ) ) {
if ( !empty( $user_value ) )
return $data;
......
......@@ -16,6 +16,7 @@ function ninja_forms_display_open_form_tag( $form_id ) {
if ( $ajax == 1 ) {
$url = admin_url( 'admin-ajax.php' );
$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 {
......
......@@ -18,7 +18,7 @@ function ninja_forms_display_process_message($form_id){
if($ajax == 1){
?>
<div id="ninja_forms_form_<?php echo $form_id;?>_process_msg" style="display:none;">
<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
......
......@@ -25,7 +25,7 @@ function ninja_forms_display_req_items( $form_id ){
}
}
}
if( $output ){
if( $output && $req_div_label != '' ){
?>
<div class="ninja-forms-required-items"><?php echo $req_div_label;?></div>
<?php
......
......@@ -98,8 +98,7 @@ class Ninja_Forms_Processing {
return false;
}else{
$this->data['form_ID'] = $form_ID;
$current_user = wp_get_current_user();
$user_ID = $current_user->ID;
$user_ID = get_current_user_id();
if(!$user_ID){
$user_ID = '';
}
......
......@@ -50,18 +50,21 @@ function ninja_forms_email_admin() {
if( $email_reply ) {
$headers[] = 'Reply-To: ' . $email_reply;
}
$headers[] = 'Content-Type: text/' . $email_type;
$headers[] = 'Content-Type: text/' . $email_type;
$headers[] = 'charset=utf-8';
$attachments = false;
if ($ninja_forms_processing->get_form_setting( 'admin_attachments' ) ) {
$attachments = $ninja_forms_processing->get_form_setting( 'admin_attachments' );
} else {
$attachments = '';
}
if ( is_array( $admin_mailto ) AND !empty( $admin_mailto ) ){
foreach( $admin_mailto as $to ){
$sent = wp_mail( $to, $subject, $message, $headers, $attachments );
foreach( $admin_mailto as $to ) {
if ( $attachments ) {
wp_mail( $to, $subject, $message, $headers, $attachments );
} else {
wp_mail( $to, $subject, $message, $headers );
}
}
}
}
\ No newline at end of file
}
......@@ -29,12 +29,12 @@ function ninja_forms_email_user(){
}
}
$email_from = $ninja_forms_processing->get_form_setting('email_from');
$email_from_name = $ninja_forms_processing->get_form_setting( 'email_from_name' );
$email_type = $ninja_forms_processing->get_form_setting('email_type');
$subject = $ninja_forms_processing->get_form_setting('user_subject');
$message = $ninja_forms_processing->get_form_setting('user_email_msg');
$default_email = get_option( 'admin_email' );
$email_from = $ninja_forms_processing->get_form_setting('email_from');
$email_from_name = $ninja_forms_processing->get_form_setting( 'email_from_name' );
$email_type = $ninja_forms_processing->get_form_setting('email_type');
$subject = $ninja_forms_processing->get_form_setting('user_subject');
$message = $ninja_forms_processing->get_form_setting('user_email_msg');
$default_email = get_option( 'admin_email' );
if(!$subject){
$subject = $form_title;
......@@ -63,13 +63,18 @@ function ninja_forms_email_user(){
$headers[] = 'Content-Type: text/'.$email_type;
$headers[] = 'charset=utf-8';
if($ninja_forms_processing->get_form_setting('user_attachments')){
$attachments = false;
if ( $ninja_forms_processing->get_form_setting( 'user_attachments' ) ) {
$attachments = $ninja_forms_processing->get_form_setting('user_attachments');
}else{
$attachments = '';
}
if(is_array($user_mailto) AND !empty($user_mailto)){
wp_mail($user_mailto, $subject, $message, $headers, $attachments);
if ( is_array( $user_mailto ) AND ! empty( $user_mailto ) ) {
// check to make sure there's an attachment before attaching one
if ( $attachments ) {
wp_mail( $user_mailto, $subject, $message, $headers, $attachments );
} else {
wp_mail( $user_mailto, $subject, $message, $headers );
}
}
}
\ No newline at end of file
}
......@@ -59,7 +59,12 @@ function ninja_forms_req_fields_process(){
$req_validation = $reg_type['req_validation'];
$plugin_settings = nf_get_settings();
$req_field_error = $plugin_settings['req_field_error'];
if ( isset ( $plugin_settings['req_field_error'] ) ) {
$req_field_error = __( $plugin_settings['req_field_error'], 'ninja-forms' );
} else {
$req_field_error = __( 'This is a required field.', 'ninja-forms' );
}
if( isset( $plugin_settings['req_error_label'] ) ){
$req_error_label = __( $plugin_settings['req_error_label'], 'ninja-forms' );
}else{
......@@ -83,7 +88,7 @@ function ninja_forms_req_fields_process(){
$ninja_forms_processing->add_error('required-general', $req_error_label, 'general');
}
}else{
if( empty( $user_value ) ){
if( $user_value === '' ){
$ninja_forms_processing->add_error('required-'.$field_id, $req_field_error, $field_id);
$ninja_forms_processing->add_error('required-general', $req_error_label, 'general');
}
......
......@@ -612,6 +612,11 @@ function ninja_forms_field_filter_list_data( $form_id ){
} else {
$all_fields = $ninja_forms_processing->get_all_fields();
}
// Make sure we have some fields before displaying them!
if ( ! $all_fields ) {
return;
}
// Loop through all of our fields and see if we have any list fields.
......@@ -658,4 +663,4 @@ function ninja_forms_field_filter_list_data( $form_id ){
}
}
add_action( 'ninja_forms_display_init', 'ninja_forms_field_filter_list_data' );
\ No newline at end of file
add_action( 'ninja_forms_display_pre_init', 'ninja_forms_field_filter_list_data' );
\ No newline at end of file
......@@ -58,6 +58,8 @@ function ninja_forms_field_textarea_display($field_id, $data){
$default_value = '';
}
$default_value = htmlspecialchars_decode( $default_value );
if(isset($data['textarea_rte'])){
$textarea_rte = $data['textarea_rte'];
}else{
......
......@@ -86,7 +86,7 @@ function ninja_forms_field_timed_submit_display($field_id, $data){
<input id="ninja_forms_field_<?php echo $field_id;?>_js" name="ninja_forms_field_<?php echo $field_id;?>[no-js]" type="hidden" value="1" rel="<?php echo $field_id;?>_js" class="no-js" />
<button type="submit" name="ninja_forms_field_<?php echo $field_id;?>[timer]" class="<?php echo $field_class;?> countdown-timer" id="ninja_forms_field_<?php echo $field_id;?>" value="<?php echo $countdown;?>" rel="<?php echo $field_id;?>" data-countdown="<?php echo $countdown;?>" data-text="<?php esc_attr_e( $submit_text );?>"><?php echo $label ;?>
<button type="submit" name="ninja_forms_field_<?php echo $field_id;?>[timer]" class="<?php echo $field_class;?> countdown-timer" id="ninja_forms_field_<?php echo $field_id;?>" value="<?php echo $countdown;?>" rel="<?php echo $field_id;?>" data-countdown="<?php echo $countdown;?>" data-text="<?php esc_attr_e( $submit_text );?>"><?php echo $label ;?></button>
<?php
......@@ -119,4 +119,4 @@ function ninja_forms_field_timed_submit_pre_process( $field_id, $user_value ){
}
\ No newline at end of file
}
......@@ -128,6 +128,9 @@ jQuery(document).ready(function(jQuery) {
ajax = settings.ajax
if(ajax == 1){
var options = {
beforeSerialize: function($form, add_product_form_options) {
tinyMCE.triggerSave();
},
beforeSubmit: ninja_forms_before_submit,
success: ninja_forms_response,
dataType: 'json'
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
Plugin Name: Ninja Forms
Plugin URI: http://ninjaforms.com/
Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
Version: 2.5.1
Version: 2.5.2
Author: The WP Ninjas
Author URI: http://ninjaforms.com
Text Domain: ninja-forms
......@@ -54,7 +54,7 @@ global $wpdb, $wp_version;
define("NINJA_FORMS_DIR", WP_PLUGIN_DIR."/".basename( dirname( __FILE__ ) ) );
define("NINJA_FORMS_URL", plugins_url()."/".basename( dirname( __FILE__ ) ) );
define("NINJA_FORMS_VERSION", "2.5.1");
define("NINJA_FORMS_VERSION", "2.5.2");
define("NINJA_FORMS_TABLE_NAME", $wpdb->prefix . "ninja_forms");
define("NINJA_FORMS_FIELDS_TABLE_NAME", $wpdb->prefix . "ninja_forms_fields");
define("NINJA_FORMS_FAV_FIELDS_TABLE_NAME", $wpdb->prefix . "ninja_forms_fav_fields");
......
......@@ -3,7 +3,7 @@ Contributors: kstover, jameslaws, daveshine, mordauk, bftrick, helgatheviking
Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
Requires at least: 3.6
Tested up to: 3.8.1
Stable tag: 2.5.1
Stable tag: 2.5.2
License: GPLv2 or later
Forms created with a simple drag and drop interface. Contact forms, Email collection forms, or any other form you want on your WordPress site.
......@@ -76,41 +76,37 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Upgrade Notice ==
= 2.5.1 =
= 2.5.2 =
*Bugs:*
* Fixed a major bug that removed the "Number" field.
= 2.5 =
* Fixed various bugs with the default label position. It should now always default to above.
* Fixed a bug that could cause Admin emails to appear to have attachments when they didn't.
* Required fields can now have a value of 0.
* Fixed a bug with list fields and calculations that could cause them not to pre-populate properly.
* Fixed a bug that could cause incomplete submissions to show in the dashboard for those using the Save Progress extension or the Multi-Part Forms extension.
*Features:*
== Requested Features ==
* Submission Limiting - Allows users to limit the number of submissions a form can receive.
* Character Counts - Added a "Character Count" option to textboxes and textareas.
If you have any feature requests, please feel free to visit [ninjaforms.com](http://ninjaforms.com) and let us know about it.
*Bugs:*
== Changelog ==
* Fixed a bug that prevented the pagination from working on view submission pages.
* Fixed a bug with the default value filter.
* Fixed a bug that prevented forms from showing when they were on the landing page of another form.
* Fixed a bug that caused required fields to go unprocessed when extensions were deactivated.
* Fixed a bug that caused list fields to pre-populate incorrectly in some instances.
* Removed some console logs that could cause crashes in Internet Explorer.
* Fixed a bug that caused forms to improperly clear when submitted.
* Fixed a bug that prevented empty success messages from being saved.
= 2.5.2 =
*Changes:*
*Bugs:*
* Add some CSS to help prevent theme from breaking left and right labels when they add display:block to the label element.
* All settings are now fetched via a proxy function.
* Added a wrapper for the entire form display (and everything that goes with it).
* Fixed various bugs with the default label position. It should now always default to above.
* Fixed a bug that could cause Admin emails to appear to have attachments when they didn't.
* Required fields can now have a value of 0.
* Fixed a bug with list fields and calculations that could cause them not to pre-populate properly.
* Fixed a bug that could cause incomplete submissions to show in the dashboard for those using the Save Progress extension or the Multi-Part Forms extension.
== Requested Features ==
= 2.5.1 =
If you have any feature requests, please feel free to visit [ninjaforms.com](http://ninjaforms.com) and let us know about it.
*Bugs:*
== Changelog ==
* Fixed a major bug that removed the "Number" field.
= 2.5 =
......