Plugin Directory

Changeset 3012607


Ignore:
Timestamp:
12/20/2023 09:40:20 PM (2 years ago)
Author:
funnelforms
Message:

-Caching system extensively reworked
-Loading time fundamentally optimized

Location:
funnelforms-free
Files:
515 added
5 edited

Legend:

Unmodified
Added
Removed
  • funnelforms-free/trunk/Funnelforms-free.php

    r3001018 r3012607  
    99Text Domain: funnelforms-free
    1010Domain Path: /languages/
    11 Version: 3.5.3.1
     11Version: 3.6
    1212*/
    1313
  • funnelforms-free/trunk/frontend/frontend.php

    r2968232 r3012607  
    4949        $base_json = json_decode(json_encode($base_json));
    5050
     51        $first_element_id = $base_json->sections[0]->contents[0]->data;
     52        $request_preload_ids = array($dataid);
     53        if($first_element_id != null && $first_element_id != '') {
     54            array_push($request_preload_ids, $first_element_id);
     55        }
     56
    5157        global $wp_locale_switcher;
    5258        if(isset($base_json->fe_locale) && $base_json->fe_locale !== "default") {
     
    6470        af2_load_frontend_resources($type);
    6571
    66        
     72        $userid = get_current_user_id();
    6773
    6874        $suported_types = fnsf_af2_get_supported_mime_types();
     
    7076        wp_localize_script('af2_frontend', 'af2_frontend_ajax', // Localizing the Script to use ajax loading
    7177            array(
    72                 'ajax_url' => admin_url('admin-ajax.php'),
    73                 'nonce' => wp_create_nonce('af2_FE_nonce'),
     78                'ajax_url' => admin_url('admin-ajax.php'),'nonce' => wp_create_nonce('af2_FE_nonce_'),
     79                'datas' => $this->fnsf_get_data_loadup_first($request_preload_ids),
    7480                'supported_file_types' => implode(',', $suported_types),
    7581                'server_max_size' => trim(str_replace("MB","", $server_max_size)),
     
    290296        return $content;
    291297    }
     298
     299    function fnsf_get_data_loadup_first($request_preload_ids) {
     300        $dataids = $request_preload_ids;
     301
     302        $returnarray = array("error" => null, "data" => array());
     303
     304        /** Checking for bad input and fetching posts * */
     305        $base_posts = array();                       // The post of it out of DB
     306        $x = 0;                           // Loop
     307        foreach ($dataids as $dataid) {
     308            if (fnsf_sql_check_it($dataid) === 'ERROR') {
     309                $returnarray["error"] = 'ERRORX';
     310                return $returnarray;
     311            }
     312
     313            $base_posts[$x] = $this->fnsf_af2_check_params_for_getting_content($dataid);
     314
     315            /** Checking that no Errors are given * */
     316            if ($base_posts[$x] === 'ERROR') {
     317                $returnarray["error"] = __('ERROR - [02] Please contact support!', 'af2_multilanguage');
     318                return $returnarray;
     319            }
     320
     321            $x++;
     322        }
     323
     324        /** Fetching content out of Database * */
     325        $base_structures = array();                      // The json Strings
     326        $base_jsons = array();                       // The json-Objects of it
     327        $post_types = array();                       // The Types of the post
     328        $x = 0;                           // Loop
     329        require_once FNSF_AF2_MISC_FUNCTIONS_PATH;
     330        foreach ($base_posts as $base_post) {
     331            $base_jsons[$x] = fnsf_af2_get_post_content($base_post);
     332
     333
     334            $base_jsons[$x] = json_decode(json_encode($base_jsons[$x]));
     335
     336            /** Checking that no Error is given * */
     337            $check = $this->fnsf_af2_check_for_errors($base_jsons[$x]);
     338            if ($check === 'ERROR') {
     339                $returnarray["error"] = __('ERROR - [03] There is an error in a form element!', 'af2_multilanguage');;
     340                return $returnarray;
     341            }
     342
     343            $post_types[$x] = get_post_field('post_type', $base_post);
     344
     345            $x++;
     346        }
     347
     348        /** Cleaning the jsons for the frontend * */
     349        $new_jsons = json_decode('{}');                    // The clean Jsons
     350        $x = 0;                           // Loop
     351        foreach ($post_types as $post_type) {
     352            $data = strval($dataids[$x]);                   // Actual called Dataid
     353            switch ($post_type) {
     354                case 'af2_frage': {
     355                        $new_jsons->$data = $this->fnsf_af2_clean_frage_json($base_jsons[$x]);
     356                        break;
     357                    }
     358                case 'af2_kontaktformular': {
     359                        $new_jsons->$data = $this->fnsf_af2_clean_kontaktformular_json($base_jsons[$x]);
     360                        break;
     361                    }
     362                case 'af2_formular': {
     363                        $new_jsons->$data = $this->fnsf_af2_clean_formular_json($base_jsons[$x]);
     364                        break;
     365                    }
     366            }
     367
     368            $x++;
     369        }
     370
     371        $jsons = json_encode($new_jsons, JSON_UNESCAPED_UNICODE);              // Json to return
     372
     373        $returnarray["data"] = $jsons;
     374        return $returnarray;
     375    }
     376
    292377
    293378    /**
     
    12531338                        }
    12541339                    }
    1255                     //VALIDATE PHONE
    1256                     if ($form_question->typ == 'text_type_phone_verification') {
    1257                         if(!fnsf_validate_phone_number_country($answer_block[$x])) {
    1258 
    1259                             $frontView_fiv .= '<div class="af2_response_error" data-id="' . $x . '">' ;
    1260                             $frontView_fiv .= __('The mobile number is not valid! (Format: +1 702 12345678)', 'funnelforms-free');
    1261                             $frontView_fiv .= '</div>' ;
    1262                                 _e(wp_kses_post($frontView_fiv));
    1263  
    1264 
    1265                             die();
    1266                         } else {
    1267                             $smsCode = sanitize_text_field($_POST['verificationSMS'][0]);
    1268                             $smsNumber = sanitize_text_field($_POST['verificationSMS'][1]);
    1269                             if(!af2_gotValidationCode($smsCode, $smsNumber))
    1270                             {
    1271                                 _e('NOT VALIDATED');
    1272                                 die();
    1273                             }
    1274                         }
    1275 
    1276                         // VERIFICATION
    1277                     }
    1278 
     1340                   
    12791341                    //VALIDATE EMAIL
    12801342                    if ($form_question->typ == 'text_type_mail') {
  • funnelforms-free/trunk/misc/constants.php

    r3001018 r3012607  
    144144
    145145// Other constants
    146 define( 'FNSF_AF2_FINAL_VERSION', '3.5.3.1' );
     146define( 'FNSF_AF2_FINAL_VERSION', '3.6' );
    147147define( 'FNSF_AF2_MENU_ICON_URL', plugins_url("/res/images/menu_icon.png", AF2F_PLUGIN) );
    148148define( 'FNSF_AF2_OPENAI_IMAGE_URL', plugins_url("/res/images/openai.png", AF2F_PLUGIN) );
  • funnelforms-free/trunk/readme.txt

    r3010657 r3012607  
    55Tested up to: 6.4.2
    66Requires PHP: 7.4
    7 Stable tag: 3.5.3.1
     7Stable tag: 3.6
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    246246== Changelog ==
    247247
    248 = 3.5.3.1 - 23. November 2023 =
     248= 3.6 - 20. December 2023 =
     249* Caching system extensively reworked
     250* Loading time fundamentally optimized
     251
     252= 3.6 - 23. November 2023 =
    249253* Bugfixes
    250254
  • funnelforms-free/trunk/res/frontend/scripts/frontend.js

    r2924566 r3012607  
    14701470const af2_init = ($) => {
    14711471
     1472    const errorAnswer = af2_frontend_ajax.datas.error;
     1473
     1474    if(errorAnswer != null) {
     1475    }
     1476    else if(af2_frontend_ajax.datas.data != null)
     1477    {
     1478        let preloadJson = JSON.parse(af2_frontend_ajax.datas.data);
     1479
     1480        const keys = Object.keys(preloadJson);
     1481
     1482        $.each(keys, (i, el) => {
     1483            let newJson = preloadJson[el];
     1484
     1485            if(newJson.type_specifics != null) {
     1486                const keysofjson = Object.keys(newJson.type_specifics);
     1487
     1488                $.each(keysofjson, (j, ele) => {
     1489                    if(newJson.type_specifics[ele] == 'true') newJson.type_specifics[ele] = true;
     1490                    if(newJson.type_specifics[ele] == 'false') newJson.type_specifics[ele] = false;
     1491
     1492                    if(ele == 'center' && newJson.type_specifics[ele].lat != null && newJson.type_specifics[ele].lng != null) {
     1493                        newJson.type_specifics[ele].lat = Number(newJson.type_specifics[ele].lat);
     1494                        newJson.type_specifics[ele].lng = Number(newJson.type_specifics[ele].lng);
     1495                    }
     1496                });
     1497            }
     1498
     1499            datas[el] = preloadJson[el];
     1500        });
     1501    }
    14721502
    14731503    /** Filling the Forms with all Forms on the Screen **/
     
    14821512
    14831513        forms[num] = new Form($, id, num, preload, size, errormail, activateScrollToAnchor, false, showSuccessScreen);
    1484        
    1485 
    1486        
    14871514    });
    14881515
     
    16581685        } else
    16591686        {
     1687            if (datas[this.neededContent] !== undefined && datas[this.neededContent] !== true)
     1688            {
     1689                this.initDraw(goBefore);
     1690            }
    16601691            this.iteratePreloads().done((dataids) => {
    16611692                if (dataids.length > 0)
     
    18031834
    18041835        /** Check neededContent first **/
    1805         if (datas[this.neededContent] === undefined)
     1836        if (this.neededContent != undefined && datas[this.neededContent] === undefined)
    18061837        {
    18071838            dataIds.push(this.neededContent);
     
    34773508        af2HandleRequest($, this.formSelector, '.af2_form_wrapper', [this.id], this);
    34783509    }
     3510    else {
     3511        af2LoadStyling(this.$, this.id, this.formSelector, this.setHeight);
     3512        this.loadContent();
     3513    }
    34793514}
    34803515
     
    36863721 */
    36873722const af2DrawCarouselContent = ($, form, dataid, formSelector, carouselNum, resize_listener_add) => {
    3688    
     3723    form.needsDraw = false
    36893724    if (jQuery(formSelector + ' .af2_form_carousel').width() !== 0)
    36903725    {
Note: See TracChangeset for help on using the changeset viewer.