Commit ded82f45 authored by Kevin Stover's avatar Kevin Stover

Merge branch 'release/v2.8.4'

parents 716a1a35 a9c84c85
......@@ -6,7 +6,6 @@ function ninja_forms_return_echo($function_name){
ob_start();
call_user_func_array($function_name, $arguments);
$return = ob_get_clean();
ob_end_clean();
return $return;
}
......
......@@ -64,34 +64,26 @@ function ninja_forms_pre_process_shortcode($content) {
add_filter('the_content', 'ninja_forms_pre_process_shortcode', 9999);
/**
* Shortcode for submission sequential ID
*
* @since 2.7
* @return string $content
* Parse the [nf_sub_seq_num] shortcode
*
* @since 2.8.4
* @return string $setting
*/
function nf_sub_seq_num_shortcode( $sub_id ) {
function nf_parse_sub_seq_num_shortcode( $setting, $setting_name = '', $id = '' ) {
global $ninja_forms_processing;
$seq_num = Ninja_Forms()->sub( $sub_id )->get_seq_num();
//Get the form settings for the form currently being processed.
$admin_subject = $ninja_forms_processing->get_form_setting( 'admin_subject' );
$user_subject = $ninja_forms_processing->get_form_setting( 'user_subject' );
$success_msg = $ninja_forms_processing->get_form_setting( 'success_msg' );
$admin_email_msg = $ninja_forms_processing->get_form_setting( 'admin_email_msg' );
$user_email_msg = $ninja_forms_processing->get_form_setting( 'user_email_msg' );
$save_msg = $ninja_forms_processing->get_form_setting( 'save_msg' );
$ninja_forms_processing->update_form_setting( 'admin_subject', str_replace( '[nf_sub_seq_num]', $seq_num, $admin_subject ) );
$ninja_forms_processing->update_form_setting( 'user_subject', str_replace( '[nf_sub_seq_num]', $seq_num, $user_subject ) );
$ninja_forms_processing->update_form_setting( 'success_msg', str_replace( '[nf_sub_seq_num]', $seq_num, $success_msg ) );
$ninja_forms_processing->update_form_setting( 'admin_email_msg', str_replace( '[nf_sub_seq_num]', $seq_num, $admin_email_msg ) );
$ninja_forms_processing->update_form_setting( 'user_email_msg', str_replace( '[nf_sub_seq_num]', $seq_num, $user_email_msg ) );
$ninja_forms_processing->update_form_setting( 'save_msg', str_replace( '[nf_sub_seq_num]', $seq_num, $save_msg ) );
if ( ! is_object( $ninja_forms_processing ) )
return $setting;
$sub_id = $ninja_forms_processing->get_form_setting( 'sub_id' );
$seq_num = Ninja_Forms()->sub( $sub_id )->get_seq_num();
$setting = str_replace( '[nf_sub_seq_num]', $seq_num, $setting );
return $setting;
}
add_action( 'nf_save_sub', 'nf_sub_seq_num_shortcode' );
add_filter( 'nf_email_notification_process_setting', 'nf_parse_sub_seq_num_shortcode', 10, 3 );
add_filter( 'nf_success_msg', 'nf_parse_sub_seq_num_shortcode', 10, 2 );
/**
* Shortcode for ninja_forms_all_fields
......@@ -142,11 +134,13 @@ function nf_parse_fields_shortcode( $content ) {
return $content;
$matches = array();
$pattern = get_shortcode_regex();
$pattern = '\[(\[?)(ninja_forms_field|ninja_forms_all_fields)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)';
preg_match_all('/'.$pattern.'/s', $content, $matches);
if ( is_array( $matches ) && ! empty( $matches[2] ) ) {
foreach ( $matches[2] as $key => $shortcode ) {
if ( 'ninja_forms_field' == $shortcode ) {
if ( isset ( $matches[3][ $key ] ) ) {
$atts = shortcode_parse_atts( $matches[3][ $key ] );
......
......@@ -82,6 +82,7 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
* Moving reply to, cc, and bcc to an advanced settings section for email notifications.
* Any field can now be inserted into the from name, address, to, subject, reply to, cc, and bcc fields.
* Added a custom short code parser that will prevent other plugins from tampering with email and success message ninja forms short codes.
*Bugs:*
......@@ -108,6 +109,7 @@ If you have any feature requests, please feel free to visit [ninjaforms.com](htt
* Moving reply to, cc, and bcc to an advanced settings section for email notifications.
* Any field can now be inserted into the from name, address, to, subject, reply to, cc, and bcc fields.
* Added a custom short code parser that will prevent other plugins from tampering with email and success message ninja forms short codes.
*Bugs:*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment