Plugin Directory

Changeset 1946544


Ignore:
Timestamp:
09/25/2018 06:27:34 AM (8 years ago)
Author:
patilswapnilv
Message:

updated to version 1.0.2

Location:
gravity-pre-submission-confirmation/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gravity-pre-submission-confirmation/trunk/README.md

    r1389068 r1946544  
    1010Requires at least: 3.5
    1111
    12 Tested up to: 4.5
     12Tested up to: 4.9.8
    1313
    14 Stable tag: 1.0.0
     14Stable tag: 1.0.2
    1515
    16 License: GPLv2
     16License: GPLv3
    1717
    1818
    19 ##Synopsis
     19## Synopsis
    2020
    2121This is an easy way to add a quick pre-submission confirmation page to your forms where users can preview their entered data before it is submitted. Gravity Forms does not provide any way to do this by default; however, with this plugin and a few simple form configuration instructions, you’ll have pre-submission confirmations working like magic!
    2222
    23 ###Features
     23### Features
    2424
    2525* Adds a quick pre-submission confirmation page to Gravity Forms.
    2626* No configurations; Just Plugin & Play!
    2727
    28 ##Installation
     28## Installation
    29291. Upload `GF-Confirmation` folder to your `/wp-content/plugins/` directory.
    30302. Activate the plugin from Admin > Plugins menu.
     
    34346. Update the Gravity form.
    3535
    36 #Contribution
     36# Contribution
    3737
    3838Contributors are always welcome.
    3939To contribute, just send a pull request.
    4040
    41 #License
    42 This Plug-in is released under the same license as the WordPress software is released ie; the [GPLv2](http://www.gnu.org/licenses/gpl-3.0.en.html) (or later) from the [Free Software Foundation](http://www.fsf.org/). A copy of the license is included with the Plug-in, but you can also read the text of the license [here](http://www.gnu.org/licenses/gpl-3.0.en.html).
     41# License
     42This Plug-in is released under the same license as the WordPress software is released ie; the [GPLv3](http://www.gnu.org/licenses/gpl-3.0.en.html) (or later) from the [Free Software Foundation](http://www.fsf.org/). A copy of the license is included with the Plug-in, but you can also read the text of the license [here](http://www.gnu.org/licenses/gpl-3.0.en.html).
    4343
    4444[https://github.com/patilswapnilv/gf-confirmation](https://github.com/patilswapnilv/gf-confirmation)
  • gravity-pre-submission-confirmation/trunk/gravity-pre-submission-confirmation.php

    r1449503 r1946544  
    44Plugin URI: http://wordpress.org/plugins/gravity-pre-submission-confirmation/
    55Description: Adds a quick pre-submission confirmation page to your Graviy forms where users can preview their entered data before it is submitted.
    6 Version: 1.0.1
     6Version: 1.0.2
    77Tags: gravity forms,confirmation, pre-submit, gravity forms extension, pre-submit confirmation
    88Author: patilswapnilv
    99Author URI: http://swapnilpatil.in/
    10 License: GPLv2
     10License: GPLv3
    1111Requires at least: 3.5
    12 Tested up to:      4.6 beta 1
    13 Stable tag:        1.0.1
     12Tested up to:      4.9.8
     13Stable tag:        1.0.2
    1414*/
    15 
    1615/*
    17 
    1816This program is free software; you can redistribute it and/or modify
    19 it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by
     17it under the terms of the GNU General Public License (Version 4 - GPLv3) as published by
    2018the Free Software Foundation.
    21 
    2219This program is distributed in the hope that it will be useful,
    2320but WITHOUT ANY WARRANTY; without even the implied warranty of
    2421MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2522GNU General Public License for more details.
    26 
    2723You should have received a copy of the GNU General Public License
    2824along with this program; if not, write to the Free Software
    2925Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    3026*/
    31 
    3227class GFPreviewConfirmation {
    33 
    3428    private static $lead;
    35 
    3629    public static function init() {
    3730        add_filter( 'gform_pre_render', array( __class__, 'replace_merge_tags' ) );
    3831    }
    39 
    4032    public static function replace_merge_tags( $form ) {
    41 
    4233        $current_page = isset(GFFormDisplay::$submission[$form['id']]) ? GFFormDisplay::$submission[$form['id']]['page_number'] : 1;
    4334        $fields = array();
    44 
    4535        // get all HTML fields on the current page
    4636        foreach($form['fields'] as &$field) {
    47 
    4837            // skip all fields on the first page
    4938            if(rgar($field, 'pageNumber') <= 1)
    5039                continue;
    51 
    5240            $default_value = rgar($field, 'defaultValue');
    5341            preg_match_all('/{.+}/', $default_value, $matches, PREG_SET_ORDER);
     
    6048                }
    6149            }
    62 
    6350            // only run 'content' filter for fields on the current page
    6451            if(rgar($field, 'pageNumber') != $current_page)
    6552                continue;
    66 
    6753            $html_content = rgar($field, 'content');
    6854            preg_match_all('/{.+}/', $html_content, $matches, PREG_SET_ORDER);
     
    7056                $field['content'] = self::preview_replace_variables($html_content, $form);
    7157            }
    72 
    7358        }
    74 
    7559        return $form;
    7660    }
    77 
    7861    /**
    7962    * Adds special support for file upload, post image and multi input merge tags.
    8063    */
    8164    public static function preview_special_merge_tags($value, $input_id, $merge_tag, $field) {
    82 
    8365        // added to prevent overriding :noadmin filter (and other filters that remove fields)
    8466        if( ! $value )
    8567            return $value;
    86 
    8768        $input_type = RGFormsModel::get_input_type($field);
    88 
    8969        $is_upload_field = in_array( $input_type, array('post_image', 'fileupload') );
    9070        $is_multi_input = is_array( rgar($field, 'inputs') );
    9171        $is_input = intval( $input_id ) != $input_id;
    92 
    9372        if( !$is_upload_field && !$is_multi_input )
    9473            return $value;
    95 
    9674        // if is individual input of multi-input field, return just that input value
    9775        if( $is_input )
    9876            return $value;
    99 
    10077        $form = RGFormsModel::get_form_meta($field['formId']);
    10178        $lead = self::create_lead($form);
    10279        $currency = GFCommon::get_currency();
    103 
    10480        if(is_array(rgar($field, 'inputs'))) {
    10581            $value = RGFormsModel::get_lead_field_value($lead, $field);
    10682            return GFCommon::get_lead_field_display($field, $value, $currency);
    10783        }
    108 
    10984        switch($input_type) {
    11085        case 'fileupload':
     
    11792            break;
    11893        }
    119 
    12094        return $value;
    12195    }
    122 
    12396    public static function preview_image_value($input_name, $field, $form, $lead) {
    124 
    12597        $field_id = $field['id'];
    12698        $file_info = RGFormsModel::get_temp_filename($form['id'], $input_name);
    12799        $source = RGFormsModel::get_upload_url($form['id']) . "/tmp/" . $file_info["temp_filename"];
    128 
    129100        if(!$file_info)
    130101            return '';
    131 
    132102        switch(RGFormsModel::get_input_type($field)){
    133 
    134103            case "post_image":
    135104                list(,$image_title, $image_caption, $image_description) = explode("|:|", $lead[$field['id']]);
    136105                $value = !empty($source) ? $source . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : "";
    137106                break;
    138 
    139107            case "fileupload" :
    140108                $value = $source;
    141109                break;
    142 
    143110        }
    144 
    145111        return $value;
    146112    }
    147 
    148113    public static function preview_image_display($field, $form, $value) {
    149 
    150114        // need to get the tmp $file_info to retrieve real uploaded filename, otherwise will display ugly tmp name
    151115        $input_name = "input_" . str_replace('.', '_', $field['id']);
    152116        $file_info = RGFormsModel::get_temp_filename($form['id'], $input_name);
    153 
    154117        $file_path = $value;
    155118        if(!empty($file_path)){
     
    158121        }
    159122        return $value;
    160 
    161123    }
    162 
    163124    /**
    164125    * Retrieves $lead object from class if it has already been created; otherwise creates a new $lead object.
    165126    */
    166127    public static function create_lead( $form ) {
    167 
    168128        if( empty( self::$lead ) ) {
    169129            self::$lead = GFFormsModel::create_lead( $form );
    170130            self::clear_field_value_cache( $form );
    171131        }
    172 
    173132        return self::$lead;
    174133    }
    175 
    176134    public static function preview_replace_variables( $content, $form ) {
    177 
    178135        $lead = self::create_lead($form);
    179 
    180136        // add filter that will handle getting temporary URLs for file uploads and post image fields (removed below)
    181137        // beware, the RGFormsModel::create_lead() function also triggers the gform_merge_tag_filter at some point and will
    182138        // result in an infinite loop if not called first above
    183139        add_filter('gform_merge_tag_filter', array('GFPreviewConfirmation', 'preview_special_merge_tags'), 10, 4);
    184 
    185140        $content = GFCommon::replace_variables($content, $form, $lead, false, false, false);
    186 
    187141        // remove filter so this function is not applied after preview functionality is complete
    188142        remove_filter('gform_merge_tag_filter', array('GFPreviewConfirmation', 'preview_special_merge_tags'));
    189 
    190143        return $content;
    191144    }
    192 
    193145    public static function clear_field_value_cache( $form ) {
    194 
    195146        if( ! class_exists( 'GFCache' ) )
    196147            return;
    197 
    198148        foreach( $form['fields'] as &$field ) {
    199149            if( GFFormsModel::get_input_type( $field ) == 'total' )
    200150                GFCache::delete( 'GFFormsModel::get_lead_field_value__' . $field['id'] );
    201151        }
    202 
    203152    }
    204 
    205153}
    206 
    207154GFPreviewConfirmation::init();
  • gravity-pre-submission-confirmation/trunk/readme.txt

    r1449506 r1946544  
    1 ===Gravity Pre-submission Confirmation===
     1=== Gravity Pre-submission Confirmation ===
    22Contributors:      patilswapnilv
    33Plugin Name:       Gravity Pre-submission Confirmation
    4 Plugin URI:        https://wordpress.org/plugins/gravity-pre-submission-confirmation
     4Plugin URI:       https://github.com/patilswapnilv/Gravity-Pre-submission-Confirmation
    55Tags:              gravity forms,confirmation, pre-submit, gravity forms extension, pre-submit confirmation
    66Author URI:        http://swapnilpatil.in
    77Author:            patilswapnilv
    8 Version:           1.0.0
     8Version:           1.0.2
    99Donate link:       http://swapnilpatil.in/contribution
    10 License:           GPLv2 or later
    11 License URI:       http://www.gnu.org/licenses/gpl-2.0.html
     10License:           GPLv3
     11License URI:       http://www.gnu.org/licenses/gpl-3.0.en.html
    1212Requires at least: 3.5
    13 Tested up to:      4.6 beat 1
    14 Stable tag:        1.0.1
     13Tested up to:      4.9.8
     14Stable tag:        1.0.2
    1515
    1616
     
    2020This is an easy way to add a quick pre-submission confirmation page to your forms where users can preview the information entered in the form before they submit it. Gravity Forms does not provide any way to do this by default; however, with this plugin and a few simple form configuration instructions, you’ll have pre-submission confirmations working like magic!
    2121
    22 ###Features
     22### Features
    2323
    2424* Adds a quick pre-submission confirmation page to Gravity Forms.
     
    6363== Changelog ==
    6464
    65 = Version 1.0.0 =
    66     Initial Release.
     65= Version 1.0.2 =
     66    Tested for WordPress 4.9.8
    6767
    6868= Version 1.0.1 =
    6969    Added support for PHP 7 and made translation ready.
     70   
     71= Version 1.0.0 =
     72    Initial Release.
    7073
    7174
Note: See TracChangeset for help on using the changeset viewer.