Plugin Directory

Changeset 2787143


Ignore:
Timestamp:
09/19/2022 04:49:36 PM (3 years ago)
Author:
ircary
Message:

2022.8

*Release Date - 19 September 2022*

  • Updated:
    • [lct_acf_form2]
    • lct_acf_form2()
Location:
lct-useful-shortcodes-functions/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/form.php

    r2782154 r2787143  
    5252 ** =>                                 'form_container'                 => null //the id of the form container
    5353 ** =>                                 'empty_form_container_on_submit' => true //the id of the form container
     54 ** =>                                 'save_now'                       => false //bool
     55 ** =>                                 'save_sess'                      => false //bool
    5456 ** =>                                 'theme_chunk_iframe_json'        => null //Used in KWSystem
    5557 * =>                              ],
     
    6870 *** 'form_data'                   => alias to form_attributes['data'], //Format: key : value :: key2 : value2; Don't use this if possible; //TODO: cs - Need to get this removed - 1/17/2022 4:40 PM
    6971 *** 'instant'                     => false //force the field(s) to save to the DB instantly via ajax
     72 *** 'save_now'                    => false //force the field(s) to save to the DB instantly via ajax
     73 *** 'save_sess'                   => false //force the field(s) to save to the DB instantly via ajax
    7074 * //CUSTOM - Field atts
    7175 * 'lct_viewonly'                  => null
     
    7983 * @return bool|string
    8084 * @since    7.49
    81  * @verified 2022.08.22
     85 * @verified 2022.09.15
    8286 */
    8387function lct_acf_form2( $a ) {
     
    108112            'form_data'         => null,
    109113            'instant'           => false,
     114            'save_now'          => false,
     115            'save_sess'         => false,
    110116            'lct_pdf_view'      => true, //true, false, hide_form (only, show on the PDF)
    111117            'lct_pdf_layout'    => '{value}', //{value}, {label}, {instructions}
     
    241247
    242248        //for backwards compatibility
    243         if ( strpos( $a['form_class'], 'lct_instant' ) !== false ) { //only if class contains LCT instant
     249        if (
     250            ! $a['save_now'] &&
     251            ! $a['save_sess'] &&
     252            strpos( $a['form_class'], 'lct_instant' ) !== false
     253        ) { //only if class contains LCT instant
    244254            $a['instant'] = true;
    245255
     
    296306     * CUSTOM
    297307     * Set the instant
    298      */
    299     $a['instant'] = filter_var( $a['instant'], FILTER_VALIDATE_BOOLEAN );
    300 
    301 
    302     if ( $a['instant'] ) {
    303         $a['honeypot']                 = false;
    304         $a['form_attributes']['class'] .= ' ' . 'lct_instant';
     308     * Set the save_now
     309     * Set the save_sess
     310     */
     311    $a['instant']   = filter_var( $a['instant'], FILTER_VALIDATE_BOOLEAN );
     312    $a['save_now']  = filter_var( $a['save_now'], FILTER_VALIDATE_BOOLEAN );
     313    $a['save_sess'] = filter_var( $a['save_sess'], FILTER_VALIDATE_BOOLEAN );
     314
     315
     316    if (
     317        $a['save_now'] ||
     318        $a['save_sess'] ||
     319        $a['instant']
     320    ) {
     321        $a['honeypot'] = false;
     322        if ( ! $a['save_now'] && ! $a['save_sess'] )
     323            $a['form_attributes']['class'] .= ' ' . 'lct_instant';
    305324
    306325
     
    438457     * _form_data_lct
    439458     */
    440     if ( isset( $a['_form_data_lct'] ) ) {
    441         $a['_form_data_lct'] = afwp_acf_maybe_json_decode( $a['_form_data_lct'] );
    442 
    443 
    444         /**
    445          * ACF API Form Variables
    446          */
    447         if ( isset( $a['_form_data_lct']['wp_api'] ) ) {
    448             /**
    449              * wp_api
    450              */
    451             $a['_form_data_lct']['wp_api'] = filter_var( $a['_form_data_lct']['wp_api'], FILTER_VALIDATE_BOOLEAN );
    452 
    453 
    454             /**
    455              * wp_api_submit_ready
    456              */
    457             if ( ! isset( $a['_form_data_lct']['wp_api_submit_ready'] ) )
    458                 $a['_form_data_lct']['wp_api_submit_ready'] = true;
    459 
    460             $a['_form_data_lct']['wp_api_submit_ready'] = filter_var( $a['_form_data_lct']['wp_api_submit_ready'], FILTER_VALIDATE_BOOLEAN );
    461 
    462 
    463             /**
    464              * print_response_container
    465              */
    466             if ( ! isset( $a['_form_data_lct']['print_response_container'] ) )
    467                 $a['_form_data_lct']['print_response_container'] = true;
    468             else if ( $a['_form_data_lct']['print_response_container'] !== 'below' )
    469                 $a['_form_data_lct']['print_response_container'] = filter_var( $a['_form_data_lct']['print_response_container'], FILTER_VALIDATE_BOOLEAN );
    470 
    471 
    472             /**
    473              * empty_form_container_on_submit
    474              */
    475             if ( ! isset( $a['_form_data_lct']['empty_form_container_on_submit'] ) )
    476                 $a['_form_data_lct']['empty_form_container_on_submit'] = true;
    477 
    478             $a['_form_data_lct']['empty_form_container_on_submit'] = filter_var( $a['_form_data_lct']['empty_form_container_on_submit'], FILTER_VALIDATE_BOOLEAN );
    479         }
    480     }
     459    if ( ! isset( $a['_form_data_lct'] ) )
     460        $a['_form_data_lct'] = [];
     461    $a['_form_data_lct'] = afwp_acf_maybe_json_decode( $a['_form_data_lct'] );
     462
     463
     464    /**
     465     * ACF API Form Variables
     466     */
     467    if ( isset( $a['_form_data_lct']['wp_api'] ) ) {
     468        /**
     469         * wp_api
     470         */
     471        $a['_form_data_lct']['wp_api'] = filter_var( $a['_form_data_lct']['wp_api'], FILTER_VALIDATE_BOOLEAN );
     472
     473
     474        /**
     475         * wp_api_submit_ready
     476         */
     477        if ( ! isset( $a['_form_data_lct']['wp_api_submit_ready'] ) )
     478            $a['_form_data_lct']['wp_api_submit_ready'] = true;
     479
     480        $a['_form_data_lct']['wp_api_submit_ready'] = filter_var( $a['_form_data_lct']['wp_api_submit_ready'], FILTER_VALIDATE_BOOLEAN );
     481
     482
     483        /**
     484         * print_response_container
     485         */
     486        if ( ! isset( $a['_form_data_lct']['print_response_container'] ) )
     487            $a['_form_data_lct']['print_response_container'] = true;
     488        else if ( $a['_form_data_lct']['print_response_container'] !== 'below' )
     489            $a['_form_data_lct']['print_response_container'] = filter_var( $a['_form_data_lct']['print_response_container'], FILTER_VALIDATE_BOOLEAN );
     490
     491
     492        /**
     493         * empty_form_container_on_submit
     494         */
     495        if ( ! isset( $a['_form_data_lct']['empty_form_container_on_submit'] ) )
     496            $a['_form_data_lct']['empty_form_container_on_submit'] = true;
     497
     498        $a['_form_data_lct']['empty_form_container_on_submit'] = filter_var( $a['_form_data_lct']['empty_form_container_on_submit'], FILTER_VALIDATE_BOOLEAN );
     499    }
     500
     501
     502    /**
     503     * save_now Variables
     504     */
     505    if ( $a['save_now'] )
     506        $a['_form_data_lct']['save_now'] = true;
     507
     508
     509    /**
     510     * save_sess Variables
     511     */
     512    if ( $a['save_sess'] )
     513        $a['_form_data_lct']['save_sess'] = true;
    481514
    482515
  • lct-useful-shortcodes-functions/trunk/code/plugins/acf/form.php

    r2679272 r2787143  
    165165     * @return bool|string
    166166     * @since    7.49
    167      * @verified 2022.01.18
     167     * @verified 2022.09.15
    168168     */
    169169    function form_shortcode( $a ) {
     
    173173        $a = shortcode_atts(
    174174        /**
    175          * @date       2022.01.07
    176          * @since      2022.1
    177          * @verified   2022.01.07
     175         * @date     2022.01.07
     176         * @since    2022.1
     177         * @verified 2022.01.07
    178178         */
    179179            apply_filters( 'lct/acf_form/shortcode_atts',
     
    219219                    'form_data'                     => null,
    220220                    'instant'                       => null,
     221                    'save_now'                      => null,
     222                    'save_sess'                     => null,
    221223                    //CUSTOM - Field atts
    222224                    zxzu( 'viewonly' )              => null,
     
    231233
    232234
    233         if ( $a['instant'] )
     235        if ( $a['instant'] || $a['save_now'] || $a['save_sess'] )
    234236            $a['honeypot'] = false;
    235237
     
    582584     * @param array $data The form data.
    583585     *
    584      * @date       2022.01.07
    585      * @since      2022.1
     586     * @date     2022.01.07
     587     * @since    2022.1
    586588     * @verified 2022.01.21
    587589     */
  • lct-useful-shortcodes-functions/trunk/lct-useful-shortcodes-functions.php

    r2784778 r2787143  
    44 * Plugin URI: https://www.simplesmithmedia.com
    55 * Description: Shortcodes & Functions that will help make your life easier.
    6  * Version: 2022.7
     6 * Version: 2022.8
    77 * Author: SimpleSmithMedia
    88 * Author URI: https://www.simplesmithmedia.com
  • lct-useful-shortcodes-functions/trunk/readme.txt

    r2784778 r2787143  
    3333
    3434== Changelog ==
     35= 2022.8 =
     36*Release Date - 19 September 2022*
     37
     38* Updated:
     39    * [lct_acf_form2]
     40    * lct_acf_form2()
     41
    3542= 2022.7 =
    3643*Release Date - 14 September 2022*
Note: See TracChangeset for help on using the changeset viewer.