Plugin Directory

Changeset 3097249


Ignore:
Timestamp:
06/04/2024 09:37:59 AM (11 months ago)
Author:
unitecms
Message:

update to 1.5.110 version.

Location:
unlimited-elements-for-elementor/trunk
Files:
2 added
34 edited

Legend:

Unmodified
Added
Removed
  • unlimited-elements-for-elementor/trunk/assets_libraries/filters/ue_filters.js

    r3094530 r3097249  
    32123212
    32133213        var urlAddition = "ucfrontajaxaction=getfiltersdata&layoutid="+layoutID+"&elid="+widgetID;
    3214                
     3214       
    32153215        urlAjax = addUrlParam(urlAjax, urlAddition);
    32163216       
  • unlimited-elements-for-elementor/trunk/assets_libraries/remote/ue-remote-controls.js

    r3094530 r3097249  
    18091809    */
    18101810    this.setAction = function(action, objElement, allowMultiple){
    1811 
     1811       
    18121812        if(g_vars.trace_debug == true){
    18131813            trace("set action: "+action);
     
    18341834
    18351835        if(allowMultiple !== true)
    1836             if(linkedAction)
     1836            if(linkedAction){
     1837               
     1838                trace("not allow multiple action: "+action);
     1839               
    18371840                return(false);
     1841            }
    18381842
    18391843        objElement.data("uc-action", action);
     
    18611865
    18621866        var isEditorMode = isInsideEditor();
    1863 
     1867       
    18641868        //in editor mode check debug every second
    18651869
     
    23562360     */
    23572361    function isInsideEditor(){
    2358 
     2362       
    23592363        if(g_vars.is_editor !== null)
    23602364            return g_vars.is_editor;
     2365       
     2366        //check for gutenberg
     2367       
     2368        if(typeof g_ucAdmin !== "undefined"){
     2369            g_vars.is_editor = true;
     2370            return(true);
     2371        }
     2372       
    23612373       
    23622374        if (window.parent === window.top) {
     
    23732385        }
    23742386       
    2375         // check for gutenberg
    2376         if (typeof window.parent.wp !== "undefined" && typeof window.parent.wp.blocks !== "undefined") {
    2377             g_vars.is_editor = true;
    2378             return true;
    2379         }
    2380        
    23812387        g_vars.is_editor = false;
    23822388
     
    24002406     */
    24012407    function checkWidgetInsideEditor(){
    2402 
     2408               
    24032409        //check for disconnect
    24042410        try{
     
    24552461    this.onWidgetInit = function(widgetID, func, options){
    24562462       
    2457        
    24582463        try{
    2459 
     2464           
     2465            if(g_vars.is_inited == true)
     2466                return(false);
     2467           
    24602468            if(g_vars.trace_debug == true){
    24612469                trace("on widget init");
     
    24792487
    24802488            if(g_vars.is_inited == false){
    2481 
     2489               
    24822490                if(g_vars.trace_debug == true){
    24832491                    trace(widgetID+" not inited yet, waiting for parent init");
     
    25092517
    25102518            onWidgetReady();
    2511 
    2512             g_vars.funcOnInit(g_objWidget);
    2513 
     2519                   
     2520            if(g_vars.funcOnInit){
     2521               
     2522                g_vars.is_inited = true;
     2523                g_vars.funcOnInit(g_objWidget);             
     2524            }
     2525               
    25142526        }catch(message){
    25152527
     
    25382550
    25392551        //if under template switcher - modify sync id
    2540                
     2552           
    25412553        if(g_vars.trace_debug == true){
    25422554            trace("Start parent sync");
     
    25562568       
    25572569        var isEditorMode = isInsideEditor();
    2558 
     2570               
    25592571        objSync.setOptions(syncID, isEditorMode);
    25602572
     
    27632775
    27642776jQuery(document).on("uc-remote-parent-init",function(event, objParent, optionsAPI){
    2765 
     2777   
    27662778    var objRemote = new UERemoteWidgets();
    27672779    objRemote.onParentInit(objParent, optionsAPI);
    2768 
     2780   
    27692781});
    27702782
  • unlimited-elements-for-elementor/trunk/inc_php/framework/include_framework.php

    r3071404 r3097249  
    4343require_once $folderIncludes . 'table.class.php';
    4444require_once $folderIncludes . 'font_manager.class.php';
    45 require_once $folderIncludes . 'shapes.class.php';
    4645require_once $folderIncludes . 'services.class.php';
    4746
  • unlimited-elements-for-elementor/trunk/inc_php/framework/settings.class.php

    r3094530 r3097249  
    13241324        public function loadXMLFile($filepath, $loadedSettingsType = null){
    13251325
    1326 
    13271326            $obj = UniteFunctionsUC::loadXMLFile($filepath);
    1328 
     1327           
    13291328            if(empty($obj))
    13301329                UniteFunctionsUC::throwError("Wrong xml file format: $filepath");
     
    13641363                    $sapParams["nodraw"] = UniteFunctionsUC::strToBool($nodraw);
    13651364                }
    1366 
    1367                 UniteFunctionsUC::validateNotEmpty($sapName,"sapName");
    1368 
     1365               
     1366                UniteFunctionsUC::validateNotEmpty($sapName,"name in fieldset attributes: $sapLabel");
     1367               
    13691368                if(!empty($loadFrom)){
    1370 
     1369                   
    13711370                    $this->addExternalSettings($loadFrom, $loadParam, $loadedSettingsType);
    13721371                    continue;
     
    16871686        private function addExternalSettings($filename, $loadParam = null, $loadType = null){
    16881687
    1689             $filepathSettings = GlobalsUC::$pathSettings."{$filename}.xml";
    1690 
     1688            $filepathSettings = GlobalsUnlimitedElements::$pathPluginSettings."{$filename}.xml";
     1689
     1690            if(file_exists($filepathSettings) == false)
     1691                $filepathSettings = GlobalsUC::$pathSettings."{$filename}.xml";
     1692           
    16911693            if(file_exists($filepathSettings) == false)
    16921694                UniteFunctionsUC::throwError("The file: {$filename}.xml don't found in settings folder");
  • unlimited-elements-for-elementor/trunk/inc_php/layouts/unitecreator_layout.class.php

    r3023498 r3097249  
    1616    protected $addonType = null, $arrAllOptionsCache = null;
    1717    protected $extraParams = array();   //extra params for link generate etc
    18     protected $objShapes, $layoutType, $isTemplate = false, $objLayouts;
     18    protected $layoutType, $isTemplate = false, $objLayouts;
    1919    protected $objLayoutType;
    2020   
     
    3232    public function __construct(){
    3333       
    34         $this->objShapes = new UniteShapeManagerUC();
    3534        $this->objLayouts = new UniteCreatorLayouts();
    3635       
     
    17371736     */
    17381737    public function modifySettings_collectSpecialAddonNames($settings, $elementType){
    1739        
    1740         $nameTop = $this->objShapes->getShapeDividerNameFromSettings($settings, "top");
    1741         if(!empty($nameTop))
    1742             $this->arrAddonNames[$nameTop."_".GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER] = GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER;
    1743        
    1744         $nameBottom = $this->objShapes->getShapeDividerNameFromSettings($settings, "bottom");
    1745         if(!empty($nameBottom))
    1746             $this->arrAddonNames[$nameBottom."_".GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER] = GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER;
    1747        
     1738               
    17481739       
    17491740        $bgAddonName = $this->getBGAddonNameFromSettings($settings);
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_actions.class.php

    r3076456 r3097249  
    584584
    585585                break;
    586                 case "get_shapes_css":
    587 
    588                     $objShapes = new UniteShapeManagerUC();
    589                     $objShapes->outputCssShapes();
    590                     exit;
    591                 break;
    592586                case "save_screenshot":
    593587
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_addon.class.php

    r3094530 r3097249  
    219219
    220220        UniteFunctionsUC::validateNotEmpty($id, "widget id");
    221 
     221       
     222        UniteFunctionsUC::validateNumeric($id,"widget id");
     223       
    222224        $id = (int)$id;
    223225
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_addons.class.php

    r3090199 r3097249  
    722722
    723723        foreach($arrAddons as $key => $addonID){
     724           
    724725            $addon = new UniteCreatorAddon();
    725726            $addon->initByID($addonID);
    726 
     727           
    727728            $addons[] = $addon;
    728729            $arrAddons[$key] = $addon->getID();
     
    996997     */
    997998    public function deleteAddonFromData($data){
    998 
     999       
    9991000        $addonID = UniteFunctionsUC::getVal($data, "addonID");
    10001001        UniteFunctionsUC::validateNotEmpty($addonID, "Widget ID");
    10011002
     1003        UniteFunctionsUC::validateNumeric($addonID,"widget id");
     1004       
    10021005        $addon = new UniteCreatorAddon();
    10031006        $addon->initByID($addonID);
    1004 
     1007       
     1008        $addonID = (int)$addonID;
     1009       
    10051010        $this->db->delete(GlobalsUC::$table_addons, "id={$addonID}");
    1006 
     1011       
    10071012        $addon->triggerAfterDeleteAction();
    10081013    }
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_categories.class.php

    r2541303 r3097249  
    853853    private function remove($catID){
    854854       
     855        $catID = UniteFunctionsUC::validateNumeric($catID,"category id");
     856       
    855857        $catID = (int)$catID;
    856858       
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_filters_process.class.php

    r3094530 r3097249  
    33 * @package Unlimited Elements
    44 * @author unlimited-elements.com
    5  * @copyright (C) 2021 Unlimited Elements, All Rights Reserved. 
     5 * @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
    66 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
    77 * */
     
    1111
    1212    const DEBUG_MAIN_QUERY = false;
    13    
     13
    1414    const DEBUG_FILTER = false;
    1515
    1616    const DEBUG_PARSED_TERMS = false;
    17    
     17
    1818    private static $showDebug = false;
    19    
     19
    2020    private static $filters = null;
    2121    private static $arrInputFiltersCache = null;
    2222    private static $arrFiltersAssocCache = null;
    23     private static $currentTermCache = null;   
     23    private static $currentTermCache = null;
    2424    private static $isModeInit = false;
    25    
     25
    2626    private static $isGutenberg = false;
    2727    private static $platform = false;
    2828    private static $objGutenberg = null;
    29    
     29
    3030    private static $isScriptAdded = false;
    3131    private static $isFilesAdded = false;
     
    3434    private static $isModeReplace = false;
    3535    private static $numTotalPosts;
    36    
     36
    3737    private static $originalQueryVars = null;
    3838    private $contentWidgetsDebug = array();
    39     private static $lastArgs = null;   
     39    private static $lastArgs = null;
    4040    private static $isUnderAjaxSearch = false;
    4141    public static $isUnderAjax = false;
    4242    private static $showEchoDebug = false;
    43    
     43
    4444    private $hasSelectedByRequest = false;
    4545    private $hasSelectedTerm = false;
    46    
    47    
     46
     47
    4848    const TYPE_TABS = "tabs";
    4949    const TYPE_SELECT = "select";
    5050    const TYPE_CHECKBOX = "checkbox";
    51    
     51
    5252    const ROLE_CHILD = "child";
    5353    const ROLE_TERM_CHILD = "term_child";
    54    
     54
    5555    private function _______SORT_FILTER_WIDGET_DATA__________(){}
    56    
     56
    5757    /**
    5858     * get sort filter data
     
    6161     */
    6262    public static function getSortFilterData($filterType, $params){
    63        
     63
    6464        //get fields
    65        
     65
    6666        $arrFields = UniteFunctionsUC::getVal($params, "fields");
    67        
     67
    6868        $arrFields = UniteFunctionsUC::getVal($arrFields, "fields_fields");
    69        
    70        
     69
     70
    7171        if(empty($arrFields))
    7272            $arrFields = array(
    7373                array("title"=>"Default","type"=>"default"),
    7474            );
    75        
     75
    7676        $isForWooProducts = false;
    7777        if($filterType == "woo")
    7878            $isForWooProducts = true;
    79        
     79
    8080        $arrWooTypes = array("sale_price","sales","rating");
    81        
     81
    8282        $output = array();
    83        
     83
    8484        $isEnableMeta = UniteFunctionsUC::getVal($params, "enable_meta");
    8585        $isEnableMeta = UniteFunctionsUC::strToBool($isEnableMeta);
    86        
     86
    8787        //find if the meta enabled - old way
    88        
     88
    8989        if($isEnableMeta == true){
    9090            $metaName = UniteFunctionsUC::getVal($params, "meta_name");
    91            
     91
    9292            $metaName = trim($metaName);
    93            
     93
    9494            if(empty($metaName))
    9595                $isEnableMeta = false;
    9696        }
    97        
     97
    9898        foreach($arrFields as $field){
    99            
     99
    100100            $title = UniteFunctionsUC::getVal($field, "title");
    101101            $type = UniteFunctionsUC::getVal($field, "type");
    102            
     102
    103103            //disable meta if not selected
    104            
     104
    105105            $typeForOutput = null;
    106            
     106
    107107            if($type == "meta"){
    108                
     108
    109109                $fieldMetaName = UniteFunctionsUC::getVal($field, "meta_name");
    110110                $fieldMetaType = UniteFunctionsUC::getVal($field, "meta_type");
    111                                
     111
    112112                if(empty($fieldMetaName) && $isEnableMeta == true){
    113113                    $fieldMetaName = $metaName;
    114114                }
    115                
     115
    116116                if(empty($fieldMetaName))
    117117                    continue;
    118                
     118
    119119                if(empty($fieldMetaType))
    120120                    continue;
    121121
    122122                $fieldMetaName = trim($fieldMetaName);
    123                
     123
    124124                $typeForOutput = "meta__{$fieldMetaName}__{$fieldMetaType}";
    125125            }
    126            
     126
    127127            //filter woo types
    128128            if($isForWooProducts == false&& in_array($type, $arrWooTypes) == true)
    129129                continue;
    130            
     130
    131131            if(!empty($typeForOutput))
    132132                $type = $typeForOutput;
    133            
     133
    134134            $output[$type] = $title;
    135135        }
    136        
    137        
     136
     137
    138138        return($output);
    139139    }
    140    
    141    
    142    
    143        
     140
     141
     142
     143
    144144    /**
    145145     * get fitler url from the given slugs
    146146     */
    147147    private function getUrlFilter_term($term, $taxonomyName){
    148        
     148
    149149        $key = "filter-term";
    150        
     150
    151151        $taxPrefix = $taxonomyName."--";
    152        
     152
    153153        if($taxonomyName == "category"){
    154154            $taxPrefix = "";
    155155            $key="filter-category";
    156156        }
    157        
     157
    158158        $slug = $term->slug;
    159159
    160160        $value = $taxPrefix.$slug;
    161        
     161
    162162        $urlAddition = "{$key}=".urlencode($value);
    163                
     163
    164164        $urlCurrent = GlobalsUC::$current_page_url;
    165                
     165
    166166        $url = UniteFunctionsUC::addUrlParams($urlCurrent, $urlAddition);
    167        
     167
    168168        return($url);
    169169    }
    170    
     170
    171171    /**
    172172     * check if the term is acrive
    173173     */
    174174    private function isTermActive($term, $arrActiveFilters = null){
    175        
     175
    176176        if(empty($term))
    177177            return(false);
    178        
     178
    179179        if($arrActiveFilters === null)
    180180            $arrActiveFilters = $this->getRequestFilters();
    181        
     181
    182182        if(empty($arrActiveFilters))
    183183            return(false);
    184        
     184
    185185        $taxonomy = $term->taxonomy;
    186        
     186
    187187        $selectedTermID = UniteFunctionsUC::getVal($arrActiveFilters, $taxonomy);
    188        
     188
    189189        if(empty($selectedTermID))
    190190            return(false);
    191            
     191
    192192        if($selectedTermID === $term->term_id)
    193193            return(true);
    194            
     194
    195195        return(false);
    196196    }
    197    
     197
    198198    /**
    199199     * get current term by query vars
    200200     */
    201201    private function getCurrentTermByQueryVars($queryVars){
    202        
     202
    203203        if(is_array($queryVars) == false)
    204204            return(null);
    205        
     205
    206206        if(empty($queryVars))
    207207            return(null);
    208            
     208
    209209        if(count($queryVars) > 1)
    210210            return(null);
    211        
     211
    212212        $postType = null;
    213213        if(isset($queryVars["post_type"])){
    214            
     214
    215215            $postType = $queryVars["post_type"];
    216216            unset($queryVars["post_type"]);
    217217        }
    218        
     218
    219219        $args = array();
    220220        if(!empty($postType))
    221221            $args["post_type"] = $postType;
    222        
     222
    223223        if(!empty($queryVars)){
    224224            $taxonomy = null;
    225225            $slug = null;
    226    
     226
    227227            foreach($queryVars as $queryTax=>$querySlug){
    228                            
     228
    229229                $taxonomy = $queryTax;
    230230                $slug = $querySlug;
    231231            }
    232            
     232
    233233            $args = array();
    234234            $args["taxonomy"] = $taxonomy;
    235             $args["slug"] = $slug;         
    236         }
    237 
    238        
     235            $args["slug"] = $slug;
     236        }
     237
     238
    239239        $arrTerms = get_terms($args);
    240        
     240
    241241        $isError = is_wp_error($arrTerms);
    242        
     242
    243243        if($isError == true){
    244244            if(self::$showDebug == true){
    245                
     245
    246246                dmp("error get terms");
    247247                dmp($args);
    248248                dmp($arrTerms);
    249249            }
    250            
     250
    251251            UniteFunctionsUC::throwError("cannot get the terms");
    252252        }
    253            
     253
    254254        if(empty($arrTerms))
    255255            return(null);
    256            
     256
    257257        $term = $arrTerms[0];
    258        
     258
    259259        return($term);
    260260    }
    261    
    262    
     261
     262
    263263    /**
    264264     * get current term
    265265     */
    266266    private function getCurrentTerm(){
    267        
     267
    268268        if(!empty(self::$currentTermCache))
    269269            return(self::$currentTermCache);
    270        
     270
    271271        if(is_archive() == false)
    272272            return(null);
    273        
     273
    274274        if(!empty(self::$originalQueryVars)){
    275            
     275
    276276            $currentTerm = $this->getCurrentTermByQueryVars(self::$originalQueryVars);
    277277        }else{
    278278            $currentTerm = get_queried_object();
    279            
    280            
    281            
     279
     280
     281
    282282            if($currentTerm instanceof WP_Term == false)
    283283                $currentTerm = null;
    284284        }
    285        
     285
    286286        self::$currentTermCache = $currentTerm;
    287        
     287
    288288        return($currentTerm);
    289289    }
    290    
     290
    291291    private function _______PARSE_INPUT_FILTERS__________(){}
    292    
     292
    293293    /**
    294294     * get request array
    295295     */
    296296    private function getArrRequest(){
    297        
     297
    298298        $request = $_GET;
    299299        if(!empty($_POST))
    300300            $request = array_merge($request, $_POST);
    301        
     301
    302302        return($request);
    303303    }
    304    
    305    
     304
     305
    306306
    307307    /**
     
    309309     */
    310310    private function parseStrTerms_groups($strValues){
    311        
     311
    312312        preg_match_all('/\|(.*?)\|/', $strValues, $matches);
    313313
    314314        if(empty($matches))
    315315            return(array());
    316            
     316
    317317        $arrGroups = $matches[0];
    318318        $arrGroupValues = $matches[1];
    319        
     319
    320320        $arrReplace = array();
    321        
     321
    322322        //break into groups
    323        
     323
    324324        foreach($arrGroups as $index => $group){
    325            
     325
    326326            $strReplace = "group".($index+1)."_".UniteFunctionsUC::getRandomString();
    327            
     327
    328328            $strGroupValues = $arrGroupValues[$index];
    329            
     329
    330330            $arrReplace[$strReplace] = $strGroupValues;
    331            
     331
    332332            $strValues = str_replace($group, $strReplace, $strValues);
    333333        }
    334        
     334
    335335        //get the array
    336        
     336
    337337        $arrValues = $this->parseStrTerms_values($strValues);
    338        
     338
    339339        foreach($arrValues as $key => $value){
    340            
     340
    341341            if(isset($arrReplace[$value])){
    342                
     342
    343343                $strGroupValue = $arrReplace[$value];
    344                
     344
    345345                $arrGroupValue = $this->parseStrTerms_values($strGroupValue);
    346        
     346
    347347                $arrGroupValue["relation"] = "OR";
    348                
     348
    349349                if(count($arrGroupValue) == 1)
    350350                    $arrGroupValue = $arrGroupValue[0];
    351                    
     351
    352352                $arrValues[$key] = $arrGroupValue;
    353353            }
    354            
    355         }
    356        
     354
     355        }
     356
    357357        $arrValues["relation"] = "AND";
    358        
     358
    359359        return($arrValues);
    360360    }
    361    
    362    
    363    
     361
     362
     363
    364364    /**
    365365     * parse the values
    366366     */
    367367    private function parseStrTerms_values($strValues){
    368        
     368
    369369        //get the groups instead
    370        
     370
    371371        if(strpos($strValues,"|") !== false){
    372            
     372
    373373            $arrValues = $this->parseStrTerms_groups($strValues);
    374            
     374
    375375            return($arrValues);
    376376        }
    377        
     377
    378378        $arrValues = explode(".", $strValues);
    379        
     379
    380380        $isTermsAnd = false;
    381381        foreach($arrValues as $valueKey=>$value){
     
    385385            }
    386386        }
    387        
     387
    388388        if($isTermsAnd == true)
    389389            $arrValues["relation"] = "AND";
    390        
     390
    391391        return($arrValues);
    392392    }
    393    
    394    
     393
     394
    395395    /**
    396396     * parse filters string
     
    399399
    400400        $arrUrlKeys = $this->getUrlPartsKeys();
    401        
     401
    402402        $taxSapSign = UniteFunctionsUC::getVal($arrUrlKeys, "tax_sap","~");
    403        
     403
    404404        $strFilters = trim($strFilters);
    405        
     405
    406406        $arrFilters = explode(";", $strFilters);
    407        
     407
    408408        //fill the terms
    409409        $arrTerms = array();
    410        
     410
    411411        foreach($arrFilters as $strFilter){
    412            
     412
    413413            $arrFilter = explode($taxSapSign, $strFilter);
    414            
     414
    415415            if(count($arrFilter) != 2)
    416416                continue;
    417            
     417
    418418            $key = $arrFilter[0];
    419419            $strValues = $arrFilter[1];
    420            
     420
    421421            $arrValues = $this->parseStrTerms_values($strValues);
    422            
     422
    423423            $arrTerms[$key] = $arrValues;
    424            
    425         }
    426        
    427        
     424
     425        }
     426
     427
    428428        //show debug terms
    429        
     429
    430430        if(self::DEBUG_PARSED_TERMS == true){
    431            
     431
    432432            dmp("parsed terms");
    433433            dmp($arrTerms);
    434434            exit();
    435435        }
    436        
    437        
     436
     437
    438438        $arrOutput = array();
    439        
     439
    440440        if(!empty($arrTerms))
    441441            $arrOutput[self::TYPE_TABS] = $arrTerms;
    442        
    443            
     442
     443
    444444        return($arrOutput);
    445445    }
    446    
     446
    447447    /**
    448448     * get orderby input filter
    449449     */
    450450    private function getArrInputFilters_getOrderby($arrOutput, $request){
    451        
     451
    452452        $orderby = UniteFunctionsUC::getVal($request, "ucorderby");
    453453        $orderby = UniteProviderFunctionsUC::sanitizeVar($orderby, UniteFunctionsUC::SANITIZE_KEY);
    454        
     454
    455455        if(empty($orderby))
    456456            return($arrOutput);
    457            
     457
    458458        //check if valid
    459459        $arrOrderby = UniteFunctionsWPUC::getArrSortBy(true);
    460            
     460
    461461        if($orderby == "id")
    462462            $orderby = "ID";
    463        
     463
    464464        if(is_string($orderby) && isset($arrOrderby[$orderby]))
    465465            $arrOutput["orderby"] = $orderby;
     
    467467        //meta old name
    468468        if($orderby == "meta"){
    469            
     469
    470470            $orderbyMeta = UniteFunctionsUC::getVal($request, "ucorderby_meta");
    471471            $orderbyMeta = UniteProviderFunctionsUC::sanitizeVar($orderbyMeta, UniteFunctionsUC::SANITIZE_KEY);
    472            
     472
    473473            $orderbyMetaType = UniteFunctionsUC::getVal($request, "ucorderby_metatype");
    474474            $orderbyMetaType = UniteProviderFunctionsUC::sanitizeVar($orderbyMetaType, UniteFunctionsUC::SANITIZE_KEY);
    475                        
     475
    476476            if(!empty($orderbyMeta)){
    477477                $arrOutput["orderby"] = $orderby;
    478478                $arrOutput["orderby_metaname"] = $orderbyMeta;
    479479            }
    480            
     480
    481481            if(!empty($orderbyMetaType))
    482482                $arrOutput["orderby_metatype"] = $orderbyMetaType;
    483            
     483
    484484        }
    485485
    486486        //meta new way
    487        
     487
    488488        if(strpos($orderby, "meta__") === false)
    489489            return($arrOutput);
    490        
     490
    491491        $arrMeta = explode("__", $orderby);
    492492
    493493        if(count($arrMeta) != 3)
    494494            return($arrOutput);
    495        
     495
    496496        $orderby = $arrMeta[0];
    497497        $metaName = $arrMeta[1];
    498498        $metaType = $arrMeta[2];
    499        
     499
    500500        if($orderby != "meta")
    501501            return($arrOutput);
    502        
     502
    503503        $arrOutput["orderby"] = $orderby;
    504504        $arrOutput["orderby_metaname"] = $metaName;
    505505        $arrOutput["orderby_metatype"] = $metaType;
    506        
    507        
     506
     507
    508508        return($arrOutput);
    509509    }
    510    
    511    
     510
     511
    512512    /**
    513513     * get filters array from input
    514514     */
    515515    private function getArrInputFilters(){
    516        
     516
    517517        if(!empty(self::$arrInputFiltersCache))
    518518            return(self::$arrInputFiltersCache);
    519        
     519
    520520        $request = $this->getArrRequest();
    521        
     521
    522522        $strTerms = UniteFunctionsUC::getVal($request, "ucterms");
    523                
     523
    524524        $arrOutput = array();
    525        
     525
    526526        //parse filters
    527        
     527
    528528        if(!empty($strTerms)){
    529529            if(self::$showDebug == true)
    530530                dmp("input filters found: $strTerms");
    531            
     531
    532532            $arrOutput = $this->parseStrTerms($strTerms);
    533533        }
    534                
     534
    535535        //page
    536        
     536
    537537        $page = UniteFunctionsUC::getVal($request, "ucpage");
    538538        $page = (int)$page;
    539        
     539
    540540        if(!empty($page))
    541541            $arrOutput["page"] = $page;
    542        
     542
    543543        //offset
    544544        $offset = UniteFunctionsUC::getVal($request, "ucoffset");
    545545        $offset = (int)$offset;
    546        
     546
    547547        if(!empty($offset))
    548548            $arrOutput["offset"] = $offset;
    549        
     549
    550550        //num items
    551            
     551
    552552        $numItems = UniteFunctionsUC::getVal($request, "uccount");
    553553        $numItems = (int)$numItems;
    554        
     554
    555555        if(!empty($numItems))
    556556            $arrOutput["num_items"] = $numItems;
    557        
     557
    558558        //search
    559559        $search = UniteFunctionsUC::getVal($request, "ucs");
    560        
     560
    561561        if(!empty($search))
    562562            $arrOutput["search"] = $search;
    563        
     563
    564564        //price
    565        
     565
    566566        $priceFrom = UniteFunctionsUC::getVal($request, "ucpricefrom");
    567567        $priceTo = UniteFunctionsUC::getVal($request, "ucpriceto");
    568        
     568
    569569        if(!empty($priceFrom))
    570570            $arrOutput["price_from"] = $priceFrom;
    571        
     571
    572572        if(!empty($priceTo))
    573573            $arrOutput["price_to"] = $priceTo;
    574        
    575        
     574
     575
    576576        //exclude
    577577        $exclude = UniteFunctionsUC::getVal($request, "ucexclude");
    578578        $exclude = UniteProviderFunctionsUC::sanitizeVar($exclude, UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    579        
     579
    580580        if(!empty($exclude)){
    581            
     581
    582582            $isValid = UniteFunctionsUC::isValidIDsList($exclude);
    583            
     583
    584584            if($isValid == true)
    585585                $arrOutput["exclude"] = $exclude;
    586586        }
    587        
     587
    588588        //orderby
    589        
     589
    590590        $arrOutput = $this->getArrInputFilters_getOrderby($arrOutput, $request);
    591        
    592        
     591
     592
    593593        //orderdir
    594        
     594
    595595        $orderDir = UniteFunctionsUC::getVal($request, "ucorderdir");
    596        
     596
    597597        if($orderDir == "asc" || $orderDir == "desc")
    598598            $arrOutput["orderdir"] = $orderDir;
    599        
    600        
     599
     600
    601601        self::$arrInputFiltersCache = $arrOutput;
    602        
    603        
     602
     603
    604604        return($arrOutput);
    605605    }
    606    
    607    
    608    
     606
     607
     608
    609609    /**
    610610     * get filters arguments
    611611     */
    612612    public function getRequestFilters(){
    613        
     613
    614614        if(self::$filters !== null)
    615615            return(self::$filters);
    616        
     616
    617617        self::$filters = array();
    618        
     618
    619619        $arrInputFilters = $this->getArrInputFilters();
    620        
     620
    621621        if(empty($arrInputFilters))
    622622            return(self::$filters);
    623        
     623
    624624        $arrTerms = UniteFunctionsUC::getVal($arrInputFilters, self::TYPE_TABS);
    625        
     625
    626626        if(!empty($arrTerms))
    627627            self::$filters["terms"] = $arrTerms;
    628                    
     628
    629629        //get the page
    630        
     630
    631631        $page = UniteFunctionsUC::getVal($arrInputFilters, "page");
    632        
     632
    633633        if(!empty($page) && is_numeric($page))
    634634            self::$filters["page"] = $page;
    635        
     635
    636636        //get the offset
    637        
     637
    638638        $offset = UniteFunctionsUC::getVal($arrInputFilters, "offset");
    639        
     639
    640640        if(!empty($offset) && is_numeric($offset))
    641641            self::$filters["offset"] = $offset;
    642        
    643        
     642
     643
    644644        //get num items
    645645        $numItems = UniteFunctionsUC::getVal($arrInputFilters, "num_items");
    646        
     646
    647647        if(!empty($numItems) && is_numeric($numItems))
    648648            self::$filters["num_items"] = $numItems;
    649        
     649
    650650        //get search
    651651        $search = UniteFunctionsUC::getVal($arrInputFilters, "search");
    652        
     652
    653653        if(!empty($search))
    654654            self::$filters["search"] = $search;
    655        
     655
    656656        //get exclude
    657657        $exclude = UniteFunctionsUC::getVal($arrInputFilters, "exclude");
    658        
     658
    659659        if(!empty($exclude))
    660660            self::$filters["exclude"] = $exclude;
    661        
     661
    662662        //get orderby
    663663        $orderby = UniteFunctionsUC::getVal($arrInputFilters, "orderby");
    664        
     664
    665665        if(!empty($orderby)){
    666                        
     666
    667667            self::$filters["orderby"] = $orderby;
    668            
     668
    669669            if($orderby == "meta"){
    670670                self::$filters["orderby_metaname"] = UniteFunctionsUC::getVal($arrInputFilters, "orderby_metaname");
     
    672672            }
    673673        }
    674        
     674
    675675        //get orderdir
    676676        $orderdir = UniteFunctionsUC::getVal($arrInputFilters, "orderdir");
     
    678678        if(!empty($orderdir))
    679679            self::$filters["orderdir"] = $orderdir;
    680        
     680
    681681        //price
    682        
     682
    683683        $priceFrom = UniteFunctionsUC::getVal($arrInputFilters, "price_from");
    684684        $priceTo = UniteFunctionsUC::getVal($arrInputFilters, "price_to");
    685        
     685
    686686        if(!empty($priceFrom) && is_numeric($priceFrom))
    687687            self::$filters["price_from"] = $priceFrom;
    688        
     688
    689689        if(!empty($priceTo) && is_numeric($priceTo))
    690690            self::$filters["price_to"] = $priceTo;
    691        
    692        
     691
     692
    693693        return(self::$filters);
    694694    }
    695    
    696    
     695
     696
    697697    private function _______FILTER_ARGS__________(){}
    698    
    699    
     698
     699
    700700    /**
    701701     * get offset
    702702     */
    703703    private function processRequestFilters_setPaging($args, $page, $numItems){
    704        
    705         if(empty($page))   
     704
     705        if(empty($page))
    706706            return(null);
    707        
     707
    708708        $perPage = UniteFunctionsUC::getVal($args, "posts_per_page");
    709        
     709
    710710        if(empty($perPage))
    711711            return($args);
    712        
     712
    713713        $offset = null;
    714714        $postsPerPage = null;
    715        
     715
    716716        //set posts per page and offset
    717717        if(!empty($numItems) && $page > 1){
    718            
     718
    719719            if($page == 2)
    720720                $offset = $perPage;
    721721            else if($page > 2)
    722722                $offset = $perPage+($page-2)*$numItems;
    723            
     723
    724724            $postsPerPage = $numItems;
    725                
     725
    726726        }else{  //no num items
    727727            $offset = ($page-1)*$perPage;
    728728        }
    729            
     729
    730730        if(!empty($offset))
    731731            $args["offset"] = $offset;
    732        
     732
    733733        if(!empty($postsPerPage))
    734734            $args["posts_per_page"] = $postsPerPage;
    735        
     735
    736736        return($args);
    737737    }
    738    
     738
    739739    /**
    740740     * get tax query from terms array
    741741     */
    742742    private function getTaxQuery($arrTax){
    743        
     743
    744744        $arrQuery = array();
    745        
     745
    746746        foreach($arrTax as $taxonomy=>$arrTerms){
    747            
     747
    748748            $relation = UniteFunctionsUC::getVal($arrTerms, "relation");
    749            
     749
    750750            if($relation == "AND"){     //multiple
    751                
     751
    752752                unset($arrTerms["relation"]);
    753                
     753
    754754                foreach($arrTerms as $term){
    755                    
     755
    756756                    $item = array();
    757757                    $item["taxonomy"] = $taxonomy;
    758758                    $item["field"] = "slug";
    759759                    $item["terms"] = $term;
    760                
     760
    761761                    $arrQuery[] = $item;
    762762                }
    763                
     763
    764764            }else{      //single  (or)
    765                
     765
    766766                $item = array();
    767767                $item["taxonomy"] = $taxonomy;
    768768                $item["field"] = "slug";
    769769                $item["terms"] = $arrTerms;
    770            
     770
    771771                $arrQuery[] = $item;
    772772            }
    773                                    
    774         }
    775        
     773
     774        }
     775
    776776        $arrQuery["relation"] = "AND";
    777        
     777
    778778        return($arrQuery);
    779779    }
    780    
     780
    781781    /**
    782782     * remove "not in" tax query
    783783     */
    784784    private function keepNotInTaxQuery($arrTaxQuery){
    785        
     785
    786786        if(empty($arrTaxQuery))
    787787            return(null);
    788            
     788
    789789        $arrNew = array();
    790        
     790
    791791        foreach($arrTaxQuery as $tax){
    792            
     792
    793793            if(isset($tax["operator"])){
    794794                $arrNew[] = $tax;
    795795                continue;
    796796            }
    797            
     797
    798798            $operator = UniteFunctionsUC::getVal($tax, "operator");
    799799            if($operator == "NOT IN")
    800800                $arrNew[] = $tax;
    801801        }
    802        
     802
    803803        return($arrNew);
    804804    }
    805    
    806    
     805
     806
    807807    /**
    808808     * set arguments tax query, merge with existing if avaliable
    809809     */
    810810    private function setArgsTaxQuery($args, $arrTaxQuery){
    811        
     811
    812812        if(empty($arrTaxQuery))
    813813            return($args);
    814        
     814
    815815        $existingTaxQuery = UniteFunctionsUC::getVal($args, "tax_query");
    816        
     816
    817817        //if replace terms mode - just delete the existing tax query
    818818        if(self::$isModeReplace == true){
    819819            $existingTaxQuery = $this->keepNotInTaxQuery($existingTaxQuery);
    820820        }
    821        
     821
    822822        if(empty($existingTaxQuery)){
    823            
     823
    824824            $args["tax_query"] = $arrTaxQuery;
    825                        
     825
    826826            return($args);
    827827        }
    828                
     828
    829829        $newTaxQuery = array(
    830             $existingTaxQuery, 
     830            $existingTaxQuery,
    831831            $arrTaxQuery
    832832        );
    833        
     833
    834834        $newTaxQuery["relation"] = "AND";
    835        
    836        
     835
     836
    837837        $args["tax_query"] = $newTaxQuery;
    838        
     838
    839839        return($args);
    840840    }
    841    
    842    
     841
     842
    843843    /**
    844844     * process request filters
    845845     */
    846846    public function processRequestFilters($args, $isFilterable, $isMainQuery = false){
    847        
     847
    848848        //allow all ajax, forbid under request and not filterable.
    849        
     849
    850850        if($isFilterable == false)
    851851            return($args);
    852                    
     852
    853853        $arrFilters = $this->getRequestFilters();
    854        
     854
    855855        $arrMetaQuery = array();
    856        
     856
    857857        //---- set offset and count ----
    858        
     858
    859859        $page = UniteFunctionsUC::getVal($arrFilters, "page");
    860860        $numItems = UniteFunctionsUC::getVal($arrFilters, "num_items");
     
    866866        $priceFrom = UniteFunctionsUC::getVal($arrFilters, "price_from");
    867867        $priceTo = UniteFunctionsUC::getVal($arrFilters, "price_to");
    868        
    869        
     868
     869
    870870        if(!empty($page))
    871871            $args = $this->processRequestFilters_setPaging($args, $page, $numItems);
    872        
     872
    873873        //set paging by offset
    874874        if(!empty($offset))
    875875            $args["offset"] = $offset;
    876        
     876
    877877        if(!empty($numItems))
    878878            $args["posts_per_page"] = $numItems;
    879        
     879
    880880        //search
    881881        if(!empty($search) && $search != "_all_"){
    882882            $args["s"] = $search;
    883883        }
    884        
     884
    885885        //orderby
    886886        if(!empty($orderby) && $orderby != "default"){
    887            
     887
    888888            $args["orderby"] = $orderby;
    889            
     889
    890890            if($orderby == "meta"){
    891                
     891
    892892                $metaName = UniteFunctionsUC::getVal($arrFilters, "orderby_metaname");
    893893                $metaType = UniteFunctionsUC::getVal($arrFilters, "orderby_metatype");
    894                
     894
    895895                if(!empty($metaName)){
    896                    
     896
    897897                    if($metaType == "number")
    898898                        $args["orderby"] = "meta_value_num";
    899899                    else
    900900                        $args["orderby"] = "meta_value";
    901                        
     901
    902902                    $args["meta_key"] = $metaName;
    903                    
     903
    904904                }
    905                                
    906             }
    907            
     905
     906            }
     907
    908908            if($orderby == UniteFunctionsWPUC::SORTBY_PRICE){
    909909                $args["orderby"] = "meta_value_num";
    910910                $args["meta_key"] = "_price";
    911911            }
    912            
     912
    913913            if($orderby == UniteFunctionsWPUC::SORTBY_SALE_PRICE){
    914914                $args["orderby"] = "meta_value_num";
    915915                $args["meta_key"] = "_sale_price";
    916916            }
    917            
    918         }
    919        
     917
     918        }
     919
    920920        //orderdir
    921921        if(!empty($orderdir) && $orderdir != "default"){
    922922            $args["order"] = strtoupper($orderdir);
    923923        }
    924        
    925        
     924
     925
    926926        $arrTerms = UniteFunctionsUC::getVal($arrFilters, "terms");
    927927        if(!empty($arrTerms)){
    928            
     928
    929929            //combine the tax queries
    930930            $arrTaxQuery = $this->getTaxQuery($arrTerms);
    931            
     931
    932932            if(!empty($arrTaxQuery))
    933933                $args = $this->setArgsTaxQuery($args, $arrTaxQuery);
    934934        }
    935        
     935
    936936        //exclude
    937937        if(!empty($exclude)){
    938            
     938
    939939            $arrExclude = explode(",", $exclude);
    940            
     940
    941941            $arrExclude = array_unique($arrExclude);
    942            
     942
    943943            $arrNotIn = UniteFunctionsUC::getVal($args, "post__not_in");
    944            
     944
    945945            if(empty($arrNotIn))
    946946                $arrNotIn = array();
    947                
     947
    948948            $arrNotIn = array_merge($arrNotIn, $arrExclude);
    949            
     949
    950950            $args["post__not_in"] = $arrExclude;
    951            
    952         }
    953        
     951
     952        }
     953
    954954        //supress all filters
    955955        if(self::$isUnderAjaxSearch == true){
    956            
     956
    957957            $args["suppress_filters"] = true;
    958            
     958
    959959            //delete all filters in case of ajax search
    960            
     960
    961961            UniteCreatorAjaxSeach::supressThirdPartyFilters();
    962            
    963         }
    964        
     962
     963        }
     964
    965965        //Woo Prices
    966        
     966
    967967        if(!empty($priceFrom)){
    968            
     968
    969969            $arrMetaQuery[] = array(
    970970                'key' => '_price',
     
    974974            );
    975975        }
    976        
     976
    977977        if(!empty($priceTo)){
    978            
     978
    979979            $arrMetaQuery[] = array(
    980980                'key' => '_price',
     
    985985        }
    986986
    987        
     987
    988988        //set the meta query
    989        
     989
    990990        if(!empty($arrMetaQuery)){
    991            
     991
    992992            $arrExistingMeta = UniteFunctionsUC::getVal($args, "meta_query",array());
    993                        
     993
    994994            $args["meta_query"] = array_merge($arrExistingMeta, $arrMetaQuery);
    995995        }
    996996
    997        
     997
    998998        if(self::$showDebug == true){
    999            
     999
    10001000            dmp("args:");
    10011001            dmp($args);
    1002            
     1002
    10031003            dmp("filters:");
    10041004            dmp($arrFilters);
    10051005        }
    1006        
     1006
    10071007        return($args);
    10081008    }
    10091009
    1010    
     1010
    10111011    private function _______AJAX__________(){}
    1012    
     1012
    10131013    /**
    10141014     * get addon post list name
    10151015     */
    10161016    private function getAddonPostListName($addon){
    1017        
     1017
    10181018        $paramPostList = $addon->getParamByType(UniteCreatorDialogParam::PARAM_POSTS_LIST);
    1019                
     1019
    10201020        $postListName = UniteFunctionsUC::getVal($paramPostList, "name");
    1021        
     1021
    10221022        return($postListName);
    10231023    }
    1024    
    1025    
     1024
     1025
    10261026    /**
    10271027     * validate if the addon ajax ready
     
    10291029     */
    10301030    private function validateAddonAjaxReady($addon, $arrSettingsValues){
    1031        
     1031
    10321032        $paramPostList = $addon->getParamByType(UniteCreatorDialogParam::PARAM_POSTS_LIST);
    1033        
     1033
    10341034        $paramListing = $addon->getListingParamForOutput();
    1035        
     1035
    10361036        if(empty($paramPostList) && !empty($paramListing))
    10371037            $paramPostList = $paramListing;
    1038            
     1038
    10391039        if(empty($paramPostList))
    10401040            UniteFunctionsUC::throwError("Widget not ready for ajax");
    1041        
     1041
    10421042        $postListName = UniteFunctionsUC::getVal($paramPostList, "name");
    1043        
     1043
    10441044        //check for ajax search
    10451045        $options = $addon->getOptions();
    10461046        $special = UniteFunctionsUC::getVal($options, "special");
    1047        
     1047
    10481048        if($special === "ajax_search")
    10491049            return($postListName);
    1050        
    1051        
     1050
     1051
    10521052        $isAjaxReady = UniteFunctionsUC::getVal($arrSettingsValues, $postListName."_isajax");
    10531053        $isAjaxReady = UniteFunctionsUC::strToBool($isAjaxReady);
    1054        
     1054
    10551055        if($isAjaxReady == false)
    10561056            UniteFunctionsUC::throwError("The ajax is not ready for this widget");
    1057            
     1057
    10581058        return($postListName);
    10591059    }
    1060    
    1061    
     1060
     1061
    10621062    /**
    10631063     * process the html output - convert all the links, remove the query part
     
    10661066
    10671067        $currentUrl = GlobalsUC::$current_page_url;
    1068        
     1068
    10691069        $arrUrl = parse_url($currentUrl);
    1070        
     1070
    10711071        $query = "?".UniteFunctionsUC::getVal($arrUrl, "query");
    1072                
     1072
    10731073        $html = str_replace($query, "", $html);
    1074        
     1074
    10751075        $query = str_replace("&", "&", $query);
    1076        
     1076
    10771077        $html = str_replace($query, "", $html);
    10781078
    10791079        return($html);
    10801080    }
    1081    
     1081
    10821082    /**
    10831083     * modify settings values before set to addon
     
    10851085     */
    10861086    private function modifySettingsValues($arrSettingsValues, $postListName){
    1087        
     1087
    10881088        $paginationType = UniteFunctionsUC::getVal($arrSettingsValues, "pagination_type");
    1089        
     1089
    10901090        if(!empty($paginationType))
    10911091            $arrSettingsValues[$postListName."_pagination_type"] = $paginationType;
    10921092
    1093         return($arrSettingsValues);         
    1094     }
     1093        return($arrSettingsValues);
     1094    }
     1095
     1096
     1097    /**
     1098     * get content element html
     1099     */
     1100    private function getContentWidgetHtml($arrContent, $elementID, $isGrid = true){
    10951101   
    1096    
    1097     /**
    1098      * get content element html
    1099      */
    1100     private function getContentWidgetHtml($arrContent, $elementID, $isGrid = true){
    1101        
    11021102        if(self::$isGutenberg == false)
    11031103            $arrElement = HelperProviderCoreUC_EL::getArrElementFromContent($arrContent, $elementID);
    11041104        else
    1105             $arrElement = self::$objGutenberg->getBlockByRootID($arrContent, $elementID);
     1105            $arrElement = self::$objGutenberg->getBlockByRootId($arrContent, $elementID);
    11061106       
    11071107        if(empty($arrElement)){
    1108            
     1108
    11091109            UniteFunctionsUC::throwError(self::$platform." Widget with id: $elementID not found");
    11101110        }
    1111        
    1112        
     1111
     1112
    11131113        //Elementor Validations
    1114        
     1114
    11151115        if(self::$isGutenberg == false){
    1116            
     1116
    11171117            $type = UniteFunctionsUC::getVal($arrElement, "elType");
    1118            
     1118
    11191119            if($type != "widget")
    11201120                UniteFunctionsUC::throwError("The element is not a widget");
    1121            
     1121
    11221122            $widgetType = UniteFunctionsUC::getVal($arrElement, "widgetType");
    1123            
     1123
    11241124            if(strpos($widgetType, "ucaddon_") === false){
    1125                
     1125
    11261126                if($widgetType == "global")
    11271127                    UniteFunctionsUC::throwError("Ajax filtering doesn't work with global widgets. Please change the grid to regular widget.");
    1128                
     1128
    11291129                UniteFunctionsUC::throwError("Cannot output widget content for widget: $widgetType");
    11301130            }
    1131        
    1132         }
    1133        
     1131
     1132        }
     1133
    11341134        //get settings values
    1135        
     1135
    11361136        if(self::$isGutenberg == false)
    11371137            $arrSettingsValues = UniteFunctionsUC::getVal($arrElement, "settings");
     
    11391139            $arrSettingsValues = self::$objGutenberg->getSettingsFromBlock($arrElement);
    11401140
    1141            
     1141
    11421142        //init addon
    1143        
     1143
    11441144        $addon = new UniteCreatorAddon();
    1145            
     1145
    11461146        if(self::$isGutenberg == false){        //init in elementor
    1147            
     1147
    11481148            $widgetName = str_replace("ucaddon_", "", $widgetType);
    11491149            $addon->initByAlias($widgetName, GlobalsUC::ADDON_TYPE_ELEMENTOR);
    1150            
     1150
    11511151        }else{      //init in gutenberg
    1152            
     1152
    11531153            $blockName = UniteFunctionsUC::getVal($arrElement, "blockName");
    11541154            $addon->initByBlockName($blockName, GlobalsUC::ADDON_TYPE_ELEMENTOR);
    11551155        }
    1156                    
    1157        
     1156
     1157
    11581158        //make a check that ajax option is on in this widget
    1159        
     1159
    11601160        if($isGrid == true){
    1161            
     1161
    11621162            $postListName = $this->validateAddonAjaxReady($addon, $arrSettingsValues);
    1163            
     1163
    11641164            $arrSettingsValues = $this->modifySettingsValues($arrSettingsValues, $postListName);
    11651165        }
    1166        
     1166
    11671167        $addon->setParamsValues($arrSettingsValues);
    1168        
    1169        
     1168
     1169
    11701170        //init the ajax search object to modify the post search list, if available
    11711171        if(GlobalsProviderUC::$isUnderAjaxSearch){
    1172            
     1172
    11731173            $objAjaxSearch = new UniteCreatorAjaxSeach();
    11741174            $objAjaxSearch->initCustomAjaxSeach($addon);
    11751175        }
    1176        
     1176
    11771177        //------ get the html output
    1178                
     1178
    11791179        //collect the debug html
    11801180        if(self::$showDebug == false)
    11811181            ob_start();
    1182        
     1182
    11831183        $objOutput = new UniteCreatorOutput();
    1184        
     1184
    11851185        $isDebugFromGet = HelperUC::hasPermissionsFromQuery("ucfieldsdebug");
    1186        
     1186
    11871187        if($isDebugFromGet == true)
    11881188            $objOutput->showDebugData(true);
     
    11911191
    11921192        if($isDebugFromGet == true){
    1193            
     1193
    11941194            HelperProviderUC::showLastQueryPosts();
    1195            
     1195
    11961196            dmp("End Here");
    11971197            exit();
    11981198        }
    1199        
     1199
    12001200        if(self::$showDebug == false){
    12011201            $htmlDebug = ob_get_contents();
    1202            
     1202
    12031203            ob_end_clean();
    12041204        }
    12051205
    1206        
     1206
    12071207        $output = array();
    1208        
     1208
    12091209        //get only items
    12101210        if($isGrid == true){
    1211                        
     1211
    12121212            $arrHtml = $objOutput->getHtmlItems();
    1213            
     1213
    12141214            $output["html"] = UniteFunctionsUC::getVal($arrHtml, "html_items1");
    12151215            $output["html2"] = UniteFunctionsUC::getVal($arrHtml, "html_items2");
    1216            
     1216
    12171217            $output["uc_id"] = $objOutput->getWidgetID();
    1218            
    1219            
     1218
     1219
    12201220        }else{      //not a grid - output of html template
    12211221
    12221222            $htmlBody = $objOutput->getHtmlOnly();
    1223            
     1223
    12241224            $htmlBody = $this->processAjaxHtmlOutput($htmlBody);
    1225            
     1225
    12261226            $output["html"] = $htmlBody;
    12271227        }
    1228        
    1229        
     1228
     1229
    12301230        if(!empty($htmlDebug))
    12311231            $output["html_debug"] = $htmlDebug;
    1232        
     1232
    12331233        return($output);
    12341234    }
    1235    
    1236    
     1235
     1236
    12371237    /**
    12381238     * get content widgets html
    12391239     */
    12401240    private function getContentWidgetsHTML($arrContent, $strIDs, $isGrid = false){
    1241        
     1241
    12421242        if(empty($strIDs))
    12431243            return(null);
    1244        
     1244
    12451245        $arrIDs = explode(",", $strIDs);
    1246        
     1246
    12471247        $arrHTML = array();
    1248        
     1248
    12491249        $this->contentWidgetsDebug = array();
    1250        
     1250
    12511251        foreach($arrIDs as $elementID){
    1252            
     1252
    12531253            $output = $this->getContentWidgetHtml($arrContent, $elementID, $isGrid);
    1254            
     1254
    12551255            $htmlDebug = UniteFunctionsUC::getVal($output, "html_debug");
    1256            
     1256
    12571257            $html = UniteFunctionsUC::getVal($output, "html");
    12581258            $html2 = UniteFunctionsUC::getVal($output, "html2");
    1259            
     1259
    12601260            //collect the debug
    12611261            if(!empty($htmlDebug))
    12621262                $this->contentWidgetsDebug[$elementID] = $htmlDebug;
    1263            
     1263
    12641264            if($isGrid == false){
    12651265                $arrHTML[$elementID] = $html;
    12661266                continue;
    12671267            }
    1268            
     1268
    12691269            //if case of grid
    1270                        
    1271            
     1270
     1271
    12721272            $arrOutput = array();
    12731273            $arrOutput["html_items"] = $html;
    1274            
     1274
    12751275            if(!empty($html2))
    12761276                $arrOutput["html_items2"] = $html2;
    1277            
     1277
    12781278            $arrHTML[$elementID] = $arrOutput;
    1279            
    1280         }
    1281        
     1279
     1280        }
     1281
    12821282        return($arrHTML);
    12831283    }
    12841284
    1285    
     1285
    12861286    /**
    12871287     * get init filtres taxonomy request
    12881288     */
    12891289    private function getInitFiltersTaxRequest($request, $strTestIDs){
    1290        
     1290
    12911291        if(strpos($request, "WHERE 1=2") !== false)
    12921292            return(null);
    1293        
     1293
    12941294        $posLimit = strpos($request, "LIMIT");
    1295        
     1295
    12961296        if($posLimit){
    12971297            $request = substr($request, 0, $posLimit-1);
    12981298            $request = trim($request);
    12991299        }
    1300        
     1300
    13011301        //remove the calc found rows
    1302        
     1302
    13031303        $request = str_replace("SQL_CALC_FOUND_ROWS", "", $request);
    1304        
     1304
    13051305        $prefix = UniteProviderFunctionsUC::$tablePrefix;
    1306        
     1306
    13071307        $request = str_replace($prefix."posts.*", $prefix."posts.id", $request);
    1308        
    1309         //wrap it in get term id's request 
    1310                
     1308
     1309        //wrap it in get term id's request
     1310
    13111311        $arrTermIDs = explode(",", $strTestIDs);
    1312        
     1312
    13131313        if(empty($arrTermIDs))
    13141314            return(null);
    1315            
     1315
    13161316        $selectTerms = "";
    13171317        $selectTop = "";
    1318        
     1318
    13191319        $query = "SELECT \n";
    1320        
     1320
    13211321        foreach($arrTermIDs as $termID){
    1322            
     1322
    13231323            if(!empty($selectTerms)){
    13241324                $selectTerms .= ",\n";
    13251325                $selectTop .= ",\n";
    13261326            }
    1327            
     1327
    13281328            $name = "term_$termID";
    1329            
     1329
    13301330            $selectTerms .= "SUM(if(tt.`parent` = $termID OR tt.`term_id` = $termID, 1, 0)) AS $name";
    1331            
     1331
    13321332            $selectTop .= "SUM(if($name > 0, 1, 0)) as $name";
    1333            
    1334         }
    1335        
     1333
     1334        }
     1335
    13361336        $query .= $selectTerms;
    1337        
     1337
    13381338        $sql = "
    13391339            FROM `{$prefix}posts` p
     
    13431343                ({$request}) \n
    13441344            GROUP BY p.`id`";
    1345        
     1345
    13461346        $query .= $sql;
    1347                
     1347
    13481348        $fullQuery = "SELECT $selectTop from($query) as summary";
    13491349
    1350                
     1350
    13511351        return($fullQuery);
    13521352    }
    1353    
    1354    
     1353
     1354
    13551355
    13561356    /**
     
    13581358     */
    13591359    private function modifyFoundTermsIDs($arrFoundTermIDs){
    1360        
     1360
    13611361        if(isset($arrFoundTermIDs[0]))
    13621362            $arrFoundTermIDs = $arrFoundTermIDs[0];
    1363        
     1363
    13641364        $arrTermsAssoc = array();
    1365        
     1365
    13661366        foreach($arrFoundTermIDs as $strID=>$count){
    13671367
    13681368            $termID = str_replace("term_", "", $strID);
    1369            
     1369
    13701370            $arrTermsAssoc[$termID] = $count;
    13711371        }
    1372        
     1372
    13731373        return($arrTermsAssoc);
    13741374    }
    1375    
    1376    
     1375
     1376
    13771377    /**
    13781378     * get widget ajax data
    13791379     */
    13801380    private function putWidgetGridFrontAjaxData(){
    1381        
     1381
    13821382        //validate by response code
    1383                
     1383
    13841384        $responseCode = http_response_code();
    1385        
     1385
    13861386        if($responseCode != 200){
    13871387            http_response_code(200);
    13881388            UniteFunctionsUC::throwError("Request not allowed, please make sure the ajax is allowed for the ajax grid");
    13891389        }
    1390        
     1390
    13911391        //init widget by post id and element id
    1392        
     1392
    13931393        self::$platform = UniteFunctionsUC::getPostGetVariable("platform","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    1394        
     1394
    13951395        self::$isGutenberg = (self::$platform == "gutenberg");
    1396        
    1397                
     1396
     1397
    13981398        $layoutID = UniteFunctionsUC::getPostGetVariable("layoutid","",UniteFunctionsUC::SANITIZE_KEY);
    13991399        $elementID = UniteFunctionsUC::getPostGetVariable("elid","",UniteFunctionsUC::SANITIZE_KEY);
    1400        
     1400
    14011401        $addElIDs = UniteFunctionsUC::getPostGetVariable("addelids","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    14021402        $syncIDs = UniteFunctionsUC::getPostGetVariable("syncelids","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);   //additional grids
    1403        
     1403
    14041404        $isModeFiltersInit = UniteFunctionsUC::getPostGetVariable("modeinit","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    14051405        $isModeFiltersInit = UniteFunctionsUC::strToBool($isModeFiltersInit);
    1406        
     1406
    14071407        self::$isModeInit = $isModeFiltersInit;
    1408        
     1408
    14091409        $testTermIDs = UniteFunctionsUC::getPostGetVariable("testtermids","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    14101410        UniteFunctionsUC::validateIDsList($testTermIDs);
     
    14131413        $isModeReplace = UniteFunctionsUC::getPostGetVariable("ucreplace","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    14141414        $isModeReplace = UniteFunctionsUC::strToBool($isModeReplace);
    1415        
     1415
    14161416        GlobalsProviderUC::$isUnderAjax = true;
    1417        
     1417
    14181418        self::$isModeReplace = $isModeReplace;
    1419        
     1419
    14201420        //if($isModeFiltersInit == true)
    14211421            //GlobalsProviderUC::$skipRunPostQueryOnce = true;
    1422                
     1422
    14231423        if(self::$isGutenberg == false)
    14241424            $arrContent = HelperProviderCoreUC_EL::getElementorContentByPostID($layoutID);
    14251425        else{   //gutenberg
    1426            
     1426
    14271427            self::$objGutenberg = new UniteCreatorGutenbergIntegrate();
    1428            
     1428
    14291429            $arrContent = self::$objGutenberg->getPostBlocks($layoutID);
    14301430        }
    1431                
     1431
    14321432        if(empty($arrContent))
    14331433            UniteFunctionsUC::throwError(self::$platform." content not found");
    1434        
     1434
    14351435        //run the post query
    14361436        $arrHtmlWidget = $this->getContentWidgetHtml($arrContent, $elementID);
    1437        
     1437
    14381438        if(empty(GlobalsProviderUC::$lastPostQuery))
    14391439            self::$numTotalPosts = 0;
    14401440        else
    14411441            self::$numTotalPosts = GlobalsProviderUC::$lastPostQuery->found_posts;
    1442        
     1442
    14431443        //find the term id's for test (find or not in the current posts query)
    14441444        if(!empty($testTermIDs)){
    1445            
     1445
    14461446            if(self::$showDebug == true)
    14471447                dmp("---- Test Not Empty Terms----");
    1448                        
     1448
    14491449            $args = GlobalsProviderUC::$lastQueryArgs;
    1450            
     1450
    14511451            if(self::$showDebug == true){
    14521452                dmp("--- Last Query Args:");
    14531453                dmp($args);
    14541454            }
    1455                        
     1455
    14561456            $query = new WP_Query($args);
    1457                        
     1457
    14581458            $request = $query->request;
    1459            
     1459
    14601460            $taxRequest = $this->getInitFiltersTaxRequest($request, $testTermIDs);
    1461            
     1461
    14621462            if(self::$showDebug == true){
    1463                
     1463
    14641464                dmp("---- Terms request: ");
    14651465                dmp($taxRequest);
    14661466            }
    1467                
     1467
    14681468            $arrFoundTermIDs = array();
    1469            
     1469
    14701470            if(!empty($taxRequest)){
    1471                
     1471
    14721472                $db = HelperUC::getDB();
    14731473                try{
    1474                    
     1474
    14751475                    $arrFoundTermIDs = $db->fetchSql($taxRequest);
    14761476                    $arrFoundTermIDs = $this->modifyFoundTermsIDs($arrFoundTermIDs);
    1477                    
     1477
    14781478                }catch(Exception $e){
    14791479                    //just leave it empty
    14801480                }
    14811481            }
    1482            
    1483            
     1482
     1483
    14841484            if(self::$showDebug == true){
    1485                
     1485
    14861486                dmp("--- result - terms with num posts");
    14871487                dmp($arrFoundTermIDs);
    14881488            }
    1489            
     1489
    14901490            //set the test term id's for the output
    1491             GlobalsProviderUC::$arrTestTermIDs = $arrFoundTermIDs;         
    1492         }
    1493        
     1491            GlobalsProviderUC::$arrTestTermIDs = $arrFoundTermIDs;
     1492        }
     1493
    14941494        $htmlGridItems = UniteFunctionsUC::getVal($arrHtmlWidget, "html");
    14951495        $htmlGridItems2 = UniteFunctionsUC::getVal($arrHtmlWidget, "html2");
    1496        
     1496
    14971497        //replace widget id
    1498         $widgetHTMLID = UniteFunctionsUC::getVal($arrHtmlWidget, "uc_id");             
    1499        
     1498        $widgetHTMLID = UniteFunctionsUC::getVal($arrHtmlWidget, "uc_id");
     1499
    15001500        if(!empty($widgetHTMLID)){
    1501            
     1501
    15021502            $htmlGridItems = str_replace($widgetHTMLID, "%uc_widget_id%", $htmlGridItems);
    15031503            $htmlGridItems2 = str_replace($widgetHTMLID, "%uc_widget_id%", $htmlGridItems2);
    15041504        }
    1505        
     1505
    15061506        $htmlDebug = UniteFunctionsUC::getVal($arrHtmlWidget, "html_debug");
    1507        
     1507
    15081508        $addWidgetsHTML = $this->getContentWidgetsHTML($arrContent, $addElIDs);
    1509        
     1509
    15101510        $syncWidgetsHTML = $this->getContentWidgetsHTML($arrContent, $syncIDs, true);
    15111511
    1512        
     1512
    15131513        //output the html
    1514         $outputData = array();     
    1515        
     1514        $outputData = array();
     1515
    15161516        if(!empty($htmlDebug))
    15171517            $outputData["html_debug"] = $htmlDebug;
    1518        
     1518
    15191519        if($isModeFiltersInit == false){
    15201520            $outputData["html_items"] = $htmlGridItems;
    1521            
     1521
    15221522            $htmlGridItems2 = trim($htmlGridItems2);
    1523            
     1523
    15241524            if(!empty($htmlGridItems2))
    15251525                $outputData["html_items2"] = $htmlGridItems2;
    1526                
    1527         }
    1528        
     1526
     1527        }
     1528
    15291529        if(!empty($addWidgetsHTML))
    15301530            $outputData["html_widgets"] = $addWidgetsHTML;
    1531        
     1531
    15321532        if(!empty($syncWidgetsHTML))
    15331533            $outputData["html_sync_widgets"] = $syncWidgetsHTML;
    1534        
     1534
    15351535        if(!empty($this->contentWidgetsDebug))
    15361536            $outputData["html_widgets_debug"] = $this->contentWidgetsDebug;
    1537        
     1537
    15381538        //add query data
    1539        
     1539
    15401540        $arrQueryData = HelperUC::$operations->getLastQueryData();
    1541        
     1541
    15421542        $strQueryPostIDs = HelperUC::$operations->getLastQueryPostIDs();
    1543        
     1543
    15441544        $outputData["query_data"] = $arrQueryData;
    15451545        $outputData["query_ids"] = $strQueryPostIDs;
    1546        
    1547        
     1546
     1547
    15481548        if(self::$showEchoDebug == true){
    15491549
    15501550            dmp("The posts: ");
    1551            
     1551
    15521552            HelperUC::$operations->putPostsCustomFieldsDebug(GlobalsProviderUC::$lastPostQuery->posts);
    1553            
     1553
    15541554            dmp("showing the debug");
    1555            
     1555
    15561556            exit();
    15571557        }
    1558        
     1558
    15591559        HelperUC::ajaxResponseData($outputData);
    1560        
     1560
    15611561    }
    15621562
    15631563    private function _______DYNAMIC_POPUP__________(){}
    1564    
     1564
    15651565    /**
    15661566     * put dynamic popup cache
    15671567     */
    15681568    private function putDynamicPopupCache(){
    1569        
     1569
    15701570        $postID = 10767;
    1571        
     1571
    15721572        $templateID = 9532;
    1573        
     1573
    15741574        $widgetID = "max111";
    1575        
     1575
    15761576        $post = get_post($postID);
    1577        
     1577
    15781578        $template = get_post($templateID);
    1579        
     1579
    15801580        //dmp($template);exit();
    1581        
     1581
    15821582        HelperProviderCoreUC_EL::putListingItemTemplate_post($post, $templateID, $widgetID);
    1583        
    1584        
    1585        
     1583
     1584
     1585
    15861586        dmp("dynamic popup cache");
    15871587        exit();
    1588        
    1589     }
    1590    
     1588
     1589    }
     1590
    15911591    private function _______AJAX_SEARCH__________(){}
    1592    
     1592
    15931593    /**
    15941594     * before custom posts query
     
    15961596     */
    15971597    public function onBeforeCustomPostsQuery($query){
    1598        
     1598
    15991599        if(GlobalsProviderUC::$isUnderAjaxSearch == false)
    16001600            return(false);
    1601            
     1601
    16021602        global $wp_the_query;
    16031603        $wp_the_query = $query;
    16041604    }
    1605    
    1606    
     1605
     1606
    16071607    /**
    16081608     * ajax search
     
    16111611
    16121612        self::$isUnderAjaxSearch = true;
    1613        
     1613
    16141614        $responseCode = http_response_code();
    1615        
     1615
    16161616        if($responseCode != 200)
    16171617            http_response_code(200);
    1618        
     1618
    16191619        define("UE_AJAX_SEARCH_ACTIVE", true);
    1620        
     1620
    16211621        $layoutID = UniteFunctionsUC::getPostGetVariable("layoutid","",UniteFunctionsUC::SANITIZE_KEY);
    16221622        $elementID = UniteFunctionsUC::getPostGetVariable("elid","",UniteFunctionsUC::SANITIZE_KEY);
    1623        
     1623
    16241624        $arrContent = HelperProviderCoreUC_EL::getElementorContentByPostID($layoutID);
    1625        
     1625
    16261626        if(empty($arrContent))
    16271627            UniteFunctionsUC::throwError("Elementor content not found");
    1628            
     1628
    16291629        //run the post query
    16301630        GlobalsProviderUC::$isUnderAjaxSearch = true;
    1631        
     1631
    16321632        //for outside filters - check that under ajax
    1633                
     1633
    16341634        $arrHtmlWidget = $this->getContentWidgetHtml($arrContent, $elementID);
    1635        
     1635
    16361636        GlobalsProviderUC::$isUnderAjaxSearch = false;
    1637        
     1637
    16381638        $htmlGridItems = UniteFunctionsUC::getVal($arrHtmlWidget, "html");
    16391639        $htmlGridItems2 = UniteFunctionsUC::getVal($arrHtmlWidget, "html2");
    1640        
     1640
    16411641        $htmlDebug = UniteFunctionsUC::getVal($arrHtmlWidget, "html_debug");
    1642        
     1642
    16431643        //output the html
    1644         $outputData = array();     
    1645        
     1644        $outputData = array();
     1645
    16461646        if(!empty($htmlDebug))
    16471647            $outputData["html_debug"] = $htmlDebug;
    1648        
     1648
    16491649        $outputData["html_items"] = $htmlGridItems;
    1650        
     1650
    16511651        $htmlGridItems2 = trim($htmlGridItems2);
    1652        
     1652
    16531653        if(!empty($htmlGridItems2))
    16541654            $outputData["html_items2"] = $htmlGridItems2;
    1655        
    1656        
     1655
     1656
    16571657        HelperUC::ajaxResponseData($outputData);
    16581658    }
    1659    
     1659
    16601660    private function _______WIDGET__________(){}
    1661    
    1662    
     1661
     1662
    16631663    /**
    16641664     * include the filters js files
    16651665     */
    16661666    private function includeJSFiles(){
    1667                
     1667
    16681668        if(self::$isFilesAdded == true)
    16691669            return(false);
    1670        
     1670
    16711671        UniteProviderFunctionsUC::addAdminJQueryInclude();
    1672        
     1672
    16731673        $urlFiltersJS = GlobalsUC::$url_assets_libraries."filters/ue_filters.js";
    1674         HelperUC::addScriptAbsoluteUrl_widget($urlFiltersJS, "ue_filters");     
    1675        
     1674        HelperUC::addScriptAbsoluteUrl_widget($urlFiltersJS, "ue_filters");
     1675
    16761676        self::$isFilesAdded = true;
    16771677    }
    1678    
     1678
    16791679    /**
    16801680     * put custom scripts
    16811681     */
    16821682    private function putCustomJsScripts(){
    1683        
     1683
    16841684        if(self::$isScriptAdded == true)
    16851685            return(false);
    1686        
     1686
    16871687        self::$isScriptAdded = true;
    1688        
     1688
    16891689        $arrData = $this->getFiltersJSData();
    1690        
     1690
    16911691        $strData = UniteFunctionsUC::jsonEncodeForClientSide($arrData);
    1692        
     1692
    16931693        $script = "/* Unlimited Elements Filters */ \n";
    16941694        $script .= "window.g_strFiltersData = {$strData};";
    1695        
     1695
    16961696        UniteProviderFunctionsUC::printCustomScript($script);
    16971697    }
    1698    
     1698
    16991699    /**
    17001700     * put custom style
    17011701     */
    17021702    private function putCustomStyle(){
    1703        
     1703
    17041704        if(self::$isStyleAdded == true)
    17051705            return(false);
    1706        
     1706
    17071707        self::$isStyleAdded = true;
    1708        
     1708
    17091709        $style = "
    17101710            .uc-ajax-loading{
     
    17121712            }
    17131713        ";
    1714        
     1714
    17151715        UniteProviderFunctionsUC::printCustomStyle($style);
    17161716    }
    1717    
    1718    
     1717
     1718
    17191719    /**
    17201720     * include the client side scripts
    17211721     */
    17221722    private function includeClientSideScripts(){
    1723        
     1723
    17241724        $isInsideEditor = GlobalsProviderUC::$isInsideEditor;
    1725        
     1725
    17261726        if($isInsideEditor == true)
    17271727            return(false);
    1728        
     1728
    17291729        $this->includeJSFiles();
    1730        
     1730
    17311731        $this->putCustomJsScripts();
    1732        
     1732
    17331733        $this->putCustomStyle();
    1734        
    1735     }
    1736    
    1737    
    1738    
     1734
     1735    }
     1736
     1737
     1738
    17391739    /**
    17401740     * get active archive terms
    17411741     */
    17421742    private function getActiveArchiveTerms($taxonomy){
    1743        
     1743
    17441744        if(is_archive() == false)
    17451745            return(null);
     
    17491749        if(empty($currentTerm))
    17501750            return(null);
    1751        
     1751
    17521752        if($currentTerm instanceof WP_Term == false)
    17531753            return(null);
    1754        
     1754
    17551755        $termID = $currentTerm->term_id;
    1756        
     1756
    17571757        $args = array();
    17581758        $args["taxonomy"] = $taxonomy;
    17591759        $args["parent"] = $termID;
    1760        
     1760
    17611761        $arrTerms = get_terms($args);
    1762        
     1762
    17631763        return($arrTerms);
    17641764    }
    1765    
    1766    
    1767    
     1765
     1766
     1767
    17681768    /**
    17691769     * add values to settings from data
     
    17711771     */
    17721772    public function addWidgetFilterableVarsFromData($data, $dataPosts, $postListName, $arrPostIDs = null){
    1773        
     1773
    17741774        //check if ajax related
    17751775        $isAjax = UniteFunctionsUC::getVal($dataPosts, $postListName."_isajax");
    17761776        $isAjax = UniteFunctionsUC::strToBool($isAjax);
    1777        
     1777
    17781778        $addClass = "";
    17791779        $strAttributes = "";
    1780        
     1780
    17811781        //avoid duplicates handle
    1782        
     1782
    17831783        if(!empty($arrPostIDs)){
    1784            
     1784
    17851785            $addClass = " uc-avoid-duplicates";
    1786            
     1786
    17871787            $strPostIDs = implode(",", $arrPostIDs);
    17881788            $strAttributes = " data-postids='$strPostIDs'";
    1789            
    1790         }
    1791        
     1789
     1790        }
     1791
    17921792        if($isAjax == false){
    1793            
     1793
    17941794            $data["uc_filtering_attributes"] = $strAttributes;
    17951795            $data["uc_filtering_addclass"] = $addClass;
    1796            
     1796
    17971797            return($data);
    17981798        }
    1799        
    1800        
     1799
     1800
    18011801        //all ajax related
    1802            
     1802
    18031803        $addClass .= " uc-filterable-grid";
    1804        
     1804
    18051805        $filterBehavoiur = UniteFunctionsUC::getVal($dataPosts, $postListName."_ajax_seturl");
    1806        
     1806
    18071807        $strAttributes .= " data-ajax='true' ";
    1808        
     1808
    18091809        if(!empty($filterBehavoiur))
    18101810            $strAttributes .= " data-filterbehave='$filterBehavoiur' ";
    1811        
     1811
    18121812        //add ajax group
    1813        
     1813
    18141814        $filterGroup = UniteFunctionsUC::getVal($dataPosts, $postListName."_filtering_group");
    1815        
     1815
    18161816        if(!empty($filterGroup)){
    18171817            $filterGroup = esc_attr($filterGroup);
    18181818            $strAttributes .= " data-filtergroup='$filterGroup' ";
    18191819        }
    1820        
    1821            
     1820
     1821
    18221822        //add last query
    18231823        $arrQueryData = HelperUC::$operations->getLastQueryData();
    18241824
    18251825        $jsonQueryData = UniteFunctionsUC::jsonEncodeForHtmlData($arrQueryData);
    1826        
     1826
    18271827        $strAttributes .= " querydata='$jsonQueryData'";
    1828        
     1828
    18291829        $this->includeClientSideScripts();
    1830        
     1830
    18311831        $data["uc_filtering_attributes"] = $strAttributes;
    18321832        $data["uc_filtering_addclass"] = $addClass;
    1833        
     1833
    18341834        return($data);
    18351835    }
    1836    
     1836
    18371837    /**
    18381838     * add widget variables
     
    18401840     */
    18411841    public function addWidgetFilterableVariables($data, $addon, $arrPostIDs = array()){
    1842        
     1842
    18431843        $param = $addon->getParamByType(UniteCreatorDialogParam::PARAM_POSTS_LIST);
    1844        
     1844
    18451845        if(empty($param))
    18461846            return($data);
    1847        
     1847
    18481848        $postListName = UniteFunctionsUC::getVal($param, "name");
    1849        
     1849
    18501850        $dataPosts = UniteFunctionsUC::getVal($data, $postListName);
    1851        
     1851
    18521852        $data = $this->addWidgetFilterableVarsFromData($data, $dataPosts, $postListName, $arrPostIDs);
    1853        
     1853
    18541854        return($data);
    18551855    }
     
    18571857    /**
    18581858     * default sign is "~"
    1859      * 
     1859     *
    18601860     */
    18611861    private function getUrlPartsKeys(){
    1862        
     1862
    18631863        $arrParts = array();
    18641864        $arrParts["tax_sap"] = apply_filters("ue_filters_url_key__taxonomy_sap","~");
    1865        
     1865
    18661866        return($arrParts);
    18671867    }
    1868    
     1868
    18691869    /**
    18701870     * get filters attributes
     
    18721872     */
    18731873    private function getFiltersJSData(){
    1874                
     1874
    18751875        $urlBase = UniteFunctionsUC::getBaseUrl(GlobalsUC::$current_page_url, true);        //strip pagination
    1876        
     1876
    18771877        //include some common url filters
    18781878        $orderby = UniteFunctionsUC::getGetVar("orderby","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    1879        
     1879
    18801880        if(!empty($orderby)){
    18811881            $orderby = urlencode($orderby);
    18821882            $urlBase = UniteFunctionsUC::addUrlParams($urlBase, "orderby=$orderby");
    18831883        }
    1884        
     1884
    18851885        //include the search if exists
    1886        
     1886
    18871887        $search = UniteFunctionsUC::getGetVar("s","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    1888        
     1888
    18891889        if(empty($search)){
    18901890            $search = null;
    1891            
     1891
    18921892            if(isset($_GET["s"]) && $_GET["s"] == "")
    18931893                $search = "";
    18941894        }
    1895        
    1896        
     1895
    18971896        if($search !== null){
    18981897            $search = urlencode($search);
     
    19111910       
    19121911        //debug client url
    1913        
     1912
    19141913        $isDebug = UniteFunctionsUC::getGetVar("ucfiltersdebug","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    19151914        $isDebug = UniteFunctionsUC::strToBool($isDebug);
    1916        
     1915
    19171916        //get url parts
    19181917        $arrUrlKeys = $this->getUrlPartsKeys();
    1919                
     1918
    19201919        //get current filters
    1921        
     1920
    19221921        $arrData = array();
    19231922        $arrData["platform"] = GlobalsProviderUC::$renderPlatform;
     
    19261925        $arrData["urlkeys"] = $arrUrlKeys;
    19271926        $arrData["postid"] = get_the_id();
    1928        
    1929        
     1927
     1928
    19301929        if($isDebug == true)
    19311930            $arrData["debug"] = true;
    1932            
     1931
    19331932        return($arrData);
    19341933    }
    1935    
    1936    
     1934
     1935
    19371936    private function _____MODIFY_PARAMS_PROCESS_TERMS_______(){}
    1938    
    1939    
     1937
     1938
    19401939    /**
    19411940     * check if term selected by request
    19421941     */
    19431942    private function isTermSelectedByRequest($term, $selectedTerms){
    1944        
     1943
    19451944        $taxonomy = UniteFunctionsUC::getVal($term, "taxonomy");
    1946        
     1945
    19471946        if(empty($taxonomy))
    19481947            return(false);
    1949            
     1948
    19501949        $arrSlugs = UniteFunctionsUC::getVal($selectedTerms, $taxonomy);
    1951        
     1950
    19521951        if(empty($arrSlugs))
    19531952            return(false);
    19541953
    19551954        $slug = UniteFunctionsUC::getVal($term, "slug");
    1956        
     1955
    19571956        $found = in_array($slug, $arrSlugs);
    1958        
     1957
    19591958        return($found);
    19601959    }
    1961    
    1962    
     1960
     1961
    19631962    /**
    19641963     * modify selected by request
     
    19671966
    19681967        $this->hasSelectedByRequest = false;
    1969        
     1968
    19701969        $selectedTerms = null;
    19711970        $selectedTermIDs = null;
    1972        
     1971
    19731972        //if mode init - get selected id's from request
    19741973        if(self::$isModeInit == true){
    1975            
     1974
    19761975            $strSelectedTermIDs = UniteFunctionsUC::getPostGetVariable("ucinitselectedterms","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    1977            
     1976
    19781977            if(empty($strSelectedTermIDs))
    19791978                return($arrTerms);
    1980                
     1979
    19811980            UniteFunctionsUC::validateIDsList($strSelectedTermIDs,"selected terms");
    1982            
     1981
    19831982            $selectedTermIDs = explode(",", $strSelectedTermIDs);
    1984            
     1983
    19851984            if(empty($selectedTermIDs))
    19861985                return($arrTerms);
    1987            
     1986
    19881987        }else{
    1989            
     1988
    19901989            $arrRequest = $this->getRequestFilters();
    1991                        
     1990
    19921991            if(empty($arrRequest))
    19931992                return($arrTerms);
    1994            
     1993
    19951994            $selectedTerms = UniteFunctionsUC::getVal($arrRequest, "terms");
    1996            
     1995
    19971996            if(empty($selectedTerms))
    19981997                return($arrTerms);
    1999            
    2000         }
    2001        
    2002                
     1998
     1999        }
     2000
     2001
    20032002        $arrSelected = array();
    2004                
     2003
    20052004        foreach($arrTerms as $index => $term){
    2006            
     2005
    20072006            if(!empty($selectedTerms))
    20082007                $isSelected = $this->isTermSelectedByRequest($term, $selectedTerms);
    20092008            else{
    2010                                
     2009
    20112010                $termID = UniteFunctionsUC::getVal($term, "id");
    20122011                if(empty($termID))
    20132012                    continue;
    2014                
     2013
    20152014                $isSelected = in_array($termID, $selectedTermIDs);
    20162015            }
    2017            
     2016
    20182017            if($isSelected == false)
    20192018                continue;
    20202019
    2021            
     2020
    20222021            $arrSelected["term_".$index] = true;
    20232022        }
    2024        
     2023
    20252024        if(empty($arrSelected))
    20262025            return($arrTerms);
    2027        
     2026
    20282027        $this->hasSelectedByRequest = true;
    2029        
     2028
    20302029        //modify the selected
    2031        
     2030
    20322031        foreach($arrTerms as $index => $term){
    2033            
     2032
    20342033            $isSelected = UniteFunctionsUC::getVal($arrSelected, "term_".$index);
    2035            
     2034
    20362035            if($isSelected == true){
    20372036                $term["iscurrent"] = true;
    20382037                $term["isselected"] = true;
    2039                
     2038
    20402039            }else{
    2041                
     2040
    20422041                $term["iscurrent"] = false;
    20432042                $term["isselected"] = false;
    20442043                $term["class_selected"] = "";
    20452044            }
    2046            
     2045
    20472046            $arrTerms[$index] = $term;
    20482047        }
    2049        
     2048
    20502049        return($arrTerms);
    20512050    }
    2052    
    2053    
     2051
     2052
    20542053    /**
    20552054     * modify filters - add first item
    20562055     */
    20572056    private function modifyOutputTerms_addFirstItem($arrTerms, $data, $filterType){
    2058        
     2057
    20592058        //don't add first item if no terms, if no terms, no "all" as well
    2060        
     2059
    20612060        if(empty($arrTerms))
    20622061            return(array());
    2063        
     2062
    20642063        $addFirst = UniteFunctionsUC::getVal($data, "add_first");
    20652064        $addFirst = UniteFunctionsUC::strToBool($addFirst);
    2066        
     2065
    20672066        if($addFirst == false)
    20682067            return($arrTerms);
    2069        
    2070            
     2068
     2069
    20712070        $text = UniteFunctionsUC::getVal($data, "first_item_text", __("All","unlimited-elements-for-elementor"));
    2072                    
     2071
    20732072        $firstTerm = array();
    20742073        $firstTerm["index"] = 0;
     
    20782077        $firstTerm["parent_id"] = "";
    20792078        $firstTerm["taxonomy"] = "";
    2080        
     2079
    20812080        $firstTerm["addclass"] = " uc-item-all";
    2082        
     2081
    20832082        if(!empty(self::$numTotalPosts))
    20842083            $firstTerm["num_posts"] = self::$numTotalPosts;
    2085        
     2084
    20862085        array_unshift($arrTerms, $firstTerm);
    2087        
     2086
    20882087        return($arrTerms);
    20892088    }
    2090    
    2091    
     2089
     2090
    20922091    /**
    20932092     * modify the selected - first selected from options
    20942093     */
    20952094    private function modifyOutputTerms_modifySelected($arrTerms, $data, $filterType){
    2096        
     2095
    20972096        if(empty($arrTerms))
    20982097            return($arrTerms);
    2099        
     2098
    21002099        $isSelectFirst = UniteFunctionsUC::getVal($data, "select_first");
    21012100        $isSelectFirst = UniteFunctionsUC::strToBool($isSelectFirst);
    2102        
     2101
    21032102        if($filterType == self::TYPE_SELECT)
    21042103            $isSelectFirst = true;
    2105        
     2104
    21062105        if($filterType == self::TYPE_TABS){
    2107            
     2106
    21082107            $role = UniteFunctionsUC::getVal($data, "filter_role");
    2109            
     2108
    21102109            if(strpos($role,"child") !== false)
    21112110                $isSelectFirst = false;
    21122111        }
    2113        
     2112
    21142113        if($isSelectFirst == false)
    2115             return($arrTerms); 
    2116        
     2114            return($arrTerms);
     2115
    21172116        $numSelectedTab = UniteFunctionsUC::getVal($data, "selected_tab_number");
    21182117        if(empty($numSelectedTab))
    21192118            $numSelectedTab = 1;
    2120        
     2119
    21212120        //correct selected tab
    2122        
     2121
    21232122        $numTerms = count($arrTerms);
    2124        
     2123
    21252124        if($isSelectFirst == true && $numSelectedTab > $numTerms)
    21262125            $numSelectedTab = 1;
    2127                    
     2126
    21282127        $firstNotHiddenIndex = null;
    2129        
     2128
    21302129        $hasSelectedTerm = false;
    2131        
     2130
    21322131        foreach($arrTerms as $index => $term){
    2133            
     2132
    21342133            //set the index
    21352134            $numTab = ($index + 1);
    2136            
     2135
    21372136            $term["index"] = $index;
    2138            
     2137
    21392138            //check if hidden
    2140            
     2139
    21412140            $isHidden = UniteFunctionsUC::getVal($term, "hidden");
    21422141            $isHidden = UniteFunctionsUC::strToBool($isHidden);
    2143            
     2142
    21442143            if($isHidden == true)
    21452144                continue;
    2146                
     2145
    21472146            if($firstNotHiddenIndex === null)
    21482147                $firstNotHiddenIndex = $index;
    2149            
     2148
    21502149            if($numTab == $numSelectedTab){
    21512150                $term["isselected"] = true;
    21522151                $hasSelected = true;
    21532152            }
    2154            
     2153
    21552154            $arrTerms[$index] = $term;
    21562155        }
    2157        
     2156
    21582157        if($hasSelected == true)
    21592158            return($arrTerms);
    2160            
     2159
    21612160        if($firstNotHiddenIndex === null)
    21622161            return($arrTerms);
    2163            
     2162
    21642163        if($filterType != self::TYPE_SELECT)
    21652164            return($arrTerms);
    2166            
     2165
    21672166        //make sure the first item selected in select filter
    21682167        if($isSelectFirst == true)
    21692168            $arrTerms[$firstNotHiddenIndex]["isselected"] = true;
    2170        
    2171        
     2169
     2170
    21722171        return($arrTerms);
    21732172    }
    2174    
    2175    
    2176     /**
    2177      * modify the terms for init after 
     2173
     2174
     2175    /**
     2176     * modify the terms for init after
    21782177     */
    21792178    private function modifyOutputTerms_setNumPosts($arrTerms){
    2180            
     2179
    21812180        if(GlobalsProviderUC::$arrTestTermIDs === null)
    21822181            return($arrTerms);
    2183            
     2182
    21842183        $arrParentNumPosts = array();
    2185        
     2184
    21862185        $arrPostNums = GlobalsProviderUC::$arrTestTermIDs;
    2187        
     2186
    21882187        foreach($arrTerms as $key => $term){
    2189            
     2188
    21902189            $termID = UniteFunctionsUC::getVal($term, "id");
    2191            
     2190
    21922191            $termFound = array_key_exists($termID, $arrPostNums);
    2193            
     2192
    21942193            $numPosts = 0;
    2195            
     2194
    21962195            if($termFound){
    21972196                $numPosts = $arrPostNums[$termID];
    21982197            }
    2199                        
     2198
    22002199            //add parent id if exists
    22012200            $parentID = UniteFunctionsUC::getVal($term, "parent_id");
    2202                        
     2201
    22032202            //set the number of posts
    22042203            $term["num_posts"] = $numPosts;
    2205            
     2204
    22062205            if(!empty($term["num_products"]))
    22072206                $term["num_products"] = $numPosts;
    2208            
     2207
    22092208            $isHidden = !$termFound;
    2210            
     2209
    22112210            if($numPosts == 0)
    22122211                $isHidden = true;
    2213            
     2212
    22142213            $htmlAttributes = "";
    22152214            $htmlAttributesNew = "";
    2216            
     2215
    22172216            if($isHidden == true){
    22182217                $htmlAttributes = "hidden='hidden' style='display:none'";
    22192218                $htmlAttributesNew = "hidden='hidden' ";    //no style
    2220                
     2219
    22212220                $addClass = UniteFunctionsUC::getVal($term, "addclass");
    22222221                $addClass .= " uc-item-hidden";
    2223                
     2222
    22242223                $term["addclass"] = $addClass;
    22252224            }
    2226            
     2225
    22272226            $term["hidden"] = $isHidden;
    22282227            $term["html_attributes"] = $htmlAttributes;
    22292228            $term["html_attributes2"] = $htmlAttributesNew;
    2230            
    2231             $arrTerms[$key] = $term;           
    2232         }
    2233        
    2234                
     2229
     2230            $arrTerms[$key] = $term;
     2231        }
     2232
     2233
    22352234        return($arrTerms);
    22362235    }
    2237    
    2238    
     2236
     2237
    22392238    /**
    22402239     * modify limit loaded items
    22412240     */
    22422241    private function modifyOutputTerms_tabs_modifyLimitGrayed($arrTerms, $limitGrayedItems){
    2243        
     2242
    22442243        if(empty($limitGrayedItems))
    22452244            return($arrTerms);
    2246        
     2245
    22472246        $numTerms = count($arrTerms);
    2248                
     2247
    22492248        if($numTerms < $limitGrayedItems)
    22502249            return($arrTerms);
    2251                    
     2250
    22522251        foreach($arrTerms as $index => $term){
    2253            
     2252
    22542253            if($index < $limitGrayedItems)
    22552254                continue;
    2256            
     2255
    22572256            $addClass = UniteFunctionsUC::getVal($term, "addclass");
    22582257            $addClass .= " uc-hide-loading-item";
    2259            
     2258
    22602259            $term["addclass"] = $addClass;
    2261            
     2260
    22622261            $arrTerms[$index] = $term;
    22632262        }
    2264        
    2265        
    2266         return($arrTerms);     
    2267     }
    2268    
     2263
     2264
     2265        return($arrTerms);
     2266    }
     2267
    22692268    /**
    22702269     * set selected class by options
    22712270     */
    22722271    private function modifyOutputTerms_setSelectedClass($arrTerms, $filterType){
    2273        
     2272
    22742273        if(empty($arrTerms))
    22752274            return($arrTerms);
    2276        
     2275
    22772276        foreach($arrTerms as $index => $term){
    2278            
     2277
    22792278            $isSelected = UniteFunctionsUC::getVal($term, "isselected");
    22802279            $isSelected = UniteFunctionsUC::strToBool($isSelected);
    2281            
     2280
    22822281            if($isSelected == false)
    22832282                continue;
    2284            
     2283
    22852284            //hidden can't be selected
    2286            
     2285
    22872286            $isHidden = UniteFunctionsUC::getVal($term, "hidden");
    22882287            $isHidden = UniteFunctionsUC::strToBool($isHidden);
    2289            
     2288
    22902289            if($isHidden == true)
    22912290                continue;
    2292                
     2291
    22932292            $class = UniteFunctionsUC::getVal($term, "addclass","");
    22942293            $class .= " uc-selected";
    2295            
     2294
    22962295            $term["addclass"] = $class;
    2297            
     2296
    22982297            //set select attribute
    22992298            switch($filterType){
    23002299                case self::TYPE_SELECT:
    2301                    
     2300
    23022301                    $htmlAttributes = UniteFunctionsUC::getVal($term, "html_attributes");
    2303                    
     2302
    23042303                    if(empty($htmlAttributes))
    23052304                        $htmlAttributes = "";
    2306                    
     2305
    23072306                    $htmlAttributes .= " selected";
    2308                    
     2307
    23092308                    $term["html_attributes"] = $htmlAttributes;
    2310                    
     2309
    23112310                break;
    23122311                case self::TYPE_CHECKBOX:
    2313                    
     2312
    23142313                    $term["html_attributes_input"] = " checked";
    2315                    
     2314
    23162315                break;
    23172316            }
    2318            
     2317
    23192318            //set hasSelected - true, only if there are some selected slug
    2320            
     2319
    23212320            $selectedSlug = UniteFunctionsUC::getVal($term, "slug");
    2322            
     2321
    23232322            if(!empty($selectedSlug))
    23242323                $this->hasSelectedTerm = true;
    2325            
     2324
    23262325            $arrTerms[$index] = $term;
    2327            
    2328         }
    2329        
    2330        
     2326
     2327        }
     2328
     2329
    23312330        return($arrTerms);
    23322331    }
    2333    
    2334    
     2332
     2333
    23352334    /**
    23362335     * check if filter should be hidden, if selected items avaliable
     
    23382337     */
    23392338    private function modifyOutputTerms_isFilterHidden($data, $arrTerms, $isUnderAjax){
    2340        
     2339
    23412340        if($isUnderAjax == false)
    23422341            return(false);
    2343            
     2342
    23442343        $role = UniteFunctionsUC::getVal($data, "filter_role");
    2345        
     2344
    23462345        if($role != "child")
    23472346            return(false);
    2348                        
     2347
    23492348        if(empty($arrTerms))
    23502349            return(true);
    2351        
     2350
    23522351        //get number of not hidden items
    2353        
     2352
    23542353        $numItems = 0;
    2355        
     2354
    23562355        foreach($arrTerms as $term){
    2357            
     2356
    23582357            $isHidden = UniteFunctionsUC::getVal($term, "hidden");
    23592358            $isHidden = UniteFunctionsUC::strToBool($isHidden);
    2360              
     2359
    23612360            if($isHidden == true)
    23622361                continue;
    2363                
     2362
    23642363            $numItems++;
    23652364        }
    2366                
     2365
    23672366        if($numItems > 1)
    23682367            return(false);
    2369        
     2368
    23702369        $firstItem = $arrTerms[0];
    2371        
     2370
    23722371        $slug = UniteFunctionsUC::getVal($firstItem, "slug");
    2373        
     2372
    23742373        $isAllItem = empty($slug);
    2375                
     2374
    23762375        //if there is only "all" item, it should be hidden as well
    2377        
     2376
    23782377        if($isAllItem == true)
    2379             return(true);           
    2380            
    2381         return(false);     
    2382     }
    2383    
     2378            return(true);
     2379
     2380        return(false);
     2381    }
     2382
    23842383    /**
    23852384     * get data attributes
    23862385     */
    23872386    private function modifyOutputTerms_getDataAttributes($arrTerms, $filterType){
    2388        
     2387
    23892388        foreach($arrTerms as $index => $term){
    2390            
     2389
    23912390            $termID = UniteFunctionsUC::getVal($term, "id");
    2392            
     2391
    23932392            if(empty($termID))
    23942393                continue;
    2395            
     2394
    23962395            $title = UniteFunctionsUC::getVal($term, "name");
    23972396            $slug = UniteFunctionsUC::getVal($term, "slug");
    23982397            $taxonomy = UniteFunctionsUC::getVal($term, "taxonomy");
    2399            
     2398
    24002399            $type = "term";
    2401            
     2400
    24022401            $title = esc_attr($title);
    24032402            $slug = esc_attr($slug);
    24042403            $taxonomy = esc_attr($taxonomy);
    2405            
     2404
    24062405            $key = "{$type}|{$taxonomy}|{$slug}";
    2407            
     2406
    24082407            $htmlData = " data-id=\"$termID\" data-type=\"$type\" data-slug=\"$slug\" data-taxonomy=\"$taxonomy\" data-title=\"{$title}\" data-key=\"{$key}\" ";
    2409            
     2408
    24102409            $term["html_data"] = $htmlData;
    2411            
     2410
    24122411            $arrTerms[$index] = $term;
    24132412        }
    2414        
     2413
    24152414        return($arrTerms);
    24162415    }
    2417    
    2418    
    2419    
     2416
     2417
     2418
    24202419    /**
    24212420     * get editor filter arguments
    24222421     */
    24232422    public function addEditorFilterArguments($data, $typeArg){
    2424        
     2423
    24252424        $filterType = self::TYPE_TABS;
    2426        
     2425
    24272426        switch($typeArg){
    24282427            case "type_select":
     
    24332432            break;
    24342433        }
    2435        
    2436        
     2434
     2435
    24372436        //add the filter related js and css includes
    24382437        $this->includeClientSideScripts();
    2439        
     2438
    24402439        $isInitAfter = UniteFunctionsUC::getVal($data, "init_after");
    24412440        $isInitAfter = UniteFunctionsUC::strToBool($isInitAfter);
    2442        
     2441
    24432442        $isReplaceTerms = UniteFunctionsUC::getVal($data, "replace_terms");
    24442443        $isReplaceTerms = UniteFunctionsUC::strToBool($isReplaceTerms);
    2445        
     2444
    24462445        $limitGrayedItems = UniteFunctionsUC::getVal($data, "load_limit_grayed");
    24472446        $limitGrayedItems = (int)$limitGrayedItems;
    2448        
     2447
    24492448        $filterRole = UniteFunctionsUC::getVal($data, "filter_role");
    2450         if($filterRole == "single")     
     2449        if($filterRole == "single")
    24512450            $filterRole = "";
    2452        
     2451
    24532452        $attributes = "";
    24542453        $style = "";
     
    24562455        $addClassItem = "";
    24572456        $isFirstLoad = true;        //not in ajax, or with init after (also first load)
    2458        
     2457
    24592458        $connectGroup = UniteFunctionsUC::getVal($data, "connect_group");
    2460        
     2459
    24612460        if($connectGroup == "auto")
    24622461            $connectGroup = null;
    2463        
     2462
    24642463        $isInsideEditor = GlobalsProviderUC::$isInsideEditor;
    2465        
     2464
    24662465        $isUnderAjax = self::$isUnderAjax;
    2467        
     2466
    24682467        if($isUnderAjax == true)
    24692468            $isFirstLoad = false;
    2470                
     2469
    24712470        if($isInitAfter == true){
    2472            
     2471
    24732472            $attributes = " data-initafter=\"true\"";
    2474            
     2473
    24752474            if($isUnderAjax == false && $isInsideEditor == false){
    24762475                $addClassItem = " uc-filter-item-hidden";
    24772476                $addClass .= " uc-filter-initing";
    24782477            }
    2479            
     2478
    24802479            $isFirstLoad = true;
    24812480        }
    2482                        
     2481
    24832482        if($filterRole == self::ROLE_TERM_CHILD){
    2484            
     2483
    24852484            $termID = UniteFunctionsUC::getVal($data, "child_termid");
    2486            
     2485
    24872486            if(!empty($termID))
    24882487                $attributes .= " data-childterm=\"$termID\"";
    2489            
    2490         }
    2491        
     2488
     2489        }
     2490
    24922491        if(!empty($connectGroup))
    24932492            $attributes .= " data-connectgroup=\"$connectGroup\"";
    2494        
    2495            
     2493
     2494
    24962495        if($isInsideEditor == true)
    24972496            $isFirstLoad = true;
    2498        
     2497
    24992498        //main filter
    2500            
     2499
    25012500        if(!empty($filterRole))
    25022501            $attributes .= " data-role=\"{$filterRole}\"";
    2503        
     2502
    25042503        if($isReplaceTerms == true)
    25052504            $attributes .= " data-replace-mode=\"true\"";
    2506        
    2507        
     2505
     2506
    25082507        //modify terms
    2509        
     2508
    25102509        $arrTerms = UniteFunctionsUC::getVal($data, "taxonomy");
    2511        
     2510
    25122511        //modify the hidden as well
    2513        
     2512
    25142513        $arrTerms = $this->modifyOutputTerms_setNumPosts($arrTerms, $isInitAfter, $isFirstLoad);
    2515                
     2514
    25162515        //modify the selected class - add first
    25172516        $arrTerms = $this->modifyOutputTerms_addFirstItem($arrTerms, $data, $filterType);
    2518        
     2517
    25192518        //modify the selected class
    25202519        $arrTerms = $this->modifyOutputTerms_modifySelected($arrTerms, $data,$filterType);
    2521                
     2520
    25222521        $arrTerms = $this->modifyOutputTerms_modifySelectedByRequest($arrTerms);
    2523        
     2522
    25242523        $isFilterHidden = false;
    2525        
     2524
    25262525        switch($filterType){
    25272526            case self::TYPE_TABS:
    25282527            case self::TYPE_CHECKBOX:
    2529                
     2528
    25302529                if($isInitAfter == true && !empty($limitGrayedItems) && $isUnderAjax == false)
    25312530                    $arrTerms = $this->modifyOutputTerms_tabs_modifyLimitGrayed($arrTerms, $limitGrayedItems);
    2532                
     2531
    25332532                $isFilterHidden = $this->modifyOutputTerms_isFilterHidden($data, $arrTerms, $isUnderAjax);
    2534                                
     2533
    25352534            break;
    25362535            case self::TYPE_SELECT:
    2537                
     2536
    25382537                //modify if hidden
    2539                
     2538
    25402539                $isFilterHidden = $this->modifyOutputTerms_isFilterHidden($data, $arrTerms, $isUnderAjax);
    25412540            break;
    25422541        }
    2543        
    2544        
     2542
     2543
    25452544        $arrTerms = $this->modifyOutputTerms_setSelectedClass($arrTerms, $filterType);
    2546        
     2545
    25472546        $arrTerms = $this->modifyOutputTerms_getDataAttributes($arrTerms, $filterType);
    2548        
    2549        
    2550         //hide child filter at start 
    2551        
    2552         if(strpos($filterRole,"child") !== false && 
    2553            $isUnderAjax == false && 
     2547
     2548
     2549        //hide child filter at start
     2550
     2551        if(strpos($filterRole,"child") !== false &&
     2552           $isUnderAjax == false &&
    25542553           $isInsideEditor == false){
    2555            
     2554
    25562555            $addClass .= " uc-filter-initing uc-initing-filter-hidden";
    25572556        }
    2558        
     2557
    25592558        if($this->hasSelectedTerm == true)
    25602559            $addClass .= " uc-has-selected";
    2561        
     2560
    25622561        if($isFilterHidden)
    25632562            $addClass .= " uc-filter-hidden";
    2564        
     2563
    25652564        $data["filter_isajax"] = $isUnderAjax?"yes":"no";
    25662565        $data["filter_attributes"] = $attributes;
     
    25692568        $data["filter_addclass_item"] = $addClassItem;
    25702569        $data["filter_first_load"] = $isFirstLoad?"yes":"no";
    2571        
     2570
    25722571        $data["taxonomy"] = $arrTerms;
    2573        
    2574                
     2572
     2573
    25752574        return($data);
    25762575    }
    2577    
    2578    
     2576
     2577
    25792578    private function _______MAIN__________(){}
    2580    
    2581    
     2579
     2580
    25822581    /**
    25832582     * show the main query debug
    25842583     */
    25852584    private function showMainQueryDebug(){
    2586        
     2585
    25872586        global $wp_query;
    2588        
     2587
    25892588        $args = $wp_query->query_vars;
    2590                
     2589
    25912590        $argsForDebug = UniteFunctionsWPUC::cleanQueryArgsForDebug($args);
    2592        
     2591
    25932592        dmp("MAIN QUERY DEBUG");
    2594        
     2593
    25952594        dmp($argsForDebug);
    2596        
    2597     }
    2598    
     2595
     2596    }
     2597
    25992598    /**
    26002599     * is ajax request
    26012600     */
    26022601    public function isFrontAjaxRequest(){
    2603        
     2602
    26042603        if(self::$isAjaxCache !== null)
    26052604            return(self::$isAjaxCache);
    2606        
     2605
    26072606        $frontAjaxAction = UniteFunctionsUC::getPostGetVariable("ucfrontajaxaction","",UniteFunctionsUC::SANITIZE_KEY);
    2608        
     2607
    26092608        if($frontAjaxAction == "getfiltersdata"){
    26102609            self::$isAjaxCache = true;
    26112610            return(true);
    26122611        }
    2613        
     2612
    26142613        self::$isAjaxCache = false;
    2615        
     2614
    26162615        return(false);
    26172616    }
    2618    
     2617
    26192618    /**
    26202619     * just return true
    26212620     */
    26222621    public function pluginProtection_ezCacheHideComment(){
    2623        
     2622
    26242623        return(true);
    26252624    }
    2626    
    2627    
     2625
     2626
    26282627    /**
    26292628     * run some cross plugin protections
    26302629     */
    26312630    private function runSomeCrossPluginProtections(){
    2632        
     2631
    26332632        add_filter("wp_bost_hide_cache_time_comment",array($this, "pluginProtection_ezCacheHideComment"));
    2634        
    2635     }
    2636    
     2633
     2634    }
     2635
    26372636    /**
    26382637     * set if show debug or not
    26392638     */
    26402639    private function setShowDebug(){
    2641        
     2640
    26422641        if(self::DEBUG_FILTER == true){
    26432642            self::$showDebug = true;
    26442643            return(false);
    26452644        }
    2646        
     2645
    26472646        //set debug only for logged in users
    2648        
     2647
    26492648        $isDebug = UniteFunctionsUC::getGetVar("ucfiltersdebug","",UniteFunctionsUC::SANITIZE_TEXT_FIELD);
    26502649        $isDebug = UniteFunctionsUC::strToBool($isDebug);
    2651        
     2650
    26522651        if($isDebug == true){
    2653            
     2652
    26542653            $hasPermissions = UniteFunctionsWPUC::isCurrentUserHasPermissions();
    2655            
     2654
    26562655            if($hasPermissions == true){
    26572656                self::$showEchoDebug = true;
    26582657                self::$showDebug = true;
    2659                
     2658
    26602659                dmp("SHOW DEBUG, logged in user");
    26612660            }
    2662            
    2663         }
    2664        
    2665     }
    2666    
    2667     /**
    2668      * check and set display errors by general option 
     2661
     2662        }
     2663
     2664    }
     2665
     2666    /**
     2667     * check and set display errors by general option
    26692668s    */
    26702669    private function checkSetErrorsReporting(){
    2671        
     2670
    26722671        $setDisplayErrors = HelperProviderCoreUC_EL::getGeneralSetting("enable_display_errors_ajax");
    26732672        $setDisplayErrors = UniteFunctionsUC::strToBool($setDisplayErrors);
    2674        
     2673
    26752674        if($setDisplayErrors == true){
    2676            
     2675
    26772676            ini_set("display_errors", "on");
    26782677            error_reporting(E_ALL);
    26792678        }
    2680        
    2681     }
    2682    
    2683    
     2679
     2680    }
     2681
     2682
    26842683    /**
    26852684     * test the request filter
    26862685     */
    26872686    public function operateAjaxResponse(){
    2688                
     2687
    26892688        if(self::DEBUG_MAIN_QUERY == true){
    26902689            $this->showMainQueryDebug();
    26912690            exit();
    26922691        }
    2693        
     2692
    26942693        $frontAjaxAction = UniteFunctionsUC::getPostGetVariable("ucfrontajaxaction","",UniteFunctionsUC::SANITIZE_KEY);
    2695        
     2694
    26962695        if(empty($frontAjaxAction))
    26972696            return(false);
    2698        
     2697
    26992698        $this->runSomeCrossPluginProtections();
    2700        
     2699
    27012700        $this->setShowDebug();
    2702        
     2701
    27032702        $this->checkSetErrorsReporting();
    27042703
    27052704        self::$isUnderAjax = true;
    2706        
     2705
    27072706        try{
    2708            
     2707
    27092708            switch($frontAjaxAction){
    27102709                case "getfiltersdata":
     
    27152714                break;
    27162715                case "submitform":
    2717                    
     2716
    27182717                    $form = new UniteCreatorForm();
    27192718                    $form->submitFormFront();
    2720                    
     2719
    27212720                break;
    27222721                case "removefromcart":
    2723                    
     2722
    27242723                    $objWoo = UniteCreatorWooIntegrate::getInstance();
    2725                    
     2724
    27262725                    $objWoo->removeFromCartFromData();
    2727                                        
     2726
    27282727                break;
    27292728                case "updatecartquantity":
    2730                    
     2729
    27312730                    $objWoo = UniteCreatorWooIntegrate::getInstance();
    2732                    
     2731
    27332732                    $objWoo->updateCartQuantityFromData();
    27342733                break;
    27352734                case "getcartdata":
    2736                                        
     2735
    27372736                    $objWoo = UniteCreatorWooIntegrate::getInstance();
    27382737                    $objWoo->outputCartFragments();
    2739                    
     2738
    27402739                break;
    27412740                case "dynamicpopupcache":
    2742                    
     2741
    27432742                    $this->putDynamicPopupCache();
    2744                    
     2743
    27452744                break;
    27462745                case "custom":
    2747                    
     2746
    27482747                    do_action("uc_custom_front_ajax_action");
    2749                    
     2748
    27502749                    //if not catch - will throw error
    2751                    
     2750
    27522751                default:
    27532752                    UniteFunctionsUC::throwError("wrong front ajax action: $frontAjaxAction");
    27542753                break;
    27552754            }
    2756        
     2755
    27572756        }catch(Exception $e){
    2758            
     2757
    27592758            $message = $e->getMessage();
    2760            
     2759
    27612760            HelperUC::ajaxResponseError($message);
    2762            
    2763         }
    2764        
    2765     }
    2766    
    2767    
     2761
     2762        }
     2763
     2764    }
     2765
     2766
    27682767    /**
    27692768     * init wordpress front filters
    27702769     */
    27712770    public function initWPFrontFilters(){
    2772                
     2771
    27732772        if(is_admin() == true)
    27742773            return(false);
    2775        
     2774
    27762775        add_action("wp", array($this, "operateAjaxResponse"));
    2777        
     2776
    27782777        add_action("ue_before_custom_posts_query", array($this, "onBeforeCustomPostsQuery"));
    27792778        //add_action("ue_after_custom_posts_query", array($this, "onAfterCustomPostsQuery"));
    2780        
    2781        
    2782     }
    2783    
    2784    
     2779
     2780
     2781    }
     2782
     2783
    27852784}
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_form.class.php

    r3094530 r3097249  
    212212
    213213        $postContent = HelperProviderCoreUC_EL::getElementorContentByPostID($postId);
    214 
     214       
    215215        if(empty($postContent))
    216216            UniteFunctionsUC::throwError("Form elementor content not found.");
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_globals.class.php

    r3094530 r3097249  
    259259
    260260            //dmp("init globals");
    261 
     261           
    262262            UniteProviderFunctionsUC::doAction(UniteCreatorFilters::ACTION_AFTER_INIT_GLOBALS);
    263 
     263           
    264264            if(self::$is_admin){
    265265
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_helperhtml.class.php

    r3094530 r3097249  
    201201            $js .= self::TAB2.'var g_ucElIcons = '.$jsonElementorIcons.';'.self::BR;
    202202
    203 
    204             //output shapes
    205             /*
    206             $objShapes = new UniteShapeManagerUC();
    207             $jsonShapes = $objShapes->getJsonShapes();
    208             $js .= self::TAB2.'var g_ucArrSvgShapes = '.$jsonShapes.';'.self::BR;
    209             */
    210203
    211204            //get nonce
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_params_processor.class.php

    r3076447 r3097249  
    11071107
    11081108
    1109     private function z________SHAPE________(){}
    1110 
    1111 
    1112     /**
    1113      * get the shape addon
    1114      */
    1115     private function getProcessedParamsValue_shapeOutput($data, $value, $param){
    1116 
    1117         $paramName = UniteFunctionsUC::getVal($param, "name");
    1118 
    1119         $shapeData = "";
    1120 
    1121         if(empty($value)){
    1122             $data[$paramName] = "";
    1123             return($data);
    1124         }
    1125 
    1126         if(empty($this->objShapes))
    1127             $this->objShapes = new UniteShapeManagerUC();
    1128 
    1129         $svgContent = $this->objShapes->getShapeSVGContent($value);
    1130         $data[$paramName] = $svgContent;
    1131 
    1132         return($data);
    1133     }
    1134 
    1135 
    1136     /**
    1137      * addon picker output
    1138      */
    1139     private function getProcessedParamsValue_addonPickerOutput($data, $value, $param){
    1140 
    1141         $addonType = UniteFunctionsUC::getVal($param, "addon_type");
    1142 
    1143         switch($addonType){
    1144             case GlobalsUC::ADDON_TYPE_SHAPES:
    1145                 $data = $this->getProcessedParamsValue_shapeOutput($data, $value, $param);
    1146             break;
    1147         }
    1148 
    1149         return($data);
    1150     }
    1151 
    11521109
    11531110    private function z_________INSTAGRAM_________(){}
     
    19271884                $data[$name] = $this->getGoogleMapOutput($value, $name, $param);
    19281885            break;
    1929             case UniteCreatorDialogParam::PARAM_SHAPE:
    1930                 $data = $this->getProcessedParamsValue_shapeOutput($data, $value, $param);
    1931             break;
    1932             case UniteCreatorDialogParam::PARAM_ADDONPICKER:
    1933                 $data = $this->getProcessedParamsValue_addonPickerOutput($data, $value, $param);
    1934             break;
    19351886        }
    19361887
     
    21602111     */
    21612112    public function getProcessedItemsData($arrItems, $processType, $forTemplate = true, $filterType = null){
    2162 
     2113       
    21632114        $this->validateInited();
    21642115        self::validateProcessType($processType);
  • unlimited-elements-for-elementor/trunk/inc_php/unitecreator_web_api.class.php

    r3034661 r3097249  
    14181418    protected function getImportedAddonData($addonType, $addonID){
    14191419
    1420         if($addonType != GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER)
    1421             return(array());
    1422 
    1423         $objShapes = new UniteShapeManagerUC();
    1424         $shapeBGContent = $objShapes->getShapeBGContentBYAddonID($addonID);
    1425 
    1426         $data = array();
    1427         $data["shape_content"] = $shapeBGContent;
    1428 
    1429         return($data);
     1420
     1421        return(array());
    14301422    }
    14311423
  • unlimited-elements-for-elementor/trunk/js/admin.js

    r3071404 r3097249  
    26822682    if(!g_ucAdmin)
    26832683        g_ucAdmin = new UniteAdminUC();
    2684 
     2684   
    26852685    g_ucAdmin.globalInit();
    26862686
  • unlimited-elements-for-elementor/trunk/provider/assets/gutenberg_integrate.js

    r3094530 r3097249  
    182182            }
    183183
    184             if (!settingsContent)
     184            var settings = getSettings();
     185
     186            if (!settings)
    185187                return; // wait for the settings
    186188
     
    195197                id: props.attributes._id,
    196198                root_id: props.attributes._rootId,
    197                 settings: getSettings(),
     199                settings: settings,
    198200                selectors: true,
    199201            }, function (response) {
  • unlimited-elements-for-elementor/trunk/provider/core/unlimited_elements/elementor/elementor_integrate.class.php

    r3094530 r3097249  
    17041704        if($isEnabled == false)
    17051705            return(false);
    1706        
     1706
    17071707        $isPreviewOption = UniteFunctionsUC::getGetVar("elementor-preview", "", UniteFunctionsUC::SANITIZE_KEY);
    17081708
  • unlimited-elements-for-elementor/trunk/provider/core/unlimited_elements/elementor/elementor_widget.class.php

    r3094530 r3097249  
    20922092        if(empty($arrItems))
    20932093            $arrItems = array();
    2094 
     2094       
    20952095        $arrDefaults = array();
    20962096
  • unlimited-elements-for-elementor/trunk/provider/core/unlimited_elements/globals.class.php

    r3094530 r3097249  
    9494    public static $pluginTitleCurrent;
    9595   
     96    public static $pathPlugin;
     97    public static $pathPluginSettings;
     98   
    9699   
    97100    /**
     
    99102     */
    100103    public static function initGlobals(){
     104       
     105        self::$pluginTitleCurrent = self::PLUGIN_TITLE;
     106       
     107        self::$urlTemplatesList = admin_url("edit.php?post_type=elementor_library&tabs_group=library");
     108
     109        self::$urlAccount = admin_url("admin.php?page=unlimitedelements-account");
     110
     111        UniteProviderFunctionsUC::addAction('admin_init', array("GlobalsUnlimitedElements", 'initAdminNotices'));
     112
     113        if(GlobalsUC::$is_admin == true && HelperUC::hasPermissionsFromQuery("showadminnotices"))
     114            self::$debugAdminNotices = true;
     115
     116        //set paths
     117
     118        self::$pathPlugin = dirname(__FILE__)."/";
     119
     120        self::$pathPlugin = UniteFunctionsUC::pathToUnix(self::$pathPlugin);
     121       
     122        self::$pathPluginSettings = self::$pathPlugin."settings/";
     123       
     124    }
     125
     126   
     127    /**
     128     * init after loaded
     129     */
     130    public static function initAfterPluginsLoaded(){
    101131
    102132        if(defined("UE_ENABLE_GUTENBERG_SUPPORT")){
     
    106136        if(GlobalsUC::$inDev == true && defined("UE_DISABLE_ELEMENTOR_SUPPORT")){
    107137            self::$enableElementorSupport = false;
    108                        
     138           
    109139            if(self::$enableElementorSupport == false && self::$enableGutenbergSupport == true)
    110140                self::$isGutenbergOnly = true;
    111                        
    112141        }
    113        
    114         self::$pluginTitleCurrent = self::PLUGIN_TITLE;
    115142       
    116143        if(self::$isGutenbergOnly == true){
     
    119146        }
    120147       
    121         self::$urlTemplatesList = admin_url("edit.php?post_type=elementor_library&tabs_group=library");
    122 
    123         self::$urlAccount = admin_url("admin.php?page=unlimitedelements-account");
    124 
    125         UniteProviderFunctionsUC::addAction('admin_init', array("GlobalsUnlimitedElements", 'initAdminNotices'));
    126 
    127148        if(self::$enableGutenbergSupport == true)
    128149            self::initGutenbergIntegration();
    129 
    130         if(GlobalsUC::$is_admin == true && HelperUC::hasPermissionsFromQuery("showadminnotices"))
    131             self::$debugAdminNotices = true;
    132 
     150       
    133151    }
    134 
     152   
     153   
    135154    /**
    136155     * init the admin notices
  • unlimited-elements-for-elementor/trunk/provider/core/unlimited_elements/helper_provider_core.class.php

    r3094530 r3097249  
    606606     */
    607607    public static function getPostContent($postID, $content=""){
    608 
     608       
    609609        if(empty($postID))
    610610            return(false);
     
    12501250
    12511251        self::$urlCore = GlobalsUC::$urlPlugin.$pathRelative;
    1252 
     1252       
    12531253        self::$filepathGeneralSettings = self::$pathCore."settings/general_settings_el.xml";
    12541254               
  • unlimited-elements-for-elementor/trunk/provider/core/unlimited_elements/provider_core_admin.class.php

    r3094530 r3097249  
    2121            ? GlobalsUnlimitedElements::VIEW_DASHBOARD
    2222            : GlobalsUnlimitedElements::VIEW_ADDONS_ELEMENTOR;
    23 
     23   
    2424        $this->arrAllowedViews = array(
    2525            "addons_elementor",
  • unlimited-elements-for-elementor/trunk/provider/core/unlimited_elements/settings/general_settings_el.xml

    r3094530 r3097249  
    33<fields>
    44   
    5   <fieldset name="elementor" label="Widgets for Elementor">
    6 
    7     <field name="el_enable"
    8       type="boolean"
    9       default="true"
    10       label="&lt;b&gt;Enable Unlimited Elements&lt;/b&gt;"
    11       description="If disabled, the Unlimited Elements will not appear in the Elementor Page Builder">
    12     </field>
    13 
    14     <field type="bulk_control_start"
    15       parent="el_enable"
    16       ctype="show"
    17       value="true"
    18     />
    19 
    20 
    21     <field name="css_includes_to"
    22       type="list"
    23       default="body"
    24       label="       Include Css Files To"
    25       description="Choose where to include css files">
    26       <option value="body" text="Body Before Widget HTML" />
    27       <option value="footer" text="Footer" />
    28     </field>
    29 
    30 
    31     <field name="enable_import_export"
    32       type="boolean"
    33       default="true"
    34       label="       Show Import and Export Buttons In Templates"
    35       description="Show special import and export buttons (import and export with images) in elementor saved templates screen">
    36     </field>
    37 
    38 
    39     <field name="enable_backgrounds"
    40       type="boolean"
    41       default="true"
    42       label="       Enable Background Widgets"
    43       description="Enable background widgets for elementor sections">
    44     </field>
    45 
    46     <field name="enable_panel_previews"
    47       type="boolean"
    48       default="true"
    49       label="       Show Elementor Panel Widgets Previews"
    50       description="Show preview images of widget boxes in elementor editor side panel">
    51     </field>
    52 
    53     <field type="bulk_control_end" />
    54 
    55   </fieldset>
    56 
     5  <fieldset name="elementor" label="Widgets for Elementor" loadfrom="elementor" load_condition="elementor_enabled"></fieldset>
     6 
     7  <!--
     8  <fieldset name="gutenberg" label="Blocks for Gutenberg" loadfrom="gutenberg" load_condition="gutenberg_enabled"></fieldset>
     9    -->
     10   
    5711  <fieldset name="widgets" label="Widgets">
    5812   
  • unlimited-elements-for-elementor/trunk/provider/functions_wordpress.class.php

    r3094530 r3097249  
    27802780        if(empty($post))
    27812781            return ("");
    2782 
    2783         //UniteFunctionsUC::showTrace();
    2784         //dmp($post);
    2785 
     2782       
    27862783        $postID = $post->ID;
    27872784
     
    27902787        if(isset(self::$cachePostContent[$postID]))
    27912788            return (self::$cachePostContent[$postID]);
    2792 
    2793         self::$cachePostContent[$postID] = $post->post_content;
    2794 
     2789               
    27952790        $isEditMode = GlobalsProviderUC::$isInsideEditor;
    2796 
     2791       
    27972792        if($isEditMode == false)
    27982793            $content = get_the_content(null, false, $post);
  • unlimited-elements-for-elementor/trunk/provider/gutenberg_integrate.class.php

    r3085242 r3097249  
    2020     */
    2121    public function __construct(){
    22        
    2322    }
    2423
     
    9594        $categories[] = array(
    9695            'slug' => GlobalsUnlimitedElements::PLUGIN_NAME,
    97             'title' => __('Elementor Widgets', 'unlimited-elements-for-elementor'),
     96            'title' => GlobalsUnlimitedElements::PLUGIN_TITLE_GUTENBERG,
    9897        );
    99 
     98       
    10099        return $categories;
    101100    }
     
    123122     */
    124123    public function renderBlock($attributes){
    125        
     124
    126125        GlobalsProviderUC::$renderPlatform = GlobalsProviderUC::RENDER_PLATFORM_GUTENBERG;
    127        
     126
    128127        $data = array(
    129128            'id' => $attributes['_id'],
     
    132131            'selectors' => true,
    133132        );
    134        
     133
    135134        $addonsManager = new UniteCreatorAddons();
    136135        $addonData = $addonsManager->getAddonOutputData($data);
     
    183182    }
    184183
    185    
    186184    /**
    187185     * Get the Gutenberg blocks.
     
    190188     */
    191189    private function getBlocks(){
    192    
     190
    193191        if(empty(self::$blocks) === true){
    194192            $addonsOrder = '';
     
    197195            $addonsManager = new UniteCreatorAddons();
    198196            $addons = $addonsManager->getArrAddons($addonsOrder, $addonsParams, $addonsType);
    199            
     197
    200198            foreach($addons as $addon){
    201                
    202199                $name = $addon->getBlockName();
    203                
     200
    204201                self::$blocks[$name] = array(
    205202                    'name' => $name,
     
    249246     * Get the parsed Gutenberg blocks.
    250247     *
    251      * @return array
    252      */
    253     public function getParsedBlocks($postID = null){
    254        
    255         $post = get_post($postID);
    256        
     248     * @param int|null $postId
     249     *
     250     * @return array
     251     */
     252    public function getPostBlocks($postId = null){
     253
     254        $post = get_post($postId);
     255        $blocks = parse_blocks($post->post_content);
     256
     257        return $blocks;
     258    }
     259
     260    /**
     261     * Get the existing parsed Gutenberg blocks.
     262     *
     263     * @return array
     264     */
     265    public function getParsedBlocks(){
     266
     267        $parsedBlocks = $this->getPostBlocks();
    257268        $existingBlocks = $this->getBlocks();
    258         $parsedBlocks = parse_blocks($post->post_content);
     269        $blocks = $this->extractParsedBlocks($parsedBlocks, $existingBlocks);
     270
     271        return $blocks;
     272    }
     273
     274    /**
     275     * Get block by root identifier.
     276     *
     277     * @param array $content
     278     * @param int $rootId
     279     *
     280     * @return array|null
     281     */
     282    public function getBlockByRootId($content, $rootId){
     283
     284        if(empty($content) === true)
     285            return null;
     286
     287        if(is_array($content) === false)
     288            return null;
     289
     290        if(empty($rootId) === true)
     291            return null;
     292
     293        foreach($content as $block){
     294            if(isset($block['blockName']) === false)
     295                continue;
     296
     297            $blockAttributes = UniteFunctionsUC::getVal($block, 'attrs');
     298            $blockRootId = UniteFunctionsUC::getVal($blockAttributes, '_rootId');
     299
     300            if($rootId === $blockRootId)
     301                return $block;
     302
     303            $innerBlocks = UniteFunctionsUC::getVal($block, 'innerBlocks');
     304
     305            if(empty($innerBlocks) === false && is_array($innerBlocks) === true){
     306                $innerBlock = $this->getBlockByRootId($innerBlocks, $rootId);
     307
     308                if(empty($innerBlock) === false)
     309                    return $innerBlock;
     310            }
     311        }
     312
     313        return null;
     314    }
     315
     316    /**
     317     * Get settings from the given block.
     318     *
     319     * @param array $block
     320     *
     321     * @return array
     322     */
     323    public function getSettingsFromBlock($block){
     324
     325        $attributes = UniteFunctionsUC::getVal($block, 'attrs', array());
     326        $data = UniteFunctionsUC::getVal($attributes, 'data', null);
     327
     328        if(empty($data) === true)
     329            return array();
     330
     331        $settings = UniteFunctionsUC::jsonDecode($data);
     332
     333        return $settings;
     334    }
     335
     336    /**
     337     * Extract the existing parsed Gutenberg blocks.
     338     *
     339     * @param array $parsedBlocks
     340     * @param array $existingBlocks
     341     *
     342     * @return array
     343     */
     344    private function extractParsedBlocks($parsedBlocks, $existingBlocks){
     345
    259346        $blocks = array();
    260        
     347
    261348        foreach($parsedBlocks as $block){
    262349            $name = $block['blockName'];
    263350
    264             if(empty($existingBlocks[$name]) === false)
     351            if(empty($existingBlocks[$name]) === false){
    265352                $blocks[] = array(
    266353                    'name' => $name,
    267354                    'html' => render_block($block),
    268355                );
     356            }
     357
     358            $innerBlocks = UniteFunctionsUC::getVal($block, 'innerBlocks');
     359
     360            if(empty($innerBlocks) === false && is_array($innerBlocks) === true){
     361                $blocks = array_merge($blocks, $this->extractParsedBlocks($innerBlocks, $existingBlocks));
     362            }
    269363        }
    270364
    271365        return $blocks;
    272366    }
    273    
    274     /**
    275      * get post blocks
    276      */
    277     public function getPostBlocks($postID){
    278        
    279         $post = get_post($postID);
    280        
    281         $arrBlocks = parse_blocks($post->post_content);
    282        
    283         return($arrBlocks);
    284     }
    285    
    286    
    287     /**
    288      * get block by root id
    289      */
    290     public function getBlockByRootID($arrContent, $rootID){
    291        
    292         if(empty($arrContent))
    293             return(null);
    294        
    295         if(is_array($arrContent) == false)
    296             return(null);
    297            
    298         if(empty($rootID))
    299             return(null);
    300            
    301         foreach($arrContent as $block){
    302            
    303             if(isset($block["blockName"]) == false)
    304                 continue;
    305                
    306             $attributes = UniteFunctionsUC::getVal($block, "attrs");
    307            
    308             $blockRootID = UniteFunctionsUC::getVal($attributes, "_rootId");
    309            
    310             if($rootID === $blockRootID)
    311                 return($block);
    312            
    313             $innerBlocks = UniteFunctionsUC::getVal($block, "innerBlocks");
    314            
    315             if(!empty($innerBlocks) && is_array($innerBlocks)){
    316                
    317                 $innerBlock = $this->getBlockByRootID($innerBlocks, $rootID);
    318                
    319                 if(!empty($innerBlock))
    320                     return($innerBlock);
    321             }
    322            
    323         }
    324        
    325         return(null);
    326     }
    327    
    328     /**
    329      * get settings from block
    330      */
    331     public function getSettingsFromBlock($arrBlock){
    332        
    333         $attributes = UniteFunctionsUC::getVal($arrBlock, "attrs");
    334        
    335         if(empty($attributes))
    336             return(array());
    337        
    338         $data = UniteFunctionsUC::getVal($attributes, "data");
    339        
    340         $arrSettings = UniteFunctionsUC::jsonDecode($data);
    341        
    342         return($arrSettings);
    343     }
    344    
    345367
    346368}
  • unlimited-elements-for-elementor/trunk/provider/include_provider_after.php

    r2093023 r3097249  
    44
    55HelperProviderUC::registerPlugins();
     6
  • unlimited-elements-for-elementor/trunk/provider/provider_alt_loader.php

    r2948512 r3097249  
    4343       
    4444        HelperUC::validatePluginStartup();
    45                
     45       
    4646        require_once  GlobalsUC::$pathProvider."core/provider_main_file.php";
    4747               
  • unlimited-elements-for-elementor/trunk/provider/provider_helper.class.php

    r3094530 r3097249  
    478478     */
    479479    public static function onPluginsLoaded(){
     480               
     481        GlobalsUC::initAfterPluginsLoaded();
     482               
     483        GlobalsUnlimitedElements::initAfterPluginsLoaded();
    480484       
    481485        load_plugin_textdomain("unlimited-elements-for-elementor", false, GlobalsUC::$pathWPLanguages);
    482        
    483         GlobalsUC::initAfterPluginsLoaded();
    484486       
    485487        UniteCreatorWooIntegrate::initActions();
     
    558560     */
    559561    public static function onPluginsLoadedCallPlugins(){
    560 
     562               
    561563        do_action("addon_library_register_plugins");
    562564
     
    582584
    583585        add_action("plugins_loaded", array("HelperProviderUC","onPluginsLoadedCallPlugins"));
    584 
     586       
    585587    }
    586588
     
    930932     */
    931933    public static function isBackgroundsEnabled(){
    932        
     934               
    933935        if(GlobalsUnlimitedElements::$enableElementorSupport == false)
    934936            return(false);
  • unlimited-elements-for-elementor/trunk/provider/provider_params_processor.class.php

    r3090199 r3097249  
    777777            $arrData["post_type"] = UniteFunctionsUC::getVal($arrPost, "post_type");
    778778
    779             $content = UniteFunctionsWPUC::getPostContent($post);
    780 
     779            $password = $post->post_password;
     780            if(!empty($password))
     781                $content = "";
     782            else
     783                $content = UniteFunctionsWPUC::getPostContent($post);
     784           
     785           
    781786            $arrData["content"] = $content;
    782 
     787           
    783788            $link = UniteFunctionsWPUC::getPermalink($post);
    784789           
     
    863868
    864869            $exceprt = UniteFunctionsUC::getVal($arrPost, "post_excerpt");
    865 
     870           
    866871            $intro = $exceprt;
    867872            $introFull = "";
     
    883888            $arrData["intro"] = $intro;
    884889            $arrData["intro_full"] = $introFull;
    885 
     890           
    886891            //put data
    887892            $strDate = UniteFunctionsUC::getVal($arrPost, "post_date");
  • unlimited-elements-for-elementor/trunk/readme.txt

    r3094530 r3097249  
    44Tags: elementor, elements, addons, elementor addons, elementor widget, page builder, builder, visual editor, wordpress page builder, elementor
    55Requires at least: 3.5
    6 Tested up to: 6.5
     6Tested up to: 6.5.3
    77Stable tag: 1.0
    88License: GPLv2 or later
     
    867867
    868868== Changelog ==
     869
     870version 1.5.110: 2024-06-04
     871
     872Plugin Changes:
     873
     874* Fix: remote arrows was sendin next/prev commands twice
     875* Fix: fix some password protected content related security issue
     876* Fix: fix some sql security small issue
     877
     878
     879Widgets Changes:
     880
     881* Feature: Email Field (Pro) - Added Asterisk Size option, allowing customization of asterisk size for better design flexibility and emphasis.
     882* Feature: Phone Field (Pro) - Added Asterisk Size option, allowing customization of asterisk size for better design flexibility and emphasis.
     883* Feature: Event List (Pro) - Added Timezone option, ensuring that expired and upcoming events are counted according to the specified timezone for accurate event scheduling and display.
     884* Feature: Number Field (Pro) - Added "Limit Number of Digits" option, allowing users to restrict the number of digits displayed for better control and readability of numerical data.
     885* Feature: Phone Field (Pro) - Added "Limit Number of Digits" option, allowing users to restrict the number of digits displayed for better control and readability of numerical data.
     886* Feature: Transparent Split Hero (Free) - Added options to enable or disable widget contents like title, subtitle, etc., and introduced an option to add an image or logo for greater customization and flexibility.
     887* Feature: Unlimited Charts (Pro) - Added Line Chart Background Color option, allowing customization of the background color for line charts to enhance visual appeal.
     888* Fix: Submit Button (Free) - Added validation function for the phone field to ensure correct email format and improve data accuracy.
     889* Fix: Mega Menu (Pro) - Added fix for layout issue that sometimes occurs after page load, ensuring consistent and stable page rendering.
     890* Fix: Post Carousel (Pro) - Set padding to 0 in Nav Dots to avoid default CSS overrides, ensuring consistent and desired styling.
     891* Fix: Semi Circle Progress Bar (Pro) - Added support for Mega Slider widget, enabling the creation and display of Semi Circle Progress Bar widget in interactive sliders for enhanced content presentation.
     892* Fix: Floating Chat Buttons (Pro) - Fixed Pulse Animation Grabber Type issue, ensuring correct animation behavior and improved visual effects.
     893* Fix: Content Tabs (Free) - Added a small delay before widget initialization to ensure the Content Tabs widget works properly within other widgets, improving overall functionality and integration.
     894* Fix: Remote Tabs (Pro) - Changed selector for padding option to resolve issue where link was not clicked when tab was clicked, improving click response accuracy.
     895
    869896
    870897
  • unlimited-elements-for-elementor/trunk/release_log.txt

    r3094530 r3097249  
     1
     2
     3version 1.5.110:
     4
     5* Fix: remote arrows was sendin next/prev commands twice
     6* Fix: fix some password protected content related security issue
     7* Fix: fix some sql security small issue
    18
    29
  • unlimited-elements-for-elementor/trunk/settings/layout_addon_container_settings.xml

    r2063047 r3097249  
    7979            </fieldset>
    8080           
    81             <fieldset name="background" label="Background" loadfrom="background"></fieldset>                       
    82                        
     81            <fieldset name="background" label="Background" loadfrom="background"></fieldset>   
     82           
    8383            <fieldset name="common_hidden" loadfrom="common_hidden"></fieldset>     
    8484           
  • unlimited-elements-for-elementor/trunk/unlimited_elements.php

    r3090199 r3097249  
    55* Description: Unlimited Elements - Huge Widgets Pack for Elementor Website Builder, with html/css/js widget creator and editor
    66* Author: Unlimited Elements
    7 * Version: 1.5.108
     7* Version: 1.5.110
    88* Author URI: http://unlimited-elements.com
    99* Text Domain: unlimited-elements-for-elementor
    1010* Domain Path: /languages
    1111*
    12 * Tested up to: 6.5 
    13 * Elementor tested up to: 3.21.2
    14 * Elementor Pro tested up to: 3.21.0
     12* Tested up to: 6.5.3
     13* Elementor tested up to: 3.21.8
     14* Elementor Pro tested up to: 3.21.3
    1515*/
    1616
  • unlimited-elements-for-elementor/trunk/views/layouts.php

    r3094530 r3097249  
    77 * */
    88defined('UNLIMITED_ELEMENTS_INC') or die('Restricted access');
     9
    910
    1011require HelperUC::getPathViewObject("layouts_view.class");
Note: See TracChangeset for help on using the changeset viewer.