Nimble Page Builder - Version 1.7.5

Version Description

Performance improvements for the live customizer part of Nimble Builder.

=

Download this release

Release Info

Developer nikeo
Plugin Icon 128x128 Nimble Page Builder
Version 1.7.5
Comparing to
See all releases

Code changes from version 1.7.4 to 1.7.5

assets/czr/sek/js/ccat-sek-control.js CHANGED
@@ -3669,7 +3669,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3669
 
3670
  // Fetch the presetSectionCollection from the server now, so we save a few milliseconds when injecting the first preset_section
3671
  // it populates api.sek_presetSections
3672
- self._maybeFetchSectionsFromServer();
 
 
 
3673
  });
3674
  return dfd;
3675
  }
3669
 
3670
  // Fetch the presetSectionCollection from the server now, so we save a few milliseconds when injecting the first preset_section
3671
  // it populates api.sek_presetSections
3672
+ //
3673
+ // updated in v1.7.5, may 21st : performance improvements on customizer load
3674
+ // inserting preset sections is not on all Nimble sessions => let's only fetch when user inserts the first section
3675
+ // self._maybeFetchSectionsFromServer();
3676
  });
3677
  return dfd;
3678
  }
assets/czr/sek/js/ccat-sek-control.min.js CHANGED
@@ -1 +1 @@
1
- var CZRSeksPrototype=CZRSeksPrototype||{};!function(n,r){r.extend(CZRSeksPrototype,{initialize:function(){var e=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(n.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");e.SECTION_ID_FOR_GLOBAL_OPTIONS="__globalOptionsSectionId",e.SECTION_ID_FOR_LOCAL_OPTIONS="__localOptionsSection",e.SECTION_ID_FOR_CONTENT_PICKER="__content_picker__",e.MAX_NUMBER_OF_COLUMNS=12,e.SETTING_UPDATE_BUFFER=100,e.TINYMCE_EDITOR_HEIGHT=100,e.defaultLocalSektionSettingValue=e.getDefaultSektionSettingValue("local"),e.localSectionsSettingId=new n.Value({}),e.registered=new n.Value([]),n.bind("ready",function(){e.doSektionThinksOnApiReady()}),n.bind("save-request-params",function(e){r.extend(e,{local_skope_id:n.czr_skopeBase.getSkopeProperty("skope_id")})}),n.bind("sek-before-clean-registered",function(){_.isArray(n.czrActiveWPEditors)&&(_.each(n.czrActiveWPEditors,function(e){wp.editor.remove(e)}),n.czrActiveWPEditors=[])})},doSektionThinksOnApiReady:function(){var o=this;o.registerAndSetupDefaultPanelSectionOptions(),o.localSectionsSettingId.callbacks.add(function(e,t){try{o.setupSettingsToBeSaved()}catch(e){n.errare("Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()",e)}o.initializeHistoryLogWhenSettingsRegistered(),n.previewer.send("sek-request-active-locations")});var i=function(e,t){o.setContextualCollectionSettingIdWhenSkopeSet(e,t),n.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){e.deferred.embedded.done(function(){!0!==e.boundForLocalOptionGeneration&&(e.boundForLocalOptionGeneration=!0,e.expanded.bind(function(e){!0===e&&o.generateUI({action:"sek-generate-local-skope-options-ui"})}))})}),n.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){!0!==e.nimbleGlobalOptionGenerated&&(o.generateUI({action:"sek-generate-global-options-ui"}),e.nimbleGlobalOptionGenerated=!0)}),n.trigger("nimble-ready-for-current-skope")};_.isEmpty(n.czr_activeSkopes().local)||i(),n.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),o.reactToPreviewMsg(),o.setupDnd(),o.setupTinyMceEditor(),o.schedulePrintSectionJson(),o.bind("sek-ui-removed",function(){n.previewedDevice("desktop")}),n.previewedDevice.bind(function(t){var e=_.filter(o.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){n.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){r(this).trigger("click")})})})}),r("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){o.resetCollectionSetting()}),o.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&n.control(e.id,function(e){e.container.find("[draggable]").each(function(){r(this).off("dragstart dragend")})}),"control"==e.what&&n.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(r(this).data("czrSelect2"))||r(this).czrSelect2("destroy")})})}),n.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=o.registered(),i=r.extend(!0,[],t),n=_.findWhere(i,{id:e.id});if(!_.isEmpty(n)&&_.isEqual(n,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),o.registered(i)}}),o.activeLocations=new n.Value([]),n.previewer.bind("sek-active-locations-in-preview",function(e){o.activeLocations(_.isObject(e)&&_.isArray(e.active_locations)?e.active_locations:[])}),o.setupTopBar(),sektionsLocalizedData.isSavedSectionEnabled&&o.setupSaveUI(),o.lastClickedTargetInPreview=new n.Value,o.lastClickedTargetInPreview.bind(function(e,t){_.isObject(e)&&e.id?n.previewer.send("sek-set-double-click-target",e):n.previewer.send("sek-reset-double-click-target"),clearTimeout(r(window).data("_preview_target_timer_")),r(window).data("_preview_target_timer_",setTimeout(function(){o.lastClickedTargetInPreview({}),n.previewer.send("sek-reset-double-click-target")},2e4))}),n.previewer.bind("sek-clean-target-drop-zone",function(){o.lastClickedTargetInPreview({})}),r(document).keydown(function(e){e&&27===e.keyCode&&o.lastClickedTargetInPreview({})}),sektionsLocalizedData.hasActiveCachePlugin&&_.delay(function(){n.previewer.trigger("sek-notify",{notif_id:"has-active-cache-plugin",type:"info",duration:2e4,message:['<span style="color:#0075a2">',sektionsLocalizedData.i18n["You seem to be using a cache plugin."],"<strong> ("+sektionsLocalizedData.hasActiveCachePlugin+")</strong><br/>","<strong>",sektionsLocalizedData.i18n["It is recommended to disable your cache plugin when customizing your website."],"</strong>","</span>"].join("")})},2e3)},registerAndSetupDefaultPanelSectionOptions:function(){var o=this,e=n.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});n.panel(sektionsLocalizedData.sektionsPanelId,function(n){n.deferred.embedded.done(function(){var e=n.container.find("h3.accordion-section-title"),t=(n.container.find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+n.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join(""));if(0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}sektionsLocalizedData.eligibleForFeedbackNotification&&n.expanded.bind(function(e){e&&_.isUndefined(o.feedbackUIVisible)&&o.setupFeedBackUI()})})}),n.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),n.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_GLOBAL_OPTIONS,title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:n.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){n.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e)})}),n.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_LOCAL_OPTIONS,title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:n.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){n.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e)})}),n.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"refresh",type:"option"}),n.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_CONTENT_PICKER,title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:n.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){n.section(o.SECTION_ID_FOR_CONTENT_PICKER,function(e){"resolved"!=n.czr_initialSkopeCollectionPopulated.state()?n.czr_initialSkopeCollectionPopulated.done(function(){n.previewer.trigger("sek-pick-content",{focus:!1})}):n.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&n.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&n.previewer.trigger("sek-pick-content"),sektionsData=n.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&n.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&n.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&n.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.localSectionsSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,a){a.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarId="#nimble-top-bar",t.topBarVisible=new r.Value(!1),t.topBarVisible.bind(function(e){t.levelTreeExpanded()||t.toggleTopBar(e)}),t.mouseMovedRecently=new r.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(a(window).data("_scroll_move_timer_")),a(window).data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};a(window).on("mousemove scroll,",_.throttle(e,50)),r.previewer.bind("ready",function(){a(r.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.setupLevelTree()},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?a.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){a("body").addClass("nimble-top-bar-visible")},200)}):(t=a.Deferred(),a("body").removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){var t,i=this;if(0<a(i.topBarId).length)return a(i.topBarId);try{t=wp.template("nimble-top-bar")({})}catch(e){return r.errare("Error when parsing the the top note template",e),!1}a("#customize-preview").after(a(t)),a(document).keydown(function(e){if(e.ctrlKey&&_.contains([89,90],e.keyCode))try{i.navigateHistory(90===e.keyCode?"undo":"redo")}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),a(".sek-add-content",i.topBarId).on("click",function(e){e.preventDefault(),r.previewer.trigger("sek-pick-content",{content_type:"module"})}),a(".sek-level-tree",i.topBarId).on("click",function(e){e.preventDefault(),i.levelTreeExpanded(!i.levelTreeExpanded())}),a("[data-nimble-history]",i.topBarId).on("click",function(e){try{i.navigateHistory(a(this).data("nimble-history"))}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),a(".sek-settings",i.topBarId).on("click",function(e){r.panel(sektionsLocalizedData.sektionsPanelId,function(e){i.rootPanelFocus(),e.focus()})}),a(".sek-nimble-doc",i.topBarId).on("click",function(e){e.preventDefault(),window.open(a(this).data("doc-href"),"_blank")});var n=function(e){a(i.topBarId).length<1||(_.isObject(e)&&e.local_template&&"default"!==e.local_template?a(i.topBarId).find(".sek-notifications").html(['<span class="fas fa-info-circle"></span>',sektionsLocalizedData.i18n["This page uses a custom template."]].join(" ")):a(i.topBarId).find(".sek-notifications").html(""))},o=function(){r(i.localSectionsSettingId(),function(e){var t=e(),i=_.isObject(t)&&t.local_options&&t.local_options.template?t.local_options.template:null;n(i)}),r(i.getLocalSkopeOptionId()+"__template",function(e){e.bind(function(e,t){n(e)})})};return o(),r.bind("nimble-ready-for-current-skope",function(){o()}),a(i.topBarId)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{initializeHistoryLogWhenSettingsRegistered:function(){this.historyLog=new l.Value([{status:"current",value:{local:l(this.localSectionsSettingId())(),global:l(this.getGlobalSectionsSettingId())()},action:"initial"}]),this.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),d("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===d(this).data("nimble-history")?d(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):d(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},trackHistoryLog:function(e,t){var i=this,n=e.id===i.getGlobalSectionsSettingId();if(!_.isObject(t)||!_.isFunction(i.historyLog)||!_.isArray(i.historyLog()))throw l.errare("params, self.historyLog() ",t,i.historyLog()),new Error("trackHistoryLog => invalid params or historyLog value");var o,r=[],a=d.extend(!0,[],i.historyLog());_.isEmpty(t.in_sektion)?_.isEmpty(t.to_sektion)||(o=t.to_sektion):o=t.in_sektion,_.each(a,function(e){"future"!=e.status&&(d.extend(e,{status:"previous"}),r.push(e))}),r.push({status:"current",value:n?{global:e()}:{local:e()},action:_.isObject(t)&&t.action||"",sektionToRefresh:o}),i.historyLog(r)},navigateHistory:function(i){var t,n,o,r,e=this,a=d.extend(!0,[],e.historyLog()),s=[];if(_.each(a,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":n=e;break;case"future":o=e}switch(i){case"undo":_.isEmpty(n)||_.isEmpty(t)||(r=t.value,n.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(o)||(r=o.value,n.sektionToRefresh,o.sektionToRefresh)}}}),!_.isUndefined(r)){_.isEmpty(r.local)||(l(e.localSectionsSettingId())(e.validateSettingValue(r.local,"local"),{navigatingHistoryLogs:!0}),l.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0})),_.isEmpty(r.global)||l(e.getGlobalSectionsSettingId())(e.validateSettingValue(r.global,"global"),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(a,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(a,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":a.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}s.push(newLog)}),e.historyLog(s)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(b,z){z.extend(CZRSeksPrototype,{setupLevelTree:function(){var i=this;i.levelTree=new b.Value([]),i.levelTree.bind(function(){i.levelTreeExpanded()&&i.renderOrRefreshTree()}),i.levelTreeExpanded=new b.Value(!1),i.levelTreeExpanded.bind(function(e){if(z("body").toggleClass("sek-level-tree-expanded",e),e){if(i.setLevelTreeValue(),_.isEmpty(i.levelTree()))return b.previewer.trigger("sek-notify",{type:"info",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["No sections to navigate"]+"</strong>","</span>"].join("")}),void i.levelTreeExpanded(!1);z("#customize-preview iframe").css("z-index",1),i.renderOrRefreshTree()}else 0<z("#nimble-level-tree").length&&_.delay(function(){z("#nimble-level-tree").remove(),z("#customize-preview iframe").css("z-index","")},300)}),i.activeLocations.bind(function(){_.isEmpty(i.levelTree())||i.renderOrRefreshTree()}),b.previewer.bind("ready",function(){i.localSectionsSettingId.callbacks.add(function(){i.levelTreeExpanded(!1),_.each([i.getGlobalSectionsSettingId(),i.localSectionsSettingId(),sektionsLocalizedData.optNameForGlobalOptions],function(e){b(e)._isBoundForNimbleLevelTree||(b(e).bind(function(e){i.setLevelTreeValue()}),b(e)._isBoundForNimbleLevelTree=!0)})})}),z("body").on("click","#nimble-level-tree [data-nimb-level]",function(e){e.preventDefault(),e.stopPropagation();var t=z(e.target).closest("[data-nimb-level]");b.previewer.send("sek-animate-to-level",{id:t.data("nimb-id")}),b.previewer.send("sek-display-level-ui",{id:t.data("nimb-id")})}),z("body").on("click","#nimble-level-tree .sek-remove-level",function(e){e.preventDefault(),e.stopPropagation();var t=z(e.target).closest("[data-nimb-level]");b.previewer.trigger("sek-remove",{level:t.data("nimb-level"),id:t.data("nimb-id"),location:t.closest('[data-nimb-level="location"]').data("nimb-id"),in_sektion:t.closest('[data-nimb-level="section"]').data("nimb-id"),in_column:t.closest('[data-nimb-level="column"]').data("nimb-id")}),t.fadeOut("slow"),i.renderOrRefreshTree()}),z("body").on("click",".sek-close-level-tree",function(e){e.preventDefault(),i.levelTreeExpanded(!1)})},setLevelTreeValue:function(){var e,t,i,n,o,r=this.getGlobalSectionsSettingId(),a=this.localSectionsSettingId(),s=sektionsLocalizedData.optNameForGlobalOptions,c=!1;if(_.each([r,a,s],function(e){b.has(e)||(c=e)}),!1===c){e=b(r)(),i=_.isObject(e)?z.extend(!0,{},e):{},i=_.isEmpty(i.collection)?[]:i.collection,i=_.isArray(i)?i:[],t=b(a)(),t=_.isObject(t)?t:{},n=z.extend(!0,{},t),n=_.isEmpty(n.collection)?[]:n.collection,n=_.isArray(n)?n:[];var l,d=_.union(i,n),u=!1,p=!1;o=b(s)(),o=_.isObject(o)?o:{},t.local_options&&t.local_options.local_header_footer&&(u="nimble_local"===(l=t.local_options.local_header_footer["header-footer"])),o.global_header_footer&&!u&&"theme"!==l&&(p="nimble_global"===o.global_header_footer["header-footer"]||"nimble_global"===l);var m,f,g=z.extend(!0,[],d);g=_.filter(g,function(e,t){return!_.contains(["nimble_global_header","nimble_global_footer","nimble_local_header","nimble_local_footer"],e.id)});var h=function(e){m=_.findWhere(d,{id:"nimble_"+e+"_header"}),f=_.findWhere(d,{id:"nimble_"+e+"_footer"}),g.unshift(m),g.push(f)};u?h("local"):p&&h("global");var k,y=this.activeLocations(),v=[];_.isEmpty(y)?v=g:_.each(y,function(e){k=_.findWhere(g,{id:e}),_.isUndefined(k)||v.push(k)}),this.levelTree(v)}else b.errare("::setLevelTreeValue => a setting id is not registered ")},renderOrRefreshTree:function(){var e;if(z("#nimble-level-tree").length<1){try{e=wp.template("nimble-level-tree")({})}catch(e){return b.errare("Error when parsing the the nimble-level-tree template",e),!1}z("#customize-preview").after(z(e))}z("#nimble-level-tree").find(".sek-tree-wrap").html(this.getLevelTreeHtml())},getLevelTreeHtml:function(e,t){var i=this;e=e||i.levelTree();var n,o,r,a=!1;if(!_.isArray(e)||_.isEmpty(e))return b.errare("::buildLevelTree => invalid collection param",e),r;var s='<i class="material-icons sek-remove-level" title="'+sektionsLocalizedData.i18n["Remove this element"]+'">delete_forever</i>';return r="<ul>",_.each(e,function(e){_.isUndefined(e.level)?b.errare("::buildLevelTree => missing level property",e):_.isUndefined(e.id)?b.errare("::buildLevelTree => missing id property",e):(n=e.level,"location"===(o=n)&&(a=!_.contains(i.activeLocations(),e.id)),a||(sektionsLocalizedData.i18n[n]&&(o=sektionsLocalizedData.i18n[n]),!0===e.is_nested&&(o=sektionsLocalizedData.i18n["nested section"]),s="location"!==n?s:"",r+='<li data-nimb-level="'+n+'" data-nimb-id="'+e.id+'">',r+='<div class="sek-level-infos"><div class="sek-inner-level-infos">',"module"===n&&(r+=[i.getTreeModuleIcon(e.module_type),i.getTreeModuleTitle(e.module_type)].join(" ")),r+=[" ",o,"( id :",e.id,")",s].join(" "),r+="</div></div>",_.isArray(e.collection)&&!_.isEmpty(e.collection)&&(r+=i.getLevelTreeHtml(e.collection,t)),r+="</li>"))}),r+="</ul>"},getTreeModuleIcon:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i={svg:e.icon?sektionsLocalizedData.moduleIconPath+e.icon:"",font:e.font_icon?e.font_icon:""})}),_.isEmpty(i.svg)?_.isEmpty(i.font)?void 0:i.font:'<img class="sek-svg-mod-icon" src="'+i.svg+'"/>'},getTreeModuleTitle:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i=e.title)}),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,c){c.extend(CZRSeksPrototype,{setupSaveUI:function(){var n=this;n.saveUIVisible=new s.Value(!1),n.saveUIVisible.bind(function(e,t,i){n.toggleSaveUI(e,i?i.id:null)})},toggleSaveUI:function(e,t){e=!!_.isUndefined(e)||e;var i,n=this;e?c.when(n.renderAndSetupSaveUITmpl({})).done(function(e){n.saveUIContainer=e,_.delay(function(){c("body").addClass("nimble-save-ui-visible")},200),c("#sek-saved-section-id").val(t)}):(i=c.Deferred(),c("body").removeClass("nimble-save-ui-visible"),0<c("#nimble-top-save-ui").length?_.delay(function(){n.saveUIContainer.remove(),i.resolve()},300):i.resolve(),i.promise()).done(function(){n.saveUIVisible(!1)})},preProcessSektion:function(e){var t=this.cleanIds(e);return _.omit(t,function(e,t){return _.contains(["id","level"],t)})},renderAndSetupSaveUITmpl:function(e){if(0<c("#nimble-top-save-ui").length)return c("#nimble-top-save-ui");var a=this;try{_tmpl=wp.template("nimble-top-save-ui")({})}catch(e){return s.errare("Error when parsing the the top note template",e),!1}return c("#customize-preview").after(c(_tmpl)),c(".sek-do-save-section","#nimble-top-save-ui").on("click",function(e){e.preventDefault();var t=c.extend(!0,{},a.getLevelModel(c("#sek-saved-section-id").val())),i=c("#sek-saved-section-title").val(),n=c("#sek-saved-section-description").val(),o=a.guid(),r=a.preProcessSektion(t);if(_.isEmpty(i))return c("#sek-saved-section-title").addClass("error"),void s.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")});c("#sek-saved-section-title").removeClass("error"),wp.ajax.post("sek_save_section",{nonce:s.settings.nonce.save,sek_title:i,sek_description:n,sek_id:o,sek_data:JSON.stringify(r)}).done(function(e){s.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n Your section has been saved.</strong>","</span>"].join("")})}).fail(function(e){s.errorLog("ajax sek_save_section => error",e),s.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")})})}),c(".sek-cancel-save","#nimble-top-save-ui").on("click",function(e){e.preventDefault(),a.saveUIVisible(!1)}),c("#nimble-top-save-ui")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,a){a.extend(CZRSeksPrototype,{setupFeedBackUI:function(){var t=this;t.feedbackLastUserAction="none",t.feedbackUIId="#nimble-feedback",t.feedbackUIVisible=new r.Value(!1),t.feedbackUIVisible.bind(function(e){t.levelTreeExpanded()||t.toggleFeddBackUI(e),e&&t.refreshSelfClosingTimer()}),t.feedbackUIVisible(!0)},refreshSelfClosingTimer:function(){var e=this;clearTimeout(a(e.feedbackUIId).data("_feedback_user_action_timer_")),a(e.feedbackUIId).data("_feedback_user_action_timer_",setTimeout(function(){_.contains(["go_review","reporting_problem"],e.feedbackLastUserAction)||e.feedbackUIVisible(!1)},6e4))},toggleFeddBackUI:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?a.when(i.renderAndSetupFeedbackTmpl({})).done(function(e){_.delay(function(){a("body").addClass("nimble-feedback-ui-visible")},200)}):(t=a.Deferred(),a("body").removeClass("nimble-feedback-ui-visible"),0<a(i.feedbackUIId).length?_.delay(function(){a(i.feedbackUIId).remove(),t.resolve()},300):t.resolve(),t.promise()).done(function(){i.feedbackUIVisible(!1)})},renderAndSetupFeedbackTmpl:function(e){var t,i=this;if(0<a(i.feedbackUIId).length)return a(i.feedbackUIId);try{t=wp.template("nimble-feedback-ui")({})}catch(e){return r.errare("Error when parsing the the feedback template",e),!1}if(a("#customize-preview").after(a(t)),!i.feedbackEventsScheduled){var n=a(i.feedbackUIId).data("sek-dismiss-pointer"),o=function(){wp.ajax.post("dismiss-wp-pointer",{pointer:n}).fail(function(e){r.errare("ajax dismiss failure",e)})};return a("body").on("click","[data-sek-feedback-action]",function(e){e.preventDefault(),i.refreshSelfClosingTimer();var t=a(this).data("sek-feedback-action");switch(i.feedbackLastUserAction=t){case"not_enjoying":a(i.feedbackUIId).find(".sek-feedback-step-one").hide(),a(i.feedbackUIId).find(".sek-feedback-step-two-not-enjoying").show();break;case"enjoying":a(i.feedbackUIId).find(".sek-feedback-step-one").hide(),a(i.feedbackUIId).find(".sek-feedback-step-two-enjoying").show();break;case"reporting_problem":window.open(a(this).data("problem-href"),"_blank");break;case"go_review":window.open("https://wordpress.org/support/plugin/nimble-builder/reviews/?filter=5/#new-post","_blank");break;case"maybe_later":i.feedbackUIVisible(!1),wp.ajax.post("sek_postpone_feedback",{nonce:r.settings.nonce.save,transient_duration_in_days:30}).fail(function(e){r.errare("ajax dismiss failure",e)});break;case"already_did":a(i.feedbackUIId).find(".sek-feedback-step-two-not-enjoying").hide(),a(i.feedbackUIId).find(".sek-feedback-step-two-enjoying").hide(),a(i.feedbackUIId).find(".sek-feedback-step-three-thanks").show(),_.delay(function(){i.feedbackUIVisible(!1)},3e3),o();break;case"dismiss":i.feedbackUIVisible(!1),o();break;default:r.errare("::renderAndSetupFeedbackTmpl => invalid action")}}),i.feedbackEventsScheduled=!0,a(i.feedbackUIId)}}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,e){jQuery.extend(CZRSeksPrototype,{getRevisionHistory:function(e){return wp.ajax.post("sek_get_revision_history",{nonce:r.settings.nonce.save,skope_id:e.is_local?r.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId})},setSingleRevision:function(i){var n=this,o=function(e,t){r.previewer.trigger("sek-notify",{notif_id:"restore-revision-error",type:t||"info",duration:1e4,message:['<span style="">',"<strong>",e||"","</strong>","</span>"].join("")})};wp.ajax.post("sek_get_single_revision",{nonce:r.settings.nonce.save,revision_post_id:i.revision_post_id}).done(function(e){var t=i.is_local?n.localSectionsSettingId():n.getGlobalSectionsSettingId();_.isEqual(r(t)(),e)?o(sektionsLocalizedData.i18n["This is the current version."],"info"):n.updateAPISetting({action:"sek-restore-revision",is_global_location:!i.is_local,revision_value:e}).done(function(){r.previewer.refresh()}).fail(function(e){r.errare("::setSingleRevision error when firing ::updateAPISetting",e),o(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}).fail(function(e){r.errare("::setSingleRevision ajax error",e),o(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}})}(wp.customize);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{setupSettingsToBeSaved:function(){var i,o=this,e={local:{collectionSettingId:o.localSectionsSettingId()},global:{collectionSettingId:o.getGlobalSectionsSettingId()}};_.each(e,function(e,t){if(i=c.czr_skopeBase.getSkopeProperty("sektions",t).db_values,_.isEmpty(e.collectionSettingId))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!c.has(e.collectionSettingId)){c.CZR_Helpers.register({what:"setting",id:e.collectionSettingId,value:o.validateSettingValue(_.isObject(i)?i:o.getDefaultSektionSettingValue(t),t),transport:"postMessage",type:"option",track:!1,origin:"nimble"});c(e.collectionSettingId,function(n){n.bind(_.debounce(function(e,t,i){if(!_.isObject(i)||!0!==i.navigatingHistoryLogs)try{o.trackHistoryLog(n,i)}catch(e){c.errare("setupSettingsToBeSaved => trackHistoryLog",e)}},1e3))})}})},validateSettingValue:function(i,n){if(!_.isObject(i))return c.errare("::validateSettingValue => validation error => the setting should be an object",i),null;if(!_.isEmpty(n)&&_.contains(["local","global"],n)){var o={},r=!1,e=[],a=function(e){c.errare(e,i),c.previewer.trigger("sek-notify",{type:"error",duration:6e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),r=!0},s=function(t){if(!r)if(_.isUndefined(t)&&_.isEmpty(o)){if(t=l.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void a("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void a('validation error => the root level should not have a "level" or an "id" property');_.each(t,function(e,t){switch(n){case"local":if(!_.contains(["collection","local_options","fonts"],t))return void a("validation error => unauthorized option group for local setting value => "+t);break;case"global":if(!_.contains(["collection","fonts"],t))return void a("validation error => unauthorized option group for global setting value => "+t)}}),_.each(i.collection,function(e){o=t,s(e)})}}else{if(_.isEmpty(t.id)||!_.isString(t.id))return void a("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void a("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void a("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void a('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void a("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void a("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&c.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(o.level))return void a("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=o.level)return void a("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=o.level)return void a("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=o.level)return void a("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=o.level)return void a("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){o=l.extend(!0,{},t),_.isUndefined(e)?a("validation error => undefined level "):s(e)})}};return s(),r?null:i}c.errare("::validateSettingValue => invalid scope provided.",n)},resetCollectionSetting:function(e){if(_.isEmpty(e)||!_.contains(["local","global"],e))throw new Error("resetCollectionSetting => invalid scope provided.",e);return l.extend(!0,{},this.getDefaultSektionSettingValue(e))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,n){n.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var o=this,r={},a={},s=!0,e={"sek-add-section":{callback:function(e){return s=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,a={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},o.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{id:e.apiParams?e.apiParams.id:"",content_type:"section"}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return s=!0,a={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},o.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return s=!0,a={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module:e.before_module,after_module:e.after_module},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_column,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(s=!0,a={},e.level){case"section":var t=o.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return o.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),"sek-remove-section"===e.apiParams.action){var t=o.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(s=!0,a={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-move-section-up":{callback:function(e){return s=!1,a={},r={action:"sek-move-section-up-down",direction:"up",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-move-section-down":{callback:function(e){return s=!1,a={},r={action:"sek-move-section-up-down",direction:"down",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-duplicate":{callback:function(e){switch(s=!0,a={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return o.updateAPISetting(r)},complete:function(e){var t;switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),t=e.apiParams.location,c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_sektion;break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_column}c.previewer.trigger("sek-refresh-stylesheet",{id:t,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return s=!0,a={},r=e,o.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(s=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,a={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)});var t=e.location_skope_id;_.isUndefined(t)&&(t=!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id")),c.previewer.trigger("sek-refresh-stylesheet",{location_skope_id:t,is_global_location:o.isGlobalLocation(e.apiParams)}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return s=!1,a={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_sektion,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return e=_.isObject(e)?e:{},c.czr_sektions.currentContentPickerType=c.czr_sektions.currentContentPickerType||new c.Value,c.czr_sektions.currentContentPickerType(e.content_type||"module"),_.isObject(e)&&e.id&&o.lastClickedTargetInPreview({id:e.id}),s=!0,r={},a={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"module",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},o.generateUI(a)},"sek-edit-options":function(e){return s=!0,r={},_.isEmpty(e.id)?n.Deferred(function(){this.reject("missing id")}):(a={action:"sek-generate-level-options-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(a))},"sek-edit-module":function(e){return s=!0,r={},a={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(a)},"sek-notify":function(t){s=!1;var i=t.notif_id||"sek-notify";return n.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification(i,{type:t.type||"info",message:t.message,dismissible:!0})),_.delay(function(){c.notifications.remove(i)},t.duration||5e3)}),this.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-level":function(t){return s=!0,n.Deferred(function(e){r={action:"sek-refresh-level",level:t.level,id:t.id},a={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-stylesheet":function(t){return s=!0,t=t||{},n.Deferred(function(e){r={id:t.id},a={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-toggle-save-section-ui":function(t){return s=!1,o.saveUIVisible(!0,t),n.Deferred(function(e){r={},a={},e.resolve({is_global_location:o.isGlobalLocation(t)})})}};_.each(e,function(i,n){c.previewer.bind(n,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+n);e=i.callback}try{e(t).done(function(e){e=e||{},s?c.previewer.send(n,{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:a,cloneId:!_.isEmpty(e.cloneId)&&e.cloneId}):c.previewer.trigger([n,"done"].join("_"),{apiParams:r,uiParams:a}),o.trigger([n,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => error when firing "+n,e),c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+n,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this;c.previewer.bind("sek-to-json",function(e){var t=n.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(i.cleanIds(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(y,v){v.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=v.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(n){if(!_.isEmpty(n.settingParams)&&_.has(n.settingParams,"to")){var o,r=this,e=n.settingParams.to,t=null,i=!1;if(!_.isEmpty(n.settingParams.args)&&_.has(n.settingParams.args,"moduleRegistrationParams")){var a=n.settingParams.args.moduleRegistrationParams.control,s=n.settingParams.args.moduleRegistrationParams.id,c=a.czr_Module(s);if(_.isEmpty(c)?y.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",n):(t=c.module_type,i=c.isMultiItem()),!i&&_.isObject(e)?o=r.normalizeAndSanitizeSingleItemInputValues(e,t):(o=[],_.each(e,function(e){o.push(r.normalizeAndSanitizeSingleItemInputValues(e,t))})),_.isEmpty(n.defaultPreviewAction))y.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",n);else{var l,d="refresh_stylesheet"===n.defaultPreviewAction,u="refresh_markup"===n.defaultPreviewAction,p="refresh_fonts"===n.defaultPreviewAction,m="refresh_preview"===n.defaultPreviewAction,f=n.settingParams.args.input_changed,g=function(){return l&&_.isString(l.refresh_markup)&&"true"!==l.refresh_markup&&"false"!==l.refresh_markup};_.isUndefined(f)||(l=r.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=g()?l.refresh_markup:Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var h=function(){if(!0!==n.isGlobalOptions)return r.updateAPISetting({action:n.uiParams.action,id:n.uiParams.id,value:o,in_column:n.uiParams.in_column,in_sektion:n.uiParams.in_sektion,options_type:n.options_type,settingParams:n.settingParams}).done(function(e){!0===d&&y.previewer.send("sek-refresh-stylesheet",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:y.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:y.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:n.uiParams.id,level:n.uiParams.level}});var t=function(){y.previewer.send("sek-refresh-level",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:y.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:y.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-level",id:n.uiParams.id,level:n.uiParams.level},skope_id:y.czr_skopeBase.getSkopeProperty("skope_id")})};if(!0===u&&t(),g()){var i=n.settingParams.args.input_value;if(!_.isString(i))throw new Error("::updateAPISettingAndExecutePreviewActions => _doUpdateWithRequestedAction => refreshMarkupWhenNeededForInput => html content is not a string.");r.htmlIncludesShortcodesOrTmplTags(i)?t():y.previewer.send("sek-update-html-in-selector",{selector:l.refresh_markup,html:i,id:n.uiParams.id,location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:y.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:y.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-update-html-in-selector",id:n.uiParams.id,level:n.uiParams.level},skope_id:y.czr_skopeBase.getSkopeProperty("skope_id")})}!0===m&&y.previewer.refresh()});if(_.isEmpty(n.options_type))y.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=y(sektionsLocalizedData.optNameForGlobalOptions)(),t=v.extend(!0,{},_.isObject(e)?e:{}),i={};_.each(o||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[n.options_type]=i,y(sektionsLocalizedData.optNameForGlobalOptions)(t)}};if(!0===p){var k=n.settingParams.args.input_value;if(!_.isString(k))return void y.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",k);-1<k.indexOf("gfont")?r.updateAPISetting({action:"sek-update-fonts",font_family:k,is_global_location:r.isGlobalLocation(n.uiParams)}).always(function(){h().then(function(){r.updateAPISetting({action:"sek-update-fonts",is_global_location:r.isGlobalLocation(n.uiParams)})})}):h()}else h()}}else y.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",n)}else y.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",n)},normalizeAndSanitizeSingleItemInputValues:function(e,o){var i,r={},n={},a=null,s=this;return _.each(e,function(e,t){var i,n;_.contains(["title","id"],t)||(null!==o&&"no_default_value_specified"===(a=s.getInputDefaultValue(t,o))&&y.infoLog("::normalizeAndSanitizeSingleItemInputValues => missing default value for input "+t+" in module "+o),i=e,n=a,(_.isBoolean(i)||_.isBoolean(n)?Boolean(i)===Boolean(n):_.isNumber(i)||_.isNumber(n)?Number(i)===Number(n):_.isString(i)||_.isString(n)?i+""==n+"":_.isObject(i)&&_.isObject(n)?_.isEqual(i,n):_.isArray(i)&&_.isArray(n)?JSON.stringify(i.sort())===JSON.stringify(n.sort()):i===n)||(_.isString(e)||_.isObject(e))&&_.isEmpty(e)||(r[t]=e))}),_.each(r,function(e,t){switch(s.getInputType(t,o)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"detached_tinymce_editor":case"nimble_tinymce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}n[t]=i}),n},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=y.control.has(t):(i=!0,1<e.length&&y.errare("generateUI => why is this control registered more than once ? => "+t)),i},htmlIncludesShortcodesOrTmplTags:function(e){var t=e.match(/\[+([\w_-])+/g),i=e.match(/\{\{+([\w_-])+/g),n=[],o=[];if(t)for(var r=0;r<t.length;r++){var a=t[r].replace(/^\[+/g,"");-1===n.indexOf(a)&&n.push(a)}if(i)for(var s=0;s<i.length;s++){var c=i[s].replace(/^\[+/g,"");-1===o.indexOf(c)&&o.push(c)}return!_.isEmpty(n)||!_.isEmpty(o)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,s){s.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(o,e){var r=this,t={};s.extend(t,{content_type_switcher:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:sektionsLocalizedData.i18n["Select a content type"],priority:0,settingValue:{content_type:o.content_type}},module_picker:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:sektionsLocalizedData.i18n["Pick a module"],content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_intro_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_intro_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for an introduction"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_features_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_features_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for services and features"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_contact_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_contact_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Contact-us sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_column_layouts_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_column_layouts_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Empty sections with columns layout"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isNimbleHeaderFooterEnabled&&s.extend(t,{sek_header_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_header_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Header sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_footer_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_footer_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Footer sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isSavedSectionEnabled&&s.extend(t,{sek_my_sections_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_my_sections_sec_picker_module",controlLabel:"@missi18n My sections",content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return r.isUIControlAlreadyRegistered(n)?a.control(n,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}})}):(_do_register_=function(){_.each(t,function(n,e){a.has(n.settingControlId)||(a(n.settingControlId,function(e){e.bind(function(e,t){a.errare("generateUIforDraggableContent => the setting() should not changed")})}),a.CZR_Helpers.register({origin:"nimble",level:o.level,what:"setting",id:n.settingControlId,dirty:!1,value:n.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),a.CZR_Helpers.register({origin:"nimble",level:o.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.SECTION_ID_FOR_CONTENT_PICKER,priority:n.priority||10,settings:{default:n.settingControlId},track:!1}).done(function(){a.control(n.settingControlId,function(e){e.content_type=n.content_type,!0===o.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),"section"===e.content_type?(e.container.find(".czr-items-wrapper").hide(),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&(e.container.find(".czr-items-wrapper").show(),t.trigger("click"))):e.container.attr("data-sek-accordion","no")})})})},a.section(r.SECTION_ID_FOR_CONTENT_PICKER,function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),r.scheduleModuleAccordion.call(e,{expand_first_control:!0}),r._maybeFetchSectionsFromServer()})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(r,e){var a=this;_.isEmpty(r.id)&&e.reject("generateUI => missing id");var i=a.getLevelProperty({property:"value",id:r.id}),t=a.getLevelProperty({property:"module_type",id:r.id}),n=a.getRegisteredModuleProperty(t,"name");_.isEmpty(t)&&e.reject("generateUI => module => invalid module_type");var o={};if(!0===a.getRegisteredModuleProperty(t,"is_father")){var s=a.getRegisteredModuleProperty(t,"children");if(_.isEmpty(s))throw new Error("::generateUIforFrontModules => a father module "+t+" is missing children modules ");_.each(s,function(e,t){o[t]={settingControlId:r.id+"__"+t,module_type:e,controlLabel:a.getRegisteredModuleProperty(e,"name")}})}else o.__no_option_group_to_be_updated_by_children_modules__={settingControlId:r.id,module_type:t,controlLabel:n};var c=_.keys(o)[0],l=o[c].settingControlId;return a.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(a.cleanRegistered(),_do_register_=function(){_.each(o,function(n,o){if(!d.has(n.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(r,{action:"sek-set-module-value"}),options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions",e)}};d(n.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},i);"__no_option_group_to_be_updated_by_children_modules__"!==o&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[o])?e[o]:{}),d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.id,priority:10,settings:{default:n.settingControlId}}).done(function(){}),d.control(n.settingControlId,function(e){d.control(n.settingControlId).focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})},d.section.when(r.id,function(){d.section(r.id).focus(),_do_register_()}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Content for"]+" "+n,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){}),d.section(r.id,function(e){e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),a.scheduleModuleAccordion.call(e,{expand_first_control:!0})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(a,e){var s=this,c=s.getLevelProperty({property:"options",id:a.id});c=_.isObject(c)?c:{};var t={};d.extend(t,{bg:{settingControlId:a.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[a.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'},border:{settingControlId:a.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:a.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:a.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Custom anchor ( CSS ID ) and CSS classes for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:a.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:a.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height and vertical alignment for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),"section"===a.level&&(d.extend(t,{width:{settingControlId:a.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),d.extend(t,{breakpoint:{settingControlId:a.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}})),"module"===a.level&&d.extend(t,{width:{settingControlId:a.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return s.isUIControlAlreadyRegistered(n)?l.control(n).focus({completeCallback:function(){var e=l.control(n).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(t,function(n,o){if(s.isUIControlAlreadyRegistered(n.settingControlId))l.section(l.control(n.settingControlId).section()).expanded(!0);else{if(!l.has(n.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=c[o]||{},i=s.getModuleStartingValue(n.module_type);if("no_starting_value"!==i&&_.isObject(i)){var r=d.extend(!0,{},i);e=d.extend(r,e)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,level_id:a.id,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:a.id,priority:0,settings:{default:n.settingControlId}}).done(function(){}),l.control(n.settingControlId,function(e){!0===n.expandAndFocusOnInit&&e.focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})}})},l.section.has(a.id)||l.section(a.id,function(e){s.scheduleModuleAccordion.call(e,{expand_first_control:!0})}),l.CZR_Helpers.register({origin:"nimble",what:"section",id:a.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+a.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){}),l.section(a.id,function(e){_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>')})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=l.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(l.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(a,e){var s=this,i=s.getLocalSkopeOptionId();if(s.isUIControlAlreadyRegistered(i))return e;if(s.localOptionsRegistrationParams={},_.isUndefined(sektionsLocalizedData.localOptionsMap)||!_.isObject(sektionsLocalizedData.localOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid localOptionsMap"),e;!0===a.clean_settings&&s.cleanRegisteredLocalOptionSettings(),_.each(sektionsLocalizedData.localOptionsMap,function(e,t){switch(t){case"template":s.localOptionsRegistrationParams[t]={settingControlId:i+"__template",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'};break;case"local_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"widths":s.localOptionsRegistrationParams[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"custom_css":s.localOptionsRegistrationParams[t]={settingControlId:i+"__custom_css",module_type:e,controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'};break;case"local_performances":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"local_reset":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"local_revisions":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of local sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"import_export":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_imp_exp",module_type:e,controlLabel:sektionsLocalizedData.i18n["Export / Import"],icon:'<i class="material-icons sek-level-option-icon">import_export</i>'};break;default:l.errare("::generateUIforLocalOptions => an option group could not be registered => "+e,t)}});var t=l(s.localSectionsSettingId())(),c=d.extend(!0,{},_.isObject(t.local_options)?t.local_options:{});return _do_register_=function(){_.each(s.localOptionsRegistrationParams,function(n,o){var e=s.getModuleStartingValue(n.module_type),t=_.isObject(c[o])?c[o]:{};if(!l.has(n.settingControlId)){var i=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};if(l(n.settingControlId,function(e){e.bind(_.debounce(i,s.SETTING_UPDATE_BUFFER))}),"no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);t=d.extend(r,t)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:t,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:s.SECTION_ID_FOR_LOCAL_OPTIONS,priority:10,settings:{default:n.settingControlId}}).done(function(){l.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(a,e){var s=this,i=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(s.isUIControlAlreadyRegistered(i))return e;var n={};if(_.isUndefined(sektionsLocalizedData.globalOptionsMap)||!_.isObject(sektionsLocalizedData.globalOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid globalOptionsMap"),e;_.each(sektionsLocalizedData.globalOptionsMap,function(e,t){switch(t){case"global_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n[t]={settingControlId:i+"__header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"breakpoint":n[t]={settingControlId:i+"__breakpoint",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">devices</i>'};break;case"widths":n[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"performances":n[t]={settingControlId:i+"__performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"recaptcha":n[t]={settingControlId:i+"__recaptcha",module_type:e,controlLabel:sektionsLocalizedData.i18n["Protect your contact forms with Google reCAPTCHA"],icon:'<i class="material-icons sek-level-option-icon">security</i>'};break;case"global_revisions":n[t]={settingControlId:i+"__global_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of global sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"global_reset":n[t]={settingControlId:i+"__global_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections displayed in global locations"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"beta_features":n[t]={settingControlId:i+"__beta_features",module_type:e,controlLabel:sektionsLocalizedData.i18n["Beta features"],icon:'<i class="material-icons sek-level-option-icon">widgets</i>'};break;default:l.errare("::generateUIforGlobalOptions => an option group could not be registered => "+e,t)}});var c=sektionsLocalizedData.globalOptionDBValues;return _do_register_=function(){_.each(n,function(n,o){if(!l.has(n.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=s.getModuleStartingValue(n.module_type),i=_.isObject(c)&&!_.isEmpty(c[o])?c[o]:{};if("no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);i=d.extend(r,i)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:i,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:s.SECTION_ID_FOR_GLOBAL_OPTIONS,priority:20,settings:{default:n.settingControlId},track:!1}).done(function(){l.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(ae,se){se.extend(CZRSeksPrototype,{updateAPISetting:function(ie){var ne=this,oe=se.Deferred();(ie=ie||{}).is_global_location="global"===ie.scope||ne.isGlobalLocation(ie);var re=ie.is_global_location?ne.getGlobalSectionsSettingId():ne.localSectionsSettingId();return ae(re,function(e){!function(){var n,t,o,i,r,a,e,s,c,l=ae(re)(),d=_.isObject(l)?se.extend(!0,{},l):ne.getDefaultSektionSettingValue(ie.is_global_location?"global":"local"),u="_not_injection_scenario_";switch(d.collection=_.isArray(d.collection)?d.collection:ne.getDefaultSektionSettingValue(ie.is_global_location?"global":"local").collection,ie.action){case"sek-add-section":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(_.isEmpty(ie.location))throw new Error("updateAPISetting => "+ie.action+" => missing location");if(!0===ie.is_nested){if(o=ne.getLevelModel(ie.in_column,d.collection),"no_match"==(c=ne.getLevelModel(ie.in_sektion,d.collection))){oe.reject("updateAPISetting => "+ie.action+" => no grand parent sektion found");break}if(!0===c.is_nested){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.push({id:ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+ne.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})}else{if("no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){ie.before_section===e.id&&(L=t),ie.after_section===e.id&&(L=t+1)}),n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(L,0,{id:ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+ne.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}break;case"sek-duplicate-section":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(_.isEmpty(ie.location))throw new Error("updateAPISetting => "+ie.action+" => missing location");var p;try{p=ne.cloneLevel(ie.id)}catch(e){ae.errare("updateAPISetting => "+ie.action,e);break}var m=ne.getLevelPositionInCollection(ie.id,d.collection);if(!0===ie.is_nested){if("no_match"==(o=ne.getLevelModel(ie.in_column,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.splice(parseInt(m+1,10),0,p)}else{if("no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(parseInt(m+1,10),0,p)}e=p.id;break;case"sek-remove-section":if(!0===ie.is_nested)"no_match"!=(o=ne.getLevelModel(ie.in_column,d.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=ie.id})):ae.errare("updateAPISetting => "+ie.action+" => no parent column matched");else{if("no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}n.collection=_.filter(n.collection,function(e){return e.id!=ie.id})}break;case"sek-move-section":var f,g,h=ne.getLevelModel(ie.to_location,d.collection);if(_.isEmpty(h)||"no_match"==h)throw new Error("updateAPISetting => "+ie.action+" => missing target location");if(ie.from_location!=ie.to_location){var k=ne.getLevelModel(ie.from_location,d.collection);if(_.isEmpty(k)||"no_match"==k)throw new Error("updateAPISetting => "+ie.action+" => missing source location");k.collection=_.isArray(k.collection)?k.collection:[],f=ne.getLevelModel(ie.id,k.collection),g=se.extend(!0,{},f),k.collection=_.filter(k.collection,function(e){return e.id!=ie.id})}h.collection=_.isArray(h.collection)?h.collection:[],r=se.extend(!0,[],h.collection),a=[],_.each(ie.newOrder,function(e){if(ie.from_location!=ie.to_location&&e==g.id)a.push(g);else{if(t=ne.getLevelModel(e,r),_.isEmpty(t)||"no_match"==t)throw new Error("updateAPISetting => "+ie.action+" => missing section candidate");a.push(t)}}),h.collection=a;break;case"sek-move-section-up-down":if(parentCandidate=ne.getLevelModel(ie.is_nested?ie.in_column:ie.location,d.collection),_.isEmpty(parentCandidate)||"no_match"==parentCandidate)throw new Error("updateAPISetting => "+ie.action+" => missing target location");parentCandidate.collection=_.isArray(parentCandidate.collection)?parentCandidate.collection:[],r=se.extend(!0,[],parentCandidate.collection),a=se.extend(!0,[],parentCandidate.collection);var y=_.findIndex(r,function(e){return e.id===ie.id});if(-1===y)throw new Error("updateAPISetting => "+ie.action+" => invalid index");var v=ie.direction||"up";if("up"!==v&&r.length===y+1)throw new Error("updateAPISetting => "+ie.action+" => bottom reached");if("up"===v&&0===y)throw new Error("updateAPISetting => "+ie.action+" => top reached");a[y]=r["up"===v?y-1:y+1],a["up"===v?y-1:y+1]=r[y],parentCandidate.collection=a;break;case"sek-add-column":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if("no_match"==(t=ne.getLevelModel(ie.in_sektion,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],ne.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}_.each(t.collection,function(e){e.width=""}),t.collection.push({id:ie.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"sek-remove-column":if("no_match"!=(t=ne.getLevelModel(ie.in_sektion,d.collection))){if(1===_.size(t.collection)){oe.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);break}t.collection=_.isArray(t.collection)?t.collection:[],t.collection=_.filter(t.collection,function(e){return e.id!=ie.id}),_.each(t.collection,function(e){e.width=""})}else ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched");break;case"sek-duplicate-column":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if("no_match"==(t=ne.getLevelModel(ie.in_sektion,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],ne.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}var b;try{b=ne.cloneLevel(ie.id)}catch(e){ae.errare("updateAPISetting => "+ie.action,e);break}var z=ne.getLevelPositionInCollection(ie.id,d.collection);e=b.id,t.collection.splice(parseInt(z+1,10),0,b),_.each(t.collection,function(e){e.width=""});break;case"sek-resize-columns":if(ie.col_number<2)break;var I=ne.getLevelModel(ie.resized_column,d.collection),w=ne.getLevelModel(ie.sister_column,d.collection);if("no_match"==I){ae.errare("updateAPISetting => "+ie.action+" => no resized column matched"),oe.reject("updateAPISetting => "+ie.action+" => no resized column matched");break}I.width=parseFloat(ie.resizedColumnWidthInPercent);var M=ne.getLevelModel(ie.in_sektion,d.collection),D=_.filter(M.collection,function(e){return e.id!=I.id&&e.id!=w.id}),S=parseFloat(I.width.toFixed(3));_.isEmpty(D)||_.each(D,function(e){currentColWidth=parseFloat(1*e.width),(!_.has(e,"width")||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(e.width=parseFloat((100/ie.col_number).toFixed(3))),S=parseFloat((S+e.width).toFixed(3))}),w.width=parseFloat((100-S).toFixed(3));break;case"sek-move-column":var C,P,x=ne.getLevelModel(ie.to_sektion,d.collection);if(_.isEmpty(x)||"no_match"==x)throw new Error("updateAPISetting => "+ie.action+" => missing target sektion");if(ie.from_sektion!=ie.to_sektion){var E=ne.getLevelModel(ie.from_sektion,d.collection);if(_.isEmpty(E)||"no_match"==E)throw new Error("updateAPISetting => "+ie.action+" => missing source column");E.collection=_.isArray(E.collection)?E.collection:[],C=ne.getLevelModel(ie.id,E.collection),P=se.extend(!0,{},C),E.collection=_.filter(E.collection,function(e){return e.id!=ie.id}),_.each(E.collection,function(e){e.width=""})}x.collection=_.isArray(x.collection)?x.collection:[],r=se.extend(!0,[],x.collection),a=[],_.each(ie.newOrder,function(e){if(ie.from_sektion!=ie.to_sektion&&e==P.id)a.push(P);else{if(o=ne.getLevelModel(e,r),_.isEmpty(o)||"no_match"==o)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");a.push(o)}}),x.collection=a,_.each(x.collection,function(e){e.width=""});break;case"sek-add-module":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(_.isEmpty(ie.module_type))throw new Error("updateAPISetting => "+ie.action+" => missing module_type");if("no_match"===(o=ne.getLevelModel(ie.in_column,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}var L=0;o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){ie.before_module===e.id&&(L=t),ie.after_module===e.id&&(L=t+1)});var R={id:ie.id,level:"module",module_type:ie.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(s=ne.getModuleStartingValue(ie.module_type))&&(R.value=s),o.collection.splice(L,0,R);break;case"sek-duplicate-module":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if("no_match"==(o=ne.getLevelModel(ie.in_column,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}var O;o.collection=_.isArray(o.collection)?o.collection:[];try{O=ne.cloneLevel(ie.id)}catch(e){ae.errare("updateAPISetting => "+ie.action,e),oe.reject("updateAPISetting => "+ie.action+" => error when cloning the level");break}var A=ne.getLevelPositionInCollection(ie.id,d.collection);e=O.id,o.collection.splice(parseInt(A+1,10),0,O);break;case"sek-remove-module":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");"no_match"!=(o=ne.getLevelModel(ie.in_column,d.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=ie.id})):ae.errare("updateAPISetting => "+ie.action+" => no parent column matched");break;case"sek-move-module":var j,T,V;if(j=ne.getLevelModel(ie.to_column,d.collection),_.isEmpty(j)||"no_match"==j)throw new Error("updateAPISetting => "+ie.action+" => missing target column");if(ie.from_column!=ie.to_column){var Z;if(Z=ne.getLevelModel(ie.from_column,d.collection),_.isEmpty(Z)||"no_match"==Z)throw new Error("updateAPISetting => "+ie.action+" => missing source column");Z.collection=_.isArray(Z.collection)?Z.collection:[],T=ne.getLevelModel(ie.id,d.collection),V=se.extend(!0,{},T),Z.collection=_.filter(Z.collection,function(e){return e.id!=ie.id})}if(j.collection=_.isArray(j.collection)?j.collection:[],r=se.extend(!0,[],j.collection),a=[],_.each(ie.newOrder,function(e){if(ie.from_column!=ie.to_column&&e==V.id)a.push(V);else{if(i=ne.getLevelModel(e,d.collection),_.isEmpty(i)||"no_match"==i)throw new Error("updateAPISetting => "+ie.action+" => missing moduleCandidate");a.push(i)}}),a.length!=_.uniq(a).length)throw new Error("updateAPISetting => "+ie.action+" => there are duplicated modules in column : "+j.id);j.collection=a;break;case"sek-set-module-value":i=ne.getLevelModel(ie.id,d.collection);var F={};if(_.each(ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(F[t]=e)}),"no_match"==i){ae.errare("updateAPISetting => "+ie.action+" => no module matched",ie),oe.reject("updateAPISetting => "+ie.action+" => error no module matched");break}if(_.isEmpty(ie.options_type)){ae.errare("updateAPISetting => "+ie.action+" => missing options_type"),oe.reject("updateAPISetting => "+ie.action+" => missing options_type");break}"__no_option_group_to_be_updated_by_children_modules__"===ie.options_type?i.value=F:(i.value=_.isEmpty(i.value)?{}:i.value,i.value[ie.options_type]=F);break;case"sek-generate-level-options-ui":var U=ne.getLevelModel(ie.id,d.collection),N={};if("no_match"===U){ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent sektion matched");break}U.options=U.options||{},_.each(ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(N[t]=e)}),_.isEmpty(ie.options_type)&&ae.errare("updateAPISetting => "+ie.action+" => missing options_type"),U.options[ie.options_type]=N;break;case"sek-generate-local-skope-options-ui":N={};var B=se.extend(!0,{},_.isObject(d.local_options)?d.local_options:{});if(_.each(ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(N[t]=e)}),_.isEmpty(ie.options_type)||!_.isString(ie.options_type))ae.errare("updateAPISetting => "+ie.action+" => missing options_type");else{var Q={};Q[ie.options_type]=N,d.local_options=se.extend(B,Q)}break;case"sek-add-content-in-new-sektion":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(L=0,"no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}switch(n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){ie.before_section===e.id&&(L=t),ie.after_section===e.id&&(L=t+1)}),ie.content_type){case"module":s=ne.getModuleStartingValue(ie.content_id),n.collection.splice(L,0,{id:ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+ne.guid(),level:"column",collection:[{id:ie.droppedModuleId,level:"module",module_type:ie.content_id,value:"no_starting_value"!==s?s:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":u=se.Deferred();var H=function(e){ne.preparePresetSectionForInjection(e).fail(function(e){oe.reject("updateAPISetting => error when preparePresetSectionForInjection => "+ie.action+" => "+e),u.reject(e)}).done(function(e){var t=!1;if(!_.isEmpty(ie.sektion_to_replace)){var i=ne.getLevelModel(ie.sektion_to_replace,d.collection);"no_match"===i&&(ae.errare("updateAPISetting => "+ie.action+" => no sektionToReplace matched"),oe.reject("updateAPISetting => "+ie.action+" => no sektionToReplace matched")),t=!0===i.is_nested}t?("no_match"===(o=ne.getLevelModel(ie.in_column,d.collection))&&(ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched")),o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){ie.before_section===e.id&&(L=t),ie.after_section===e.id&&(L=t+1)}),o.collection.splice(L,0,{id:ie.id,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):n.collection.splice(L,0,{id:ie.id,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion}),u.resolve()})};ne.getPresetSectionCollection({is_user_section:ie.is_user_section,presetSectionId:ie.content_id,section_id:ie.id}).fail(function(e){ae.errare("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()",e),oe.reject("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(ae.errare("updateAPISetting => "+ie.action+" => preset section type not found or empty : "+ie.content_id,e),oe.reject("updateAPISetting => "+ie.action+" => preset section type not found or empty")),H(e)})}break;case"sek-add-preset-section-in-new-nested-sektion":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(o=ne.getLevelModel(ie.in_column,d.collection),"no_match"==(c=ne.getLevelModel(ie.in_sektion,d.collection))){oe.reject("updateAPISetting => "+ie.action+" => no grand parent sektion found");break}if(!0===c.is_nested){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],u=se.Deferred(),H=function(e){ne.preparePresetSectionForInjection(e).fail(function(e){oe.reject("updateAPISetting => error when preparePresetSectionForInjection => "+ie.action+" => "+e),u.reject(e)}).done(function(e){o.collection.push({id:ie.id,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion}),u.resolve()})},ne.getPresetSectionCollection({is_user_section:ie.is_user_section,presetSectionId:ie.content_id,section_id:ie.id}).fail(function(){ae.errare("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()",_er_),oe.reject("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(ae.errare("updateAPISetting => "+ie.action+" => preset section type not found or empty : "+ie.content_id,e),oe.reject("updateAPISetting => "+ie.action+" => preset section type not found or empty")),H(e)});break;case"sek-update-fonts":var G=ne.sniffGFonts({is_global_location:ie&&!0===ie.is_global_location});if(!_.isEmpty(ie.font_family)&&_.isString(ie.font_family)&&!_.contains(G,ie.font_family)){if(ie.font_family.indexOf("gfont")<0){ae.errare("updateAPISetting => "+ie.action+" => error => must be a google font, prefixed gfont"),oe.reject("updateAPISetting => "+ie.action+" => error => must be a google font, prefixed gfont");break}G.push(ie.font_family)}d.fonts=G;break;case"sek-restore-revision":d=ie.revision_value;break;case"sek-import-from-file":if(ae.infoLog("sek-import-from-file",ie),_.isUndefined(ie.imported_content.data)||_.isUndefined(ie.imported_content.metas)){ae.errare("updateAPISetting::sek-import-from-file => invalid imported content",imported_content);break}var W=_.isArray(ie.imported_content.data.collection)?se.extend(!0,[],ie.imported_content.data.collection):[];if(!0===ie.assign_missing_locations){var $=ie.imported_content.metas.active_locations,q=ae.czr_sektions.activeLocations(),Y=_.first(q);if(!_.isEmpty(Y)&&!_.isEmpty($)&&_.isArray($)){var J=se($).not(q).get(),K=ne.getLevelModel(Y,d.collection),X=ne.getLevelModel(Y,ie.imported_content.data.collection),ee=[];K.collection=_.isArray(K.collection)?K.collection:[],X.collection=_.isArray(X.collection)?X.collection:[],_.each($,function(e){var t=ne.getLevelModel(e,W);_.isEmpty(t.collection)||(ee=_.union(ee,t.collection))}),X.collection=ee,ie.imported_content.data.collection=_.filter(ie.imported_content.data.collection,function(e){return!_.contains(J,e.id)})}}!0===ie.keep_existing_sections&&(_.each(W,function(e){var t=ne.getLevelModel(e.id,d.collection);if(!_.isEmpty(t.collection)){var i=ne.getLevelModel(e.id,ie.imported_content.data.collection);i.collection=_.union(t.collection,i.collection)}}),d.fonts&&!_.isEmpty(d.fonts)&&_.isArray(d.fonts)&&(ie.imported_content.data.fonts=_.isArray(ie.imported_content.data.fonts)?ie.imported_content.data.fonts:[],ie.imported_content.data.fonts=_.uniq(_.union(d.fonts,ie.imported_content.data.fonts)))),d=ie.imported_content.data;break;case"sek-reset-collection":try{d=ae.czr_sektions.resetCollectionSetting(ie.scope)}catch(e){ae.errare("sek-reset-collection => error when firing resetCollectionSetting()",e)}}if("pending"==oe.state()){var te=function(){_.isEqual(l,d)?oe.reject("updateAPISetting => the new setting value is unchanged when firing action : "+ie.action):null!==ne.validateSettingValue(d,ie.is_global_location?"global":"local")?(ae(re)(d,ie),ie.cloneId=e,oe.resolve(ie)):oe.reject("Validation problem for action "+ie.action)};"_not_injection_scenario_"===u?(te(),"pending"===oe.state()&&ae.errare("::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.")):u.done(function(){te(),"pending"===oe.state()&&ae.errare("::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.")}).fail(function(e){ae.errare("updateAPISetting => __presetSectionInjected__ failed",e)})}}()}),oe.promise()},_maybeFetchSectionsFromServer:function(t){var e,i=se.Deferred();return!0===(t=t||{is_user_section:!1}).is_user_section?_.isEmpty(ae.sek_userSavedSections)||_.isEmpty(ae.sek_userSavedSections[t.preset_section_id])?(ae.sek_userSavedSections=ae.sek_userSavedSections||{},_.isUndefined(ae.sek_fetchingUserSavedSections)||"pending"!=ae.sek_fetchingUserSavedSections.state()?(e=wp.ajax.post("sek_get_user_saved_sections",{nonce:ae.settings.nonce.save,preset_section_id:t.preset_section_id}),ae.sek_fetchingUserSavedSections=e):e=ae.sek_fetchingUserSavedSections,e.done(function(e){ae.sek_userSavedSections[t.preset_section_id]=e,i.resolve(ae.sek_userSavedSections)}).fail(function(e){i.reject(e)})):i.resolve(ae.sek_userSavedSections):_.isEmpty(ae.sek_presetSections)?(_.isUndefined(ae.sek_fetchingPresetSections)||"pending"!=ae.sek_fetchingPresetSections.state()?(e=wp.ajax.post("sek_get_preset_sections",{nonce:ae.settings.nonce.save}),ae.sek_fetchingPresetSections=e):e=ae.sek_fetchingPresetSections,e.done(function(e){ae.sek_presetSections=e,i.resolve(ae.sek_presetSections)}).fail(function(e){i.reject(e)})):i.resolve(ae.sek_presetSections),i.promise()},getPresetSectionCollection:function(r){var a=this,s=se.Deferred();return a._maybeFetchSectionsFromServer({is_user_section:r.is_user_section,preset_section_id:r.presetSectionId}).fail(function(e){s.reject(e)}).done(function(e){var t=se.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[r.presetSectionId]))throw new Error('getPresetSectionCollection => the preset section : "'+r.presetSectionId+'" has not been found in the collection');var i=t[r.presetSectionId],n=function(e){return _.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+a.guid(),_.isArray(e.collection)&&n(e.collection)}),e},o=function(e){return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&o(e.collection)}),e};i.id=r.section_id,i.collection=n(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=o(i.collection),s.resolve(i)}),s.promise()},preparePresetSectionForInjection:function(o){var i=this,n={},r=se.Deferred(),a=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?a(e):_.isString(e)&&-1!=e.indexOf("__img_url__")&&(_.has(n,e)||(n[e]=i.importAttachment(e.replace("__img_url__",""))))}),n},s=function(i,n){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?s(e,n):_.isString(e)&&-1!=e.indexOf("__img_url__")&&_.has(n,e)&&_.isObject(n[e])&&(i[t]=n[e].id)}),o};return i.whenAllPromisesInParallel(a(o)).done(function(e){var t=s(o,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,o){o.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=o.extend(!0,[],i.registered()||[]);n.trigger("sek-before-clean-registered"),e=_.filter(e,function(e){if("setting"!==e.what&&n[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(n[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),o.when(n[e.what](e.id).container.remove()).done(function(){n[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLocalOptionSettings:function(){var t=this.getLocalSkopeOptionId(),e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return e.id&&-1!==e.id.indexOf(t)&&n.has(e.id)&&n.remove(e.id),e.id&&-1===e.id.indexOf(t)}),this.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return!_.isEmpty(e.level)&&"setting"===e.what&&n.has(e.id)&&n.remove(e.id),_.isEmpty(e.level)&&"setting"===e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{rootPanelFocus:function(){l.section.has(l.czr_activeSectionId())?l.section(l.czr_activeSectionId()).expanded(!1):l.section.each(function(e){e.expanded(!1)}),l.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getGlobalSectionsSettingId:function(){return sektionsLocalizedData.settingIdForGlobalSections},getLevelModel:function(i,n){var a=this,s="no_match",c=function(t,e,i,n){if(_.isUndefined(e)){var o=l(i)(),r=_.isObject(o)?d.extend(!0,{},o):d.extend(!0,{},a.getDefaultSektionSettingValue(n));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==s&&(t===e.id?s=e:_.isArray(e.collection)&&c(t,e.collection,i,n))}),s};return _.isEmpty(n)?_.each({local:a.localSectionsSettingId(),global:a.getGlobalSectionsSettingId()},function(e,t){"no_match"===s&&c(i,n,e,t)}):c(i,n),s},isGlobalLocation:function(e){var t=!1;return e=e||{},_.has(e,"is_global_location")?t=e.is_global_location:_.has(e,"scope")?t="global"===e.scope:_.isEmpty(e.location)?_.isEmpty(e.in_sektion)?_.isEmpty(e.id)||(t=this.isChildOfAGlobalLocation(e.id)):t=this.isChildOfAGlobalLocation(e.in_sektion):t=this.isChildOfAGlobalLocation(e.location),t},isChildOfAGlobalLocation:function(e){var r=this,a=function(t,e){var i="no_match";if(_.isUndefined(e)){var n=l(r.getGlobalSectionsSettingId())(),o=_.isObject(n)?d.extend(!0,{},n):r.getDefaultSektionSettingValue("global");e=_.isArray(o.collection)?o.collection:[]}return _.each(e,function(e){"no_match"==i&&(t===e.id?i=e:_.isArray(e.collection)&&(i=a(t,e.collection)))}),i};return"no_match"!==a(e)},getLevelPositionInCollection:function(i,n){var a=this,s="no_match",c=function(i,e,n,o){if(_.isUndefined(e)){var t=l(n)(),r=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},a.getDefaultSektionSettingValue(o));e=_.isArray(r.collection)?r.collection:[]}_.each(e,function(e,t){"no_match"==s&&(i===e.id?s=t:_.isArray(e.collection)&&c(i,e.collection,n,o))})};return _.isEmpty(n)?_.each({local:a.localSectionsSettingId(),global:a.getGlobalSectionsSettingId()},function(e,t){"no_match"===s&&c(i,e,t,n)}):c(i,n),s},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))l.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];l.errare("getLevelProperty => invalid model for id : "+e.id,t)}else l.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var n=d.extend(!0,{},i),o=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),o(e)})}return e};return o(n)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(!sektionsLocalizedData.registeredModules[e].is_father){var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i}l.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically")},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},sniffGFonts:function(e){var o=this,r=[],a=function(i,n,e){if(_.isUndefined(e)){var t=l(i)();e=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},o.getDefaultSektionSettingValue(n))}_.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===o.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(r,e)&&r.push(e),(_.isArray(e)||_.isObject(e))&&a(i,n,e)})};return(e=e||{is_global_location:!1}).is_global_location?a(o.getGlobalSectionsSettingId(),"global"):a(o.localSectionsSettingId(),"local"),r},getInputDefaultValue:function(i,n,e){var o=this;if(o.cachedDefaultInputValues=o.cachedDefaultInputValues||{},o.cachedDefaultInputValues[n]=o.cachedDefaultInputValues[n]||{},_.has(o.cachedDefaultInputValues[n],i))return o.cachedDefaultInputValues[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputDefaultValue => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputDefaultValue(i,n,e)),"no_default_value_specified"!==r&&(o.cachedDefaultInputValues[n][i]=r))}),r}l.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,n,e){var o=this;if(o.cachedInputTypes=o.cachedInputTypes||{},o.cachedInputTypes[n]=o.cachedInputTypes[n]||{},_.has(o.cachedInputTypes[n],i))return o.cachedInputTypes[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputType => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputType(i,n,e)),"no_input_type_specified"!==r&&(o.cachedInputTypes[n][i]=r))}),r}l.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,n,e){var o=this;if(o.cachedInputRegistrationParams=o.cachedInputRegistrationParams||{},o.cachedInputRegistrationParams[n]=o.cachedInputRegistrationParams[n]||{},_.has(o.cachedInputRegistrationParams[n],i))return o.cachedInputRegistrationParams[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputRegistrationParams => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputRegistrationParams(i,n,e)),_.isEmpty(r)||(o.cachedInputRegistrationParams[n][i]=r))}),r}l.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var n=this;if(n.cachedFontFamilyModifier=n.cachedFontFamilyModifier||{},_.has(n.cachedFontFamilyModifier,i))return n.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var o="not_set";return _.each(e,function(e,t){"not_set"===o&&(i!==t||_.isUndefined(e.input_type)||(o=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===o&&(_.isArray(e)||_.isObject(e))&&(o=n.inputIsAFontFamilyModifier(i,e)),"not_set"!==o&&(n.cachedFontFamilyModifier[i]=o))}),o}l.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){if(!sektionsLocalizedData.registeredModules)return l.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return l.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t=sektionsLocalizedData.registeredModules[e].starting_value;return _.isEmpty(t)?"no_starting_value":t},selectNextTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=0;if(1===i.length){var o=t.index(i);o+1<t.length&&(n=o+1)}t.eq(n).focus()},selectPrevTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=t.length-1;if(1===i.length){var o=t.index(i);0<o&&(n=o-1)}t.eq(n).focus()},setupSelectInput:function(e){var n=this,t=(n.input_parent,n.module,l.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type)),i={params:e=_.isEmpty(e)?t.choices:e};if(n.module.trigger("nimble-set-select-input-options",i),e=i.params,!_.isEmpty(e)&&_.isObject(e))switch(n.type){case"simpleselect":_.each(e,function(e,t){var i={value:t,html:e};t==n()?d.extend(i,{selected:"selected"}):"px"===t&&d.extend(i,{selected:"selected"}),d("select[data-czrtype]",n.container).append(d("<option>",i))}),d("select[data-czrtype]",n.container).selecter();break;case"multiselect":var o=n();o=_.isString(o)?[o]:o,o=_.isArray(o)?o:[],_.each(e,function(e,t){var i={value:t,html:e};_.contains(o,t)&&d.extend(i,{selected:"selected"}),d("select[data-czrtype]",n.container).append(d("<option>",i))}),d("select[data-czrtype]",n.container).czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),d("select[data-czrtype]",n.container).on("change",function(){0===d(this).find("option:selected").length&&n([])});break;default:l.errare("::setupSelectInput => invalid input type => "+n.type)}else l.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+n.id+" in module "+n.module.module_type)},setupFontSizeAndLineHeightInputs:function(e){var t=this,i=d(".sek-font-size-line-height-wrapper",t.container),n=i.find("input[data-czrtype]").data("sek-unit"),o=function(e){return _.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new l.Value(_.isEmpty(n)?"px":o(n)),t.css_unit.bind(function(e){e=_.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("change")}),i.find('input[type="number"]').on("input change",function(e){t(d(this).val()+o(t.css_unit()))}).stepper(),i.on("click","[data-sek-unit]",function(e){e.preventDefault(),i.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",d(this).data("sek-unit")),t.css_unit(d(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0)},maybeSetupDeviceSwitcherForInput:function(){var i=this,e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");i.container.find(".customize-control-title").prepend(e),i.previewedDevice=new l.Value(l.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),i.container.find("[data-sek-device]").removeClass("active"),d(this).addClass("active");var t="desktop";try{t=d(this).data("sek-device")}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{l.previewedDevice(t)}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}i.previewedDevice(t)},i.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=i.container.find('[data-sek-device="'+l.previewedDevice()+'"]');0<t.length&&t.trigger("click")},scheduleModuleAccordion:function(e){e=e||{expand_first_control:!0};var i=this;if(d(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=d(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){d(this).attr("data-sek-accordion")||(d(this).attr("data-sek-expanded","false"),d(this).find(".czr-items-wrapper").stop(!0,!0).slideUp(0))}),t.find(".czr-items-wrapper").stop(!0,!0).slideToggle({duration:0,start:function(){t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),t.trigger("true"==t.attr("data-sek-expanded")?"sek-accordion-expanded":"sek-accordion-collapsed")}}))}),e.expand_first_control){var t=_.first(i.controls());_.isObject(t)&&!_.isEmpty(t.id)&&l.control(t.id,function(e){e.container.trigger("sek-accordion-expanded"),i.container.find(".customize-control").first().find("label > .customize-control-title").trigger("click")})}},isPromise:function(e){return e&&"function"==typeof e.then&&String(d.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=d.Deferred(),n=[],o=_.keys(e);return _.each(e,function(e,t){n.push(d.Deferred(function(t){(i.isPromise(e)?e:d.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),d.when.apply(this,n).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[o[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,n,o){i=i||0,n=n||{},o=o||d.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:d.Deferred(function(e){e.resolve()})).always(function(e){n[i]=e,i+1==t.length?o.resolve(n):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,n,o)})}return o},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{img_url:t,nonce:l.settings.nonce.save}).fail(function(e){l.errare("sek_import_attachment ajax action failed for image "+t,e)})},cleanIds:function(e){e.id="";var t=this;return _.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&t.cleanIds(e)}),e},getDefaultSektionSettingValue:function(e){return!_.isUndefined(e)&&_.contains(["local","global"],e)||l.errare("getDefaultSektionSettingValue => the skope should be set to local or global"),"global"===e?sektionsLocalizedData.defaultGlobalSektionSettingValue:sektionsLocalizedData.defaultLocalSektionSettingValue},scheduleVisibilityOfInputId:function(t,i){var n=this.input_parent;if(!_.isFunction(i)||_.isEmpty(t))throw new Error("::scheduleVisibilityOfInputId => error when firing for input id : "+this.id);n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,m){m.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){!0!="draggable"in document.createElement("span")&&s.panel(sektionsLocalizedData.sektionsPanelId,function(e){s.notifications.add(new s.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){s.notifications.remove("drag-drop-support")},1e4)}),t.setupNimbleDragZones(e.input_container)}),s.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){s.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var n=this,o=function(){s.notifications.add(new s.Notification("missing-injection-target",{type:"info",message:sektionsLocalizedData.i18n["You first need to click on a target ( with a + icon ) in the preview."],dismissible:!0})),_.delay(function(){s.notifications.remove("missing-injection-target")},3e4)};e.find('[draggable="true"]').each(function(){m(this).on("dragstart",function(e){(function(e){n.lastClickedTargetInPreview({}),e.originalEvent.dataTransfer.setData("sek-content-type",m(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-content-id",m(this).data("sek-content-id")),e.originalEvent.dataTransfer.setData("sek-section-type",m(this).data("sek-section-type")),e.originalEvent.dataTransfer.setData("sek-is-user-section",m(this).data("sek-is-user-section")),n.dndData={content_type:e.originalEvent.dataTransfer.getData("sek-content-type"),content_id:e.originalEvent.dataTransfer.getData("sek-content-id"),section_type:e.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===e.originalEvent.dataTransfer.getData("sek-is-user-section")};try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){s.panel(sektionsLocalizedData.sektionsPanelId,function(e){s.notifications.add(new s.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){s.notifications.remove("drag-drop-support")},1e4)})}m(this).addClass("sek-dragged"),m("body").addClass("sek-dragging"),s.previewer.send("sek-drag-start",{type:n.dndData.content_type})}).call(m(this),e)}).on("dragend",function(e){(function(e){m("body").removeClass("sek-dragging"),m(this).removeClass("sek-dragged"),s.previewer.send("sek-drag-stop")}).call(m(this),e)}).dblclick(function(e){(function(e){var t,i=n.lastClickedTargetInPreview();!_.isEmpty(i)&&i.id?t=n.dnd_getDropZonesElements().find('[data-sek-id="'+i.id+'"]').find(".sek-module-drop-zone-for-first-module").first():o(),t&&0<t.length?(s.czr_sektions.trigger("sek-content-dropped",{drop_target_element:t,location:t.closest('[data-sek-level="location"]').data("sek-id"),before_module:t.data("drop-zone-before-module-or-nested-section"),after_module:t.data("drop-zone-after-module-or-nested-section"),before_section:t.data("drop-zone-before-section"),after_section:t.data("drop-zone-after-section"),content_type:m(this).data("sek-content-type"),content_id:m(this).data("sek-content-id"),section_type:m(this).data("sek-section-type"),is_user_section:"true"===m(this).data("sek-is-user-section")}),n.lastClickedTargetInPreview({})):(o(),s.errare("Double click insertion => the target zone was not found"))}).call(m(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=m("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=m(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.stopPropagation(),t.dnd_OnEnterOver(m(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(m(this),e)||t.dnd_cleanOnLeaveDrop(m(this),e);break;case"drop":if(this.$cachedDropZoneCandidates=null,!t.dnd_canDrop({targetEl:m(this),evt:e}))return;e.preventDefault(),t.dnd_onDrop(m(this),e),t.dnd_cleanOnLeaveDrop(m(this),e),s.previewer.send("sek-drag-stop")}}).data("zone-droppable-setup",!0))})},dnd_isInTarget:function(e,t){var i=t.clientY,n=t.clientX,o=e[0].getBoundingClientRect(),r=n<=o.right&&o.left<=n;return i>=o.top&&o.bottom>=i&&r},dnd_toggleDragApproachClassesToDropZones:function(u){var p=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.distanceTable=[],this.$dropZones.find(".sek-drop-zone").each(function(){var e,t,i=u.clientY,n=u.clientX,o=m(this)[0].getBoundingClientRect(),r=Math.abs(i-(o.bottom-(o.bottom-o.top)/2)),a=(Math.abs(o.top-i),Math.abs(n-(o.right-(o.right-o.left)/2))),s=(o.right,o.left,r<50),c=a<50,l=n<=o.right&&o.left<=n,d=i>=o.top&&o.bottom>=i;p.distanceTable.push({el:m(this),dist:d&&l?0:(e=a,t=r,Math.sqrt(e*e+t*t))}),m(this).removeClass("sek-drag-is-in"),(s||d)&&(c||l)?(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).addClass("sek-drag-is-very-close")):(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).removeClass("sek-drag-is-very-close")),m(this).removeClass("sek-drag-is-in")});var t=_.min(_.pluck(p.distanceTable,"dist"));p.$dropTargetCandidate=null,_.each(p.distanceTable,function(e){_.isNull(p.$dropTargetCandidate)&&t===e.dist&&(p.$dropTargetCandidate=e.el)}),p.$dropTargetCandidate&&0<p.$dropTargetCandidate.length&&p.dnd_isInTarget(p.$dropTargetCandidate,u)&&p.$dropTargetCandidate.addClass("sek-drag-is-in"),p.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,n=m(e.currentTarget);switch(this.dndData.content_type){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<n.length&&("between-sections"!==n.data("sek-location")&&"in-empty-location"!==n.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:s.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return m(s.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=this,i=(e=_.extend({targetEl:{},evt:{}},e||{})).targetEl;if(!_.isObject(i)||i.length<1)return!1;var n=i.hasClass("sek-content-preset_section-drop-zone"),o=i.hasClass("sek-module-drop-zone-for-first-module"),r=!0===i.closest('[data-sek-level="location"]').data("sek-is-header-location"),a=!0===i.closest('[data-sek-level="location"]').data("sek-is-footer-location"),s="preset_section"===t.dndData.content_type&&"content"===t.dndData.section_type,c=function(e){m(".sek-no-drop-possible-message",i).length<1&&i.append(['<div class="sek-no-drop-possible-message">','<i class="material-icons">not_interested</i>',e,"</div>"].join(""))};return(r||a)&&s?(c(r?sektionsLocalizedData.i18n["The header location only accepts modules and pre-built header sections"]:sektionsLocalizedData.i18n["The footer location only accepts modules and pre-built footer sections"]),!1):a&&"preset_section"===t.dndData.content_type&&"header"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a header section in the footer location"]),!1):r&&"preset_section"===t.dndData.content_type&&"footer"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a footer section in the header location"]),!1):i.hasClass("sek-drop-zone")&&("preset_section"===t.dndData.content_type&&n||"module"===t.dndData.content_type&&!n||"preset_section"===t.dndData.content_type&&o)},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){s.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),m(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(m(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"),e.find(".sek-no-drop-possible-message").remove())},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),n=i.height;return"before"===e.data("preDrop-position")?n+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(n-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-n/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,n=e.data("preDrop-position"),o=this.dnd_getPosition(e,t);if(n!==o&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");m.when(i.preDropElement.remove()).done(function(){e["before"===o?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",o),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),n=t.clientX,o=t.clientY,r=i.left,a=i.right,s=i.top,c=i.bottom;return r<=n&&n-r<=a-r&&(s<=o&&o-s<=c-s)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();s.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module:e.data("drop-zone-before-module-or-nested-section"),after_module:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id"),section_type:t.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===t.originalEvent.dataTransfer.getData("sek-is-user-section")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t=e.drop_target_element,i="content-in-column";switch(t.data("sek-location")){case"between-sections":i="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,i="content-in-empty-location";break;case"between-columns":i="content-in-new-column"}if("preset_section"===e.content_type)if(t.hasClass("sek-module-drop-zone-for-first-module")){var n=t.closest('div[data-sek-level="section"]');1<n.find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(i="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=n.data("sek-id")):(e.sektion_to_replace=n.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=n.closest('[data-sek-level="column"]').data("sek-id"),i="content-in-a-section-to-replace")}else"between-sections"===t.data("sek-location")&&(i="content-in-a-section-to-create");switch(i){case"content-in-column":var o=t.closest("div[data-sek-level]");if(o.length<1)throw new Error("No valid level dom element found");var r=o.data("sek-level"),a=o.data("sek-id");if(_.isEmpty(r)||_.isEmpty(a))throw new Error("No valid level id found");s.previewer.trigger("sek-add-module",{level:r,id:a,in_column:t.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:t.closest('div[data-sek-level="section"]').data("sek-id"),before_module:e.before_module,after_module:e.after_module,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":s.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":s.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"content-in-empty-location":s.previewer.trigger("sek-add-content-in-new-sektion",e);break;default:s.errare("sek control panel => ::reactToDrop => invalid drop case : "+i)}}(e)}catch(e){s.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var n=this;l.sekEditorExpanded=new l.Value(!1),n.editorEventsListenerSetup=!1,n.$editorPane=d("#czr-customize-content_editor-pane"),n.$editorDragbar=d("#czr-customize-content_editor-dragbar"),n.$preview=d("#customize-preview"),n.$collapseSidebar=d(".collapse-sidebar"),n.attachResizeEventsToEditor();d("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=d(this).data("czr-control-id"),t=d(this).data("czr-input-id");_.isEmpty(e)||_.isEmpty(t)?l.errare("toggle-tinymce-editor => missing input or control id"):l.sekEditorExpanded(!0)}),l.sekEditorExpanded.bind(function(e,t,i){!function(){l.sekTinyMceEditor=tinyMCE.get(sektionsLocalizedData.idOfDetachedTinyMceTextArea);var e=function(){!1===n.editorEventsListenerSetup&&(n.editorEventsListenerSetup=!0,n.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};l.sekTinyMceEditor&&(l.sekTinyMceEditor.initialized?e():l.sekTinyMceEditor.on("init",function(){e()}))}(),e&&l.sekTinyMceEditor&&l.sekTinyMceEditor.focus(),d(document.body).toggleClass("czr-customize-content_editor-pane-open",e),d(window)[e?"on":"off"]("resize",function(){l.sekEditorExpanded()&&_.delay(function(){n.czrResizeEditor(window.innerHeight-n.$editorPane.height())},50)}),e?(n.czrResizeEditor(window.innerHeight-n.$editorPane.height()),_.delay(function(){d(window).trigger("resize")},100)):(n.$preview.css("bottom",""),n.$collapseSidebar.css("bottom",""))}),d("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){l.sekEditorExpanded(!1)}),d("#customize-controls").on("click",function(e){"open-tinymce-editor"!=d(e.target).data("czr-action")&&l.sekEditorExpanded(!1,{context:"clicked anywhere"})}),d(document).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50)),n.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=d(l.sekTinyMceEditor.iframeElement).contents().get(0);d(e).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?l.previewer.bind(e,function(){l.sekEditorExpanded(!1)}):l.previewer.bind(e,function(e){l.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachResizeEventsToEditor:function(){var t=this;d("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===d(e.target).attr("id")||d(e.target).hasClass("czr-resize-handle"))&&l.sekEditorExpanded())switch(e.type){case"mousedown":d(document).on("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea,function(e){e.preventDefault(),d(document.body).addClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":d(document).off("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea),d(document.body).removeClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,n=window.innerHeight,o=(window.innerWidth,{}),r=d("#czr-customize-content_editor_ifr"),a=d("#wp-czr-customize-content_editor-tools"),s=i.$editorPane.find(".mce-toolbar-grp"),c=i.$editorPane.find(".mce-statusbar");l.sekEditorExpanded()&&(_.isNaN(e)||(t=n-e),o.height=t,o.components=a.outerHeight()+s.outerHeight()+c.outerHeight(),t<40&&(o.height=40),n-1<t&&(o.height=n-1),n<i.$editorPane.outerHeight()&&(o.height=n),i.$preview.css("bottom",o.height),i.$editorPane.css("height",o.height),r.css("height",o.height-o.components))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var n=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),n.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(n.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var n=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),n(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var o=this,i=d(".sek-spacing-wrapper",o.container),t=l.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),n=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(o())?o():{}),n=d(this).val();u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?i[t]=n:i=u.omit(i,t),o(i)}),m.call(o,i,n),u.isObject(o())){u.each(o(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",o.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o())||u.isEmpty(o().unit)||e===o().unit&&(r=e)}),d(".sek-unit-wrapper",o.container).find('[data-sek-unit="'+p.call(o,r)+'"]').trigger("click")}var a=o();o.initial_unit="px",u.isEmpty(a)||(o.initial_unit=u.isEmpty(a.unit)?"px":a.unit),o.css_unit=new l.Value(p.call(o,o.initial_unit)),o.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(o())?o():{})).unit=e,o(t)}),_.call(o,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,a=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),s=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var n=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&n<i.length?c(e,i[n+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},s);t=u.isObject(t)?d.extend(i,t):i;var n=c(t,e);d("[data-sek-spacing]",a).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(n)||u.isEmpty(n[e])||(t=n[e]),d(this).find('input[type="number"]').val(t)});var o="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n)||u.isEmpty(n.unit)||e===n.unit&&(o=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,o)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var n=r();r.initial_unit="px",u.isEmpty(n)||u.isEmpty(n[r.previewedDevice()])||(r.initial_unit=u.isEmpty(n[r.previewedDevice()].unit)?"px":n[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),a.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),n=d(this).val(),o=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},t[o]||{}),u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?t[o][i]=n:t[o]=u.omit(t[o],i),r(t)}),m.call(r,a,s),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var n,o=r.previewedDevice()||"desktop";(n=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},n[o]||{}),n[o].unit=e,r(n)}}),_.call(r,a);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(n,s,c){n.czrInputMap=n.czrInputMap||{},s.extend(n.czrInputMap,{bg_position:function(e){var t=this;s(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(s(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var o=this,t=n.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;n.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var a=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var n=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&n<i.length?a(e,i[n+1]):{}},i=function(e){var t=s.extend(!0,{},c.isObject(o())?o():{}),i=s.extend(!0,{},r);t=c.isObject(t)?s.extend(i,t):i;var n=a(t,e);o.container.find('input[value="'+n+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};s(".sek-bg-pos-wrapper",o.container).on("change",'input[type="radio"]',function(e){var t,i=s(this).val();(t=s.extend(!0,{},c.isObject(o())?o():{}))[n.previewedDevice()||"desktop"]=i,o(t)}),o.previewedDevice.bind(function(e){try{i(e)}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+o.id,e)}});try{i(n.previewedDevice())}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+o.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var o=this,t=c.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===o.type?".sek-v-align-wrapper":".sek-h-align-wrapper",a=l(i,o.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var s=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?s(e,i[n+1]):{}},n=function(e){var t=l.extend(!0,{},d.isObject(o())?o():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var n=s(t,e);a.find(".selected").removeClass("selected"),a.find('div[data-sek-align="'+n+'"]').addClass("selected")};a.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(o())?o():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),a.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){o(t)})}),o.previewedDevice.bind(function(e){try{n(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}});try{n(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{font_size:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{line_height:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(i,c,l){i.czrInputMap=i.czrInputMap||{},c.extend(i.czrInputMap,{font_picker:function(e){var s=this,o=s.input_parent,n=function(e,t){o();var n=c('select[data-czrtype="'+s.id+'"]',s.container);l.isNull(s())||l.isEmpty(s())?n.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):n.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"),l.each([{title:sektionsLocalizedData.i18n["Web Safe Fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google Fonts"],type:"gfont",list:t.gfonts}],function(e){var t,r,a,i=c("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,a="",l.each(t,function(e){var t,i,n=e.name,o=l.isString(n)?n.replace(/[+|:]/g," "):n;t=n,i=r,(n=l.isString(t)?["[",i,"]",t].join(""):"")==s()?a+='<option selected="selected" value="'+n+'">'+o+"</option>":a+='<option value="'+n+'">'+o+"</option>"}),a)});n.append(i)});var i={escapeMarkup:function(e){return e}};e&&c.extend(i,{resultsAdapter:e,closeOnSelect:!1}),n.czrSelect2(i),c(".czrSelect2-selection__rendered",s.container).css(r(s()))},r=function(e){if(!l.isString(e)||l.isEmpty(e))return{};var t,i,n,o=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=a(e),i=o[1]?o[1].replace(/[^0-9.]+/g,""):400,i=l.isNumber(i)?i:400,n=o[1]&&-1!=o[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":n||"normal"}},a=function(e){if(!l.isString(e)||l.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return l.isString(t[0])?t[0].replace(/[+|:]/g," "):""};c.when(function(){var e,t=c.Deferred();l.isEmpty(i.sek_fontCollections)?(l.isUndefined(i.sek_fetchingFontCollection)||"pending"!=i.sek_fetchingFontCollection.state()?(e=i.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:s.module.id}),i.sek_fetchingFontCollection=e):e=i.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");i.sek_fontCollections=JSON.parse(e),t.resolve(i.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(i.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=c.Deferred(),void 0!==c.fn.czrSelect2&&void 0!==c.fn.czrSelect2.amd&&"function"==typeof c.fn.czrSelect2.amd.require?c.fn.czrSelect2.amd.require(["czrSelect2/results","czrSelect2/utils"],function(e,t){var n=function(e,t,i){n.__super__.constructor.call(this,e,t,i)};t.Extend(n,e),n.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),n.__super__.bind.call(this,e,t)},i.resolve(n)}):i.resolve(!1),i.promise()).done(function(e){n(e,t)})}).fail(function(e){i.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(r,a,s){r.czrInputMap=r.czrInputMap||{},a.extend(r.czrInputMap,{fa_icon_picker:function(){var n=this,o=!1,e=function(t){!0!==n.iconCollectionSet&&(a.when(a.Deferred(function(t){s.isEmpty(n.sek_faIconCollection)?r.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:n.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");n.sek_faIconCollection=JSON.parse(e),t.resolve(n.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_faIconCollection)})).done(function(e){!function(e){s.each(e,function(e){var t={value:e,html:r.CZR_Helpers.capitalize(e.substring(7))};t.value==n()&&(a.extend(t,{selected:"selected"}),o=!0),a("select[data-czrtype]",n.container).append(a("<option>",t))});var t,i=function(e){return e.id?a('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=o?a("<option>"):a("<option>",{selected:"selected"}),a("select[data-czrtype]",n.container).prepend(t).czrSelect2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e),t&&!0===t.open_on_init&&s.delay(function(){try{a("select[data-czrtype]",n.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){r.errare("fa_icon_picker => fail response =>",e)}),n.iconCollectionSet=!0)};n.container.on("click",function(){e()}),s.delay(function(){e({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{code_editor:function(e){var n=this,i=this.module.control,t=(n.input_parent(),!1),r=n.container.find("textarea"),o=n.container.find(".customize-control-title"),a=r.data("editor-params");wp.codeEditor&&(p.isUndefined(a)||!1!==a)&&(t=a),n.isReady.done(function(){var e=function(e){p.isEmpty(this.editor)&&(p.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(t)try{s(t)}catch(e){d.errare("error in sek_control => code_editor() input",e),c()}else c();o.click()},10))};e.call(n),n.module.control.container.on("sek-accordion-expanded",function(){e.call(n)})});var s=function(e){var t,i=!1;t=p.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:l}),n.editor=wp.codeEditor.initialize(r,t),u(n.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":o.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),o.on("click",function(e){e.stopPropagation(),n.editor.codemirror.focus()}),n.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),n.editor.codemirror.setValue(n()),n.bind(n.id+":changed",function(e){i||n.editor.codemirror.setValue(e)}),n.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},c=function(){var o=r[0];n.editor=o,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,n;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=o.selectionStart,i=o.selectionEnd,n=o.value,0<=t&&(o.value=n.substring(0,t).concat("\t",n.substring(i)),r.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},l=function(e){var t;i.setting.notifications.remove(n.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",o.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",o.html()),i.setting.notifications.add(n.id,new d.Notification(n.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]');o.on("input",function(e){n.val(r(this).val()).trigger("input")}),n.on("input",function(e){t(r(this).val()),o.val(r(this).val())}),o.val(n.val()||0)}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{range_simple_device_switcher:function(e){var a=this,t=u(".sek-range-with-unit-picker-wrapper",a.container),s=t.find('input[type="number"]'),r=t.find('input[type="range"]'),i=d.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),c=p.isEmpty(i)||p.isEmpty(i.default)?{}:i.default,l=function(e,t){var i=["mobile","tablet","desktop"];if(p.has(e,t))return e[t];var n=p.findIndex(i,function(e){return t===e});return!p.isEmpty(t)&&n<i.length?l(e,i[n+1]):u.extend(!0,{desktop:""},c).desktop},n=function(e){var t=a(),i={};i=u.extend(!0,{},c),p.isObject(t)?i=u.extend(!0,{},t):p.isString(t)&&!p.isEmpty(t)&&(i={desktop:t});var n,o=l(i,e),r=(n=o,p.isEmpty(n)||!p.isString(n)?"16":n.replace(/px|em|%/g,""));s.val(r).trigger("input",{previewed_device_switched:!0})};d.czr_sektions.maybeSetupDeviceSwitcherForInput.call(a),r.on("input",function(e){s.val(u(this).val()).trigger("input")}),s.on("input",function(e,t){var i,n=d.previewedDevice()||"desktop",o=u(this).val();(i=u.extend(!0,{},p.isObject(a())?a():{}))[n]=u.extend(!0,{},i[n]||{}),p.isString(o)&&!p.isEmpty(o)&&(i[n]=o),(p.isEmpty(t)||p.isObject(t)&&!0!==t.previewed_device_switched)&&a(i),r.val(u(this).val())}),a.previewedDevice.bind(function(e){try{n(e)}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+a.type+" for input id "+a.id,e)}}),r.val(s.val()||0);try{n(d.previewedDevice())}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+a.type+" for input id "+a.id,e)}}})}(wp.customize,jQuery,_),function(s,c,l){s.czrInputMap=s.czrInputMap||{},c.extend(s.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),a=function(e){return l.contains(["px","em","%"],e)||(s.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new s.Value(l.isEmpty(r)?"px":a(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),o.on("input",function(e){n.val(c(this).val()).trigger("input")}),n.on("input",function(e){t(c(this).val()+a(t.css_unit())),o.val(c(this).val())}),o.val(n.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(s,_,m){s.czrInputMap=s.czrInputMap||{},_.extend(s.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),a=function(e){return m.contains(["px","em","%"],e)||(s.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=s.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var n=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&n<i.length?p(e,i[n+1]):_.extend(!0,{desktop:""},u).desktop},n=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var n,o,r=p(i,e),a=(o=r,m.isEmpty(o)||!m.isString(o)?"px":o.replace(/[0-9]|\.|,/g,"")),s=(n=r,m.isEmpty(n)||!m.isString(n)?"16":n.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+a+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+a+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(s).trigger("input",{previewed_device_switched:!0})};s.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new s.Value(m.isEmpty(i())?"px":a(i()));var o='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(o),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,n=s.previewedDevice()||"desktop",o=_(this).val()+a(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[n]=_.extend(!0,{},i[n]||{}),m.isString(o)&&!m.isEmpty(o)&&(i[n]=o),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{n(e)}catch(e){s.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=s.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),n(s.previewedDevice()))}),r.val(d.val()||0);try{n(s.previewedDevice())}catch(e){s.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(g,h,k){g.czrInputMap=g.czrInputMap||{},h.extend(g.czrInputMap,{borders:function(e){var s=this,c=h(".sek-borders",s.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return k.contains(["px","em","%"],e)||(g.errare("borders => error : invalid unit for input "+s.id,e),e="px"),e},_=function(e){return k.isEmpty(e)||!k.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return k.isEmpty(e)||!k.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=g.czr_sektions.getInputRegistrationParams(s.id,s.module.module_type),f=k.isEmpty(t)||k.isEmpty(t.default)?{}:t.default;s.cssBorderTypes=["top","left","right","bottom"];var i,n,o=function(){var e=s(),t="px";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=s(),t="#000000";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.col)&&(t=e._all_.col),t},a=function(e){if(!k.contains(k.union(s.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=s(),i={},n=h.extend(!0,{},f);k.isObject(t)?i=h.extend(!0,{},t):k.isString(t)&&(i={_all_:{wght:t}});var o,r,a=function(e,t){var i,n=h.extend(!0,{},f);if(!k.has(n,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=k.isObject(e)&&k.has(e,"_all_")?k.extend(n._all_,e._all_):n._all_,k.has(e,t)&&k.isObject(e[t])?k.extend(i,e[t]):n._all_}(i=h.extend(n,i),e);if(k.isEmpty(a)||!k.isObject(a)||k.isEmpty(a.wght)||k.isEmpty(a.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");o=m(a.wght),r=_(a.wght),h(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(a.col).trigger("change"),u.data("border_type_switched",!1)};s.borderColor=new g.Value(k.isEmpty(r())?"#000000":r()),s.css_unit=new g.Value(k.isEmpty(o())?"px":p(o())),s.borderType=new g.Value("_all_"),l.val((i=s(),n=1,k.isObject(i)&&k.has(i,"_all_")&&k.isObject(i._all_)&&!k.isEmpty(i._all_.wght)&&(n=_(i._all_.wght)),n=parseInt(n,10),(!k.isNumber(n)||n<0)&&(g.errare("Error in borders input type for module : "+s.module.module_type+" the initial border width is invalid : "+n),n=1),n)),u.val(s.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){h(this).val(t.color.toString()).trigger("colorpickerchange"),s.borderColor(t.color.toString(),{border_type_switched:!0===h(this).data("border_type_switched")})},clear:function(e,t){h(this).val("").trigger("colorpickerchange"),s.borderColor("")}}),s.css_unit.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),s.borderColor.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),s.borderType.bind(function(e){try{a(e)}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+s.module.module_type,e)}}),d.on("input",function(e){l.val(h(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=s.borderType()||"_all_",o=s.borderColor(),r=h(this).val()+p(s.css_unit()),a=h.extend(!0,{},f);(i=h.extend(!0,{},k.isObject(s())?s():a))[n]=h.extend(!0,{},i[n]||a[n]),k.isString(r)&&!k.isEmpty(r)&&(i[n].wght=r),i[n].col=o,(k.isEmpty(t)||k.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===n&&k.each(s.cssBorderTypes,function(e){i=k.omit(i,e)}),s(i)),d.val(h(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",h(this).data("sek-unit")),s.css_unit(h(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=h(this).data("sek-border-type")}catch(e){g.errare("borders input type => error when attaching click event",e)}s.borderType(i,t)}),s.container.on("click",".sek-reset-button",function(e){var t=s.borderType()||"_all_",i=h.extend(!0,{},k.isObject(s())?s():{});k.isEmpty(i[t])||(i=k.omit(i,t),s(i),a(t))}),d.val(l.val()||0);try{a(s.borderType())}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+s.module.module_type,e)}h('[data-sek-unit="'+s.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,g){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var s=this,c=f(".sek-borders",s.container),l=c.find('input[type="number"]'),a=c.find('input[type="range"]'),d=function(e){return g.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+s.id,e),e="px"),e},u=function(e){return g.isEmpty(e)||!g.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return g.isEmpty(e)||!g.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(s.id,s.module.module_type),_=g.isEmpty(t)||g.isEmpty(t.default)?{}:t.default;s.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,n,o=function(){var e=s(),t="px";return g.isObject(e)&&g.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!g.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=s(),i={},n=f.extend(!0,{},_);g.isObject(t)?i=f.extend(!0,{},t):g.isString(t)&&(i={_all_:"0px"});var o,r,a=function(e,t){var i,n=f.extend(!0,{},_);if(!g.has(n,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=g.isObject(e)&&g.has(e,"_all_")?e._all_:n._all_,g.has(e,t)?e[t]:i}(i=f.extend(n,i),e);if(g.isEmpty(a)||!g.isString(a))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");o=p(a),r=u(a),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};s.css_unit=new m.Value(g.isEmpty(o())?"px":d(o())),s.radiusType=new m.Value("_all_"),l.val((i=s(),n=0,g.isObject(i)&&g.has(i,"_all_")&&(n=u(i._all_)),n=parseInt(n,10),(!g.isNumber(n)||n<0)&&(m.errare("Error in border_radius input type for module : "+s.module.module_type+" the initial radius is invalid : "+n),n=0),n)),s.css_unit.bind(function(e,t,i){(!g.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),s.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+s.module.module_type,e)}}),a.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=s.radiusType()||"_all_",o=f(this).val()+d(s.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},g.isObject(s())?s():r))[n]=f.extend(!0,{},i[n]||r[n]),g.isString(o)&&!g.isEmpty(o)&&(i[n]=o),(g.isEmpty(t)||g.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===n&&g.each(s.cssRadiusTypes,function(e){i=g.omit(i,e)}),s(i)),a.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),s.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}s.radiusType(i,t)}),s.container.on("click",".sek-reset-button",function(e){var t=s.radiusType()||"_all_",i=f.extend(!0,{},g.isObject(s())?s():{});g.isEmpty(i[t])||(i=g.omit(i,t),s(i),r(t))}),a.val(l.val()||0);try{r(s.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+s.module.module_type,e)}f('[data-sek-unit="'+s.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,a,s){r.czrInputMap=r.czrInputMap||{},a.extend(r.czrInputMap,{buttons_choice:function(e){var n=this,o=a(".sek-button-choice-wrapper",n.container),t=o.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);s.isEmpty(i)||s.isEmpty(i.default)||i.default;t.val(n()),o.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),a(this).addClass("is-selected").attr("aria-pressed",!0);try{i=a(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}n(i)}),a('[data-sek-choice="'+n()+'"]',o).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(n,o,r){n.czrInputMap=n.czrInputMap||{},o.extend(n.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){e.stopPropagation();var i=o(this).data("sek-reset-scope");!r.isEmpty(i)&&r.contains(["local","global"],i)?n.czr_sektions.updateAPISetting({action:"sek-reset-collection",scope:i}).done(function(){n.previewer.refresh(),n.previewer.trigger("sek-notify",{notif_id:"reset-success",type:"success",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset complete"],"</strong>","</span>"].join("")})}).fail(function(e){n.errare("reset_button input => error when firing ::updateAPISetting",e),n.previewer.trigger("sek-notify",{notif_id:"reset-failed",type:"error",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset failed"],"<br/>","<i>"+e+"</i>","</strong>","</span>"].join("")})}):n.errare("reset_button input => invalid scope provided.",i)})}})}(wp.customize,jQuery,_),function(i,r,a){i.czrInputMap=i.czrInputMap||{},r.extend(i.czrInputMap,{revision_history:function(e){var o=this;_selected_found=!1;var t=function(t){!0!==o.revisionHistorySet&&(r.when(r.Deferred(function(t){a.isEmpty(o.sek_revisionHistory)?i.czr_sektions.getRevisionHistory({is_local:"local_revisions"===o.id}).done(function(e){if(!a.isObject(e))throw new Error("_getRevisionHistory => server list is not a object");o.sek_revisionHistory=e,t.resolve(o.sek_revisionHistory)}).fail(function(e){t.reject(e)}):t.resolve(o.sek_revisionHistory)})).done(function(e){!function(e){if(!(0<o.container.find(".sek-revision-history").length))if(a.isEmpty(e))o.container.append(["<i>",sektionsLocalizedData.i18n["No revision history available for the moment."],"</i>"].join(""));else{o.container.append(r("<select/>",{class:"sek-revision-history",html:['<option value="_select_">'," -",sektionsLocalizedData.i18n.Select,"- ","</option>"].join("")}));var n=[];a.each(e,function(e,t){var i={value:t,html:e};i.value==o()&&(r.extend(i,{selected:"selected"}),_selected_found=!0),n.unshift(r("<option>",i))}),n[0].html([n[0].html(),sektionsLocalizedData.i18n["(currently published version)"]].join(" ")),a.each(n,function(e){r("select.sek-revision-history",o.container).append(e)}),r("select.sek-revision-history",o.container).selecter()}}(e),t&&!0===t.open_on_init&&a.delay(function(){try{r("select[data-czrtype]",o.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){i.errare("_getRevisionHistory => fail response =>",e)}),o.revisionHistorySet=!0)};o.container.on("change",".sek-revision-history",function(){var e=r(this).val();"_select_"!==e&&i.czr_sektions.setSingleRevision({revision_post_id:e,is_local:"local_revisions"===o.id})}),a.delay(function(){t({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(p,_,m){p.czrInputMap=p.czrInputMap||{},_.extend(p.czrInputMap,{nimble_tinymce_editor:function(){var t=this,e=t.container.find("textarea").first(),i=0<e.length?e.attr("id"):null,n=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type),o=sektionsLocalizedData.defaultToolbarBtns;if(m.isNull(i))throw new Error("setupTinyMceEditor => missing textarea for module :"+t.module.id);if(tinyMCE.get(i))throw new Error("setupTinyMceEditor => duplicate editor id.");var r,a,s=function(){return n&&n.editor_params&&!0===n.editor_params.autop},c={tinymce:{toolbar1:function(){var e=o.split(",");if(n.editor_params&&m.isArray(n.editor_params.excludedBtns)){var t=n.editor_params.excludedBtns;e=m.filter(e,function(e){return!m.contains(t,e)})}if(n.editor_params&&m.isString(n.editor_params.includedBtns)){var i=n.editor_params.includedBtns;m.isEmpty(i)||!m.isArray(sektionsLocalizedData[i])?p.errare("nimble_tinymce_editor input => invalid set of buttons provided",i):(i=sektionsLocalizedData[i],e=m.filter(e,function(e){return m.contains(i,e)}))}return e.join(",")}(),content_css:(r=wp.editor.getDefaultSettings(),a=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],r&&r.tinymce&&r.tinymce.content_css&&(a=m.union(r.tinymce.content_css.split(","),a)),a.join(",")),min_height:40,height:n.editor_params&&m.isNumber(n.editor_params.height)?n.editor_params.height:p.czr_sektions.TINYMCE_EDITOR_HEIGHT},quicktags:{buttons:"strong,em,link,code"},mediaButtons:!n.editor_params||!1!==n.editor_params.media_button};c.tinymce.wpautop=s(),s()||(c.tinymce.forced_root_block=""),wp.editor.initialize(i,c);var l=tinyMCE.get(i);if(!l)throw new Error("setupTinyMceEditor => missing editor instance for module :"+t.module.id);p.czrActiveWPEditors=p.czrActiveWPEditors||[];var d=_.extend(!0,[],p.czrActiveWPEditors);d.push(i),p.czrActiveWPEditors=d;var u=function(){l.setContent(t())};l.initialized?u():l.on("init",u),l.on("input change keyup",function(e){t(l.getContent())})},detached_tinymce_editor:function(){var e,t=this,i=_("textarea#"+sektionsLocalizedData.idOfDetachedTinyMceTextArea),n=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type);if(!(0<i.length))throw new Error("api.czrInputMap::detached_tinymce_editor => missing textarea element");if(e=i.attr("id"),window.tinymce&&(mceInstance=window.tinymce.get(e),mceInstance&&mceInstance.remove()),!window.nimbleTinyMCEPreInit||!window.nimbleTinyMCEPreInit.mceInit||!window.nimbleTinyMCEPreInit.mceInit[e])throw new Error("setupDetachedTinyMceEditor => invalid nimbleTinyMCEPreInit global var");var o,r,a=nimbleTinyMCEPreInit.mceInit[e];a.content_css=(o=wp.editor.getDefaultSettings(),r=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],o&&o.tinymce&&o.tinymce.content_css&&(r=m.union(o.tinymce.content_css.split(","),r)),r.join(","));var s=t.input_parent,c=function(){var e=s();return m.isUndefined(e.autop)?n&&n.editor_params&&!0===n.editor_params.autop:e.autop};a.wpautop=c(),c()||(a.forced_root_block=""),a.toolbar1=sektionsLocalizedData.defaultToolbarBtns,a.toolbar2="",window.tinymce.init(a),window.QTags.getInstance(e);var l=tinyMCE.get(e);if(!l)throw new Error("setupDetachedTinyMceEditor => missing editor instance for module :"+t.module.id);var d=function(){var e=c()?wp.editor.autop(t()):t();l.setContent(e),p.sekEditorExpanded(!0),_(window).trigger("resize")};l.initialized?d():l.on("init",d),l.on("input change keyup keydown click SetContent BeforeSetContent",function(e){t(c()?l.getContent():wp.editor.removep(l.getContent()))}),p.sekCurrentDetachedTinyMceInput=t,i.data("czr-bound-for-detached-editor")||(i.on("input",function(e,t){p.sekCurrentDetachedTinyMceInput(_(this).val())}),i.data("czr-bound-for-detached-editor",!0))}})}(wp.customize,jQuery,_),function(_,m,f){_.czrInputMap=_.czrInputMap||{},m.extend(_.czrInputMap,{import_export:function(){var o=this,r=o.container.find('button[data-czr-action="sek-pre-import"]'),i=o.container.find("input[name=sek-import-file]"),n=_.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),s="local"===n.scope?_.czr_sektions.localSectionsSettingId():_.czr_sektions.getGlobalSectionsSettingId();i.on("change",function(e){r.toggleClass("disabled",f.isEmpty(m(this).val()))});o.container.on("click","[data-czr-action]",function(e){var i,t;switch(e.stopPropagation(),m(this).data("czr-action")){case"sek-export":if(i=!1,t=wp.customize.dirtyValues(),f.isEmpty(t)||f.each(t,function(e,t){i||(i=-1!==t.indexOf("nimble"))}),i){alert(sektionsLocalizedData.i18n["You need to publish before exporting."]);break}var n=_(s)(),o=!0;if(f.each(n.collection,function(e){o&&(f.isEmpty(e.collection)||(o=!1))}),o){alert(sektionsLocalizedData.i18n["Nothing to export."]);break}p();break;case"sek-pre-import":if(f.isEmpty(_.czr_sektions.activeLocations())){alert(sektionsLocalizedData.i18n["The current page has no available locations to import Nimble Builder sections."]);break}c({pre_import_check:!0}).done(a).fail(function(e){_.errare("sek_pre_import_checks failed",e),u(),c()});break;case"sek-import-as-is":c();break;case"sek-import-assign":c({assign_missing_locations:!0});break;case"sek-cancel-import":u()}});var a=function(e){var t=_.czr_sektions.activeLocations(),i=m.extend(!0,[],f.isArray(e.data.metas.active_locations)?e.data.metas.active_locations:[]);if(i=f.filter(i,function(e){return!f.contains(["nimble_local_header","nimble_local_footer"],e)}),f.isArray(i)&&f.isArray(t)){var n=m(i).not(t).get();f.isEmpty(n)?c():(r.hide(),o.container.find(".czr-import-dialog").slideToggle(),_.infoLog("sek-pre-import => imported locations missing in current page.",n))}else _.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Import failed"],"</strong>","</span>"].join("")}),u()},c=function(t){if(t=t||{},i.length<1||f.isUndefined(i[0])||!i[0].files||f.isEmpty(i.val()))_.previewer.trigger("sek-notify",{notif_id:"missing-import-file",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Missing file"],"</strong>","</span>"].join("")});else{_.notifications.remove("missing-import-file"),_.notifications.remove("import-success"),_.notifications.remove("import-failed"),_.notifications.remove("img-import-errors"),o.container.find(".sek-uploading").show();var e=new FormData;if(e.append("file_candidate",i[0].files[0]),e.append("action","sek_get_imported_file_content"),e.append("nonce",_.settings.nonce.save),f.contains(["local","global"],n.scope)){if(e.append("skope",n.scope),t.pre_import_check&&e.append("pre_import_check",t.pre_import_check),__request__=m.ajax({url:wp.ajax.settings.url,data:e,processData:!1,contentType:!1,type:"POST"}),t.pre_import_check)return m.Deferred(function(){var t=this;__request__.done(function(e){e.success||t.reject(e),l(e)||t.reject(e),t.resolve(e)}).fail(function(e){t.reject(e)}).always(function(){})});o.container.find(".sek-uploading").show(),_.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0}),__request__.done(function(e){var n=function(i){return(f.isObject(i)||f.isArray(i))&&f.each(i,function(e,t){(f.isObject(e)||f.isArray(e))&&(i[t]=n(e)),"id"!==t||!f.isString(e)||0!==e.indexOf("__rep__me__")&&0!==e.indexOf("__nimble__")||(i[t]=sektionsLocalizedData.optPrefixForSektionsNotSaved+_.czr_sektions.guid())}),i};e.data.data.collection=n(e.data.data.collection),d(e,t)}).fail(function(e){_.errare("sek-import input => ajax error",e),_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["Import failed, file problem"],"</strong>","</span>"].join("")})}).always(u)}else _.errare("sek-import input => invalid scope provided",n.scope)}},l=function(e){var t=!0,i=e.data,n=null;e.success||(n=[sektionsLocalizedData.i18n["Import failed"],i].join(" : ")),f.isNull(n)&&!f.isObject(i)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]);var o=i.data,r=i.metas,a=i.img_errors;return f.isNull(n)&&!f.isObject(o)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]),f.isNull(n)&&!f.isObject(r)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]),f.isNull(n)&&f.isEqual(_(s)(),o)&&(_.infoLog("sek-import input => Setting unchanged"),t=!1),f.isNull(n)||(_.errare("sek-import input => invalid data sent from server",i),_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",n,"</strong>","</span>"].join("")}),t=!1),f.isEmpty(a)||_.previewer.trigger("sek-notify",{notif_id:"img-import-errors",type:"info",duration:6e4,message:['<span style="color:#0075a2">',["<strong>"+sektionsLocalizedData.i18n["Some image(s) could not be imported"]+"</strong><br/>",'<span style="font-size:11px">'+a+"</span>"].join(" : "),"</span>"].join("")}),t},d=function(e,t){t=t||{},l(e)?(_.czr_sektions.updateAPISetting({action:"sek-import-from-file",scope:"global"===n.scope,imported_content:e.data,assign_missing_locations:t.assign_missing_locations,keep_existing_sections:o.input_parent.czr_Input("keep_existing_sections")()}).done(function(){"local"===n.scope&&_.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0}),_.previewer.refresh(),_.previewer.trigger("sek-notify",{notif_id:"import-success",type:"success",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["File successfully imported"],"</strong>","</span>"].join("")})}).fail(function(e){_.errare("sek-import input => error when firing ::updateAPISetting",e),_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Import failed"],e].join(" : "),"</strong>","</span>"].join("")})}),_.previewer.refresh()):u()},u=function(){_.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0}),o.container.find(".sek-uploading").hide(),i.val("").trigger("change"),o.container.find(".czr-import-dialog").hide(),r.show()},p=function(){var i=[],e={sek_export_nonce:_.settings.nonce.save,skope_id:_.czr_skopeBase.getSkopeProperty("skope_id"),active_locations:_.czr_sektions.activeLocations()};f.each(e,function(e,t){i.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),wp.ajax.post("sek_pre_export_checks",{nonce:_.settings.nonce.save,sek_export_nonce:_.settings.nonce.save,skope_id:_.czr_skopeBase.getSkopeProperty("skope_id"),active_locations:_.czr_sektions.activeLocations()}).done(function(){m(window).off("beforeunload"),window.location.href=[sektionsLocalizedData.customizerURL,"?",i.join("&")].join(""),m(window).on("beforeunload")}).fail(function(e){_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Export failed"],encodeURIComponent(e)].join(" "),"</strong>","</span>"].join("")})})}}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{simpleselect:function(e){t.czr_sektions.setupSelectInput.call(this,e)},multiselect:function(e){t.czr_sektions.setupSelectInput.call(this,e)}})}(wp.customize,jQuery,_),function(s,c,l){s.czrInputMap=s.czrInputMap||{},c.extend(s.czrInputMap,{category_picker:function(e){var n=this,o=c("select[data-czrtype]",n.container),r=function(){var e=n();return e=l.isString(e)?[e]:e,l.isArray(e)?e:[]},t=function(t){!0!==n.catCollectionSet&&(c.when(c.Deferred(function(i){l.isEmpty(s.czr_sektions.post_categories)?wp.ajax.post("sek_get_post_categories",{nonce:s.settings.nonce.save}).done(function(e){l.isArray(e)||s.errare(n.id+" => error => invalid category collection sent by server");var t={};l.each(e,function(e){l.isEmpty(e.slug)||l.isEmpty(e.name)?i.reject("missing slug or name for at least one category"):t[e.slug]=e.name}),s.czr_sektions.post_categories=t,i.resolve(s.czr_sektions.post_categories)}).fail(function(e){i.reject(e)}):i.resolve(s.czr_sektions.post_categories)})).done(function(e){i(e),t&&!0===t.open_on_init&&l.delay(function(){try{o.czrSelect2("open")}catch(e){}},100)}).fail(function(e){s.errare(n.id+" => fail response when _getCategoryCollection()",e)}),n.catCollectionSet=!0)},i=function(e){l.each(e,function(e,t){var i={value:t,html:e};l.contains(r(),t)&&c.extend(i,{selected:"selected"}),o.append(c("<option>",i))}),o.czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),o.on("change",function(){0===c(this).find("option:selected").length&&n([])})},a={};l.each(r(),function(e){a[e]=(e+"").replace(/-/g," ")}),i(a),n.container.on("click",function(){!0!==n.catCollectionSet&&(o.czrSelect2("destroy"),c.when(o.find("option").remove()).done(function(){t({open_on_init:!0})}))})}})}(wp.customize,jQuery,_),function(r,a,e){r.czrInputMap=r.czrInputMap||{},a.extend(r.czrInputMap,{grid_layout:function(e){var n=this,o=a(".sek-grid-layout-wrapper",n.container);o.find('input[type="hidden"]').val(n()),o.on("click","[data-sek-grid-layout]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-grid-layout]").removeClass("selected").attr("aria-pressed",!1),a(this).addClass("selected").attr("aria-pressed",!0);try{i=a(this).data("sek-grid-layout")}catch(e){r.errare(n.type+" => error when attaching click event",e)}n(i)}),a('[data-sek-grid-layout="'+n()+'"]',o).trigger("click")}})}(wp.customize,jQuery,_),function(o,r,a){o.czrModuleMap=o.czrModuleMap||{},r.extend(o.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:a.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}}),o.czrInputMap=o.czrInputMap||{},r.extend(o.czrInputMap,{content_type_switcher:function(e){var i,n=this;if(!o.section.has(n.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=o.section(n.module.control.section()),n.container.on("click","[data-sek-content-type]",function(e){e.preventDefault(),n.container.find("[data-sek-content-type]").removeClass("is-selected").attr("aria-pressed",!1),r(this).addClass("is-selected").attr("aria-pressed",!0),o.czr_sektions.currentContentPickerType(r(this).data("sek-content-type"))});var t=function(t){n.container.find('[data-sek-content-type="'+(t||"module")+'"]').trigger("click"),a.each(i.controls(),function(e){a.isUndefined(e.content_type)||e.active(t===e.content_type)})};o.czr_sektions.currentContentPickerType=o.czr_sektions.currentContentPickerType||new o.Value(n()),t(o.czr_sektions.currentContentPickerType()),o.czr_sektions.currentContentPickerType.bind(function(e){t(e)})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},e.extend(t.czrModuleMap,{sek_module_picker_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{};var n=sektionsLocalizedData.presetSectionsModules;i.isArray(n)&&!i.isEmpty(n)?(sektionsLocalizedData.isNimbleHeaderFooterEnabled||(n=i.filter(n,function(e){return!i.contains(["sek_header_sec_picker_module","sek_footer_sec_picker_module"],e)})),i.each(n,function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}})):t.errare("api.czrModuleMap => error when adding section modules")}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({initialize:function(e,t){var i=this;r.CZRInput.prototype.initialize.call(i,e,t),i.isReady.then(function(){i.renderUserSavedSections(),r.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:i.container})})},renderUserSavedSections:function(){var i="",n=this.container.find(".sek-content-type-wrapper"),o="";a.each(sektionsLocalizedData.userSavedSektions,function(e,t){try{o=function(e){var t=e.getDate(),i=e.getMonth(),n=e.getFullYear();e.getHours(),e.getMinutes(),e.getSeconds();return[t,["January","February","March","April","May","June","July","August","September","October","November","December"][i],n].join(" ")}(new Date(e.creation_date.replace(/-/g,"/")))}catch(e){r.errare("::renderUserSavedSections => formatDate => error",e)}i=['<div class="sek-user-section-wrapper">','<div class="sek-saved-section-title"><i class="sek-remove-user-section far fa-trash-alt"></i>'+e.title+"</div>",'<div draggable="true" data-sek-is-user-section="true" data-sek-section-type="'+e.type+'" data-sek-content-type="preset_section" data-sek-content-id="'+t+'" style="" title="'+e.title+'">','<div class="sek-overlay"></div>','<div class="sek-saved-section-description">'+e.description+"</div>",a.isEmpty(o)?"":'<div class="sek-saved-section-date"><i class="far fa-calendar-alt"></i> @missi18n Created : '+o+"</div>","</div>","</div>"].join(""),n.append(i)})}}),r.CZRDynModule.prototype.initialize.call(this,e,t)}};r.czrModuleMap=r.czrModuleMap||{},sektionsLocalizedData.isSavedSectionEnabled&&e.extend(r.czrModuleMap,{sek_my_sections_sec_picker_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_my_sections_sec_picker_module")}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"bg-image":a.each(["bg-attachment","bg-scale","bg-repeat","bg-apply-overlay","bg-color-overlay","bg-opacity-overlay","bg-parallax","bg-parallax-force"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-color-overlay":case"bg-opacity-overlay":e=!a.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-apply-overlay")());break;case"bg-parallax-force":e=!a.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;case"bg-scale":case"bg-repeat":e=!a.isEmpty(i()+"")&&!r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;default:e=!a.isEmpty(i()+"")}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":a.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return!a.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-parallax":a.each(["bg-parallax-force","bg-scale","bg-repeat"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!a.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i());break;case"bg-repeat":case"bg-scale":e=!a.isEmpty(n.czr_Input("bg-image")()+"")&&!r.CZR_Helpers.isChecked(i())}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}}),i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-attachment")())&&n.czr_Input("bg-attachment").container.find("input[type=checkbox]").trigger("click")});break;case"bg-attachment":i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")())&&n.czr_Input("bg-parallax").container.find("input[type=checkbox]").trigger("click")})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:a.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":o.each(["custom-height","overflow_hidden"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"width-type":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-width",function(){return"custom"===e()}),i.czr_sektions.scheduleVisibilityOfInputId.call(e,"h_alignment",function(){return"custom"===e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_template:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_header_footer"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_imp_exp:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_imp_exp","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_imp_exp"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"global-custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_header_footer"))}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"enable":a.each(["public_key","private_key","badge","show_failure_message","failure_message","score"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"failure_message":e=i()&&n.czr_Input("show_failure_message")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_failure_message":a.each(["failure_message"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("enable")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_global_recaptcha:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_global_recaptcha","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:a.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_recaptcha"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_beta_features:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_beta_features","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_beta_features"))}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=n.module;n.czr_Input.each(function(i){switch(i.id){case"img":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"img-size",function(){return!r.isEmpty(i()+"")&&r.isNumber(i())});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!r.contains(["no-link","img-lightbox"],i())}return e})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"border-type":r.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"none"!==i()})}catch(e){o.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":r.each(["custom_width"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_title_attr":r.each(["heading_title"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend(this.CZRTextEditorInputMths||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"detached_tinymce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),n.CZRInput.prototype.initialize.call(i,e,t)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(i){switch(i.id){case"img-type":o.each(["img-id","img-size"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":o.each(["content-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"custom"===i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":o.each(["btn-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":a.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"use_custom_color_on_hover":a.each(["color_hover"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e=i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":case"link-target":e=i()}return e})}catch(e){o.errare("Heading module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&!0===n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_heading_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_heading_spacing_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_divider_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRButtonItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"quote_design":n.each(["border_width_css","border_color_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"border-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}}),n.each(["icon_color_css","icon_size_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_quote_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_cite_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"icon":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this.module;this.czr_Input.each(function(i){switch(i.id){case"layout":r.each(["columns","img_column_width","has_tablet_breakpoint","has_mobile_breakpoint"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"columns":e="grid"===i();break;case"has_tablet_breakpoint":case"has_mobile_breakpoint":case"img_column_width":e="list"===i()}return e})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"categories":r.each(["must_have_all_cats"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){var e=i();return r.isArray(e)&&1<e.length})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"custom_grid_spaces":r.each(["column_gap","row_gap"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_excerpt":r.each(["excerpt_length"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_post_grid_main_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_post_grid_main_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_main_child")}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"show_thumb":a.each(["img_size","img_has_custom_height","img_height","border_radius_css","use_post_thumb_placeholder"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img_height":e=i()&&n.czr_Input("img_has_custom_height")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"img_has_custom_height":a.each(["img_height"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("show_thumb")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_post_grid_thumb_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_post_grid_thumb_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_thumb_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_metas_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_metas_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_metas_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_content_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_content_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_mobile_options:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_mobile_options","name"),has_mod_opt:!1,ready_on_section_expanded:!0,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_mobile_options")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"show_name_field":n.each(["name_field_label","name_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":n.each(["subject_field_label","subject_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":n.each(["message_field_label","message_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,"link-custom-url",function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_submission_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"use_custom_bg_color_on_hover":r.each(["bg_color_hover"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":r.each(["push_effect"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_font_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.bind("nimble-set-select-input-options",function(e){e.params=sektionsLocalizedData.registeredWidgetZones}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_widget_area_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_widget_area_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_widget_area_module")}})}(wp.customize,jQuery,_);
1
+ var CZRSeksPrototype=CZRSeksPrototype||{};!function(n,r){r.extend(CZRSeksPrototype,{initialize:function(){var e=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(n.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");e.SECTION_ID_FOR_GLOBAL_OPTIONS="__globalOptionsSectionId",e.SECTION_ID_FOR_LOCAL_OPTIONS="__localOptionsSection",e.SECTION_ID_FOR_CONTENT_PICKER="__content_picker__",e.MAX_NUMBER_OF_COLUMNS=12,e.SETTING_UPDATE_BUFFER=100,e.TINYMCE_EDITOR_HEIGHT=100,e.defaultLocalSektionSettingValue=e.getDefaultSektionSettingValue("local"),e.localSectionsSettingId=new n.Value({}),e.registered=new n.Value([]),n.bind("ready",function(){e.doSektionThinksOnApiReady()}),n.bind("save-request-params",function(e){r.extend(e,{local_skope_id:n.czr_skopeBase.getSkopeProperty("skope_id")})}),n.bind("sek-before-clean-registered",function(){_.isArray(n.czrActiveWPEditors)&&(_.each(n.czrActiveWPEditors,function(e){wp.editor.remove(e)}),n.czrActiveWPEditors=[])})},doSektionThinksOnApiReady:function(){var o=this;o.registerAndSetupDefaultPanelSectionOptions(),o.localSectionsSettingId.callbacks.add(function(e,t){try{o.setupSettingsToBeSaved()}catch(e){n.errare("Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()",e)}o.initializeHistoryLogWhenSettingsRegistered(),n.previewer.send("sek-request-active-locations")});var i=function(e,t){o.setContextualCollectionSettingIdWhenSkopeSet(e,t),n.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){e.deferred.embedded.done(function(){!0!==e.boundForLocalOptionGeneration&&(e.boundForLocalOptionGeneration=!0,e.expanded.bind(function(e){!0===e&&o.generateUI({action:"sek-generate-local-skope-options-ui"})}))})}),n.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){!0!==e.nimbleGlobalOptionGenerated&&(o.generateUI({action:"sek-generate-global-options-ui"}),e.nimbleGlobalOptionGenerated=!0)}),n.trigger("nimble-ready-for-current-skope")};_.isEmpty(n.czr_activeSkopes().local)||i(),n.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),o.reactToPreviewMsg(),o.setupDnd(),o.setupTinyMceEditor(),o.schedulePrintSectionJson(),o.bind("sek-ui-removed",function(){n.previewedDevice("desktop")}),n.previewedDevice.bind(function(t){var e=_.filter(o.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){n.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){r(this).trigger("click")})})})}),r("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){o.resetCollectionSetting()}),o.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&n.control(e.id,function(e){e.container.find("[draggable]").each(function(){r(this).off("dragstart dragend")})}),"control"==e.what&&n.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(r(this).data("czrSelect2"))||r(this).czrSelect2("destroy")})})}),n.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=o.registered(),i=r.extend(!0,[],t),n=_.findWhere(i,{id:e.id});if(!_.isEmpty(n)&&_.isEqual(n,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),o.registered(i)}}),o.activeLocations=new n.Value([]),n.previewer.bind("sek-active-locations-in-preview",function(e){o.activeLocations(_.isObject(e)&&_.isArray(e.active_locations)?e.active_locations:[])}),o.setupTopBar(),sektionsLocalizedData.isSavedSectionEnabled&&o.setupSaveUI(),o.lastClickedTargetInPreview=new n.Value,o.lastClickedTargetInPreview.bind(function(e,t){_.isObject(e)&&e.id?n.previewer.send("sek-set-double-click-target",e):n.previewer.send("sek-reset-double-click-target"),clearTimeout(r(window).data("_preview_target_timer_")),r(window).data("_preview_target_timer_",setTimeout(function(){o.lastClickedTargetInPreview({}),n.previewer.send("sek-reset-double-click-target")},2e4))}),n.previewer.bind("sek-clean-target-drop-zone",function(){o.lastClickedTargetInPreview({})}),r(document).keydown(function(e){e&&27===e.keyCode&&o.lastClickedTargetInPreview({})}),sektionsLocalizedData.hasActiveCachePlugin&&_.delay(function(){n.previewer.trigger("sek-notify",{notif_id:"has-active-cache-plugin",type:"info",duration:2e4,message:['<span style="color:#0075a2">',sektionsLocalizedData.i18n["You seem to be using a cache plugin."],"<strong> ("+sektionsLocalizedData.hasActiveCachePlugin+")</strong><br/>","<strong>",sektionsLocalizedData.i18n["It is recommended to disable your cache plugin when customizing your website."],"</strong>","</span>"].join("")})},2e3)},registerAndSetupDefaultPanelSectionOptions:function(){var o=this,e=n.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});n.panel(sektionsLocalizedData.sektionsPanelId,function(n){n.deferred.embedded.done(function(){var e=n.container.find("h3.accordion-section-title"),t=(n.container.find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+n.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join(""));if(0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}sektionsLocalizedData.eligibleForFeedbackNotification&&n.expanded.bind(function(e){e&&_.isUndefined(o.feedbackUIVisible)&&o.setupFeedBackUI()})})}),n.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),n.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_GLOBAL_OPTIONS,title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:n.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){n.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e)})}),n.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_LOCAL_OPTIONS,title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:n.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){n.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e)})}),n.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"refresh",type:"option"}),n.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_CONTENT_PICKER,title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:n.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){n.section(o.SECTION_ID_FOR_CONTENT_PICKER,function(e){"resolved"!=n.czr_initialSkopeCollectionPopulated.state()?n.czr_initialSkopeCollectionPopulated.done(function(){n.previewer.trigger("sek-pick-content",{focus:!1})}):n.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&n.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&n.previewer.trigger("sek-pick-content"),sektionsData=n.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&n.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&n.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&n.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.localSectionsSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,a){a.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarId="#nimble-top-bar",t.topBarVisible=new r.Value(!1),t.topBarVisible.bind(function(e){t.levelTreeExpanded()||t.toggleTopBar(e)}),t.mouseMovedRecently=new r.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(a(window).data("_scroll_move_timer_")),a(window).data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};a(window).on("mousemove scroll,",_.throttle(e,50)),r.previewer.bind("ready",function(){a(r.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.setupLevelTree()},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?a.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){a("body").addClass("nimble-top-bar-visible")},200)}):(t=a.Deferred(),a("body").removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){var t,i=this;if(0<a(i.topBarId).length)return a(i.topBarId);try{t=wp.template("nimble-top-bar")({})}catch(e){return r.errare("Error when parsing the the top note template",e),!1}a("#customize-preview").after(a(t)),a(document).keydown(function(e){if(e.ctrlKey&&_.contains([89,90],e.keyCode))try{i.navigateHistory(90===e.keyCode?"undo":"redo")}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),a(".sek-add-content",i.topBarId).on("click",function(e){e.preventDefault(),r.previewer.trigger("sek-pick-content",{content_type:"module"})}),a(".sek-level-tree",i.topBarId).on("click",function(e){e.preventDefault(),i.levelTreeExpanded(!i.levelTreeExpanded())}),a("[data-nimble-history]",i.topBarId).on("click",function(e){try{i.navigateHistory(a(this).data("nimble-history"))}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),a(".sek-settings",i.topBarId).on("click",function(e){r.panel(sektionsLocalizedData.sektionsPanelId,function(e){i.rootPanelFocus(),e.focus()})}),a(".sek-nimble-doc",i.topBarId).on("click",function(e){e.preventDefault(),window.open(a(this).data("doc-href"),"_blank")});var n=function(e){a(i.topBarId).length<1||(_.isObject(e)&&e.local_template&&"default"!==e.local_template?a(i.topBarId).find(".sek-notifications").html(['<span class="fas fa-info-circle"></span>',sektionsLocalizedData.i18n["This page uses a custom template."]].join(" ")):a(i.topBarId).find(".sek-notifications").html(""))},o=function(){r(i.localSectionsSettingId(),function(e){var t=e(),i=_.isObject(t)&&t.local_options&&t.local_options.template?t.local_options.template:null;n(i)}),r(i.getLocalSkopeOptionId()+"__template",function(e){e.bind(function(e,t){n(e)})})};return o(),r.bind("nimble-ready-for-current-skope",function(){o()}),a(i.topBarId)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{initializeHistoryLogWhenSettingsRegistered:function(){this.historyLog=new l.Value([{status:"current",value:{local:l(this.localSectionsSettingId())(),global:l(this.getGlobalSectionsSettingId())()},action:"initial"}]),this.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),d("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===d(this).data("nimble-history")?d(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):d(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},trackHistoryLog:function(e,t){var i=this,n=e.id===i.getGlobalSectionsSettingId();if(!_.isObject(t)||!_.isFunction(i.historyLog)||!_.isArray(i.historyLog()))throw l.errare("params, self.historyLog() ",t,i.historyLog()),new Error("trackHistoryLog => invalid params or historyLog value");var o,r=[],a=d.extend(!0,[],i.historyLog());_.isEmpty(t.in_sektion)?_.isEmpty(t.to_sektion)||(o=t.to_sektion):o=t.in_sektion,_.each(a,function(e){"future"!=e.status&&(d.extend(e,{status:"previous"}),r.push(e))}),r.push({status:"current",value:n?{global:e()}:{local:e()},action:_.isObject(t)&&t.action||"",sektionToRefresh:o}),i.historyLog(r)},navigateHistory:function(i){var t,n,o,r,e=this,a=d.extend(!0,[],e.historyLog()),s=[];if(_.each(a,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":n=e;break;case"future":o=e}switch(i){case"undo":_.isEmpty(n)||_.isEmpty(t)||(r=t.value,n.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(o)||(r=o.value,n.sektionToRefresh,o.sektionToRefresh)}}}),!_.isUndefined(r)){_.isEmpty(r.local)||(l(e.localSectionsSettingId())(e.validateSettingValue(r.local,"local"),{navigatingHistoryLogs:!0}),l.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0})),_.isEmpty(r.global)||l(e.getGlobalSectionsSettingId())(e.validateSettingValue(r.global,"global"),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(a,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(a,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":a.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}s.push(newLog)}),e.historyLog(s)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(b,z){z.extend(CZRSeksPrototype,{setupLevelTree:function(){var i=this;i.levelTree=new b.Value([]),i.levelTree.bind(function(){i.levelTreeExpanded()&&i.renderOrRefreshTree()}),i.levelTreeExpanded=new b.Value(!1),i.levelTreeExpanded.bind(function(e){if(z("body").toggleClass("sek-level-tree-expanded",e),e){if(i.setLevelTreeValue(),_.isEmpty(i.levelTree()))return b.previewer.trigger("sek-notify",{type:"info",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["No sections to navigate"]+"</strong>","</span>"].join("")}),void i.levelTreeExpanded(!1);z("#customize-preview iframe").css("z-index",1),i.renderOrRefreshTree()}else 0<z("#nimble-level-tree").length&&_.delay(function(){z("#nimble-level-tree").remove(),z("#customize-preview iframe").css("z-index","")},300)}),i.activeLocations.bind(function(){_.isEmpty(i.levelTree())||i.renderOrRefreshTree()}),b.previewer.bind("ready",function(){i.localSectionsSettingId.callbacks.add(function(){i.levelTreeExpanded(!1),_.each([i.getGlobalSectionsSettingId(),i.localSectionsSettingId(),sektionsLocalizedData.optNameForGlobalOptions],function(e){b(e)._isBoundForNimbleLevelTree||(b(e).bind(function(e){i.setLevelTreeValue()}),b(e)._isBoundForNimbleLevelTree=!0)})})}),z("body").on("click","#nimble-level-tree [data-nimb-level]",function(e){e.preventDefault(),e.stopPropagation();var t=z(e.target).closest("[data-nimb-level]");b.previewer.send("sek-animate-to-level",{id:t.data("nimb-id")}),b.previewer.send("sek-display-level-ui",{id:t.data("nimb-id")})}),z("body").on("click","#nimble-level-tree .sek-remove-level",function(e){e.preventDefault(),e.stopPropagation();var t=z(e.target).closest("[data-nimb-level]");b.previewer.trigger("sek-remove",{level:t.data("nimb-level"),id:t.data("nimb-id"),location:t.closest('[data-nimb-level="location"]').data("nimb-id"),in_sektion:t.closest('[data-nimb-level="section"]').data("nimb-id"),in_column:t.closest('[data-nimb-level="column"]').data("nimb-id")}),t.fadeOut("slow"),i.renderOrRefreshTree()}),z("body").on("click",".sek-close-level-tree",function(e){e.preventDefault(),i.levelTreeExpanded(!1)})},setLevelTreeValue:function(){var e,t,i,n,o,r=this.getGlobalSectionsSettingId(),a=this.localSectionsSettingId(),s=sektionsLocalizedData.optNameForGlobalOptions,c=!1;if(_.each([r,a,s],function(e){b.has(e)||(c=e)}),!1===c){e=b(r)(),i=_.isObject(e)?z.extend(!0,{},e):{},i=_.isEmpty(i.collection)?[]:i.collection,i=_.isArray(i)?i:[],t=b(a)(),t=_.isObject(t)?t:{},n=z.extend(!0,{},t),n=_.isEmpty(n.collection)?[]:n.collection,n=_.isArray(n)?n:[];var l,d=_.union(i,n),u=!1,p=!1;o=b(s)(),o=_.isObject(o)?o:{},t.local_options&&t.local_options.local_header_footer&&(u="nimble_local"===(l=t.local_options.local_header_footer["header-footer"])),o.global_header_footer&&!u&&"theme"!==l&&(p="nimble_global"===o.global_header_footer["header-footer"]||"nimble_global"===l);var m,f,g=z.extend(!0,[],d);g=_.filter(g,function(e,t){return!_.contains(["nimble_global_header","nimble_global_footer","nimble_local_header","nimble_local_footer"],e.id)});var h=function(e){m=_.findWhere(d,{id:"nimble_"+e+"_header"}),f=_.findWhere(d,{id:"nimble_"+e+"_footer"}),g.unshift(m),g.push(f)};u?h("local"):p&&h("global");var k,y=this.activeLocations(),v=[];_.isEmpty(y)?v=g:_.each(y,function(e){k=_.findWhere(g,{id:e}),_.isUndefined(k)||v.push(k)}),this.levelTree(v)}else b.errare("::setLevelTreeValue => a setting id is not registered ")},renderOrRefreshTree:function(){var e;if(z("#nimble-level-tree").length<1){try{e=wp.template("nimble-level-tree")({})}catch(e){return b.errare("Error when parsing the the nimble-level-tree template",e),!1}z("#customize-preview").after(z(e))}z("#nimble-level-tree").find(".sek-tree-wrap").html(this.getLevelTreeHtml())},getLevelTreeHtml:function(e,t){var i=this;e=e||i.levelTree();var n,o,r,a=!1;if(!_.isArray(e)||_.isEmpty(e))return b.errare("::buildLevelTree => invalid collection param",e),r;var s='<i class="material-icons sek-remove-level" title="'+sektionsLocalizedData.i18n["Remove this element"]+'">delete_forever</i>';return r="<ul>",_.each(e,function(e){_.isUndefined(e.level)?b.errare("::buildLevelTree => missing level property",e):_.isUndefined(e.id)?b.errare("::buildLevelTree => missing id property",e):(n=e.level,"location"===(o=n)&&(a=!_.contains(i.activeLocations(),e.id)),a||(sektionsLocalizedData.i18n[n]&&(o=sektionsLocalizedData.i18n[n]),!0===e.is_nested&&(o=sektionsLocalizedData.i18n["nested section"]),s="location"!==n?s:"",r+='<li data-nimb-level="'+n+'" data-nimb-id="'+e.id+'">',r+='<div class="sek-level-infos"><div class="sek-inner-level-infos">',"module"===n&&(r+=[i.getTreeModuleIcon(e.module_type),i.getTreeModuleTitle(e.module_type)].join(" ")),r+=[" ",o,"( id :",e.id,")",s].join(" "),r+="</div></div>",_.isArray(e.collection)&&!_.isEmpty(e.collection)&&(r+=i.getLevelTreeHtml(e.collection,t)),r+="</li>"))}),r+="</ul>"},getTreeModuleIcon:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i={svg:e.icon?sektionsLocalizedData.moduleIconPath+e.icon:"",font:e.font_icon?e.font_icon:""})}),_.isEmpty(i.svg)?_.isEmpty(i.font)?void 0:i.font:'<img class="sek-svg-mod-icon" src="'+i.svg+'"/>'},getTreeModuleTitle:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i=e.title)}),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,c){c.extend(CZRSeksPrototype,{setupSaveUI:function(){var n=this;n.saveUIVisible=new s.Value(!1),n.saveUIVisible.bind(function(e,t,i){n.toggleSaveUI(e,i?i.id:null)})},toggleSaveUI:function(e,t){e=!!_.isUndefined(e)||e;var i,n=this;e?c.when(n.renderAndSetupSaveUITmpl({})).done(function(e){n.saveUIContainer=e,_.delay(function(){c("body").addClass("nimble-save-ui-visible")},200),c("#sek-saved-section-id").val(t)}):(i=c.Deferred(),c("body").removeClass("nimble-save-ui-visible"),0<c("#nimble-top-save-ui").length?_.delay(function(){n.saveUIContainer.remove(),i.resolve()},300):i.resolve(),i.promise()).done(function(){n.saveUIVisible(!1)})},preProcessSektion:function(e){var t=this.cleanIds(e);return _.omit(t,function(e,t){return _.contains(["id","level"],t)})},renderAndSetupSaveUITmpl:function(e){if(0<c("#nimble-top-save-ui").length)return c("#nimble-top-save-ui");var a=this;try{_tmpl=wp.template("nimble-top-save-ui")({})}catch(e){return s.errare("Error when parsing the the top note template",e),!1}return c("#customize-preview").after(c(_tmpl)),c(".sek-do-save-section","#nimble-top-save-ui").on("click",function(e){e.preventDefault();var t=c.extend(!0,{},a.getLevelModel(c("#sek-saved-section-id").val())),i=c("#sek-saved-section-title").val(),n=c("#sek-saved-section-description").val(),o=a.guid(),r=a.preProcessSektion(t);if(_.isEmpty(i))return c("#sek-saved-section-title").addClass("error"),void s.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")});c("#sek-saved-section-title").removeClass("error"),wp.ajax.post("sek_save_section",{nonce:s.settings.nonce.save,sek_title:i,sek_description:n,sek_id:o,sek_data:JSON.stringify(r)}).done(function(e){s.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n Your section has been saved.</strong>","</span>"].join("")})}).fail(function(e){s.errorLog("ajax sek_save_section => error",e),s.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")})})}),c(".sek-cancel-save","#nimble-top-save-ui").on("click",function(e){e.preventDefault(),a.saveUIVisible(!1)}),c("#nimble-top-save-ui")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,a){a.extend(CZRSeksPrototype,{setupFeedBackUI:function(){var t=this;t.feedbackLastUserAction="none",t.feedbackUIId="#nimble-feedback",t.feedbackUIVisible=new r.Value(!1),t.feedbackUIVisible.bind(function(e){t.levelTreeExpanded()||t.toggleFeddBackUI(e),e&&t.refreshSelfClosingTimer()}),t.feedbackUIVisible(!0)},refreshSelfClosingTimer:function(){var e=this;clearTimeout(a(e.feedbackUIId).data("_feedback_user_action_timer_")),a(e.feedbackUIId).data("_feedback_user_action_timer_",setTimeout(function(){_.contains(["go_review","reporting_problem"],e.feedbackLastUserAction)||e.feedbackUIVisible(!1)},6e4))},toggleFeddBackUI:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?a.when(i.renderAndSetupFeedbackTmpl({})).done(function(e){_.delay(function(){a("body").addClass("nimble-feedback-ui-visible")},200)}):(t=a.Deferred(),a("body").removeClass("nimble-feedback-ui-visible"),0<a(i.feedbackUIId).length?_.delay(function(){a(i.feedbackUIId).remove(),t.resolve()},300):t.resolve(),t.promise()).done(function(){i.feedbackUIVisible(!1)})},renderAndSetupFeedbackTmpl:function(e){var t,i=this;if(0<a(i.feedbackUIId).length)return a(i.feedbackUIId);try{t=wp.template("nimble-feedback-ui")({})}catch(e){return r.errare("Error when parsing the the feedback template",e),!1}if(a("#customize-preview").after(a(t)),!i.feedbackEventsScheduled){var n=a(i.feedbackUIId).data("sek-dismiss-pointer"),o=function(){wp.ajax.post("dismiss-wp-pointer",{pointer:n}).fail(function(e){r.errare("ajax dismiss failure",e)})};return a("body").on("click","[data-sek-feedback-action]",function(e){e.preventDefault(),i.refreshSelfClosingTimer();var t=a(this).data("sek-feedback-action");switch(i.feedbackLastUserAction=t){case"not_enjoying":a(i.feedbackUIId).find(".sek-feedback-step-one").hide(),a(i.feedbackUIId).find(".sek-feedback-step-two-not-enjoying").show();break;case"enjoying":a(i.feedbackUIId).find(".sek-feedback-step-one").hide(),a(i.feedbackUIId).find(".sek-feedback-step-two-enjoying").show();break;case"reporting_problem":window.open(a(this).data("problem-href"),"_blank");break;case"go_review":window.open("https://wordpress.org/support/plugin/nimble-builder/reviews/?filter=5/#new-post","_blank");break;case"maybe_later":i.feedbackUIVisible(!1),wp.ajax.post("sek_postpone_feedback",{nonce:r.settings.nonce.save,transient_duration_in_days:30}).fail(function(e){r.errare("ajax dismiss failure",e)});break;case"already_did":a(i.feedbackUIId).find(".sek-feedback-step-two-not-enjoying").hide(),a(i.feedbackUIId).find(".sek-feedback-step-two-enjoying").hide(),a(i.feedbackUIId).find(".sek-feedback-step-three-thanks").show(),_.delay(function(){i.feedbackUIVisible(!1)},3e3),o();break;case"dismiss":i.feedbackUIVisible(!1),o();break;default:r.errare("::renderAndSetupFeedbackTmpl => invalid action")}}),i.feedbackEventsScheduled=!0,a(i.feedbackUIId)}}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,e){jQuery.extend(CZRSeksPrototype,{getRevisionHistory:function(e){return wp.ajax.post("sek_get_revision_history",{nonce:r.settings.nonce.save,skope_id:e.is_local?r.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId})},setSingleRevision:function(i){var n=this,o=function(e,t){r.previewer.trigger("sek-notify",{notif_id:"restore-revision-error",type:t||"info",duration:1e4,message:['<span style="">',"<strong>",e||"","</strong>","</span>"].join("")})};wp.ajax.post("sek_get_single_revision",{nonce:r.settings.nonce.save,revision_post_id:i.revision_post_id}).done(function(e){var t=i.is_local?n.localSectionsSettingId():n.getGlobalSectionsSettingId();_.isEqual(r(t)(),e)?o(sektionsLocalizedData.i18n["This is the current version."],"info"):n.updateAPISetting({action:"sek-restore-revision",is_global_location:!i.is_local,revision_value:e}).done(function(){r.previewer.refresh()}).fail(function(e){r.errare("::setSingleRevision error when firing ::updateAPISetting",e),o(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}).fail(function(e){r.errare("::setSingleRevision ajax error",e),o(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}})}(wp.customize);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{setupSettingsToBeSaved:function(){var i,o=this,e={local:{collectionSettingId:o.localSectionsSettingId()},global:{collectionSettingId:o.getGlobalSectionsSettingId()}};_.each(e,function(e,t){if(i=c.czr_skopeBase.getSkopeProperty("sektions",t).db_values,_.isEmpty(e.collectionSettingId))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!c.has(e.collectionSettingId)){c.CZR_Helpers.register({what:"setting",id:e.collectionSettingId,value:o.validateSettingValue(_.isObject(i)?i:o.getDefaultSektionSettingValue(t),t),transport:"postMessage",type:"option",track:!1,origin:"nimble"});c(e.collectionSettingId,function(n){n.bind(_.debounce(function(e,t,i){if(!_.isObject(i)||!0!==i.navigatingHistoryLogs)try{o.trackHistoryLog(n,i)}catch(e){c.errare("setupSettingsToBeSaved => trackHistoryLog",e)}},1e3))})}})},validateSettingValue:function(i,n){if(!_.isObject(i))return c.errare("::validateSettingValue => validation error => the setting should be an object",i),null;if(!_.isEmpty(n)&&_.contains(["local","global"],n)){var o={},r=!1,e=[],a=function(e){c.errare(e,i),c.previewer.trigger("sek-notify",{type:"error",duration:6e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),r=!0},s=function(t){if(!r)if(_.isUndefined(t)&&_.isEmpty(o)){if(t=l.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void a("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void a('validation error => the root level should not have a "level" or an "id" property');_.each(t,function(e,t){switch(n){case"local":if(!_.contains(["collection","local_options","fonts"],t))return void a("validation error => unauthorized option group for local setting value => "+t);break;case"global":if(!_.contains(["collection","fonts"],t))return void a("validation error => unauthorized option group for global setting value => "+t)}}),_.each(i.collection,function(e){o=t,s(e)})}}else{if(_.isEmpty(t.id)||!_.isString(t.id))return void a("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void a("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void a("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void a('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void a("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void a("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&c.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(o.level))return void a("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=o.level)return void a("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=o.level)return void a("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=o.level)return void a("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=o.level)return void a("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){o=l.extend(!0,{},t),_.isUndefined(e)?a("validation error => undefined level "):s(e)})}};return s(),r?null:i}c.errare("::validateSettingValue => invalid scope provided.",n)},resetCollectionSetting:function(e){if(_.isEmpty(e)||!_.contains(["local","global"],e))throw new Error("resetCollectionSetting => invalid scope provided.",e);return l.extend(!0,{},this.getDefaultSektionSettingValue(e))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,n){n.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var o=this,r={},a={},s=!0,e={"sek-add-section":{callback:function(e){return s=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,a={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},o.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{id:e.apiParams?e.apiParams.id:"",content_type:"section"}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return s=!0,a={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},o.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return s=!0,a={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module:e.before_module,after_module:e.after_module},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_column,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(s=!0,a={},e.level){case"section":var t=o.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return o.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),"sek-remove-section"===e.apiParams.action){var t=o.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(s=!0,a={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-move-section-up":{callback:function(e){return s=!1,a={},r={action:"sek-move-section-up-down",direction:"up",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-move-section-down":{callback:function(e){return s=!1,a={},r={action:"sek-move-section-up-down",direction:"down",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-duplicate":{callback:function(e){switch(s=!0,a={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return o.updateAPISetting(r)},complete:function(e){var t;switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),t=e.apiParams.location,c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_sektion;break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_column}c.previewer.trigger("sek-refresh-stylesheet",{id:t,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return s=!0,a={},r=e,o.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(s=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,a={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)});var t=e.location_skope_id;_.isUndefined(t)&&(t=!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id")),c.previewer.trigger("sek-refresh-stylesheet",{location_skope_id:t,is_global_location:o.isGlobalLocation(e.apiParams)}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return s=!1,a={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_sektion,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return e=_.isObject(e)?e:{},c.czr_sektions.currentContentPickerType=c.czr_sektions.currentContentPickerType||new c.Value,c.czr_sektions.currentContentPickerType(e.content_type||"module"),_.isObject(e)&&e.id&&o.lastClickedTargetInPreview({id:e.id}),s=!0,r={},a={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"module",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},o.generateUI(a)},"sek-edit-options":function(e){return s=!0,r={},_.isEmpty(e.id)?n.Deferred(function(){this.reject("missing id")}):(a={action:"sek-generate-level-options-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(a))},"sek-edit-module":function(e){return s=!0,r={},a={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(a)},"sek-notify":function(t){s=!1;var i=t.notif_id||"sek-notify";return n.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification(i,{type:t.type||"info",message:t.message,dismissible:!0})),_.delay(function(){c.notifications.remove(i)},t.duration||5e3)}),this.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-level":function(t){return s=!0,n.Deferred(function(e){r={action:"sek-refresh-level",level:t.level,id:t.id},a={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-stylesheet":function(t){return s=!0,t=t||{},n.Deferred(function(e){r={id:t.id},a={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-toggle-save-section-ui":function(t){return s=!1,o.saveUIVisible(!0,t),n.Deferred(function(e){r={},a={},e.resolve({is_global_location:o.isGlobalLocation(t)})})}};_.each(e,function(i,n){c.previewer.bind(n,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+n);e=i.callback}try{e(t).done(function(e){e=e||{},s?c.previewer.send(n,{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:a,cloneId:!_.isEmpty(e.cloneId)&&e.cloneId}):c.previewer.trigger([n,"done"].join("_"),{apiParams:r,uiParams:a}),o.trigger([n,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => error when firing "+n,e),c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+n,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this;c.previewer.bind("sek-to-json",function(e){var t=n.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(i.cleanIds(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(y,v){v.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=v.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){y.errare("::generateUI() => error",e),i=v.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(n){if(!_.isEmpty(n.settingParams)&&_.has(n.settingParams,"to")){var o,r=this,e=n.settingParams.to,t=null,i=!1;if(!_.isEmpty(n.settingParams.args)&&_.has(n.settingParams.args,"moduleRegistrationParams")){var a=n.settingParams.args.moduleRegistrationParams.control,s=n.settingParams.args.moduleRegistrationParams.id,c=a.czr_Module(s);if(_.isEmpty(c)?y.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",n):(t=c.module_type,i=c.isMultiItem()),!i&&_.isObject(e)?o=r.normalizeAndSanitizeSingleItemInputValues(e,t):(o=[],_.each(e,function(e){o.push(r.normalizeAndSanitizeSingleItemInputValues(e,t))})),_.isEmpty(n.defaultPreviewAction))y.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",n);else{var l,d="refresh_stylesheet"===n.defaultPreviewAction,u="refresh_markup"===n.defaultPreviewAction,p="refresh_fonts"===n.defaultPreviewAction,m="refresh_preview"===n.defaultPreviewAction,f=n.settingParams.args.input_changed,g=function(){return l&&_.isString(l.refresh_markup)&&"true"!==l.refresh_markup&&"false"!==l.refresh_markup};_.isUndefined(f)||(l=r.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=g()?l.refresh_markup:Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var h=function(){if(!0!==n.isGlobalOptions)return r.updateAPISetting({action:n.uiParams.action,id:n.uiParams.id,value:o,in_column:n.uiParams.in_column,in_sektion:n.uiParams.in_sektion,options_type:n.options_type,settingParams:n.settingParams}).done(function(e){!0===d&&y.previewer.send("sek-refresh-stylesheet",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:y.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:y.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:n.uiParams.id,level:n.uiParams.level}});var t=function(){y.previewer.send("sek-refresh-level",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:y.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:y.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-level",id:n.uiParams.id,level:n.uiParams.level},skope_id:y.czr_skopeBase.getSkopeProperty("skope_id")})};if(!0===u&&t(),g()){var i=n.settingParams.args.input_value;if(!_.isString(i))throw new Error("::updateAPISettingAndExecutePreviewActions => _doUpdateWithRequestedAction => refreshMarkupWhenNeededForInput => html content is not a string.");r.htmlIncludesShortcodesOrTmplTags(i)?t():y.previewer.send("sek-update-html-in-selector",{selector:l.refresh_markup,html:i,id:n.uiParams.id,location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:y.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:y.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-update-html-in-selector",id:n.uiParams.id,level:n.uiParams.level},skope_id:y.czr_skopeBase.getSkopeProperty("skope_id")})}!0===m&&y.previewer.refresh()});if(_.isEmpty(n.options_type))y.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=y(sektionsLocalizedData.optNameForGlobalOptions)(),t=v.extend(!0,{},_.isObject(e)?e:{}),i={};_.each(o||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[n.options_type]=i,y(sektionsLocalizedData.optNameForGlobalOptions)(t)}};if(!0===p){var k=n.settingParams.args.input_value;if(!_.isString(k))return void y.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",k);-1<k.indexOf("gfont")?r.updateAPISetting({action:"sek-update-fonts",font_family:k,is_global_location:r.isGlobalLocation(n.uiParams)}).always(function(){h().then(function(){r.updateAPISetting({action:"sek-update-fonts",is_global_location:r.isGlobalLocation(n.uiParams)})})}):h()}else h()}}else y.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",n)}else y.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",n)},normalizeAndSanitizeSingleItemInputValues:function(e,o){var i,r={},n={},a=null,s=this;return _.each(e,function(e,t){var i,n;_.contains(["title","id"],t)||(null!==o&&"no_default_value_specified"===(a=s.getInputDefaultValue(t,o))&&y.infoLog("::normalizeAndSanitizeSingleItemInputValues => missing default value for input "+t+" in module "+o),i=e,n=a,(_.isBoolean(i)||_.isBoolean(n)?Boolean(i)===Boolean(n):_.isNumber(i)||_.isNumber(n)?Number(i)===Number(n):_.isString(i)||_.isString(n)?i+""==n+"":_.isObject(i)&&_.isObject(n)?_.isEqual(i,n):_.isArray(i)&&_.isArray(n)?JSON.stringify(i.sort())===JSON.stringify(n.sort()):i===n)||(_.isString(e)||_.isObject(e))&&_.isEmpty(e)||(r[t]=e))}),_.each(r,function(e,t){switch(s.getInputType(t,o)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"detached_tinymce_editor":case"nimble_tinymce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}n[t]=i}),n},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=y.control.has(t):(i=!0,1<e.length&&y.errare("generateUI => why is this control registered more than once ? => "+t)),i},htmlIncludesShortcodesOrTmplTags:function(e){var t=e.match(/\[+([\w_-])+/g),i=e.match(/\{\{+([\w_-])+/g),n=[],o=[];if(t)for(var r=0;r<t.length;r++){var a=t[r].replace(/^\[+/g,"");-1===n.indexOf(a)&&n.push(a)}if(i)for(var s=0;s<i.length;s++){var c=i[s].replace(/^\[+/g,"");-1===o.indexOf(c)&&o.push(c)}return!_.isEmpty(n)||!_.isEmpty(o)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,s){s.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(o,e){var r=this,t={};s.extend(t,{content_type_switcher:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:sektionsLocalizedData.i18n["Select a content type"],priority:0,settingValue:{content_type:o.content_type}},module_picker:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:sektionsLocalizedData.i18n["Pick a module"],content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_intro_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_intro_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for an introduction"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_features_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_features_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for services and features"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_contact_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_contact_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Contact-us sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_column_layouts_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_column_layouts_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Empty sections with columns layout"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isNimbleHeaderFooterEnabled&&s.extend(t,{sek_header_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_header_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Header sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_footer_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_footer_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Footer sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isSavedSectionEnabled&&s.extend(t,{sek_my_sections_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_my_sections_sec_picker_module",controlLabel:"@missi18n My sections",content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return r.isUIControlAlreadyRegistered(n)?a.control(n,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}})}):(_do_register_=function(){_.each(t,function(n,e){a.has(n.settingControlId)||(a(n.settingControlId,function(e){e.bind(function(e,t){a.errare("generateUIforDraggableContent => the setting() should not changed")})}),a.CZR_Helpers.register({origin:"nimble",level:o.level,what:"setting",id:n.settingControlId,dirty:!1,value:n.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),a.CZR_Helpers.register({origin:"nimble",level:o.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.SECTION_ID_FOR_CONTENT_PICKER,priority:n.priority||10,settings:{default:n.settingControlId},track:!1}).done(function(){a.control(n.settingControlId,function(e){e.content_type=n.content_type,!0===o.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),"section"===e.content_type?(e.container.find(".czr-items-wrapper").hide(),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&(e.container.find(".czr-items-wrapper").show(),t.trigger("click"))):e.container.attr("data-sek-accordion","no")})})})},a.section(r.SECTION_ID_FOR_CONTENT_PICKER,function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),r.scheduleModuleAccordion.call(e,{expand_first_control:!0})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(r,e){var a=this;_.isEmpty(r.id)&&e.reject("generateUI => missing id");var i=a.getLevelProperty({property:"value",id:r.id}),t=a.getLevelProperty({property:"module_type",id:r.id}),n=a.getRegisteredModuleProperty(t,"name");_.isEmpty(t)&&e.reject("generateUI => module => invalid module_type");var o={};if(!0===a.getRegisteredModuleProperty(t,"is_father")){var s=a.getRegisteredModuleProperty(t,"children");if(_.isEmpty(s))throw new Error("::generateUIforFrontModules => a father module "+t+" is missing children modules ");_.each(s,function(e,t){o[t]={settingControlId:r.id+"__"+t,module_type:e,controlLabel:a.getRegisteredModuleProperty(e,"name")}})}else o.__no_option_group_to_be_updated_by_children_modules__={settingControlId:r.id,module_type:t,controlLabel:n};var c=_.keys(o)[0],l=o[c].settingControlId;return a.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(a.cleanRegistered(),_do_register_=function(){_.each(o,function(n,o){if(!d.has(n.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(r,{action:"sek-set-module-value"}),options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions",e)}};d(n.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},i);"__no_option_group_to_be_updated_by_children_modules__"!==o&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[o])?e[o]:{}),d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.id,priority:10,settings:{default:n.settingControlId}}).done(function(){}),d.control(n.settingControlId,function(e){d.control(n.settingControlId).focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})},d.section.when(r.id,function(){d.section(r.id).focus(),_do_register_()}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Content for"]+" "+n,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){}),d.section(r.id,function(e){e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),a.scheduleModuleAccordion.call(e,{expand_first_control:!0})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(a,e){var s=this,c=s.getLevelProperty({property:"options",id:a.id});c=_.isObject(c)?c:{};var t={};d.extend(t,{bg:{settingControlId:a.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[a.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'},border:{settingControlId:a.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:a.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:a.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Custom anchor ( CSS ID ) and CSS classes for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:a.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:a.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height and vertical alignment for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),"section"===a.level&&(d.extend(t,{width:{settingControlId:a.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),d.extend(t,{breakpoint:{settingControlId:a.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}})),"module"===a.level&&d.extend(t,{width:{settingControlId:a.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[a.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return s.isUIControlAlreadyRegistered(n)?l.control(n).focus({completeCallback:function(){var e=l.control(n).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(t,function(n,o){if(s.isUIControlAlreadyRegistered(n.settingControlId))l.section(l.control(n.settingControlId).section()).expanded(!0);else{if(!l.has(n.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=c[o]||{},i=s.getModuleStartingValue(n.module_type);if("no_starting_value"!==i&&_.isObject(i)){var r=d.extend(!0,{},i);e=d.extend(r,e)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,level_id:a.id,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:a.id,priority:0,settings:{default:n.settingControlId}}).done(function(){}),l.control(n.settingControlId,function(e){!0===n.expandAndFocusOnInit&&e.focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})}})},l.section.has(a.id)||l.section(a.id,function(e){s.scheduleModuleAccordion.call(e,{expand_first_control:!0})}),l.CZR_Helpers.register({origin:"nimble",what:"section",id:a.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+a.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){}),l.section(a.id,function(e){_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>')})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=l.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(l.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(a,e){var s=this,i=s.getLocalSkopeOptionId();if(s.isUIControlAlreadyRegistered(i))return e;if(s.localOptionsRegistrationParams={},_.isUndefined(sektionsLocalizedData.localOptionsMap)||!_.isObject(sektionsLocalizedData.localOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid localOptionsMap"),e;!0===a.clean_settings&&s.cleanRegisteredLocalOptionSettings(),_.each(sektionsLocalizedData.localOptionsMap,function(e,t){switch(t){case"template":s.localOptionsRegistrationParams[t]={settingControlId:i+"__template",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'};break;case"local_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"widths":s.localOptionsRegistrationParams[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"custom_css":s.localOptionsRegistrationParams[t]={settingControlId:i+"__custom_css",module_type:e,controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'};break;case"local_performances":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"local_reset":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"local_revisions":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of local sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"import_export":s.localOptionsRegistrationParams[t]={settingControlId:i+"__local_imp_exp",module_type:e,controlLabel:sektionsLocalizedData.i18n["Export / Import"],icon:'<i class="material-icons sek-level-option-icon">import_export</i>'};break;default:l.errare("::generateUIforLocalOptions => an option group could not be registered => "+e,t)}});var t=l(s.localSectionsSettingId())(),c=d.extend(!0,{},_.isObject(t.local_options)?t.local_options:{});return _do_register_=function(){_.each(s.localOptionsRegistrationParams,function(n,o){var e=s.getModuleStartingValue(n.module_type),t=_.isObject(c[o])?c[o]:{};if(!l.has(n.settingControlId)){var i=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};if(l(n.settingControlId,function(e){e.bind(_.debounce(i,s.SETTING_UPDATE_BUFFER))}),"no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);t=d.extend(r,t)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:t,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:s.SECTION_ID_FOR_LOCAL_OPTIONS,priority:10,settings:{default:n.settingControlId}}).done(function(){l.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(a,e){var s=this,i=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(s.isUIControlAlreadyRegistered(i))return e;var n={};if(_.isUndefined(sektionsLocalizedData.globalOptionsMap)||!_.isObject(sektionsLocalizedData.globalOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid globalOptionsMap"),e;_.each(sektionsLocalizedData.globalOptionsMap,function(e,t){switch(t){case"global_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n[t]={settingControlId:i+"__header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"breakpoint":n[t]={settingControlId:i+"__breakpoint",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">devices</i>'};break;case"widths":n[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"performances":n[t]={settingControlId:i+"__performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"recaptcha":n[t]={settingControlId:i+"__recaptcha",module_type:e,controlLabel:sektionsLocalizedData.i18n["Protect your contact forms with Google reCAPTCHA"],icon:'<i class="material-icons sek-level-option-icon">security</i>'};break;case"global_revisions":n[t]={settingControlId:i+"__global_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of global sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"global_reset":n[t]={settingControlId:i+"__global_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections displayed in global locations"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"beta_features":n[t]={settingControlId:i+"__beta_features",module_type:e,controlLabel:sektionsLocalizedData.i18n["Beta features"],icon:'<i class="material-icons sek-level-option-icon">widgets</i>'};break;default:l.errare("::generateUIforGlobalOptions => an option group could not be registered => "+e,t)}});var c=sektionsLocalizedData.globalOptionDBValues;return _do_register_=function(){_.each(n,function(n,o){if(!l.has(n.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=s.getModuleStartingValue(n.module_type),i=_.isObject(c)&&!_.isEmpty(c[o])?c[o]:{};if("no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);i=d.extend(r,i)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:i,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:s.SECTION_ID_FOR_GLOBAL_OPTIONS,priority:20,settings:{default:n.settingControlId},track:!1}).done(function(){l.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(ae,se){se.extend(CZRSeksPrototype,{updateAPISetting:function(ie){var ne=this,oe=se.Deferred();(ie=ie||{}).is_global_location="global"===ie.scope||ne.isGlobalLocation(ie);var re=ie.is_global_location?ne.getGlobalSectionsSettingId():ne.localSectionsSettingId();return ae(re,function(e){!function(){var n,t,o,i,r,a,e,s,c,l=ae(re)(),d=_.isObject(l)?se.extend(!0,{},l):ne.getDefaultSektionSettingValue(ie.is_global_location?"global":"local"),u="_not_injection_scenario_";switch(d.collection=_.isArray(d.collection)?d.collection:ne.getDefaultSektionSettingValue(ie.is_global_location?"global":"local").collection,ie.action){case"sek-add-section":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(_.isEmpty(ie.location))throw new Error("updateAPISetting => "+ie.action+" => missing location");if(!0===ie.is_nested){if(o=ne.getLevelModel(ie.in_column,d.collection),"no_match"==(c=ne.getLevelModel(ie.in_sektion,d.collection))){oe.reject("updateAPISetting => "+ie.action+" => no grand parent sektion found");break}if(!0===c.is_nested){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.push({id:ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+ne.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})}else{if("no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){ie.before_section===e.id&&(L=t),ie.after_section===e.id&&(L=t+1)}),n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(L,0,{id:ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+ne.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}break;case"sek-duplicate-section":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(_.isEmpty(ie.location))throw new Error("updateAPISetting => "+ie.action+" => missing location");var p;try{p=ne.cloneLevel(ie.id)}catch(e){ae.errare("updateAPISetting => "+ie.action,e);break}var m=ne.getLevelPositionInCollection(ie.id,d.collection);if(!0===ie.is_nested){if("no_match"==(o=ne.getLevelModel(ie.in_column,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.splice(parseInt(m+1,10),0,p)}else{if("no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(parseInt(m+1,10),0,p)}e=p.id;break;case"sek-remove-section":if(!0===ie.is_nested)"no_match"!=(o=ne.getLevelModel(ie.in_column,d.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=ie.id})):ae.errare("updateAPISetting => "+ie.action+" => no parent column matched");else{if("no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}n.collection=_.filter(n.collection,function(e){return e.id!=ie.id})}break;case"sek-move-section":var f,g,h=ne.getLevelModel(ie.to_location,d.collection);if(_.isEmpty(h)||"no_match"==h)throw new Error("updateAPISetting => "+ie.action+" => missing target location");if(ie.from_location!=ie.to_location){var k=ne.getLevelModel(ie.from_location,d.collection);if(_.isEmpty(k)||"no_match"==k)throw new Error("updateAPISetting => "+ie.action+" => missing source location");k.collection=_.isArray(k.collection)?k.collection:[],f=ne.getLevelModel(ie.id,k.collection),g=se.extend(!0,{},f),k.collection=_.filter(k.collection,function(e){return e.id!=ie.id})}h.collection=_.isArray(h.collection)?h.collection:[],r=se.extend(!0,[],h.collection),a=[],_.each(ie.newOrder,function(e){if(ie.from_location!=ie.to_location&&e==g.id)a.push(g);else{if(t=ne.getLevelModel(e,r),_.isEmpty(t)||"no_match"==t)throw new Error("updateAPISetting => "+ie.action+" => missing section candidate");a.push(t)}}),h.collection=a;break;case"sek-move-section-up-down":if(parentCandidate=ne.getLevelModel(ie.is_nested?ie.in_column:ie.location,d.collection),_.isEmpty(parentCandidate)||"no_match"==parentCandidate)throw new Error("updateAPISetting => "+ie.action+" => missing target location");parentCandidate.collection=_.isArray(parentCandidate.collection)?parentCandidate.collection:[],r=se.extend(!0,[],parentCandidate.collection),a=se.extend(!0,[],parentCandidate.collection);var y=_.findIndex(r,function(e){return e.id===ie.id});if(-1===y)throw new Error("updateAPISetting => "+ie.action+" => invalid index");var v=ie.direction||"up";if("up"!==v&&r.length===y+1)throw new Error("updateAPISetting => "+ie.action+" => bottom reached");if("up"===v&&0===y)throw new Error("updateAPISetting => "+ie.action+" => top reached");a[y]=r["up"===v?y-1:y+1],a["up"===v?y-1:y+1]=r[y],parentCandidate.collection=a;break;case"sek-add-column":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if("no_match"==(t=ne.getLevelModel(ie.in_sektion,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],ne.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}_.each(t.collection,function(e){e.width=""}),t.collection.push({id:ie.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"sek-remove-column":if("no_match"!=(t=ne.getLevelModel(ie.in_sektion,d.collection))){if(1===_.size(t.collection)){oe.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);break}t.collection=_.isArray(t.collection)?t.collection:[],t.collection=_.filter(t.collection,function(e){return e.id!=ie.id}),_.each(t.collection,function(e){e.width=""})}else ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched");break;case"sek-duplicate-column":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if("no_match"==(t=ne.getLevelModel(ie.in_sektion,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],ne.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}var b;try{b=ne.cloneLevel(ie.id)}catch(e){ae.errare("updateAPISetting => "+ie.action,e);break}var z=ne.getLevelPositionInCollection(ie.id,d.collection);e=b.id,t.collection.splice(parseInt(z+1,10),0,b),_.each(t.collection,function(e){e.width=""});break;case"sek-resize-columns":if(ie.col_number<2)break;var I=ne.getLevelModel(ie.resized_column,d.collection),w=ne.getLevelModel(ie.sister_column,d.collection);if("no_match"==I){ae.errare("updateAPISetting => "+ie.action+" => no resized column matched"),oe.reject("updateAPISetting => "+ie.action+" => no resized column matched");break}I.width=parseFloat(ie.resizedColumnWidthInPercent);var M=ne.getLevelModel(ie.in_sektion,d.collection),D=_.filter(M.collection,function(e){return e.id!=I.id&&e.id!=w.id}),S=parseFloat(I.width.toFixed(3));_.isEmpty(D)||_.each(D,function(e){currentColWidth=parseFloat(1*e.width),(!_.has(e,"width")||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(e.width=parseFloat((100/ie.col_number).toFixed(3))),S=parseFloat((S+e.width).toFixed(3))}),w.width=parseFloat((100-S).toFixed(3));break;case"sek-move-column":var C,P,x=ne.getLevelModel(ie.to_sektion,d.collection);if(_.isEmpty(x)||"no_match"==x)throw new Error("updateAPISetting => "+ie.action+" => missing target sektion");if(ie.from_sektion!=ie.to_sektion){var E=ne.getLevelModel(ie.from_sektion,d.collection);if(_.isEmpty(E)||"no_match"==E)throw new Error("updateAPISetting => "+ie.action+" => missing source column");E.collection=_.isArray(E.collection)?E.collection:[],C=ne.getLevelModel(ie.id,E.collection),P=se.extend(!0,{},C),E.collection=_.filter(E.collection,function(e){return e.id!=ie.id}),_.each(E.collection,function(e){e.width=""})}x.collection=_.isArray(x.collection)?x.collection:[],r=se.extend(!0,[],x.collection),a=[],_.each(ie.newOrder,function(e){if(ie.from_sektion!=ie.to_sektion&&e==P.id)a.push(P);else{if(o=ne.getLevelModel(e,r),_.isEmpty(o)||"no_match"==o)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");a.push(o)}}),x.collection=a,_.each(x.collection,function(e){e.width=""});break;case"sek-add-module":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(_.isEmpty(ie.module_type))throw new Error("updateAPISetting => "+ie.action+" => missing module_type");if("no_match"===(o=ne.getLevelModel(ie.in_column,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}var L=0;o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){ie.before_module===e.id&&(L=t),ie.after_module===e.id&&(L=t+1)});var R={id:ie.id,level:"module",module_type:ie.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(s=ne.getModuleStartingValue(ie.module_type))&&(R.value=s),o.collection.splice(L,0,R);break;case"sek-duplicate-module":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if("no_match"==(o=ne.getLevelModel(ie.in_column,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}var O;o.collection=_.isArray(o.collection)?o.collection:[];try{O=ne.cloneLevel(ie.id)}catch(e){ae.errare("updateAPISetting => "+ie.action,e),oe.reject("updateAPISetting => "+ie.action+" => error when cloning the level");break}var A=ne.getLevelPositionInCollection(ie.id,d.collection);e=O.id,o.collection.splice(parseInt(A+1,10),0,O);break;case"sek-remove-module":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");"no_match"!=(o=ne.getLevelModel(ie.in_column,d.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=ie.id})):ae.errare("updateAPISetting => "+ie.action+" => no parent column matched");break;case"sek-move-module":var j,T,V;if(j=ne.getLevelModel(ie.to_column,d.collection),_.isEmpty(j)||"no_match"==j)throw new Error("updateAPISetting => "+ie.action+" => missing target column");if(ie.from_column!=ie.to_column){var Z;if(Z=ne.getLevelModel(ie.from_column,d.collection),_.isEmpty(Z)||"no_match"==Z)throw new Error("updateAPISetting => "+ie.action+" => missing source column");Z.collection=_.isArray(Z.collection)?Z.collection:[],T=ne.getLevelModel(ie.id,d.collection),V=se.extend(!0,{},T),Z.collection=_.filter(Z.collection,function(e){return e.id!=ie.id})}if(j.collection=_.isArray(j.collection)?j.collection:[],r=se.extend(!0,[],j.collection),a=[],_.each(ie.newOrder,function(e){if(ie.from_column!=ie.to_column&&e==V.id)a.push(V);else{if(i=ne.getLevelModel(e,d.collection),_.isEmpty(i)||"no_match"==i)throw new Error("updateAPISetting => "+ie.action+" => missing moduleCandidate");a.push(i)}}),a.length!=_.uniq(a).length)throw new Error("updateAPISetting => "+ie.action+" => there are duplicated modules in column : "+j.id);j.collection=a;break;case"sek-set-module-value":i=ne.getLevelModel(ie.id,d.collection);var F={};if(_.each(ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(F[t]=e)}),"no_match"==i){ae.errare("updateAPISetting => "+ie.action+" => no module matched",ie),oe.reject("updateAPISetting => "+ie.action+" => error no module matched");break}if(_.isEmpty(ie.options_type)){ae.errare("updateAPISetting => "+ie.action+" => missing options_type"),oe.reject("updateAPISetting => "+ie.action+" => missing options_type");break}"__no_option_group_to_be_updated_by_children_modules__"===ie.options_type?i.value=F:(i.value=_.isEmpty(i.value)?{}:i.value,i.value[ie.options_type]=F);break;case"sek-generate-level-options-ui":var U=ne.getLevelModel(ie.id,d.collection),N={};if("no_match"===U){ae.errare("updateAPISetting => "+ie.action+" => no parent sektion matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent sektion matched");break}U.options=U.options||{},_.each(ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(N[t]=e)}),_.isEmpty(ie.options_type)&&ae.errare("updateAPISetting => "+ie.action+" => missing options_type"),U.options[ie.options_type]=N;break;case"sek-generate-local-skope-options-ui":N={};var B=se.extend(!0,{},_.isObject(d.local_options)?d.local_options:{});if(_.each(ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(N[t]=e)}),_.isEmpty(ie.options_type)||!_.isString(ie.options_type))ae.errare("updateAPISetting => "+ie.action+" => missing options_type");else{var Q={};Q[ie.options_type]=N,d.local_options=se.extend(B,Q)}break;case"sek-add-content-in-new-sektion":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(L=0,"no_match"==(n=ne.getLevelModel(ie.location,d.collection))){ae.errare("updateAPISetting => "+ie.action+" => no location matched"),oe.reject("updateAPISetting => "+ie.action+" => no location matched");break}switch(n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){ie.before_section===e.id&&(L=t),ie.after_section===e.id&&(L=t+1)}),ie.content_type){case"module":s=ne.getModuleStartingValue(ie.content_id),n.collection.splice(L,0,{id:ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+ne.guid(),level:"column",collection:[{id:ie.droppedModuleId,level:"module",module_type:ie.content_id,value:"no_starting_value"!==s?s:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":u=se.Deferred();var H=function(e){ne.preparePresetSectionForInjection(e).fail(function(e){oe.reject("updateAPISetting => error when preparePresetSectionForInjection => "+ie.action+" => "+e),u.reject(e)}).done(function(e){var t=!1;if(!_.isEmpty(ie.sektion_to_replace)){var i=ne.getLevelModel(ie.sektion_to_replace,d.collection);"no_match"===i&&(ae.errare("updateAPISetting => "+ie.action+" => no sektionToReplace matched"),oe.reject("updateAPISetting => "+ie.action+" => no sektionToReplace matched")),t=!0===i.is_nested}t?("no_match"===(o=ne.getLevelModel(ie.in_column,d.collection))&&(ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched")),o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){ie.before_section===e.id&&(L=t),ie.after_section===e.id&&(L=t+1)}),o.collection.splice(L,0,{id:ie.id,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):n.collection.splice(L,0,{id:ie.id,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion}),u.resolve()})};ne.getPresetSectionCollection({is_user_section:ie.is_user_section,presetSectionId:ie.content_id,section_id:ie.id}).fail(function(e){ae.errare("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()",e),oe.reject("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(ae.errare("updateAPISetting => "+ie.action+" => preset section type not found or empty : "+ie.content_id,e),oe.reject("updateAPISetting => "+ie.action+" => preset section type not found or empty")),H(e)})}break;case"sek-add-preset-section-in-new-nested-sektion":if(_.isEmpty(ie.id))throw new Error("updateAPISetting => "+ie.action+" => missing id");if(o=ne.getLevelModel(ie.in_column,d.collection),"no_match"==(c=ne.getLevelModel(ie.in_sektion,d.collection))){oe.reject("updateAPISetting => "+ie.action+" => no grand parent sektion found");break}if(!0===c.is_nested){oe.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){ae.errare("updateAPISetting => "+ie.action+" => no parent column matched"),oe.reject("updateAPISetting => "+ie.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],u=se.Deferred(),H=function(e){ne.preparePresetSectionForInjection(e).fail(function(e){oe.reject("updateAPISetting => error when preparePresetSectionForInjection => "+ie.action+" => "+e),u.reject(e)}).done(function(e){o.collection.push({id:ie.id,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion}),u.resolve()})},ne.getPresetSectionCollection({is_user_section:ie.is_user_section,presetSectionId:ie.content_id,section_id:ie.id}).fail(function(){ae.errare("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()",_er_),oe.reject("updateAPISetting => "+ie.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(ae.errare("updateAPISetting => "+ie.action+" => preset section type not found or empty : "+ie.content_id,e),oe.reject("updateAPISetting => "+ie.action+" => preset section type not found or empty")),H(e)});break;case"sek-update-fonts":var G=ne.sniffGFonts({is_global_location:ie&&!0===ie.is_global_location});if(!_.isEmpty(ie.font_family)&&_.isString(ie.font_family)&&!_.contains(G,ie.font_family)){if(ie.font_family.indexOf("gfont")<0){ae.errare("updateAPISetting => "+ie.action+" => error => must be a google font, prefixed gfont"),oe.reject("updateAPISetting => "+ie.action+" => error => must be a google font, prefixed gfont");break}G.push(ie.font_family)}d.fonts=G;break;case"sek-restore-revision":d=ie.revision_value;break;case"sek-import-from-file":if(ae.infoLog("sek-import-from-file",ie),_.isUndefined(ie.imported_content.data)||_.isUndefined(ie.imported_content.metas)){ae.errare("updateAPISetting::sek-import-from-file => invalid imported content",imported_content);break}var W=_.isArray(ie.imported_content.data.collection)?se.extend(!0,[],ie.imported_content.data.collection):[];if(!0===ie.assign_missing_locations){var $=ie.imported_content.metas.active_locations,q=ae.czr_sektions.activeLocations(),Y=_.first(q);if(!_.isEmpty(Y)&&!_.isEmpty($)&&_.isArray($)){var J=se($).not(q).get(),K=ne.getLevelModel(Y,d.collection),X=ne.getLevelModel(Y,ie.imported_content.data.collection),ee=[];K.collection=_.isArray(K.collection)?K.collection:[],X.collection=_.isArray(X.collection)?X.collection:[],_.each($,function(e){var t=ne.getLevelModel(e,W);_.isEmpty(t.collection)||(ee=_.union(ee,t.collection))}),X.collection=ee,ie.imported_content.data.collection=_.filter(ie.imported_content.data.collection,function(e){return!_.contains(J,e.id)})}}!0===ie.keep_existing_sections&&(_.each(W,function(e){var t=ne.getLevelModel(e.id,d.collection);if(!_.isEmpty(t.collection)){var i=ne.getLevelModel(e.id,ie.imported_content.data.collection);i.collection=_.union(t.collection,i.collection)}}),d.fonts&&!_.isEmpty(d.fonts)&&_.isArray(d.fonts)&&(ie.imported_content.data.fonts=_.isArray(ie.imported_content.data.fonts)?ie.imported_content.data.fonts:[],ie.imported_content.data.fonts=_.uniq(_.union(d.fonts,ie.imported_content.data.fonts)))),d=ie.imported_content.data;break;case"sek-reset-collection":try{d=ae.czr_sektions.resetCollectionSetting(ie.scope)}catch(e){ae.errare("sek-reset-collection => error when firing resetCollectionSetting()",e)}}if("pending"==oe.state()){var te=function(){_.isEqual(l,d)?oe.reject("updateAPISetting => the new setting value is unchanged when firing action : "+ie.action):null!==ne.validateSettingValue(d,ie.is_global_location?"global":"local")?(ae(re)(d,ie),ie.cloneId=e,oe.resolve(ie)):oe.reject("Validation problem for action "+ie.action)};"_not_injection_scenario_"===u?(te(),"pending"===oe.state()&&ae.errare("::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.")):u.done(function(){te(),"pending"===oe.state()&&ae.errare("::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.")}).fail(function(e){ae.errare("updateAPISetting => __presetSectionInjected__ failed",e)})}}()}),oe.promise()},_maybeFetchSectionsFromServer:function(t){var e,i=se.Deferred();return!0===(t=t||{is_user_section:!1}).is_user_section?_.isEmpty(ae.sek_userSavedSections)||_.isEmpty(ae.sek_userSavedSections[t.preset_section_id])?(ae.sek_userSavedSections=ae.sek_userSavedSections||{},_.isUndefined(ae.sek_fetchingUserSavedSections)||"pending"!=ae.sek_fetchingUserSavedSections.state()?(e=wp.ajax.post("sek_get_user_saved_sections",{nonce:ae.settings.nonce.save,preset_section_id:t.preset_section_id}),ae.sek_fetchingUserSavedSections=e):e=ae.sek_fetchingUserSavedSections,e.done(function(e){ae.sek_userSavedSections[t.preset_section_id]=e,i.resolve(ae.sek_userSavedSections)}).fail(function(e){i.reject(e)})):i.resolve(ae.sek_userSavedSections):_.isEmpty(ae.sek_presetSections)?(_.isUndefined(ae.sek_fetchingPresetSections)||"pending"!=ae.sek_fetchingPresetSections.state()?(e=wp.ajax.post("sek_get_preset_sections",{nonce:ae.settings.nonce.save}),ae.sek_fetchingPresetSections=e):e=ae.sek_fetchingPresetSections,e.done(function(e){ae.sek_presetSections=e,i.resolve(ae.sek_presetSections)}).fail(function(e){i.reject(e)})):i.resolve(ae.sek_presetSections),i.promise()},getPresetSectionCollection:function(r){var a=this,s=se.Deferred();return a._maybeFetchSectionsFromServer({is_user_section:r.is_user_section,preset_section_id:r.presetSectionId}).fail(function(e){s.reject(e)}).done(function(e){var t=se.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[r.presetSectionId]))throw new Error('getPresetSectionCollection => the preset section : "'+r.presetSectionId+'" has not been found in the collection');var i=t[r.presetSectionId],n=function(e){return _.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+a.guid(),_.isArray(e.collection)&&n(e.collection)}),e},o=function(e){return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&o(e.collection)}),e};i.id=r.section_id,i.collection=n(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=o(i.collection),s.resolve(i)}),s.promise()},preparePresetSectionForInjection:function(o){var i=this,n={},r=se.Deferred(),a=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?a(e):_.isString(e)&&-1!=e.indexOf("__img_url__")&&(_.has(n,e)||(n[e]=i.importAttachment(e.replace("__img_url__",""))))}),n},s=function(i,n){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?s(e,n):_.isString(e)&&-1!=e.indexOf("__img_url__")&&_.has(n,e)&&_.isObject(n[e])&&(i[t]=n[e].id)}),o};return i.whenAllPromisesInParallel(a(o)).done(function(e){var t=s(o,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,o){o.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=o.extend(!0,[],i.registered()||[]);n.trigger("sek-before-clean-registered"),e=_.filter(e,function(e){if("setting"!==e.what&&n[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(n[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),o.when(n[e.what](e.id).container.remove()).done(function(){n[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLocalOptionSettings:function(){var t=this.getLocalSkopeOptionId(),e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return e.id&&-1!==e.id.indexOf(t)&&n.has(e.id)&&n.remove(e.id),e.id&&-1===e.id.indexOf(t)}),this.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return!_.isEmpty(e.level)&&"setting"===e.what&&n.has(e.id)&&n.remove(e.id),_.isEmpty(e.level)&&"setting"===e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{rootPanelFocus:function(){l.section.has(l.czr_activeSectionId())?l.section(l.czr_activeSectionId()).expanded(!1):l.section.each(function(e){e.expanded(!1)}),l.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getGlobalSectionsSettingId:function(){return sektionsLocalizedData.settingIdForGlobalSections},getLevelModel:function(i,n){var a=this,s="no_match",c=function(t,e,i,n){if(_.isUndefined(e)){var o=l(i)(),r=_.isObject(o)?d.extend(!0,{},o):d.extend(!0,{},a.getDefaultSektionSettingValue(n));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==s&&(t===e.id?s=e:_.isArray(e.collection)&&c(t,e.collection,i,n))}),s};return _.isEmpty(n)?_.each({local:a.localSectionsSettingId(),global:a.getGlobalSectionsSettingId()},function(e,t){"no_match"===s&&c(i,n,e,t)}):c(i,n),s},isGlobalLocation:function(e){var t=!1;return e=e||{},_.has(e,"is_global_location")?t=e.is_global_location:_.has(e,"scope")?t="global"===e.scope:_.isEmpty(e.location)?_.isEmpty(e.in_sektion)?_.isEmpty(e.id)||(t=this.isChildOfAGlobalLocation(e.id)):t=this.isChildOfAGlobalLocation(e.in_sektion):t=this.isChildOfAGlobalLocation(e.location),t},isChildOfAGlobalLocation:function(e){var r=this,a=function(t,e){var i="no_match";if(_.isUndefined(e)){var n=l(r.getGlobalSectionsSettingId())(),o=_.isObject(n)?d.extend(!0,{},n):r.getDefaultSektionSettingValue("global");e=_.isArray(o.collection)?o.collection:[]}return _.each(e,function(e){"no_match"==i&&(t===e.id?i=e:_.isArray(e.collection)&&(i=a(t,e.collection)))}),i};return"no_match"!==a(e)},getLevelPositionInCollection:function(i,n){var a=this,s="no_match",c=function(i,e,n,o){if(_.isUndefined(e)){var t=l(n)(),r=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},a.getDefaultSektionSettingValue(o));e=_.isArray(r.collection)?r.collection:[]}_.each(e,function(e,t){"no_match"==s&&(i===e.id?s=t:_.isArray(e.collection)&&c(i,e.collection,n,o))})};return _.isEmpty(n)?_.each({local:a.localSectionsSettingId(),global:a.getGlobalSectionsSettingId()},function(e,t){"no_match"===s&&c(i,e,t,n)}):c(i,n),s},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))l.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];l.errare("getLevelProperty => invalid model for id : "+e.id,t)}else l.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var n=d.extend(!0,{},i),o=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),o(e)})}return e};return o(n)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(!sektionsLocalizedData.registeredModules[e].is_father){var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i}l.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically")},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},sniffGFonts:function(e){var o=this,r=[],a=function(i,n,e){if(_.isUndefined(e)){var t=l(i)();e=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},o.getDefaultSektionSettingValue(n))}_.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===o.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(r,e)&&r.push(e),(_.isArray(e)||_.isObject(e))&&a(i,n,e)})};return(e=e||{is_global_location:!1}).is_global_location?a(o.getGlobalSectionsSettingId(),"global"):a(o.localSectionsSettingId(),"local"),r},getInputDefaultValue:function(i,n,e){var o=this;if(o.cachedDefaultInputValues=o.cachedDefaultInputValues||{},o.cachedDefaultInputValues[n]=o.cachedDefaultInputValues[n]||{},_.has(o.cachedDefaultInputValues[n],i))return o.cachedDefaultInputValues[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputDefaultValue => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputDefaultValue(i,n,e)),"no_default_value_specified"!==r&&(o.cachedDefaultInputValues[n][i]=r))}),r}l.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,n,e){var o=this;if(o.cachedInputTypes=o.cachedInputTypes||{},o.cachedInputTypes[n]=o.cachedInputTypes[n]||{},_.has(o.cachedInputTypes[n],i))return o.cachedInputTypes[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputType => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputType(i,n,e)),"no_input_type_specified"!==r&&(o.cachedInputTypes[n][i]=r))}),r}l.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,n,e){var o=this;if(o.cachedInputRegistrationParams=o.cachedInputRegistrationParams||{},o.cachedInputRegistrationParams[n]=o.cachedInputRegistrationParams[n]||{},_.has(o.cachedInputRegistrationParams[n],i))return o.cachedInputRegistrationParams[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputRegistrationParams => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputRegistrationParams(i,n,e)),_.isEmpty(r)||(o.cachedInputRegistrationParams[n][i]=r))}),r}l.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var n=this;if(n.cachedFontFamilyModifier=n.cachedFontFamilyModifier||{},_.has(n.cachedFontFamilyModifier,i))return n.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var o="not_set";return _.each(e,function(e,t){"not_set"===o&&(i!==t||_.isUndefined(e.input_type)||(o=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===o&&(_.isArray(e)||_.isObject(e))&&(o=n.inputIsAFontFamilyModifier(i,e)),"not_set"!==o&&(n.cachedFontFamilyModifier[i]=o))}),o}l.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){if(!sektionsLocalizedData.registeredModules)return l.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return l.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t=sektionsLocalizedData.registeredModules[e].starting_value;return _.isEmpty(t)?"no_starting_value":t},selectNextTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=0;if(1===i.length){var o=t.index(i);o+1<t.length&&(n=o+1)}t.eq(n).focus()},selectPrevTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=t.length-1;if(1===i.length){var o=t.index(i);0<o&&(n=o-1)}t.eq(n).focus()},setupSelectInput:function(e){var n=this,t=(n.input_parent,n.module,l.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type)),i={params:e=_.isEmpty(e)?t.choices:e};if(n.module.trigger("nimble-set-select-input-options",i),e=i.params,!_.isEmpty(e)&&_.isObject(e))switch(n.type){case"simpleselect":_.each(e,function(e,t){var i={value:t,html:e};t==n()?d.extend(i,{selected:"selected"}):"px"===t&&d.extend(i,{selected:"selected"}),d("select[data-czrtype]",n.container).append(d("<option>",i))}),d("select[data-czrtype]",n.container).selecter();break;case"multiselect":var o=n();o=_.isString(o)?[o]:o,o=_.isArray(o)?o:[],_.each(e,function(e,t){var i={value:t,html:e};_.contains(o,t)&&d.extend(i,{selected:"selected"}),d("select[data-czrtype]",n.container).append(d("<option>",i))}),d("select[data-czrtype]",n.container).czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),d("select[data-czrtype]",n.container).on("change",function(){0===d(this).find("option:selected").length&&n([])});break;default:l.errare("::setupSelectInput => invalid input type => "+n.type)}else l.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+n.id+" in module "+n.module.module_type)},setupFontSizeAndLineHeightInputs:function(e){var t=this,i=d(".sek-font-size-line-height-wrapper",t.container),n=i.find("input[data-czrtype]").data("sek-unit"),o=function(e){return _.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new l.Value(_.isEmpty(n)?"px":o(n)),t.css_unit.bind(function(e){e=_.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("change")}),i.find('input[type="number"]').on("input change",function(e){t(d(this).val()+o(t.css_unit()))}).stepper(),i.on("click","[data-sek-unit]",function(e){e.preventDefault(),i.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",d(this).data("sek-unit")),t.css_unit(d(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0)},maybeSetupDeviceSwitcherForInput:function(){var i=this,e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");i.container.find(".customize-control-title").prepend(e),i.previewedDevice=new l.Value(l.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),i.container.find("[data-sek-device]").removeClass("active"),d(this).addClass("active");var t="desktop";try{t=d(this).data("sek-device")}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{l.previewedDevice(t)}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}i.previewedDevice(t)},i.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=i.container.find('[data-sek-device="'+l.previewedDevice()+'"]');0<t.length&&t.trigger("click")},scheduleModuleAccordion:function(e){e=e||{expand_first_control:!0};var i=this;if(d(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=d(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){d(this).attr("data-sek-accordion")||(d(this).attr("data-sek-expanded","false"),d(this).find(".czr-items-wrapper").stop(!0,!0).slideUp(0))}),t.find(".czr-items-wrapper").stop(!0,!0).slideToggle({duration:0,start:function(){t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),t.trigger("true"==t.attr("data-sek-expanded")?"sek-accordion-expanded":"sek-accordion-collapsed")}}))}),e.expand_first_control){var t=_.first(i.controls());_.isObject(t)&&!_.isEmpty(t.id)&&l.control(t.id,function(e){e.container.trigger("sek-accordion-expanded"),i.container.find(".customize-control").first().find("label > .customize-control-title").trigger("click")})}},isPromise:function(e){return e&&"function"==typeof e.then&&String(d.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=d.Deferred(),n=[],o=_.keys(e);return _.each(e,function(e,t){n.push(d.Deferred(function(t){(i.isPromise(e)?e:d.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),d.when.apply(this,n).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[o[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,n,o){i=i||0,n=n||{},o=o||d.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:d.Deferred(function(e){e.resolve()})).always(function(e){n[i]=e,i+1==t.length?o.resolve(n):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,n,o)})}return o},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{img_url:t,nonce:l.settings.nonce.save}).fail(function(e){l.errare("sek_import_attachment ajax action failed for image "+t,e)})},cleanIds:function(e){e.id="";var t=this;return _.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&t.cleanIds(e)}),e},getDefaultSektionSettingValue:function(e){return!_.isUndefined(e)&&_.contains(["local","global"],e)||l.errare("getDefaultSektionSettingValue => the skope should be set to local or global"),"global"===e?sektionsLocalizedData.defaultGlobalSektionSettingValue:sektionsLocalizedData.defaultLocalSektionSettingValue},scheduleVisibilityOfInputId:function(t,i){var n=this.input_parent;if(!_.isFunction(i)||_.isEmpty(t))throw new Error("::scheduleVisibilityOfInputId => error when firing for input id : "+this.id);n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,m){m.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){!0!="draggable"in document.createElement("span")&&s.panel(sektionsLocalizedData.sektionsPanelId,function(e){s.notifications.add(new s.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){s.notifications.remove("drag-drop-support")},1e4)}),t.setupNimbleDragZones(e.input_container)}),s.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){s.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var n=this,o=function(){s.notifications.add(new s.Notification("missing-injection-target",{type:"info",message:sektionsLocalizedData.i18n["You first need to click on a target ( with a + icon ) in the preview."],dismissible:!0})),_.delay(function(){s.notifications.remove("missing-injection-target")},3e4)};e.find('[draggable="true"]').each(function(){m(this).on("dragstart",function(e){(function(e){n.lastClickedTargetInPreview({}),e.originalEvent.dataTransfer.setData("sek-content-type",m(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-content-id",m(this).data("sek-content-id")),e.originalEvent.dataTransfer.setData("sek-section-type",m(this).data("sek-section-type")),e.originalEvent.dataTransfer.setData("sek-is-user-section",m(this).data("sek-is-user-section")),n.dndData={content_type:e.originalEvent.dataTransfer.getData("sek-content-type"),content_id:e.originalEvent.dataTransfer.getData("sek-content-id"),section_type:e.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===e.originalEvent.dataTransfer.getData("sek-is-user-section")};try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){s.panel(sektionsLocalizedData.sektionsPanelId,function(e){s.notifications.add(new s.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){s.notifications.remove("drag-drop-support")},1e4)})}m(this).addClass("sek-dragged"),m("body").addClass("sek-dragging"),s.previewer.send("sek-drag-start",{type:n.dndData.content_type})}).call(m(this),e)}).on("dragend",function(e){(function(e){m("body").removeClass("sek-dragging"),m(this).removeClass("sek-dragged"),s.previewer.send("sek-drag-stop")}).call(m(this),e)}).dblclick(function(e){(function(e){var t,i=n.lastClickedTargetInPreview();!_.isEmpty(i)&&i.id?t=n.dnd_getDropZonesElements().find('[data-sek-id="'+i.id+'"]').find(".sek-module-drop-zone-for-first-module").first():o(),t&&0<t.length?(s.czr_sektions.trigger("sek-content-dropped",{drop_target_element:t,location:t.closest('[data-sek-level="location"]').data("sek-id"),before_module:t.data("drop-zone-before-module-or-nested-section"),after_module:t.data("drop-zone-after-module-or-nested-section"),before_section:t.data("drop-zone-before-section"),after_section:t.data("drop-zone-after-section"),content_type:m(this).data("sek-content-type"),content_id:m(this).data("sek-content-id"),section_type:m(this).data("sek-section-type"),is_user_section:"true"===m(this).data("sek-is-user-section")}),n.lastClickedTargetInPreview({})):(o(),s.errare("Double click insertion => the target zone was not found"))}).call(m(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=m("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=m(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.stopPropagation(),t.dnd_OnEnterOver(m(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(m(this),e)||t.dnd_cleanOnLeaveDrop(m(this),e);break;case"drop":if(this.$cachedDropZoneCandidates=null,!t.dnd_canDrop({targetEl:m(this),evt:e}))return;e.preventDefault(),t.dnd_onDrop(m(this),e),t.dnd_cleanOnLeaveDrop(m(this),e),s.previewer.send("sek-drag-stop")}}).data("zone-droppable-setup",!0))})},dnd_isInTarget:function(e,t){var i=t.clientY,n=t.clientX,o=e[0].getBoundingClientRect(),r=n<=o.right&&o.left<=n;return i>=o.top&&o.bottom>=i&&r},dnd_toggleDragApproachClassesToDropZones:function(u){var p=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.distanceTable=[],this.$dropZones.find(".sek-drop-zone").each(function(){var e,t,i=u.clientY,n=u.clientX,o=m(this)[0].getBoundingClientRect(),r=Math.abs(i-(o.bottom-(o.bottom-o.top)/2)),a=(Math.abs(o.top-i),Math.abs(n-(o.right-(o.right-o.left)/2))),s=(o.right,o.left,r<50),c=a<50,l=n<=o.right&&o.left<=n,d=i>=o.top&&o.bottom>=i;p.distanceTable.push({el:m(this),dist:d&&l?0:(e=a,t=r,Math.sqrt(e*e+t*t))}),m(this).removeClass("sek-drag-is-in"),(s||d)&&(c||l)?(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).addClass("sek-drag-is-very-close")):(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).removeClass("sek-drag-is-very-close")),m(this).removeClass("sek-drag-is-in")});var t=_.min(_.pluck(p.distanceTable,"dist"));p.$dropTargetCandidate=null,_.each(p.distanceTable,function(e){_.isNull(p.$dropTargetCandidate)&&t===e.dist&&(p.$dropTargetCandidate=e.el)}),p.$dropTargetCandidate&&0<p.$dropTargetCandidate.length&&p.dnd_isInTarget(p.$dropTargetCandidate,u)&&p.$dropTargetCandidate.addClass("sek-drag-is-in"),p.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,n=m(e.currentTarget);switch(this.dndData.content_type){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<n.length&&("between-sections"!==n.data("sek-location")&&"in-empty-location"!==n.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:s.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return m(s.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=this,i=(e=_.extend({targetEl:{},evt:{}},e||{})).targetEl;if(!_.isObject(i)||i.length<1)return!1;var n=i.hasClass("sek-content-preset_section-drop-zone"),o=i.hasClass("sek-module-drop-zone-for-first-module"),r=!0===i.closest('[data-sek-level="location"]').data("sek-is-header-location"),a=!0===i.closest('[data-sek-level="location"]').data("sek-is-footer-location"),s="preset_section"===t.dndData.content_type&&"content"===t.dndData.section_type,c=function(e){m(".sek-no-drop-possible-message",i).length<1&&i.append(['<div class="sek-no-drop-possible-message">','<i class="material-icons">not_interested</i>',e,"</div>"].join(""))};return(r||a)&&s?(c(r?sektionsLocalizedData.i18n["The header location only accepts modules and pre-built header sections"]:sektionsLocalizedData.i18n["The footer location only accepts modules and pre-built footer sections"]),!1):a&&"preset_section"===t.dndData.content_type&&"header"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a header section in the footer location"]),!1):r&&"preset_section"===t.dndData.content_type&&"footer"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a footer section in the header location"]),!1):i.hasClass("sek-drop-zone")&&("preset_section"===t.dndData.content_type&&n||"module"===t.dndData.content_type&&!n||"preset_section"===t.dndData.content_type&&o)},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){s.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),m(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(m(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"),e.find(".sek-no-drop-possible-message").remove())},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),n=i.height;return"before"===e.data("preDrop-position")?n+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(n-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-n/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,n=e.data("preDrop-position"),o=this.dnd_getPosition(e,t);if(n!==o&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");m.when(i.preDropElement.remove()).done(function(){e["before"===o?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",o),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),n=t.clientX,o=t.clientY,r=i.left,a=i.right,s=i.top,c=i.bottom;return r<=n&&n-r<=a-r&&(s<=o&&o-s<=c-s)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();s.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module:e.data("drop-zone-before-module-or-nested-section"),after_module:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id"),section_type:t.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===t.originalEvent.dataTransfer.getData("sek-is-user-section")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t=e.drop_target_element,i="content-in-column";switch(t.data("sek-location")){case"between-sections":i="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,i="content-in-empty-location";break;case"between-columns":i="content-in-new-column"}if("preset_section"===e.content_type)if(t.hasClass("sek-module-drop-zone-for-first-module")){var n=t.closest('div[data-sek-level="section"]');1<n.find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(i="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=n.data("sek-id")):(e.sektion_to_replace=n.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=n.closest('[data-sek-level="column"]').data("sek-id"),i="content-in-a-section-to-replace")}else"between-sections"===t.data("sek-location")&&(i="content-in-a-section-to-create");switch(i){case"content-in-column":var o=t.closest("div[data-sek-level]");if(o.length<1)throw new Error("No valid level dom element found");var r=o.data("sek-level"),a=o.data("sek-id");if(_.isEmpty(r)||_.isEmpty(a))throw new Error("No valid level id found");s.previewer.trigger("sek-add-module",{level:r,id:a,in_column:t.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:t.closest('div[data-sek-level="section"]').data("sek-id"),before_module:e.before_module,after_module:e.after_module,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":s.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":s.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"content-in-empty-location":s.previewer.trigger("sek-add-content-in-new-sektion",e);break;default:s.errare("sek control panel => ::reactToDrop => invalid drop case : "+i)}}(e)}catch(e){s.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var n=this;l.sekEditorExpanded=new l.Value(!1),n.editorEventsListenerSetup=!1,n.$editorPane=d("#czr-customize-content_editor-pane"),n.$editorDragbar=d("#czr-customize-content_editor-dragbar"),n.$preview=d("#customize-preview"),n.$collapseSidebar=d(".collapse-sidebar"),n.attachResizeEventsToEditor();d("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=d(this).data("czr-control-id"),t=d(this).data("czr-input-id");_.isEmpty(e)||_.isEmpty(t)?l.errare("toggle-tinymce-editor => missing input or control id"):l.sekEditorExpanded(!0)}),l.sekEditorExpanded.bind(function(e,t,i){!function(){l.sekTinyMceEditor=tinyMCE.get(sektionsLocalizedData.idOfDetachedTinyMceTextArea);var e=function(){!1===n.editorEventsListenerSetup&&(n.editorEventsListenerSetup=!0,n.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};l.sekTinyMceEditor&&(l.sekTinyMceEditor.initialized?e():l.sekTinyMceEditor.on("init",function(){e()}))}(),e&&l.sekTinyMceEditor&&l.sekTinyMceEditor.focus(),d(document.body).toggleClass("czr-customize-content_editor-pane-open",e),d(window)[e?"on":"off"]("resize",function(){l.sekEditorExpanded()&&_.delay(function(){n.czrResizeEditor(window.innerHeight-n.$editorPane.height())},50)}),e?(n.czrResizeEditor(window.innerHeight-n.$editorPane.height()),_.delay(function(){d(window).trigger("resize")},100)):(n.$preview.css("bottom",""),n.$collapseSidebar.css("bottom",""))}),d("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){l.sekEditorExpanded(!1)}),d("#customize-controls").on("click",function(e){"open-tinymce-editor"!=d(e.target).data("czr-action")&&l.sekEditorExpanded(!1,{context:"clicked anywhere"})}),d(document).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50)),n.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=d(l.sekTinyMceEditor.iframeElement).contents().get(0);d(e).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?l.previewer.bind(e,function(){l.sekEditorExpanded(!1)}):l.previewer.bind(e,function(e){l.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachResizeEventsToEditor:function(){var t=this;d("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===d(e.target).attr("id")||d(e.target).hasClass("czr-resize-handle"))&&l.sekEditorExpanded())switch(e.type){case"mousedown":d(document).on("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea,function(e){e.preventDefault(),d(document.body).addClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":d(document).off("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea),d(document.body).removeClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,n=window.innerHeight,o=(window.innerWidth,{}),r=d("#czr-customize-content_editor_ifr"),a=d("#wp-czr-customize-content_editor-tools"),s=i.$editorPane.find(".mce-toolbar-grp"),c=i.$editorPane.find(".mce-statusbar");l.sekEditorExpanded()&&(_.isNaN(e)||(t=n-e),o.height=t,o.components=a.outerHeight()+s.outerHeight()+c.outerHeight(),t<40&&(o.height=40),n-1<t&&(o.height=n-1),n<i.$editorPane.outerHeight()&&(o.height=n),i.$preview.css("bottom",o.height),i.$editorPane.css("height",o.height),r.css("height",o.height-o.components))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var n=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),n.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(n.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var n=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),n(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var o=this,i=d(".sek-spacing-wrapper",o.container),t=l.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),n=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(o())?o():{}),n=d(this).val();u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?i[t]=n:i=u.omit(i,t),o(i)}),m.call(o,i,n),u.isObject(o())){u.each(o(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",o.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o())||u.isEmpty(o().unit)||e===o().unit&&(r=e)}),d(".sek-unit-wrapper",o.container).find('[data-sek-unit="'+p.call(o,r)+'"]').trigger("click")}var a=o();o.initial_unit="px",u.isEmpty(a)||(o.initial_unit=u.isEmpty(a.unit)?"px":a.unit),o.css_unit=new l.Value(p.call(o,o.initial_unit)),o.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(o())?o():{})).unit=e,o(t)}),_.call(o,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,a=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),s=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var n=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&n<i.length?c(e,i[n+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},s);t=u.isObject(t)?d.extend(i,t):i;var n=c(t,e);d("[data-sek-spacing]",a).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(n)||u.isEmpty(n[e])||(t=n[e]),d(this).find('input[type="number"]').val(t)});var o="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n)||u.isEmpty(n.unit)||e===n.unit&&(o=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,o)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var n=r();r.initial_unit="px",u.isEmpty(n)||u.isEmpty(n[r.previewedDevice()])||(r.initial_unit=u.isEmpty(n[r.previewedDevice()].unit)?"px":n[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),a.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),n=d(this).val(),o=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},t[o]||{}),u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?t[o][i]=n:t[o]=u.omit(t[o],i),r(t)}),m.call(r,a,s),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var n,o=r.previewedDevice()||"desktop";(n=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},n[o]||{}),n[o].unit=e,r(n)}}),_.call(r,a);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(n,s,c){n.czrInputMap=n.czrInputMap||{},s.extend(n.czrInputMap,{bg_position:function(e){var t=this;s(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(s(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var o=this,t=n.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;n.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var a=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var n=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&n<i.length?a(e,i[n+1]):{}},i=function(e){var t=s.extend(!0,{},c.isObject(o())?o():{}),i=s.extend(!0,{},r);t=c.isObject(t)?s.extend(i,t):i;var n=a(t,e);o.container.find('input[value="'+n+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};s(".sek-bg-pos-wrapper",o.container).on("change",'input[type="radio"]',function(e){var t,i=s(this).val();(t=s.extend(!0,{},c.isObject(o())?o():{}))[n.previewedDevice()||"desktop"]=i,o(t)}),o.previewedDevice.bind(function(e){try{i(e)}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+o.id,e)}});try{i(n.previewedDevice())}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+o.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var o=this,t=c.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===o.type?".sek-v-align-wrapper":".sek-h-align-wrapper",a=l(i,o.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var s=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?s(e,i[n+1]):{}},n=function(e){var t=l.extend(!0,{},d.isObject(o())?o():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var n=s(t,e);a.find(".selected").removeClass("selected"),a.find('div[data-sek-align="'+n+'"]').addClass("selected")};a.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(o())?o():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),a.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){o(t)})}),o.previewedDevice.bind(function(e){try{n(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}});try{n(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{font_size:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{line_height:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(i,c,l){i.czrInputMap=i.czrInputMap||{},c.extend(i.czrInputMap,{font_picker:function(e){var s=this,o=s.input_parent,n=function(e,t){o();var n=c('select[data-czrtype="'+s.id+'"]',s.container);l.isNull(s())||l.isEmpty(s())?n.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):n.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"),l.each([{title:sektionsLocalizedData.i18n["Web Safe Fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google Fonts"],type:"gfont",list:t.gfonts}],function(e){var t,r,a,i=c("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,a="",l.each(t,function(e){var t,i,n=e.name,o=l.isString(n)?n.replace(/[+|:]/g," "):n;t=n,i=r,(n=l.isString(t)?["[",i,"]",t].join(""):"")==s()?a+='<option selected="selected" value="'+n+'">'+o+"</option>":a+='<option value="'+n+'">'+o+"</option>"}),a)});n.append(i)});var i={escapeMarkup:function(e){return e}};e&&c.extend(i,{resultsAdapter:e,closeOnSelect:!1}),n.czrSelect2(i),c(".czrSelect2-selection__rendered",s.container).css(r(s()))},r=function(e){if(!l.isString(e)||l.isEmpty(e))return{};var t,i,n,o=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=a(e),i=o[1]?o[1].replace(/[^0-9.]+/g,""):400,i=l.isNumber(i)?i:400,n=o[1]&&-1!=o[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":n||"normal"}},a=function(e){if(!l.isString(e)||l.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return l.isString(t[0])?t[0].replace(/[+|:]/g," "):""};c.when(function(){var e,t=c.Deferred();l.isEmpty(i.sek_fontCollections)?(l.isUndefined(i.sek_fetchingFontCollection)||"pending"!=i.sek_fetchingFontCollection.state()?(e=i.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:s.module.id}),i.sek_fetchingFontCollection=e):e=i.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");i.sek_fontCollections=JSON.parse(e),t.resolve(i.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(i.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=c.Deferred(),void 0!==c.fn.czrSelect2&&void 0!==c.fn.czrSelect2.amd&&"function"==typeof c.fn.czrSelect2.amd.require?c.fn.czrSelect2.amd.require(["czrSelect2/results","czrSelect2/utils"],function(e,t){var n=function(e,t,i){n.__super__.constructor.call(this,e,t,i)};t.Extend(n,e),n.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),n.__super__.bind.call(this,e,t)},i.resolve(n)}):i.resolve(!1),i.promise()).done(function(e){n(e,t)})}).fail(function(e){i.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(r,a,s){r.czrInputMap=r.czrInputMap||{},a.extend(r.czrInputMap,{fa_icon_picker:function(){var n=this,o=!1,e=function(t){!0!==n.iconCollectionSet&&(a.when(a.Deferred(function(t){s.isEmpty(n.sek_faIconCollection)?r.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:n.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");n.sek_faIconCollection=JSON.parse(e),t.resolve(n.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_faIconCollection)})).done(function(e){!function(e){s.each(e,function(e){var t={value:e,html:r.CZR_Helpers.capitalize(e.substring(7))};t.value==n()&&(a.extend(t,{selected:"selected"}),o=!0),a("select[data-czrtype]",n.container).append(a("<option>",t))});var t,i=function(e){return e.id?a('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=o?a("<option>"):a("<option>",{selected:"selected"}),a("select[data-czrtype]",n.container).prepend(t).czrSelect2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e),t&&!0===t.open_on_init&&s.delay(function(){try{a("select[data-czrtype]",n.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){r.errare("fa_icon_picker => fail response =>",e)}),n.iconCollectionSet=!0)};n.container.on("click",function(){e()}),s.delay(function(){e({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{code_editor:function(e){var n=this,i=this.module.control,t=(n.input_parent(),!1),r=n.container.find("textarea"),o=n.container.find(".customize-control-title"),a=r.data("editor-params");wp.codeEditor&&(p.isUndefined(a)||!1!==a)&&(t=a),n.isReady.done(function(){var e=function(e){p.isEmpty(this.editor)&&(p.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(t)try{s(t)}catch(e){d.errare("error in sek_control => code_editor() input",e),c()}else c();o.click()},10))};e.call(n),n.module.control.container.on("sek-accordion-expanded",function(){e.call(n)})});var s=function(e){var t,i=!1;t=p.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:l}),n.editor=wp.codeEditor.initialize(r,t),u(n.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":o.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),o.on("click",function(e){e.stopPropagation(),n.editor.codemirror.focus()}),n.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),n.editor.codemirror.setValue(n()),n.bind(n.id+":changed",function(e){i||n.editor.codemirror.setValue(e)}),n.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},c=function(){var o=r[0];n.editor=o,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,n;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=o.selectionStart,i=o.selectionEnd,n=o.value,0<=t&&(o.value=n.substring(0,t).concat("\t",n.substring(i)),r.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},l=function(e){var t;i.setting.notifications.remove(n.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",o.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",o.html()),i.setting.notifications.add(n.id,new d.Notification(n.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]');o.on("input",function(e){n.val(r(this).val()).trigger("input")}),n.on("input",function(e){t(r(this).val()),o.val(r(this).val())}),o.val(n.val()||0)}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{range_simple_device_switcher:function(e){var a=this,t=u(".sek-range-with-unit-picker-wrapper",a.container),s=t.find('input[type="number"]'),r=t.find('input[type="range"]'),i=d.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),c=p.isEmpty(i)||p.isEmpty(i.default)?{}:i.default,l=function(e,t){var i=["mobile","tablet","desktop"];if(p.has(e,t))return e[t];var n=p.findIndex(i,function(e){return t===e});return!p.isEmpty(t)&&n<i.length?l(e,i[n+1]):u.extend(!0,{desktop:""},c).desktop},n=function(e){var t=a(),i={};i=u.extend(!0,{},c),p.isObject(t)?i=u.extend(!0,{},t):p.isString(t)&&!p.isEmpty(t)&&(i={desktop:t});var n,o=l(i,e),r=(n=o,p.isEmpty(n)||!p.isString(n)?"16":n.replace(/px|em|%/g,""));s.val(r).trigger("input",{previewed_device_switched:!0})};d.czr_sektions.maybeSetupDeviceSwitcherForInput.call(a),r.on("input",function(e){s.val(u(this).val()).trigger("input")}),s.on("input",function(e,t){var i,n=d.previewedDevice()||"desktop",o=u(this).val();(i=u.extend(!0,{},p.isObject(a())?a():{}))[n]=u.extend(!0,{},i[n]||{}),p.isString(o)&&!p.isEmpty(o)&&(i[n]=o),(p.isEmpty(t)||p.isObject(t)&&!0!==t.previewed_device_switched)&&a(i),r.val(u(this).val())}),a.previewedDevice.bind(function(e){try{n(e)}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+a.type+" for input id "+a.id,e)}}),r.val(s.val()||0);try{n(d.previewedDevice())}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+a.type+" for input id "+a.id,e)}}})}(wp.customize,jQuery,_),function(s,c,l){s.czrInputMap=s.czrInputMap||{},c.extend(s.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),a=function(e){return l.contains(["px","em","%"],e)||(s.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new s.Value(l.isEmpty(r)?"px":a(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),o.on("input",function(e){n.val(c(this).val()).trigger("input")}),n.on("input",function(e){t(c(this).val()+a(t.css_unit())),o.val(c(this).val())}),o.val(n.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(s,_,m){s.czrInputMap=s.czrInputMap||{},_.extend(s.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),a=function(e){return m.contains(["px","em","%"],e)||(s.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=s.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var n=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&n<i.length?p(e,i[n+1]):_.extend(!0,{desktop:""},u).desktop},n=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var n,o,r=p(i,e),a=(o=r,m.isEmpty(o)||!m.isString(o)?"px":o.replace(/[0-9]|\.|,/g,"")),s=(n=r,m.isEmpty(n)||!m.isString(n)?"16":n.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+a+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+a+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(s).trigger("input",{previewed_device_switched:!0})};s.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new s.Value(m.isEmpty(i())?"px":a(i()));var o='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(o),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,n=s.previewedDevice()||"desktop",o=_(this).val()+a(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[n]=_.extend(!0,{},i[n]||{}),m.isString(o)&&!m.isEmpty(o)&&(i[n]=o),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{n(e)}catch(e){s.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=s.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),n(s.previewedDevice()))}),r.val(d.val()||0);try{n(s.previewedDevice())}catch(e){s.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(g,h,k){g.czrInputMap=g.czrInputMap||{},h.extend(g.czrInputMap,{borders:function(e){var s=this,c=h(".sek-borders",s.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return k.contains(["px","em","%"],e)||(g.errare("borders => error : invalid unit for input "+s.id,e),e="px"),e},_=function(e){return k.isEmpty(e)||!k.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return k.isEmpty(e)||!k.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=g.czr_sektions.getInputRegistrationParams(s.id,s.module.module_type),f=k.isEmpty(t)||k.isEmpty(t.default)?{}:t.default;s.cssBorderTypes=["top","left","right","bottom"];var i,n,o=function(){var e=s(),t="px";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=s(),t="#000000";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.col)&&(t=e._all_.col),t},a=function(e){if(!k.contains(k.union(s.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=s(),i={},n=h.extend(!0,{},f);k.isObject(t)?i=h.extend(!0,{},t):k.isString(t)&&(i={_all_:{wght:t}});var o,r,a=function(e,t){var i,n=h.extend(!0,{},f);if(!k.has(n,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=k.isObject(e)&&k.has(e,"_all_")?k.extend(n._all_,e._all_):n._all_,k.has(e,t)&&k.isObject(e[t])?k.extend(i,e[t]):n._all_}(i=h.extend(n,i),e);if(k.isEmpty(a)||!k.isObject(a)||k.isEmpty(a.wght)||k.isEmpty(a.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");o=m(a.wght),r=_(a.wght),h(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(a.col).trigger("change"),u.data("border_type_switched",!1)};s.borderColor=new g.Value(k.isEmpty(r())?"#000000":r()),s.css_unit=new g.Value(k.isEmpty(o())?"px":p(o())),s.borderType=new g.Value("_all_"),l.val((i=s(),n=1,k.isObject(i)&&k.has(i,"_all_")&&k.isObject(i._all_)&&!k.isEmpty(i._all_.wght)&&(n=_(i._all_.wght)),n=parseInt(n,10),(!k.isNumber(n)||n<0)&&(g.errare("Error in borders input type for module : "+s.module.module_type+" the initial border width is invalid : "+n),n=1),n)),u.val(s.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){h(this).val(t.color.toString()).trigger("colorpickerchange"),s.borderColor(t.color.toString(),{border_type_switched:!0===h(this).data("border_type_switched")})},clear:function(e,t){h(this).val("").trigger("colorpickerchange"),s.borderColor("")}}),s.css_unit.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),s.borderColor.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),s.borderType.bind(function(e){try{a(e)}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+s.module.module_type,e)}}),d.on("input",function(e){l.val(h(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=s.borderType()||"_all_",o=s.borderColor(),r=h(this).val()+p(s.css_unit()),a=h.extend(!0,{},f);(i=h.extend(!0,{},k.isObject(s())?s():a))[n]=h.extend(!0,{},i[n]||a[n]),k.isString(r)&&!k.isEmpty(r)&&(i[n].wght=r),i[n].col=o,(k.isEmpty(t)||k.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===n&&k.each(s.cssBorderTypes,function(e){i=k.omit(i,e)}),s(i)),d.val(h(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",h(this).data("sek-unit")),s.css_unit(h(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=h(this).data("sek-border-type")}catch(e){g.errare("borders input type => error when attaching click event",e)}s.borderType(i,t)}),s.container.on("click",".sek-reset-button",function(e){var t=s.borderType()||"_all_",i=h.extend(!0,{},k.isObject(s())?s():{});k.isEmpty(i[t])||(i=k.omit(i,t),s(i),a(t))}),d.val(l.val()||0);try{a(s.borderType())}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+s.module.module_type,e)}h('[data-sek-unit="'+s.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,g){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var s=this,c=f(".sek-borders",s.container),l=c.find('input[type="number"]'),a=c.find('input[type="range"]'),d=function(e){return g.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+s.id,e),e="px"),e},u=function(e){return g.isEmpty(e)||!g.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return g.isEmpty(e)||!g.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(s.id,s.module.module_type),_=g.isEmpty(t)||g.isEmpty(t.default)?{}:t.default;s.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,n,o=function(){var e=s(),t="px";return g.isObject(e)&&g.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!g.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=s(),i={},n=f.extend(!0,{},_);g.isObject(t)?i=f.extend(!0,{},t):g.isString(t)&&(i={_all_:"0px"});var o,r,a=function(e,t){var i,n=f.extend(!0,{},_);if(!g.has(n,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=g.isObject(e)&&g.has(e,"_all_")?e._all_:n._all_,g.has(e,t)?e[t]:i}(i=f.extend(n,i),e);if(g.isEmpty(a)||!g.isString(a))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");o=p(a),r=u(a),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};s.css_unit=new m.Value(g.isEmpty(o())?"px":d(o())),s.radiusType=new m.Value("_all_"),l.val((i=s(),n=0,g.isObject(i)&&g.has(i,"_all_")&&(n=u(i._all_)),n=parseInt(n,10),(!g.isNumber(n)||n<0)&&(m.errare("Error in border_radius input type for module : "+s.module.module_type+" the initial radius is invalid : "+n),n=0),n)),s.css_unit.bind(function(e,t,i){(!g.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),s.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+s.module.module_type,e)}}),a.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=s.radiusType()||"_all_",o=f(this).val()+d(s.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},g.isObject(s())?s():r))[n]=f.extend(!0,{},i[n]||r[n]),g.isString(o)&&!g.isEmpty(o)&&(i[n]=o),(g.isEmpty(t)||g.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===n&&g.each(s.cssRadiusTypes,function(e){i=g.omit(i,e)}),s(i)),a.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),s.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}s.radiusType(i,t)}),s.container.on("click",".sek-reset-button",function(e){var t=s.radiusType()||"_all_",i=f.extend(!0,{},g.isObject(s())?s():{});g.isEmpty(i[t])||(i=g.omit(i,t),s(i),r(t))}),a.val(l.val()||0);try{r(s.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+s.module.module_type,e)}f('[data-sek-unit="'+s.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,a,s){r.czrInputMap=r.czrInputMap||{},a.extend(r.czrInputMap,{buttons_choice:function(e){var n=this,o=a(".sek-button-choice-wrapper",n.container),t=o.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);s.isEmpty(i)||s.isEmpty(i.default)||i.default;t.val(n()),o.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),a(this).addClass("is-selected").attr("aria-pressed",!0);try{i=a(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}n(i)}),a('[data-sek-choice="'+n()+'"]',o).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(n,o,r){n.czrInputMap=n.czrInputMap||{},o.extend(n.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){e.stopPropagation();var i=o(this).data("sek-reset-scope");!r.isEmpty(i)&&r.contains(["local","global"],i)?n.czr_sektions.updateAPISetting({action:"sek-reset-collection",scope:i}).done(function(){n.previewer.refresh(),n.previewer.trigger("sek-notify",{notif_id:"reset-success",type:"success",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset complete"],"</strong>","</span>"].join("")})}).fail(function(e){n.errare("reset_button input => error when firing ::updateAPISetting",e),n.previewer.trigger("sek-notify",{notif_id:"reset-failed",type:"error",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset failed"],"<br/>","<i>"+e+"</i>","</strong>","</span>"].join("")})}):n.errare("reset_button input => invalid scope provided.",i)})}})}(wp.customize,jQuery,_),function(i,r,a){i.czrInputMap=i.czrInputMap||{},r.extend(i.czrInputMap,{revision_history:function(e){var o=this;_selected_found=!1;var t=function(t){!0!==o.revisionHistorySet&&(r.when(r.Deferred(function(t){a.isEmpty(o.sek_revisionHistory)?i.czr_sektions.getRevisionHistory({is_local:"local_revisions"===o.id}).done(function(e){if(!a.isObject(e))throw new Error("_getRevisionHistory => server list is not a object");o.sek_revisionHistory=e,t.resolve(o.sek_revisionHistory)}).fail(function(e){t.reject(e)}):t.resolve(o.sek_revisionHistory)})).done(function(e){!function(e){if(!(0<o.container.find(".sek-revision-history").length))if(a.isEmpty(e))o.container.append(["<i>",sektionsLocalizedData.i18n["No revision history available for the moment."],"</i>"].join(""));else{o.container.append(r("<select/>",{class:"sek-revision-history",html:['<option value="_select_">'," -",sektionsLocalizedData.i18n.Select,"- ","</option>"].join("")}));var n=[];a.each(e,function(e,t){var i={value:t,html:e};i.value==o()&&(r.extend(i,{selected:"selected"}),_selected_found=!0),n.unshift(r("<option>",i))}),n[0].html([n[0].html(),sektionsLocalizedData.i18n["(currently published version)"]].join(" ")),a.each(n,function(e){r("select.sek-revision-history",o.container).append(e)}),r("select.sek-revision-history",o.container).selecter()}}(e),t&&!0===t.open_on_init&&a.delay(function(){try{r("select[data-czrtype]",o.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){i.errare("_getRevisionHistory => fail response =>",e)}),o.revisionHistorySet=!0)};o.container.on("change",".sek-revision-history",function(){var e=r(this).val();"_select_"!==e&&i.czr_sektions.setSingleRevision({revision_post_id:e,is_local:"local_revisions"===o.id})}),a.delay(function(){t({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(p,_,m){p.czrInputMap=p.czrInputMap||{},_.extend(p.czrInputMap,{nimble_tinymce_editor:function(){var t=this,e=t.container.find("textarea").first(),i=0<e.length?e.attr("id"):null,n=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type),o=sektionsLocalizedData.defaultToolbarBtns;if(m.isNull(i))throw new Error("setupTinyMceEditor => missing textarea for module :"+t.module.id);if(tinyMCE.get(i))throw new Error("setupTinyMceEditor => duplicate editor id.");var r,a,s=function(){return n&&n.editor_params&&!0===n.editor_params.autop},c={tinymce:{toolbar1:function(){var e=o.split(",");if(n.editor_params&&m.isArray(n.editor_params.excludedBtns)){var t=n.editor_params.excludedBtns;e=m.filter(e,function(e){return!m.contains(t,e)})}if(n.editor_params&&m.isString(n.editor_params.includedBtns)){var i=n.editor_params.includedBtns;m.isEmpty(i)||!m.isArray(sektionsLocalizedData[i])?p.errare("nimble_tinymce_editor input => invalid set of buttons provided",i):(i=sektionsLocalizedData[i],e=m.filter(e,function(e){return m.contains(i,e)}))}return e.join(",")}(),content_css:(r=wp.editor.getDefaultSettings(),a=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],r&&r.tinymce&&r.tinymce.content_css&&(a=m.union(r.tinymce.content_css.split(","),a)),a.join(",")),min_height:40,height:n.editor_params&&m.isNumber(n.editor_params.height)?n.editor_params.height:p.czr_sektions.TINYMCE_EDITOR_HEIGHT},quicktags:{buttons:"strong,em,link,code"},mediaButtons:!n.editor_params||!1!==n.editor_params.media_button};c.tinymce.wpautop=s(),s()||(c.tinymce.forced_root_block=""),wp.editor.initialize(i,c);var l=tinyMCE.get(i);if(!l)throw new Error("setupTinyMceEditor => missing editor instance for module :"+t.module.id);p.czrActiveWPEditors=p.czrActiveWPEditors||[];var d=_.extend(!0,[],p.czrActiveWPEditors);d.push(i),p.czrActiveWPEditors=d;var u=function(){l.setContent(t())};l.initialized?u():l.on("init",u),l.on("input change keyup",function(e){t(l.getContent())})},detached_tinymce_editor:function(){var e,t=this,i=_("textarea#"+sektionsLocalizedData.idOfDetachedTinyMceTextArea),n=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type);if(!(0<i.length))throw new Error("api.czrInputMap::detached_tinymce_editor => missing textarea element");if(e=i.attr("id"),window.tinymce&&(mceInstance=window.tinymce.get(e),mceInstance&&mceInstance.remove()),!window.nimbleTinyMCEPreInit||!window.nimbleTinyMCEPreInit.mceInit||!window.nimbleTinyMCEPreInit.mceInit[e])throw new Error("setupDetachedTinyMceEditor => invalid nimbleTinyMCEPreInit global var");var o,r,a=nimbleTinyMCEPreInit.mceInit[e];a.content_css=(o=wp.editor.getDefaultSettings(),r=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],o&&o.tinymce&&o.tinymce.content_css&&(r=m.union(o.tinymce.content_css.split(","),r)),r.join(","));var s=t.input_parent,c=function(){var e=s();return m.isUndefined(e.autop)?n&&n.editor_params&&!0===n.editor_params.autop:e.autop};a.wpautop=c(),c()||(a.forced_root_block=""),a.toolbar1=sektionsLocalizedData.defaultToolbarBtns,a.toolbar2="",window.tinymce.init(a),window.QTags.getInstance(e);var l=tinyMCE.get(e);if(!l)throw new Error("setupDetachedTinyMceEditor => missing editor instance for module :"+t.module.id);var d=function(){var e=c()?wp.editor.autop(t()):t();l.setContent(e),p.sekEditorExpanded(!0),_(window).trigger("resize")};l.initialized?d():l.on("init",d),l.on("input change keyup keydown click SetContent BeforeSetContent",function(e){t(c()?l.getContent():wp.editor.removep(l.getContent()))}),p.sekCurrentDetachedTinyMceInput=t,i.data("czr-bound-for-detached-editor")||(i.on("input",function(e,t){p.sekCurrentDetachedTinyMceInput(_(this).val())}),i.data("czr-bound-for-detached-editor",!0))}})}(wp.customize,jQuery,_),function(_,m,f){_.czrInputMap=_.czrInputMap||{},m.extend(_.czrInputMap,{import_export:function(){var o=this,r=o.container.find('button[data-czr-action="sek-pre-import"]'),i=o.container.find("input[name=sek-import-file]"),n=_.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),s="local"===n.scope?_.czr_sektions.localSectionsSettingId():_.czr_sektions.getGlobalSectionsSettingId();i.on("change",function(e){r.toggleClass("disabled",f.isEmpty(m(this).val()))});o.container.on("click","[data-czr-action]",function(e){var i,t;switch(e.stopPropagation(),m(this).data("czr-action")){case"sek-export":if(i=!1,t=wp.customize.dirtyValues(),f.isEmpty(t)||f.each(t,function(e,t){i||(i=-1!==t.indexOf("nimble"))}),i){alert(sektionsLocalizedData.i18n["You need to publish before exporting."]);break}var n=_(s)(),o=!0;if(f.each(n.collection,function(e){o&&(f.isEmpty(e.collection)||(o=!1))}),o){alert(sektionsLocalizedData.i18n["Nothing to export."]);break}p();break;case"sek-pre-import":if(f.isEmpty(_.czr_sektions.activeLocations())){alert(sektionsLocalizedData.i18n["The current page has no available locations to import Nimble Builder sections."]);break}c({pre_import_check:!0}).done(a).fail(function(e){_.errare("sek_pre_import_checks failed",e),u(),c()});break;case"sek-import-as-is":c();break;case"sek-import-assign":c({assign_missing_locations:!0});break;case"sek-cancel-import":u()}});var a=function(e){var t=_.czr_sektions.activeLocations(),i=m.extend(!0,[],f.isArray(e.data.metas.active_locations)?e.data.metas.active_locations:[]);if(i=f.filter(i,function(e){return!f.contains(["nimble_local_header","nimble_local_footer"],e)}),f.isArray(i)&&f.isArray(t)){var n=m(i).not(t).get();f.isEmpty(n)?c():(r.hide(),o.container.find(".czr-import-dialog").slideToggle(),_.infoLog("sek-pre-import => imported locations missing in current page.",n))}else _.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Import failed"],"</strong>","</span>"].join("")}),u()},c=function(t){if(t=t||{},i.length<1||f.isUndefined(i[0])||!i[0].files||f.isEmpty(i.val()))_.previewer.trigger("sek-notify",{notif_id:"missing-import-file",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Missing file"],"</strong>","</span>"].join("")});else{_.notifications.remove("missing-import-file"),_.notifications.remove("import-success"),_.notifications.remove("import-failed"),_.notifications.remove("img-import-errors"),o.container.find(".sek-uploading").show();var e=new FormData;if(e.append("file_candidate",i[0].files[0]),e.append("action","sek_get_imported_file_content"),e.append("nonce",_.settings.nonce.save),f.contains(["local","global"],n.scope)){if(e.append("skope",n.scope),t.pre_import_check&&e.append("pre_import_check",t.pre_import_check),__request__=m.ajax({url:wp.ajax.settings.url,data:e,processData:!1,contentType:!1,type:"POST"}),t.pre_import_check)return m.Deferred(function(){var t=this;__request__.done(function(e){e.success||t.reject(e),l(e)||t.reject(e),t.resolve(e)}).fail(function(e){t.reject(e)}).always(function(){})});o.container.find(".sek-uploading").show(),_.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0}),__request__.done(function(e){var n=function(i){return(f.isObject(i)||f.isArray(i))&&f.each(i,function(e,t){(f.isObject(e)||f.isArray(e))&&(i[t]=n(e)),"id"!==t||!f.isString(e)||0!==e.indexOf("__rep__me__")&&0!==e.indexOf("__nimble__")||(i[t]=sektionsLocalizedData.optPrefixForSektionsNotSaved+_.czr_sektions.guid())}),i};e.data.data.collection=n(e.data.data.collection),d(e,t)}).fail(function(e){_.errare("sek-import input => ajax error",e),_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["Import failed, file problem"],"</strong>","</span>"].join("")})}).always(u)}else _.errare("sek-import input => invalid scope provided",n.scope)}},l=function(e){var t=!0,i=e.data,n=null;e.success||(n=[sektionsLocalizedData.i18n["Import failed"],i].join(" : ")),f.isNull(n)&&!f.isObject(i)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]);var o=i.data,r=i.metas,a=i.img_errors;return f.isNull(n)&&!f.isObject(o)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]),f.isNull(n)&&!f.isObject(r)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]),f.isNull(n)&&f.isEqual(_(s)(),o)&&(_.infoLog("sek-import input => Setting unchanged"),t=!1),f.isNull(n)||(_.errare("sek-import input => invalid data sent from server",i),_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",n,"</strong>","</span>"].join("")}),t=!1),f.isEmpty(a)||_.previewer.trigger("sek-notify",{notif_id:"img-import-errors",type:"info",duration:6e4,message:['<span style="color:#0075a2">',["<strong>"+sektionsLocalizedData.i18n["Some image(s) could not be imported"]+"</strong><br/>",'<span style="font-size:11px">'+a+"</span>"].join(" : "),"</span>"].join("")}),t},d=function(e,t){t=t||{},l(e)?(_.czr_sektions.updateAPISetting({action:"sek-import-from-file",scope:"global"===n.scope,imported_content:e.data,assign_missing_locations:t.assign_missing_locations,keep_existing_sections:o.input_parent.czr_Input("keep_existing_sections")()}).done(function(){"local"===n.scope&&_.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0}),_.previewer.refresh(),_.previewer.trigger("sek-notify",{notif_id:"import-success",type:"success",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["File successfully imported"],"</strong>","</span>"].join("")})}).fail(function(e){_.errare("sek-import input => error when firing ::updateAPISetting",e),_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Import failed"],e].join(" : "),"</strong>","</span>"].join("")})}),_.previewer.refresh()):u()},u=function(){_.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0}),o.container.find(".sek-uploading").hide(),i.val("").trigger("change"),o.container.find(".czr-import-dialog").hide(),r.show()},p=function(){var i=[],e={sek_export_nonce:_.settings.nonce.save,skope_id:_.czr_skopeBase.getSkopeProperty("skope_id"),active_locations:_.czr_sektions.activeLocations()};f.each(e,function(e,t){i.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),wp.ajax.post("sek_pre_export_checks",{nonce:_.settings.nonce.save,sek_export_nonce:_.settings.nonce.save,skope_id:_.czr_skopeBase.getSkopeProperty("skope_id"),active_locations:_.czr_sektions.activeLocations()}).done(function(){m(window).off("beforeunload"),window.location.href=[sektionsLocalizedData.customizerURL,"?",i.join("&")].join(""),m(window).on("beforeunload")}).fail(function(e){_.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Export failed"],encodeURIComponent(e)].join(" "),"</strong>","</span>"].join("")})})}}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{simpleselect:function(e){t.czr_sektions.setupSelectInput.call(this,e)},multiselect:function(e){t.czr_sektions.setupSelectInput.call(this,e)}})}(wp.customize,jQuery,_),function(s,c,l){s.czrInputMap=s.czrInputMap||{},c.extend(s.czrInputMap,{category_picker:function(e){var n=this,o=c("select[data-czrtype]",n.container),r=function(){var e=n();return e=l.isString(e)?[e]:e,l.isArray(e)?e:[]},t=function(t){!0!==n.catCollectionSet&&(c.when(c.Deferred(function(i){l.isEmpty(s.czr_sektions.post_categories)?wp.ajax.post("sek_get_post_categories",{nonce:s.settings.nonce.save}).done(function(e){l.isArray(e)||s.errare(n.id+" => error => invalid category collection sent by server");var t={};l.each(e,function(e){l.isEmpty(e.slug)||l.isEmpty(e.name)?i.reject("missing slug or name for at least one category"):t[e.slug]=e.name}),s.czr_sektions.post_categories=t,i.resolve(s.czr_sektions.post_categories)}).fail(function(e){i.reject(e)}):i.resolve(s.czr_sektions.post_categories)})).done(function(e){i(e),t&&!0===t.open_on_init&&l.delay(function(){try{o.czrSelect2("open")}catch(e){}},100)}).fail(function(e){s.errare(n.id+" => fail response when _getCategoryCollection()",e)}),n.catCollectionSet=!0)},i=function(e){l.each(e,function(e,t){var i={value:t,html:e};l.contains(r(),t)&&c.extend(i,{selected:"selected"}),o.append(c("<option>",i))}),o.czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),o.on("change",function(){0===c(this).find("option:selected").length&&n([])})},a={};l.each(r(),function(e){a[e]=(e+"").replace(/-/g," ")}),i(a),n.container.on("click",function(){!0!==n.catCollectionSet&&(o.czrSelect2("destroy"),c.when(o.find("option").remove()).done(function(){t({open_on_init:!0})}))})}})}(wp.customize,jQuery,_),function(r,a,e){r.czrInputMap=r.czrInputMap||{},a.extend(r.czrInputMap,{grid_layout:function(e){var n=this,o=a(".sek-grid-layout-wrapper",n.container);o.find('input[type="hidden"]').val(n()),o.on("click","[data-sek-grid-layout]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-grid-layout]").removeClass("selected").attr("aria-pressed",!1),a(this).addClass("selected").attr("aria-pressed",!0);try{i=a(this).data("sek-grid-layout")}catch(e){r.errare(n.type+" => error when attaching click event",e)}n(i)}),a('[data-sek-grid-layout="'+n()+'"]',o).trigger("click")}})}(wp.customize,jQuery,_),function(o,r,a){o.czrModuleMap=o.czrModuleMap||{},r.extend(o.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:a.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}}),o.czrInputMap=o.czrInputMap||{},r.extend(o.czrInputMap,{content_type_switcher:function(e){var i,n=this;if(!o.section.has(n.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=o.section(n.module.control.section()),n.container.on("click","[data-sek-content-type]",function(e){e.preventDefault(),n.container.find("[data-sek-content-type]").removeClass("is-selected").attr("aria-pressed",!1),r(this).addClass("is-selected").attr("aria-pressed",!0),o.czr_sektions.currentContentPickerType(r(this).data("sek-content-type"))});var t=function(t){n.container.find('[data-sek-content-type="'+(t||"module")+'"]').trigger("click"),a.each(i.controls(),function(e){a.isUndefined(e.content_type)||e.active(t===e.content_type)})};o.czr_sektions.currentContentPickerType=o.czr_sektions.currentContentPickerType||new o.Value(n()),t(o.czr_sektions.currentContentPickerType()),o.czr_sektions.currentContentPickerType.bind(function(e){t(e)})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},e.extend(t.czrModuleMap,{sek_module_picker_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{};var n=sektionsLocalizedData.presetSectionsModules;i.isArray(n)&&!i.isEmpty(n)?(sektionsLocalizedData.isNimbleHeaderFooterEnabled||(n=i.filter(n,function(e){return!i.contains(["sek_header_sec_picker_module","sek_footer_sec_picker_module"],e)})),i.each(n,function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}})):t.errare("api.czrModuleMap => error when adding section modules")}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({initialize:function(e,t){var i=this;r.CZRInput.prototype.initialize.call(i,e,t),i.isReady.then(function(){i.renderUserSavedSections(),r.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:i.container})})},renderUserSavedSections:function(){var i="",n=this.container.find(".sek-content-type-wrapper"),o="";a.each(sektionsLocalizedData.userSavedSektions,function(e,t){try{o=function(e){var t=e.getDate(),i=e.getMonth(),n=e.getFullYear();e.getHours(),e.getMinutes(),e.getSeconds();return[t,["January","February","March","April","May","June","July","August","September","October","November","December"][i],n].join(" ")}(new Date(e.creation_date.replace(/-/g,"/")))}catch(e){r.errare("::renderUserSavedSections => formatDate => error",e)}i=['<div class="sek-user-section-wrapper">','<div class="sek-saved-section-title"><i class="sek-remove-user-section far fa-trash-alt"></i>'+e.title+"</div>",'<div draggable="true" data-sek-is-user-section="true" data-sek-section-type="'+e.type+'" data-sek-content-type="preset_section" data-sek-content-id="'+t+'" style="" title="'+e.title+'">','<div class="sek-overlay"></div>','<div class="sek-saved-section-description">'+e.description+"</div>",a.isEmpty(o)?"":'<div class="sek-saved-section-date"><i class="far fa-calendar-alt"></i> @missi18n Created : '+o+"</div>","</div>","</div>"].join(""),n.append(i)})}}),r.CZRDynModule.prototype.initialize.call(this,e,t)}};r.czrModuleMap=r.czrModuleMap||{},sektionsLocalizedData.isSavedSectionEnabled&&e.extend(r.czrModuleMap,{sek_my_sections_sec_picker_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_my_sections_sec_picker_module")}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"bg-image":a.each(["bg-attachment","bg-scale","bg-repeat","bg-apply-overlay","bg-color-overlay","bg-opacity-overlay","bg-parallax","bg-parallax-force"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-color-overlay":case"bg-opacity-overlay":e=!a.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-apply-overlay")());break;case"bg-parallax-force":e=!a.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;case"bg-scale":case"bg-repeat":e=!a.isEmpty(i()+"")&&!r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;default:e=!a.isEmpty(i()+"")}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":a.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return!a.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-parallax":a.each(["bg-parallax-force","bg-scale","bg-repeat"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!a.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i());break;case"bg-repeat":case"bg-scale":e=!a.isEmpty(n.czr_Input("bg-image")()+"")&&!r.CZR_Helpers.isChecked(i())}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}}),i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-attachment")())&&n.czr_Input("bg-attachment").container.find("input[type=checkbox]").trigger("click")});break;case"bg-attachment":i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")())&&n.czr_Input("bg-parallax").container.find("input[type=checkbox]").trigger("click")})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:a.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":o.each(["custom-height","overflow_hidden"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"width-type":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-width",function(){return"custom"===e()}),i.czr_sektions.scheduleVisibilityOfInputId.call(e,"h_alignment",function(){return"custom"===e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_template:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_header_footer"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_imp_exp:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_imp_exp","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_imp_exp"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"global-custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_header_footer"))}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"enable":a.each(["public_key","private_key","badge","show_failure_message","failure_message","score"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"failure_message":e=i()&&n.czr_Input("show_failure_message")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_failure_message":a.each(["failure_message"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("enable")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_global_recaptcha:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_global_recaptcha","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:a.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_recaptcha"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_beta_features:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_beta_features","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_beta_features"))}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=n.module;n.czr_Input.each(function(i){switch(i.id){case"img":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"img-size",function(){return!r.isEmpty(i()+"")&&r.isNumber(i())});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!r.contains(["no-link","img-lightbox"],i())}return e})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"border-type":r.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"none"!==i()})}catch(e){o.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":r.each(["custom_width"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_title_attr":r.each(["heading_title"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend(this.CZRTextEditorInputMths||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"detached_tinymce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),n.CZRInput.prototype.initialize.call(i,e,t)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(i){switch(i.id){case"img-type":o.each(["img-id","img-size"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":o.each(["content-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"custom"===i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":o.each(["btn-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":a.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"use_custom_color_on_hover":a.each(["color_hover"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e=i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":case"link-target":e=i()}return e})}catch(e){o.errare("Heading module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&!0===n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_heading_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_heading_spacing_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_divider_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRButtonItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"quote_design":n.each(["border_width_css","border_color_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"border-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}}),n.each(["icon_color_css","icon_size_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_quote_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_cite_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"icon":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this.module;this.czr_Input.each(function(i){switch(i.id){case"layout":r.each(["columns","img_column_width","has_tablet_breakpoint","has_mobile_breakpoint"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"columns":e="grid"===i();break;case"has_tablet_breakpoint":case"has_mobile_breakpoint":case"img_column_width":e="list"===i()}return e})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"categories":r.each(["must_have_all_cats"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){var e=i();return r.isArray(e)&&1<e.length})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"custom_grid_spaces":r.each(["column_gap","row_gap"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_excerpt":r.each(["excerpt_length"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_post_grid_main_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_post_grid_main_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_main_child")}})}(wp.customize,jQuery,_),function(r,e,a){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"show_thumb":a.each(["img_size","img_has_custom_height","img_height","border_radius_css","use_post_thumb_placeholder"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img_height":e=i()&&n.czr_Input("img_has_custom_height")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"img_has_custom_height":a.each(["img_height"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("show_thumb")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_post_grid_thumb_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_post_grid_thumb_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_thumb_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_metas_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_metas_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_metas_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_content_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_content_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_mobile_options:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_mobile_options","name"),has_mod_opt:!1,ready_on_section_expanded:!0,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_mobile_options")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"show_name_field":n.each(["name_field_label","name_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":n.each(["subject_field_label","subject_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":n.each(["message_field_label","message_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,"link-custom-url",function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_submission_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"use_custom_bg_color_on_hover":r.each(["bg_color_hover"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":r.each(["push_effect"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_font_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.bind("nimble-set-select-input-options",function(e){e.params=sektionsLocalizedData.registeredWidgetZones}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_widget_area_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_widget_area_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_widget_area_module")}})}(wp.customize,jQuery,_);
assets/img/section_assets/thumbs/contact_one.jpg ADDED
Binary file
assets/img/section_assets/thumbs/contact_two.jpg ADDED
Binary file
assets/img/section_assets/thumbs/features_one.jpg ADDED
Binary file
assets/img/section_assets/thumbs/features_two.jpg ADDED
Binary file
assets/img/section_assets/thumbs/footer_one.jpg ADDED
Binary file
assets/img/section_assets/thumbs/four_columns.jpg ADDED
Binary file
assets/img/section_assets/thumbs/header_one.jpg ADDED
Binary file
assets/img/section_assets/thumbs/intro_one.jpg ADDED
Binary file
assets/img/section_assets/thumbs/intro_three.jpg ADDED
Binary file
assets/img/section_assets/thumbs/intro_two.jpg ADDED
Binary file
assets/img/section_assets/thumbs/three_columns.jpg ADDED
Binary file
assets/img/section_assets/thumbs/two_columns.jpg ADDED
Binary file
assets/preset_sections.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "intro_one" : {"collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_heading_module","value":{"main_settings":{"heading_text":"Our creative Lab","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Montserrat:regular","font_size_css":{"desktop":"46px","tablet":"30px","mobile":"20px"},"color_css":"#000000","text_transform_css":"uppercase"},"spacing":{"spacing_css":{"desktop":{"margin-bottom":"10","unit":"px"}}}},"options":{"spacing":[]},"ver_ini":"1.1.0"},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","value":{"main_settings":{"content":"Helps you bring your ideas to life.","h_alignment_css":{"desktop":"center"},"autop":false},"font_settings":{"font_family_css":"[gfont]Roboto:italic","font_size_css":{"desktop":"20px","tablet":"18px","mobile":"16px"},"color_css":"#6d6d6d"}},"options":{"spacing":[]},"ver_ini":"1.1.0"}],"options":{"bg":{"bg-color":"rgba(255,255,255,0.75)","bg-color-overlay":"#000000","bg-opacity-overlay":"40"},"spacing":{"pad_marg":{"desktop":{"padding-right":"20","padding-left":"20","padding-top":"70","padding-bottom":"70"},"tablet":{"padding-top":"40","padding-bottom":"40","padding-right":"10","padding-left":"10"},"mobile":{"padding-top":"30","padding-bottom":"30"}}}},"ver_ini":"1.1.0"}],"options":{"bg":{"bg-image":"__img_url__https://ec45f9666931702052dd-d41d6dc80bfaa5965f59737e1438a459.ssl.cf5.rackcdn.com/prebuilt_sections/imgs/intro_one.jpg","bg-color-overlay":"#000000","bg-opacity-overlay":"40"},"width":{"use-custom-inner-width":true,"inner-section-width":{"desktop":"525px","tablet":"50%","mobile":"85%"}},"spacing":{"pad_marg":{"desktop":{"padding-top":"250","padding-bottom":"250"},"tablet":{"padding-bottom":"200","padding-top":"200"},"mobile":{"padding-top":"150","padding-bottom":"150"}}}},"ver_ini":"1.1.0"},
3
+ "intro_two" : {"collection":[{"id":"","level":"column","collection":[],"ver_ini":"1.1.0","width":""},{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Design your <strong>own space</strong>","h_alignment_css":{"desktop":"right","mobile":"center"},"autop":false},"font_settings":{"font_family_css":"[gfont]Montserrat:regular","font_size_css":{"desktop":"50px","tablet":"33px"},"color_css":"#ffffff"}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.","h_alignment_css":{"desktop":"right","mobile":"justify"}},"font_settings":{"font_family_css":"[gfont]Roboto:regular","color_css":"#ffffff"}}},{"id":"","level":"module","module_type":"czr_button_module","ver_ini":"1.1.0","value":{"content":{"button_text":"Start now"},"design":{"bg_color_css":"#c5a872","bg_color_hover":"#151515","border_radius_css":"2","h_alignment_css":{"desktop":"right","mobile":"center"}},"font":{"font_family_css":"[gfont]Roboto:regular","color_css":"#ffffff","font_style_css":"italic"}}}],"ver_ini":"1.1.0","options":{"spacing":{"pad_marg":{"desktop":{"padding-left":"63"},"mobile":{"padding-left":"0"}}}}}],"options":{"bg":{"bg-image":"__img_url__https://ec45f9666931702052dd-d41d6dc80bfaa5965f59737e1438a459.ssl.cf5.rackcdn.com/prebuilt_sections/imgs/intro_two.jpg","bg-position":{"desktop":"top","tablet":"top_left","mobile":"center"},"bg-apply-overlay":true},"width":{"use-custom-inner-width":true,"inner-section-width":{"desktop":"960px"}},"breakpoint":{"use-custom-breakpoint":true,"custom-breakpoint":"575"},"spacing":{"pad_marg":{"desktop":{"padding-top":"180","padding-bottom":"180"},"tablet":{"padding-right":"20","padding-left":"20"},"mobile":{"padding-right":"10","padding-left":"10","padding-top":"150","padding-bottom":"150"}}}},"ver_ini":"1.1.0"},
4
+ "intro_three" : {"collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"We can help you<br/><strong><i>grow</i></strong> your business !","heading_tag":"h2","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Poppins:regular","font_size_css":{"desktop":"50px","tablet":"40px","mobile":"30px"},"color_css":"#000000"},"spacing":{"spacing_css":{"desktop":{"margin-bottom":"14"}}}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec.","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Roboto:regular","font_size_css":{"desktop":"18px","tablet":"17px","mobile":"16px"},"color_css":"#514f4f"}}},{"id":"","level":"module","module_type":"czr_button_module","ver_ini":"1.1.0","value":{"content":{"button_text":"Learn more","link-to":"url","link-pick-url":{"id":"_custom_","type_label":"","title":"<span style=\"font-weight:bold\">Set a custom url</span>","url":""},"link-custom-url":"mailto:contact@youremail.com","icon":"far fa-envelope-open"},"design":{"bg_color_css":"#ff595e","bg_color_hover":"#151515","border_radius_css":{"_all_":"10px"},"h_alignment_css":"center"},"font":{"font_family_css":"[gfont]Roboto:regular","font_size_css":{"desktop":"20px","mobile":"16px","tablet":"18px"},"color_css":"#ffffff"}}}],"ver_ini":"1.1.0","options":{"spacing":{"pad_marg":{"desktop":{"padding-left":"20","padding-right":"20"},"mobile":{"padding-left":"0","padding-right":"0"}}}}}],"ver_ini":"1.1.0","options":{"bg":{"bg-image":"__img_url__https://ec45f9666931702052dd-d41d6dc80bfaa5965f59737e1438a459.ssl.cf5.rackcdn.com/prebuilt_sections/imgs/intro_three.jpg","bg-position":{"desktop":"top","mobile":"center"},"bg-parallax":true,"bg-opacity-overlay":"22"},"spacing":{"pad_marg":{"desktop":{"padding-top":"200","padding-bottom":"200"},"mobile":{"padding-top":"150","padding-bottom":"150"}}},"width":{"use-custom-inner-width":true,"inner-section-width":{"desktop":"600px"}}}},
5
+ "features_one" : {"collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"Our services","heading_tag":"h2","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Poppins:regular","font_size_css":{"desktop":"45px","tablet":"40px","mobile":"30px"},"color_css":"#000000"},"spacing":{"spacing_css":{"desktop":{"margin-bottom":"3","margin-top":"3"}}}}},{"id":"","is_nested":true,"level":"section","collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_icon_module","ver_ini":"1.1.0","value":{"icon_settings":{"icon":"fas fa-award","font_size_css":{"desktop":"34px"},"color_css":"#19b934"}}},{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"Award winning ","heading_tag":"h3","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Poppins:500","font_size_css":{"desktop":"25px","tablet":"18px"}},"spacing":{"spacing_css":{"desktop":{"margin-top":"10","margin-bottom":"10"}}}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet.","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Montserrat:500","font_size_css":{"desktop":"16px","tablet":"15px","mobile":"15px"},"color_css":"#727272"}}},{"id":"","level":"module","module_type":"czr_button_module","ver_ini":"1.1.0","value":{"content":{"button_text":"Learn more"},"design":{"bg_color_css":"#19b934","bg_color_hover":"#151515","border_radius_css":"2","h_alignment_css":"center"},"font":{"font_size_css":{"desktop":"17px","mobile":"15px"},"color_css":"#ffffff"}},"options":{"spacing":{"pad_marg":{"desktop":{"margin-top":"1","unit":"em"}}}}}],"ver_ini":"1.1.0","options":{"border":{"shadow":true},"spacing":{"pad_marg":{"desktop":{"margin-right":"10","margin-left":"10","padding-top":"50","padding-bottom":"50","padding-left":"15","padding-right":"15","margin-bottom":"20"},"tablet":{"padding-top":"30","padding-bottom":"30"}}}},"width":""},{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_icon_module","ver_ini":"1.1.0","value":{"icon_settings":{"icon":"fas fa-rocket","font_size_css":{"desktop":"34px"},"color_css":"#19b934"}}},{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"Performances ","heading_tag":"h3","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Poppins:500","font_size_css":{"desktop":"25px","tablet":"18px"}},"spacing":{"spacing_css":{"desktop":{"margin-top":"10","margin-bottom":"10"}}}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet.","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Montserrat:500","font_size_css":{"desktop":"16px","tablet":"15px","mobile":"15px"},"color_css":"#727272"}}},{"id":"","level":"module","module_type":"czr_button_module","ver_ini":"1.1.0","value":{"content":{"button_text":"Learn more"},"design":{"bg_color_css":"#19b934","bg_color_hover":"#151515","border_radius_css":"2","h_alignment_css":"center"},"font":{"font_size_css":{"desktop":"17px","mobile":"15px"},"color_css":"#ffffff"}},"options":{"spacing":{"pad_marg":{"desktop":{"margin-top":"1","unit":"em"}}}}}],"ver_ini":"1.1.0","options":{"border":{"shadow":true},"spacing":{"pad_marg":{"desktop":{"margin-right":"10","margin-left":"10","padding-top":"50","padding-bottom":"50","padding-left":"15","padding-right":"15","margin-bottom":"20"},"tablet":{"padding-top":"30","padding-bottom":"30"}}}},"width":""},{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_icon_module","ver_ini":"1.1.0","value":{"icon_settings":{"icon":"fas fa-hands-helping","font_size_css":{"desktop":"34px"},"color_css":"#19b934"}}},{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"Top support","heading_tag":"h3","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Poppins:500","font_size_css":{"desktop":"25px","tablet":"18px"}},"spacing":{"spacing_css":{"desktop":{"margin-top":"10","margin-bottom":"10"}}}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet.","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Montserrat:500","font_size_css":{"desktop":"16px","tablet":"15px","mobile":"15px"},"color_css":"#727272"}}},{"id":"","level":"module","module_type":"czr_button_module","ver_ini":"1.1.0","value":{"content":{"button_text":"Learn more"},"design":{"bg_color_css":"#19b934","bg_color_hover":"#151515","border_radius_css":"2","h_alignment_css":"center"},"font":{"font_size_css":{"desktop":"17px","mobile":"15px"},"color_css":"#ffffff"}},"options":{"spacing":{"pad_marg":{"desktop":{"margin-top":"1","unit":"em"}}}}}],"ver_ini":"1.1.0","options":{"border":{"shadow":true},"spacing":{"pad_marg":{"desktop":{"margin-right":"10","margin-left":"10","padding-top":"50","padding-bottom":"50","padding-left":"15","padding-right":"15","margin-bottom":"20"},"tablet":{"padding-top":"30","padding-bottom":"30"}}}},"width":""}],"options":{"spacing":{"pad_marg":{"desktop":{"padding-bottom":"180","padding-top":"80"},"tablet":{"padding-top":"70","padding-bottom":"130"},"mobile":{"padding-top":"30","padding-bottom":"50"}}},"width":{"use-custom-inner-width":true,"inner-section-width":{"desktop":"960px"}},"breakpoint":{"use-custom-breakpoint":true,"custom-breakpoint":"720"}},"ver_ini":"1.1.0"}],"ver_ini":"1.1.0"}],"ver_ini":"1.1.0","options":{"spacing":{"pad_marg":{"desktop":{"padding-top":"100"},"tablet":{"padding-top":"80"},"mobile":{"padding-top":"30"}}}}},
6
+ "features_two" : {"collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_icon_module","ver_ini":"1.1.0","value":{"icon_settings":{"icon":"fas fa-chart-line","font_size_css":"40px","color_css":"#ffffff"},"spacing_border":{"spacing_css":{"desktop":{"padding-top":"30","padding-bottom":"30","padding-right":"30","padding-left":"30"}},"border-type":"solid","borders":{"_all_":{"wght":"3px","col":"#ffffff"}},"border_radius_css":{"_all_":"119px"},"use_box_shadow":true}}},{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"High performances","heading_tag":"h3","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Lato:regular","font_size_css":{"desktop":"27px","mobile":"22px","tablet":"24px"},"color_css":"#ffffff"},"spacing":{"spacing_css":{"desktop":{"margin-top":"15","margin-bottom":"15"}}}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Montserrat:italic","font_size_css":{"desktop":"17px","mobile":"15px"},"color_css":"#ffffff"}}}],"ver_ini":"1.1.0","width":"","options":{"spacing":{"pad_marg":{"desktop":[],"mobile":{},"tablet":{"margin-bottom":"20"}}}}},{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_icon_module","ver_ini":"1.1.0","value":{"icon_settings":{"icon":"fas fa-award","font_size_css":"40px","color_css":"#ffffff"},"spacing_border":{"spacing_css":{"desktop":{"padding-top":"30","padding-bottom":"30","padding-right":"30","padding-left":"30"}},"border-type":"solid","borders":{"_all_":{"wght":"3px","col":"#ffffff"}},"border_radius_css":{"_all_":"231px"},"use_box_shadow":true}}},{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"Industry leader","heading_tag":"h3","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Lato:regular","font_size_css":{"desktop":"27px","mobile":"22px","tablet":"24px"},"color_css":"#ffffff"},"spacing":{"spacing_css":{"desktop":{"margin-top":"15","margin-bottom":"15"}}}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Montserrat:italic","font_size_css":{"desktop":"17px","mobile":"15px"},"color_css":"#ffffff"}}}],"ver_ini":"1.1.0","width":"","options":{"spacing":{"pad_marg":{"desktop":[],"mobile":{},"tablet":{"margin-bottom":"20"}}}}},{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_icon_module","ver_ini":"1.1.0","value":{"icon_settings":{"icon":"far fa-clock","font_size_css":"40px","color_css":"#ffffff"},"spacing_border":{"spacing_css":{"desktop":{"padding-top":"30","padding-bottom":"30","padding-right":"30","padding-left":"30"}},"border-type":"solid","borders":{"_all_":{"wght":"3px","col":"#ffffff"}},"border_radius_css":{"_all_":"119px"},"use_box_shadow":true}}},{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.0","value":{"main_settings":{"heading_text":"Delivers on time","heading_tag":"h3","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Lato:regular","font_size_css":{"desktop":"27px","mobile":"22px","tablet":"24px"},"color_css":"#ffffff"},"spacing":{"spacing_css":{"desktop":{"margin-top":"15","margin-bottom":"15"}}}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.0","value":{"main_settings":{"content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Montserrat:italic","font_size_css":{"desktop":"17px","mobile":"15px"},"color_css":"#ffffff"}}}],"ver_ini":"1.1.0","width":"","options":{"spacing":{"pad_marg":{"desktop":[],"mobile":{},"tablet":{"margin-bottom":"20"}}}}}],"options":{"bg":{"bg-image":"__img_url__https://ec45f9666931702052dd-d41d6dc80bfaa5965f59737e1438a459.ssl.cf5.rackcdn.com/prebuilt_sections/imgs/features_two.jpg","bg-attachment":true,"bg-apply-overlay":true,"bg-opacity-overlay":"62"},"spacing":{"pad_marg":{"desktop":{"padding-top":"200","padding-bottom":"200"},"mobile":{"padding-top":"100","padding-bottom":"100","padding-left":"5","padding-right":"5"},"tablet":{"padding-top":"150","padding-bottom":"150","padding-left":"40","padding-right":"40"}}},"width":{"use-custom-inner-width":true,"inner-section-width":{"desktop":"960px"}},"breakpoint":{"use-custom-breakpoint":true,"custom-breakpoint":"660"}},"ver_ini":"1.1.0"},
7
+ "contact_one":{"collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_map_module","ver_ini":"1.1.6","value":{"address":"405 East 42nd Street, New York, NY, 10017, USA","zoom":"16","height_css":{"desktop":"588px","mobile":"336px"}}}],"ver_ini":"1.1.6","width":"","options":{"spacing":{"pad_marg":{"desktop":{"margin-right":"10","margin-left":"10"}}}}},{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.6","value":{"main_settings":{"heading_text":"Drop us a line","heading_tag":"h2","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Roboto:regular","font_size_css":{"desktop":"32px","mobile":"23px"},"color_css":"#141414"}}},{"id":"","level":"module","module_type":"czr_tiny_mce_editor_module","ver_ini":"1.1.6","value":{"main_settings":{"content":"Contact us for anything you want to know! We are happy to answer any question you have as quickly as possible.","h_alignment_css":{"desktop":"justify"}},"font_settings":{"font_family_css":"[gfont]Montserrat:regular","color_css":"#333333"}}},{"id":"","level":"module","module_type":"czr_simple_form_module","ver_ini":"1.1.6","value":{"fields_design":{"borders":{"_all_":{"wght":"0px","col":"#cccccc"},"bottom":{"wght":"1px","col":"#cccccc"}},"use_inset_shadow":false,"border":{"_all_":{"wght":"1px","col":"#cccccc"}}},"form_button":{"bg_color_css":"#020202","bg_color_hover":"#151515","h_alignment_css":{"desktop":"center"},"spacing_css":{"margin-top":0.5,"padding-top":0.5,"padding-bottom":0.5,"padding-right":"2","padding-left":"2","unit":"em"}},"form_fonts":{"fl_font_family_css":"[gfont]Montserrat:regular","fl_font_weight_css":"700","btn_font_family_css":"[gfont]Montserrat:regular","btn_color_css":"#ffffff"},"form_submission":{"email_footer":""}},"options":{"spacing":{"pad_marg":{"desktop":[],"tablet":{"padding-left":"10","padding-right":"15"},"mobile":{"padding-right":"25"}}}}}],"width":"","ver_ini":"1.1.6","options":{"spacing":{"pad_marg":{"desktop":{"margin-right":"10","margin-left":"10"},"tablet":{"margin-left":"10","margin-right":"10","padding-right":"20","padding-left":"20"}}},"bg":[]}}],"options":{"width":{"use-custom-inner-width":true,"inner-section-width":{"desktop":"1000px"}},"spacing":{"pad_marg":{"desktop":{"padding-top":"75","padding-bottom":"75"},"tablet":{"padding-top":"40","padding-bottom":"40"}}},"breakpoint":{"reverse-col-at-breakpoint":true}},"ver_ini":"1.1.6"},
8
+ "contact_two":{"collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_heading_module","ver_ini":"1.1.6","value":{"main_settings":{"heading_text":"CONTACT US","heading_tag":"h2","h_alignment_css":{"desktop":"center"}},"font_settings":{"font_family_css":"[gfont]Roboto:regular","font_size_css":{"desktop":"40px","tablet":"35px","mobile":"25px"},"color_css":"#ffffff"},"spacing":{"spacing_css":{"desktop":{"margin-bottom":"5"}}}}},{"id":"","level":"module","module_type":"czr_simple_form_module","ver_ini":"1.1.6","value":{"fields_design":{"border-type":"none","use_outset_shadow":true,"border":{"_all_":{"wght":"1px","col":"#cccccc"}}},"form_button":{"bg_color_hover":"#151515","border-type":"solid","borders":{"_all_":{"wght":"0px","col":""}},"border_radius_css":"2","h_alignment_css":{"desktop":"center"},"spacing_css":{"margin-top":0.5,"padding-top":0.5,"padding-bottom":0.5,"padding-right":"3","padding-left":"3","unit":"em"}},"form_fonts":{"fl_font_family_css":"[cfont]Lucida Console,Monaco,monospace","fl_color_css":"#ffffff","btn_color_css":"#ffffff"},"form_submission":{"email_footer":""}}}],"ver_ini":"1.1.6"}],"ver_ini":"1.1.6","options":{"bg":{"bg-image":"__img_url__https://ec45f9666931702052dd-d41d6dc80bfaa5965f59737e1438a459.ssl.cf5.rackcdn.com/prebuilt_sections/imgs/contact_two.jpg","bg-apply-overlay":true,"bg-color-overlay":"#752a2a"},"spacing":{"pad_marg":{"desktop":{"padding-top":"120","padding-bottom":"120"},"tablet":{"padding-top":"85","padding-bottom":"85"},"mobile":{"padding-top":"40","padding-bottom":"40"}}},"width":{"use-custom-inner-width":true,"inner-section-width":{"desktop":"600px"}}}},
9
+ "two_columns":{"collection":[{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[]}]},
10
+ "three_columns":{"collection":[{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[]}]},
11
+ "four_columns":{"collection":[{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[]}]},
12
+ "header_one":{"collection":[{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_image_module","ver_ini":"1.4.0","value":{"main_settings":{"img":"__img_url__https://ec45f9666931702052dd-d41d6dc80bfaa5965f59737e1438a459.ssl.cf5.rackcdn.com/prebuilt_sections/imgs/logo_placeholder_190x80.jpg","img-size":"original","link-to":"url","link-pick-url":{"id":"_custom_","type_label":"","title":"<span style=\"font-weight:bold\">Set a custom url</span>","url":""},"link-custom-url":"{{home_url}}"},"borders_corners":{"border_radius_css":{"_all_":"8px"}}},"options":{"spacing":{"pad_marg":{"desktop":{"padding-top":"8","padding-bottom":"8"}}}}}],"ver_ini":"1.4.0","width":25},{"id":"","level":"column","collection":[{"id":"","level":"module","module_type":"czr_menu_module","ver_ini":"1.4.0","value":{"content":{"h_alignment_css":{"desktop":"right"}},"font":{"font_family_css":"[gfont]Poppins:regular","font_size_css":{"desktop":"18px"},"text_transform_css":"uppercase"}}}],"ver_ini":"1.4.0","width":75}],"ver_ini":"1.4.0"},
13
+ "footer_one":{"collection":[{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[],"width":""},{"id":"","level":"column","collection":[]}]}
14
+ }
inc/czr-skope/assets/czr/js/czr-skope-base.js CHANGED
@@ -1,19 +1,41 @@
1
-
2
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
3
  (function ( api, $, _ ) {
4
  $.extend( CZRSkopeBaseMths, {
5
 
6
  initialize: function() {
7
  var self = this;
 
 
 
8
  api.czr_initialSkopeCollectionPopulated = $.Deferred();
 
 
 
 
9
  api.czr_skopeCollection = new api.Value([]);//all available skope, including the current skopes
 
10
  api.czr_currentSkopesCollection = new api.Value([]);
 
 
11
  api.czr_activeSkopes = new api.Value( { local : '', group : ''} );
 
 
 
 
 
 
 
 
 
 
12
  api.bind( 'ready' , function() {
13
  api.previewer.bind( 'czr-new-skopes-synced', function( skope_server_data ) {
14
  if ( serverControlParams.isDevMode ) {
15
  api.infoLog( 'API SKOPE SYNCED', skope_server_data );
16
  }
 
 
17
  if ( ! _.has( skope_server_data, 'czr_stylesheet') ) {
18
  api.errorLog( "On 'czr-new-skopes-synced' : missing stylesheet in the server data" );
19
  return;
@@ -21,18 +43,29 @@ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
21
 
22
  api.czr_skopeBase.stylesheet = api.czr_skopeBase.stylesheet || new api.Value( api.settings.theme.stylesheet );
23
  api.czr_skopeBase.stylesheet( skope_server_data.czr_stylesheet );
 
 
24
  var preview = this,
25
  previousSkopeCollection = api.czr_currentSkopesCollection();
 
 
26
  if ( ! _.has( skope_server_data, 'czr_new_skopes') ) {
27
  api.errorLog( "On 'czr-new-skopes-synced' : missing skopes in the server data" );
28
  return;
29
  }
 
 
 
30
  if ( _.isEmpty( _.findWhere( skope_server_data.czr_new_skopes, { skope : 'group' } ) ) ){
31
  var _local_ = _.findWhere( skope_server_data.czr_new_skopes, { skope : 'local' } );
32
  if ( ! _.isEmpty( _local_ ) && ! _.contains( FlatSkopeLocalizedData.noGroupSkopeList, _local_.level ) ) {
33
  api.errorLog( 'No group level skope sent while there should be one' );
34
  }
35
  }
 
 
 
 
36
  if ( serverControlParams.isDevMode ) {
37
  api.czr_skopeBase.updateSkopeCollection( skope_server_data.czr_new_skopes , preview.channel() );
38
  } else {
@@ -42,21 +75,56 @@ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
42
  return;
43
  }
44
  }
 
 
 
 
 
 
 
 
 
 
 
45
  api.czr_initialSkopeCollectionPopulated.then( function() {
 
46
  if ( ! _.has( skope_server_data, 'czr_new_skopes' ) || _.isEmpty( skope_server_data.czr_new_skopes ) ) {
47
  api.errorLog( 'Missing skope data after refresh', skope_server_data );
48
  }
 
 
49
  api.czr_activeSkopes( {
50
  'local' : self.getSkopeProperty( 'skope_id', 'local' ),
51
  'group' : self.getSkopeProperty( 'skope_id', 'group' )
52
  });
53
 
 
 
 
 
 
 
 
 
 
 
54
  });
55
  });//api.previewer.bind
56
  });//api.bind( 'ready'
 
 
 
 
 
 
 
57
  api.czr_currentSkopesCollection.bind( function( to, from ) {
58
  return self.currentSkopesCollectionReact( to, from );
59
  }, { deferred : true });
 
 
 
 
60
  api.trigger( 'czr_skopeBase_initialized' );
61
  }//initialize
62
  });//$.extend()
@@ -64,11 +132,16 @@ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
64
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
65
  ( function ( api, $, _ ) {
66
  $.extend( CZRSkopeBaseMths, {
 
 
 
 
67
  getSkopeProperty : function( what, skope_level ) {
68
  what = what || 'skope_id';
69
  skope_level = skope_level || 'local';
70
  var _skope_data = _.findWhere( api.czr_currentSkopesCollection(), { skope : skope_level });
71
  if ( _.isEmpty( _skope_data ) ){
 
72
  if ( 'local' == skope_level ) {
73
  api.errorLog( "getSkopeProperty => local skope missing, returning not_set" );
74
  }
@@ -80,23 +153,75 @@ $.extend( CZRSkopeBaseMths, {
80
  return _skope_data[ what ];
81
  }
82
  },
 
 
 
83
  firstToUpperCase : function( str ) {
84
  return ! _.isString( str ) ? '' : str.substr(0, 1).toUpperCase() + str.substr(1);
85
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  });//$.extend
87
  })( wp.customize , jQuery, _ );//@global serverControlParams
88
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
89
  (function ( api, $, _ ) {
90
  $.extend( CZRSkopeBaseMths, {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  updateSkopeCollection : function( sent_collection ) {
92
  var self = this,
93
  _api_ready_collection = [];
 
 
94
  _.each( sent_collection, function( _skope ) {
95
  var skope_candidate = $.extend( true, {}, _skope );//deep clone to avoid any shared references
96
  _api_ready_collection.push( self.prepareSkopeForAPI( skope_candidate ) );
97
  });
 
 
 
98
  api.czr_currentSkopesCollection( _api_ready_collection );
 
 
 
99
  },
 
 
 
 
 
 
 
 
 
 
 
100
  prepareSkopeForAPI : function( skope_candidate ) {
101
  if ( ! _.isObject( skope_candidate ) ) {
102
  throw new Error('prepareSkopeForAPI : a skope must be an object to be API ready');
@@ -143,6 +268,9 @@ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
143
  api_ready_skope[_key] = _candidate_val;
144
  break;
145
  case 'values' :
 
 
 
146
  api_ready_skope[_key] = _candidate_val;
147
  break;
148
  default :
@@ -150,6 +278,8 @@ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
150
  break;
151
  }//switch
152
  });
 
 
153
  api_ready_skope.id = api_ready_skope.skope + '_' + api_ready_skope.skope_id;
154
  if ( ! _.isString( api_ready_skope.id ) || _.isEmpty( api_ready_skope.id ) ) {
155
  throw new Error('prepareSkopeForAPI : a skope id must a string not empty');
@@ -160,8 +290,16 @@ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
160
  }
161
  return api_ready_skope;
162
  },
 
 
 
 
163
  currentSkopesCollectionReact : function( to, from ) {
164
  var dfd = $.Deferred();
 
 
 
 
165
  if ( _.isEmpty( from ) && ! _.isEmpty( to ) ) {
166
  api.czr_initialSkopeCollectionPopulated.resolve();
167
  }
@@ -172,7 +310,13 @@ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
172
  })( wp.customize , jQuery, _);//@global serverControlParams
173
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
174
  (function ( api, $ ) {
 
175
  $.extend( CZRSkopeBaseMths, api.Events );
176
  var CZR_SkopeBase = api.Class.extend( CZRSkopeBaseMths );
 
 
 
 
 
177
  api.czr_skopeBase = new CZR_SkopeBase();
178
  })( wp.customize, jQuery );
1
+ //@global serverControlParams
2
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
3
  (function ( api, $, _ ) {
4
  $.extend( CZRSkopeBaseMths, {
5
 
6
  initialize: function() {
7
  var self = this;
8
+ ///////////////////// DEFINITIONS /////////////////////
9
+
10
+ //Store the state of the first skope collection state
11
  api.czr_initialSkopeCollectionPopulated = $.Deferred();
12
+
13
+ //the czr_skopeCollection stores all skopes instantiated by the user
14
+ //this collection is not updated directly
15
+ //=> it's updated on skope() instance change
16
  api.czr_skopeCollection = new api.Value([]);//all available skope, including the current skopes
17
+ //the current skopes collection get updated each time the 'czr-new-skopes-synced' event is triggered on the api by the preview
18
  api.czr_currentSkopesCollection = new api.Value([]);
19
+
20
+ //the currently active skopes
21
  api.czr_activeSkopes = new api.Value( { local : '', group : ''} );
22
+
23
+
24
+
25
+ ///////////////////// SKOPE COLLECTIONS SYNCHRONISATION AND LISTENERS /////////////////////
26
+ //LISTEN TO SKOPE SYNC => UPDATE SKOPE COLLECTION ON START AND ON EACH REFRESH
27
+ //the sent data look like :
28
+ //{
29
+ // czr_new_skopes : _wpCustomizeSettings.czr_new_skopes || [],
30
+ // isChangesetDirty : boolean
31
+ // }
32
  api.bind( 'ready' , function() {
33
  api.previewer.bind( 'czr-new-skopes-synced', function( skope_server_data ) {
34
  if ( serverControlParams.isDevMode ) {
35
  api.infoLog( 'API SKOPE SYNCED', skope_server_data );
36
  }
37
+
38
+ // set the currently active stylesheet
39
  if ( ! _.has( skope_server_data, 'czr_stylesheet') ) {
40
  api.errorLog( "On 'czr-new-skopes-synced' : missing stylesheet in the server data" );
41
  return;
43
 
44
  api.czr_skopeBase.stylesheet = api.czr_skopeBase.stylesheet || new api.Value( api.settings.theme.stylesheet );
45
  api.czr_skopeBase.stylesheet( skope_server_data.czr_stylesheet );
46
+
47
+ //api.consoleLog('czr-skopes-ready DATA', skope_server_data );
48
  var preview = this,
49
  previousSkopeCollection = api.czr_currentSkopesCollection();
50
+ //initialize skopes with the server sent skope_server_data
51
+ //if skope has not been initialized yet and the server sent wrong skope_server_data, then reject the skope ready promise()
52
  if ( ! _.has( skope_server_data, 'czr_new_skopes') ) {
53
  api.errorLog( "On 'czr-new-skopes-synced' : missing skopes in the server data" );
54
  return;
55
  }
56
+
57
+ // If no "group" skope has been sent, check if we should have one
58
+ // array( 'home', 'search', '404', 'date' ) <= have no group
59
  if ( _.isEmpty( _.findWhere( skope_server_data.czr_new_skopes, { skope : 'group' } ) ) ){
60
  var _local_ = _.findWhere( skope_server_data.czr_new_skopes, { skope : 'local' } );
61
  if ( ! _.isEmpty( _local_ ) && ! _.contains( FlatSkopeLocalizedData.noGroupSkopeList, _local_.level ) ) {
62
  api.errorLog( 'No group level skope sent while there should be one' );
63
  }
64
  }
65
+
66
+ //1) Updated the collection with normalized skopes => prepareSkopeForAPI + api.czr_currentSkopesCollection( collection )
67
+ //2) When the api.czr_currentSkopesCollection() Value is set => instantiates the missing skope
68
+ //3) Set the skope layout view when the skope embedded promise is resolved
69
  if ( serverControlParams.isDevMode ) {
70
  api.czr_skopeBase.updateSkopeCollection( skope_server_data.czr_new_skopes , preview.channel() );
71
  } else {
75
  return;
76
  }
77
  }
78
+
79
+ //@return void()
80
+ // => refresh skope notice below the skope switcher title
81
+ // => refresh bottom skope infos in the preview
82
+ // var _refreshSkopeInfosNotices = function() {
83
+ // console.log('REFRESH SKOPE TITLE IF NEEDED ?');
84
+ // //WRITE THE CURRENT SKOPE TITLE
85
+ // //self._writeCurrentSkopeTitle();
86
+ // };
87
+
88
+ //Always wait for the initial collection to be populated
89
  api.czr_initialSkopeCollectionPopulated.then( function() {
90
+ //console.log('INITIAL SKOPE COLLECTION POPULATED');
91
  if ( ! _.has( skope_server_data, 'czr_new_skopes' ) || _.isEmpty( skope_server_data.czr_new_skopes ) ) {
92
  api.errorLog( 'Missing skope data after refresh', skope_server_data );
93
  }
94
+
95
+ // set the local and group skope id
96
  api.czr_activeSkopes( {
97
  'local' : self.getSkopeProperty( 'skope_id', 'local' ),
98
  'group' : self.getSkopeProperty( 'skope_id', 'group' )
99
  });
100
 
101
+ // if ( ! _.isEmpty( previousSkopeCollection ) ) { //Rewrite the title when the local skope has changed
102
+ // var _prevLoc = _.findWhere( previousSkopeCollection , { skope : 'local' } ).opt_name,
103
+ // _newLoc =_.findWhere( skope_server_data.czr_new_skopes, { skope : 'local' } ).opt_name;
104
+
105
+ // if ( _newLoc !== _prevLoc ) {
106
+ // //REFRESH SKOPE INFOS IN TITLE AND PREVIEW FRAME
107
+ // _refreshSkopeInfosNotices();
108
+ // }
109
+ // }
110
+
111
  });
112
  });//api.previewer.bind
113
  });//api.bind( 'ready'
114
+
115
+
116
+ //CURRENT SKOPE COLLECTION LISTENER
117
+ //The skope collection is set on 'czr-new-skopes-synced' triggered by the preview
118
+ //setup the callbacks of the skope collection update
119
+ //on init and on preview change : the collection of skopes is populated with new skopes
120
+ //=> instanciate the relevant skope object + render them
121
  api.czr_currentSkopesCollection.bind( function( to, from ) {
122
  return self.currentSkopesCollectionReact( to, from );
123
  }, { deferred : true });
124
+
125
+ ///////////////////// VARIOUS /////////////////////
126
+ //DECLARE THE LIST OF CONTROL TYPES FOR WHICH THE VIEW IS REFRESHED ON CHANGE
127
+ //self.refreshedControls = [ 'czr_cropped_image'];// [ 'czr_cropped_image', 'czr_multi_module', 'czr_module' ];
128
  api.trigger( 'czr_skopeBase_initialized' );
129
  }//initialize
130
  });//$.extend()
132
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
133
  ( function ( api, $, _ ) {
134
  $.extend( CZRSkopeBaseMths, {
135
+
136
+ //////////////////////////////////////////////////////////
137
+ /// <SKOPE HELPERSS>
138
+ // @return string
139
  getSkopeProperty : function( what, skope_level ) {
140
  what = what || 'skope_id';
141
  skope_level = skope_level || 'local';
142
  var _skope_data = _.findWhere( api.czr_currentSkopesCollection(), { skope : skope_level });
143
  if ( _.isEmpty( _skope_data ) ){
144
+ // display an error message if local skope not found. Should always be defined.
145
  if ( 'local' == skope_level ) {
146
  api.errorLog( "getSkopeProperty => local skope missing, returning not_set" );
147
  }
153
  return _skope_data[ what ];
154
  }
155
  },
156
+
157
+
158
+ //@return string
159
  firstToUpperCase : function( str ) {
160
  return ! _.isString( str ) ? '' : str.substr(0, 1).toUpperCase() + str.substr(1);
161
  }
162
+
163
+
164
+
165
+ // //@return string
166
+ // buildSkopeLink : function( skope_id ) {
167
+ // if ( ! api.czr_skope.has( skope_id ) ) {
168
+ // api.errorLog( 'buildSkopeLink : the requested skope id is not registered : ' + skope_id );
169
+ // return '';
170
+ // }
171
+ // var _link_title = [ serverControlParams.i18n.skope['Switch to scope'], api.czr_skope( skope_id )().title ].join(' : ');
172
+ // return [
173
+ // '<span class="czr-skope-switch" title=" ' + _link_title + '" data-skope-id="' + skope_id + '">',
174
+ // api.czr_skope( skope_id )().title,
175
+ // '</span>'
176
+ // ].join( '' );
177
+ // },
178
  });//$.extend
179
  })( wp.customize , jQuery, _ );//@global serverControlParams
180
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
181
  (function ( api, $, _ ) {
182
  $.extend( CZRSkopeBaseMths, {
183
+ //Fired on 'czr-new-skopes-synced' triggered by the preview, each time the preview is refreshed.
184
+ //On a Save Action, api.czr_savedDirties has been populated =>
185
+ // 1) check if the server sends the same saved values
186
+ // 2) update the skope db properties with the latests saved ones
187
+ //
188
+ //A skope candidate is structured this way :
189
+ //{
190
+ // id:""
191
+ // long_title:"Site wide options"
192
+ // obj_id:""
193
+ // skope:"global"
194
+ // title:"Site wide options"
195
+ //}
196
+ //@see api_overrides
197
  updateSkopeCollection : function( sent_collection ) {
198
  var self = this,
199
  _api_ready_collection = [];
200
+
201
+ //normalize each sent skopes
202
  _.each( sent_collection, function( _skope ) {
203
  var skope_candidate = $.extend( true, {}, _skope );//deep clone to avoid any shared references
204
  _api_ready_collection.push( self.prepareSkopeForAPI( skope_candidate ) );
205
  });
206
+
207
+ //set the new collection of current skopes
208
+ //=> this will instantiate the not instantiated skopes
209
  api.czr_currentSkopesCollection( _api_ready_collection );
210
+
211
+ // set the group skope id
212
+ //console.log( "SKOPE COLLECTION UPDATED", api.czr_currentSkopesCollection() );
213
  },
214
+
215
+
216
+ //@param skope_candidate
217
+ ////A skope candidate is structured this way :
218
+ //{
219
+ // id:""
220
+ // long_title:"Site wide options"
221
+ // obj_id:""
222
+ // skope:"global"
223
+ // title:"Site wide options"
224
+ //}
225
  prepareSkopeForAPI : function( skope_candidate ) {
226
  if ( ! _.isObject( skope_candidate ) ) {
227
  throw new Error('prepareSkopeForAPI : a skope must be an object to be API ready');
268
  api_ready_skope[_key] = _candidate_val;
269
  break;
270
  case 'values' :
271
+ // if ( ! _.isString( _candidate_val ) ) {
272
+ // throw new Error('prepareSkopeForAPI : invalid "values" for skope ' + _candidate_val.skope );
273
+ // }
274
  api_ready_skope[_key] = _candidate_val;
275
  break;
276
  default :
278
  break;
279
  }//switch
280
  });
281
+
282
+ //Finally, generate the id and the title
283
  api_ready_skope.id = api_ready_skope.skope + '_' + api_ready_skope.skope_id;
284
  if ( ! _.isString( api_ready_skope.id ) || _.isEmpty( api_ready_skope.id ) ) {
285
  throw new Error('prepareSkopeForAPI : a skope id must a string not empty');
290
  }
291
  return api_ready_skope;
292
  },
293
+
294
+
295
+ //cb of api.czr_currentSkopesCollection.callbacks
296
+ //fired in initialize
297
  currentSkopesCollectionReact : function( to, from ) {
298
  var dfd = $.Deferred();
299
+
300
+ //ON INITIAL COLLECTION POPULATE, RESOLVE THE DEFERRED STATE
301
+ //=> this way we can defer earlier actions.
302
+ //For example when autofocus is requested, the section might be expanded before the initial skope collection is sent from the preview.
303
  if ( _.isEmpty( from ) && ! _.isEmpty( to ) ) {
304
  api.czr_initialSkopeCollectionPopulated.resolve();
305
  }
310
  })( wp.customize , jQuery, _);//@global serverControlParams
311
  var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
312
  (function ( api, $ ) {
313
+ // Skope
314
  $.extend( CZRSkopeBaseMths, api.Events );
315
  var CZR_SkopeBase = api.Class.extend( CZRSkopeBaseMths );
316
+
317
+ // Schedule skope instantiation on api ready
318
+ // api.bind( 'ready' , function() {
319
+ // api.czr_skopeBase = new api.CZR_SkopeBase();
320
+ // });
321
  api.czr_skopeBase = new CZR_SkopeBase();
322
  })( wp.customize, jQuery );
inc/czr-skope/index.php CHANGED
@@ -6,13 +6,21 @@ if ( did_action('nimble_skope_loaded') ) {
6
  }
7
  return;
8
  }
 
 
9
  global $czr_skope_namespace;
10
  $czr_skope_namespace = __NAMESPACE__ . '\\';
11
 
12
  do_action( 'nimble_skope_loaded' );
 
 
13
  function Flat_Skop_Base( $params = array() ) {
14
  return Flat_Skop_Base::skp_get_instance( $params );
15
  }
 
 
 
 
16
  function skp_get_default_skope_model() {
17
  return array(
18
  'title' => '',
@@ -20,15 +28,26 @@ function skp_get_default_skope_model() {
20
  'ctx_title' => '',
21
  'id' => '',
22
  'skope' => '',
 
23
  'obj_id' => '',
24
  'skope_id' => '',
25
  'values' => ''
26
  );
27
  }
 
 
 
28
  function skp_get_no_group_skope_list() {
29
  return array( 'home', 'search', '404', 'date' );
30
  }
31
 
 
 
 
 
 
 
 
32
  function skp_trim_text( $text, $text_length, $more ) {
33
  if ( ! $text )
34
  return '';
@@ -47,6 +66,15 @@ function skp_trim_text( $text, $text_length, $more ) {
47
  }
48
  return ( ( $end_substr < $text_length ) && $more ) ? $text : $text . ' ' .$more ;
49
  }
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Return the current skope
52
  * Front / Back agnostic.
@@ -63,8 +91,19 @@ function skp_trim_text( $text, $text_length, $more ) {
63
  * @return a string of all concatenated ctx parts (default) 0R an array of the ctx parts
64
  */
65
  function skp_get_skope( $_requesting_wot = null, $_return_string = true, $requested_parts = array() ) {
 
 
 
 
 
 
 
66
  $parts = ( is_array( $requested_parts ) && ! empty( $requested_parts ) ) ? $requested_parts : skp_get_query_skope();
67
 
 
 
 
 
68
  $_return = array();
69
  $meta_type = $type = $obj_id = false;
70
 
@@ -94,16 +133,23 @@ function skp_get_skope( $_requesting_wot = null, $_return_string = true, $reques
94
  break;
95
 
96
  default:
 
 
 
97
  if ( false !== $meta_type && false !== $obj_id ) {
98
  $_return = array( "meta_type" => "{$meta_type}" , "type" => "{$type}", "id" => "{$obj_id}" );
99
  }
 
100
  else if ( false !== $meta_type && ! $obj_id ) {
101
  $_return = array( "meta_type" => "{$meta_type}", "type" => "{$type}" );
102
  }
 
103
  else if ( false !== $obj_id ) {
104
  $_return = array( "id" => "{$obj_id}" );
105
  }
106
  else {
 
 
107
  if ( defined( 'NIMBLE_DEV' ) && NIMBLE_DEV ) {
108
  error_log( __FUNCTION__ . ' error when building the local skope, no object_id provided.');
109
  error_log( print_r( $parts, true) );
@@ -111,15 +157,24 @@ function skp_get_skope( $_requesting_wot = null, $_return_string = true, $reques
111
  }
112
  break;
113
  }
 
 
114
  if ( ! $_return_string ) {
115
  return $_return;
116
  }
 
 
117
  if ( ! is_array( $_return ) || ( is_array( $_return ) && empty( $_return ) ) ) {
118
  return '';
119
  }
 
 
 
120
  if ( ! is_null( $_requesting_wot ) ) {
121
  return isset( $_return[ $_requesting_wot ] ) ? $_return[ $_requesting_wot ] : '';
122
  }
 
 
123
  $_concat = "";
124
  foreach ( $_return as $_key => $_part ) {
125
  if ( empty( $_concat) ) {
@@ -139,32 +194,52 @@ function skp_get_skope( $_requesting_wot = null, $_return_string = true, $reques
139
  * @return array of ctx parts
140
  */
141
  function skp_get_query_skope() {
 
142
  global $wp_the_query;
143
  if ( ! isset( $wp_the_query ) || empty( $wp_the_query ) )
144
  return array();
 
145
  if ( ! empty( Flat_Skop_Base()->query_skope ) )
146
  return Flat_Skop_Base()->query_skope;
147
 
148
  $queried_object = get_queried_object();
149
 
 
 
 
 
150
  $meta_type = $type = $obj_id = false;
 
 
 
 
 
 
151
  if ( ! is_null( $queried_object ) && is_object( $queried_object ) ) {
 
152
  if ( isset($queried_object -> post_type) ) {
153
  $meta_type = 'post';
154
  $type = $queried_object -> post_type;
155
  $obj_id = $queried_object -> ID;
156
  }
 
 
157
  if ( isset($queried_object -> taxonomy) && isset($queried_object -> term_id) ) {
158
  $meta_type = 'tax';
159
  $type = $queried_object -> taxonomy;
160
  $obj_id = $queried_object -> term_id;
161
  }
162
  }
 
 
163
  if ( is_author() ) {
164
  $meta_type = 'user';
165
  $type = 'author';
166
  $obj_id = $wp_the_query ->get( 'author' );
167
  }
 
 
 
168
  if ( is_post_type_archive() ) {
169
  $obj_id = 'post_type_archive' . '_'. $wp_the_query ->get( 'post_type' );
170
  }
@@ -180,6 +255,25 @@ function skp_get_query_skope() {
180
 
181
  if ( skp_is_real_home() ) {
182
  $obj_id = 'home';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  if ( ! is_home() && 'page' === get_option( 'show_on_front' ) ) {
184
  $home_page_id = get_option( 'page_on_front' );
185
  if ( 0 < $home_page_id ) {
@@ -187,13 +281,21 @@ function skp_get_query_skope() {
187
  }
188
  }
189
  }
 
 
190
  if ( did_action( 'wp' ) ) {
191
  Flat_Skop_Base()->query_skope = apply_filters( 'skp_get_query_skope' , array( 'meta_type' => $meta_type , 'type' => $type , 'obj_id' => $obj_id ) , $queried_object );
192
  }
193
 
194
  return Flat_Skop_Base()->query_skope;
195
  }
 
 
 
196
  function skp_get_skope_id( $level = 'local' ) {
 
 
 
197
  $new_skope_ids = array( 'local' => '_skope_not_set_', 'group' => '_skope_not_set_' );
198
  if ( did_action( 'wp' ) ) {
199
  if ( empty( Flat_Skop_Base()->current_skope_ids ) ) {
@@ -203,6 +305,9 @@ function skp_get_skope_id( $level = 'local' ) {
203
  Flat_Skop_Base()->current_skope_ids = $new_skope_ids;
204
 
205
  $skope_id_to_return = $new_skope_ids[ $level ];
 
 
 
206
  } else {
207
  $new_skope_ids = Flat_Skop_Base()->current_skope_ids;
208
  $skope_id_to_return = $new_skope_ids[ $level ];
@@ -210,18 +315,33 @@ function skp_get_skope_id( $level = 'local' ) {
210
  } else {
211
  $skope_id_to_return = array_key_exists( $level, $new_skope_ids ) ? $new_skope_ids[ $level ] : '_skope_not_set_';
212
  }
 
 
213
  return apply_filters( 'skp_get_skope_id', $skope_id_to_return, $level );
214
  }
 
 
 
 
 
 
 
215
  function skp_build_skope_id( $args = array() ) {
216
  $skope_id = '_skope_not_set_';
 
 
217
  $args = is_array( $args ) ? $args : array();
218
  $args = wp_parse_args(
219
  $args,
220
  array( 'skope_string' => '', 'skope_type' => '', 'skope_level' => '' )
221
  );
 
 
222
  $args['skope_level'] = empty( $args['skope_level'] ) ? 'local' : $args['skope_level'];
223
  $args['skope_string'] = ( 'local' == $args['skope_level'] && empty( $args['skope_string'] ) ) ? skp_get_skope() : $args['skope_string'];
224
  $args['skope_type'] = ( 'group' == $args['skope_level'] && empty( $args['skope_type'] ) ) ? skp_get_skope( 'type' ) : $args['skope_type'];
 
 
225
  switch( $args[ 'skope_level'] ) {
226
  case 'local' :
227
  $skope_id = strtolower( NIMBLE_SKOPE_ID_PREFIX . $args[ 'skope_string' ] );
@@ -324,19 +444,31 @@ function skp_get_skope_title( $args = array() ) {
324
  $title = ucfirst( $title );
325
  return skp_trim_text( $title, $long ? 45 : 28, '...');
326
  }
 
 
 
327
  function skp_skope_has_no_group( $meta_type ) {
328
  return in_array(
329
  $meta_type,
330
  skp_get_no_group_skope_list()
331
  ) || is_post_type_archive();
332
  }
 
 
 
333
  function skp_skope_has_a_group( $meta_type ) {
334
  return in_array(
335
  $meta_type,
336
  array('post', 'tax', 'user')
337
  );
338
  }
 
 
 
 
339
  function skp_is_real_home() {
 
 
340
  return ( is_home() && ( 'posts' == get_option( 'show_on_front' ) || '__nothing__' == get_option( 'show_on_front' ) ) )
341
  || ( is_home() && 0 == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) )//<= this is the case when the user want to display a page on home but did not pick a page yet
342
  || is_front_page();
@@ -347,10 +479,14 @@ function skp_is_real_home() {
347
  * Returns a boolean
348
  */
349
  function skp_is_customizing() {
 
350
  global $pagenow;
351
  $_is_ajaxing_from_customizer = isset( $_POST['customized'] ) || isset( $_POST['wp_customize'] );
352
 
353
  $is_customizing = false;
 
 
 
354
  $is_customize_php_page = ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) );
355
  $is_customize_admin_page_one = (
356
  $is_customize_php_page
@@ -363,8 +499,12 @@ function skp_is_customizing() {
363
 
364
  if ( $is_customize_admin_page_one || $is_customize_admin_page_two ) {
365
  $is_customizing = true;
 
 
 
366
  } else if ( is_customize_preview() || ( ! is_admin() && isset($_REQUEST['customize_messenger_channel']) ) ) {
367
  $is_customizing = true;
 
368
  } else if ( $_is_ajaxing_from_customizer && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
369
  $is_customizing = true;
370
  }
@@ -386,6 +526,9 @@ function skp_is_previewing_live_changeset() {
386
  return ! isset( $_POST['customize_messenger_channel']) && is_customize_preview();
387
  }
388
  ?><?php
 
 
 
389
  if ( ! class_exists( 'Flat_Skop_Base' ) ) :
390
  class Flat_Skop_Base {
391
  static $instance;
@@ -412,8 +555,11 @@ if ( ! class_exists( 'Flat_Skop_Base' ) ) :
412
  }
413
  endif;
414
  ?><?php
 
 
415
  if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
416
  class Flat_Skop_Register_And_Load_Control_Assets extends Flat_Skop_Base {
 
417
  public function skp_register_and_load_control_assets() {
418
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'skp_enqueue_controls_js_css' ), 20 );
419
  }
@@ -421,6 +567,7 @@ if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
421
  public function skp_enqueue_controls_js_css() {
422
  $_use_unminified = defined('CZR_DEV')
423
  && true === CZR_DEV
 
424
  && file_exists( sprintf( '%s/assets/czr/js/czr-skope-base.js' , dirname( __FILE__ ) ) );
425
 
426
  $_prod_script_path = sprintf(
@@ -431,6 +578,7 @@ if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
431
 
432
  wp_enqueue_script(
433
  'czr-skope-base',
 
434
  $_prod_script_path,
435
  array('customize-controls' , 'jquery', 'underscore'),
436
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : wp_get_theme() -> version,
@@ -456,15 +604,21 @@ endif;
456
  /* ------------------------------------------------------------------------- */
457
  if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
458
  class Flat_Export_Skope_Data_And_Send_To_Panel extends Flat_Skop_Register_And_Load_Control_Assets {
 
459
  public function skp_export_skope_data_and_schedule_sending_to_panel() {
460
  add_action( 'wp_footer', array( $this, 'skp_print_server_skope_data') , 30 );
461
  }
 
 
 
462
  public function skp_print_server_skope_data() {
463
  if ( ! skp_is_customize_preview_frame() )
464
  return;
465
 
466
  global $wp_query, $wp_customize;
467
  $_meta_type = skp_get_skope( 'meta_type', true );
 
 
468
  $_czr_skopes = $this->_skp_get_json_export_ready_skopes();
469
  ?>
470
  <script type="text/javascript" id="czr-print-skop">
@@ -492,10 +646,30 @@ if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
492
  /* ------------------------------------------------------------------------- *
493
  * CUSTOMIZE PREVIEW : BUILD SKOPES JSON
494
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  private function _skp_get_json_export_ready_skopes() {
496
  $skopes = array();
497
  $_meta_type = skp_get_skope( 'meta_type', true );
 
 
498
  $defaults = skp_get_default_skope_model();
 
499
  $skopes[] = wp_parse_args(
500
  array(
501
  'title' => skp_get_skope_title( array( 'level' => 'global' ) ),
@@ -506,6 +680,14 @@ if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
506
  ),
507
  $defaults
508
  );
 
 
 
 
 
 
 
 
509
  if ( skp_get_skope('meta_type') ) {
510
  $skopes[] = wp_parse_args(
511
  array(
@@ -519,6 +701,9 @@ if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
519
  $defaults
520
  );
521
  }
 
 
 
522
  $skopes[] = wp_parse_args(
523
  array(
524
  'title' => skp_get_skope_title( array( 'level' => 'local', 'meta_type' => $_meta_type ) ),
@@ -540,56 +725,101 @@ endif;
540
 
541
  if ( ! class_exists( 'Flat_Skope_Clean_Final' ) ) :
542
  final class Flat_Skope_Clean_Final extends Flat_Export_Skope_Data_And_Send_To_Panel {
 
543
  public function skp_schedule_cleaning_on_object_delete() {
544
  add_action( 'delete_post', array( $this, 'skp_clean_skopified_posts' ) );
545
  add_action( 'delete_term_taxonomy', array( $this, 'skp_clean_skopified_taxonomies' ) );
546
  add_action( 'delete_user', array( $this, 'skp_clean_skopified_users' ) );
547
  }
 
 
 
 
 
 
548
  public function skp_clean_skopified_posts( $postid ) {
549
  $deletion_candidate = get_post( $postid );
550
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
551
  return;
 
 
 
 
 
552
  if ( ! is_post_type_viewable( $deletion_candidate -> post_type ) )
553
  return;
 
 
554
  $skope_string = skp_get_skope( null, true, array(
555
  'meta_type' => 'post',
556
  'type' => $deletion_candidate -> post_type,
557
  'obj_id' => $postid
558
  ) );
 
 
559
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
 
 
560
  $skope_post_id_candidate = get_theme_mod( $skope_id );
561
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
 
562
  wp_delete_post( $skope_post_id_candidate );
 
563
  remove_theme_mod( $skope_id );
564
  }
565
  }
 
 
 
566
  public function skp_clean_skopified_taxonomies( $term_id ) {
567
  $deletion_candidate = get_term( $term_id );
568
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
569
  return;
 
 
 
 
570
  $skope_string = skp_get_skope( null, true, array(
571
  'meta_type' => 'tax',
572
  'type' => $deletion_candidate -> taxonomy,
573
  'obj_id' => $term_id
574
  ) );
 
 
575
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
 
 
576
  $skope_post_id_candidate = get_theme_mod( $skope_id );
577
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
 
578
  wp_delete_post( $skope_post_id_candidate );
 
579
  remove_theme_mod( $skope_id );
 
580
  }
581
  }
 
 
 
582
  public function skp_clean_skopified_users( $user_id ) {
 
583
  $skope_string = skp_get_skope( null, true, array(
584
  'meta_type' => 'user',
585
  'type' => 'author',
586
  'obj_id' => $user_id
587
  ) );
 
 
588
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
 
 
589
  $skope_post_id_candidate = get_theme_mod( $skope_id );
590
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
 
591
  wp_delete_post( $skope_post_id_candidate );
 
592
  remove_theme_mod( $skope_id );
 
593
  }
594
  }
595
  }//class
6
  }
7
  return;
8
  }
9
+
10
+ // Set the namsepace as a global so we can use it when fired from another theme/plugin using the fmk
11
  global $czr_skope_namespace;
12
  $czr_skope_namespace = __NAMESPACE__ . '\\';
13
 
14
  do_action( 'nimble_skope_loaded' );
15
+
16
+ //Creates a new instance
17
  function Flat_Skop_Base( $params = array() ) {
18
  return Flat_Skop_Base::skp_get_instance( $params );
19
  }
20
+
21
+ /////////////////////////////////////////////////////////////////
22
+ // <DEFINITIONS>
23
+ // THE SKOPE MODEL
24
  function skp_get_default_skope_model() {
25
  return array(
26
  'title' => '',
28
  'ctx_title' => '',
29
  'id' => '',
30
  'skope' => '',
31
+ //'level' => '',
32
  'obj_id' => '',
33
  'skope_id' => '',
34
  'values' => ''
35
  );
36
  }
37
+
38
+
39
+ // those contexts have no group
40
  function skp_get_no_group_skope_list() {
41
  return array( 'home', 'search', '404', 'date' );
42
  }
43
 
44
+ /////////////////////////////////////////////////////////////////
45
+ // </DEFINITIONS>
46
+
47
+
48
+ /////////////////////////////////////////////////////////////////
49
+ // HELPERS
50
+
51
  function skp_trim_text( $text, $text_length, $more ) {
52
  if ( ! $text )
53
  return '';
66
  }
67
  return ( ( $end_substr < $text_length ) && $more ) ? $text : $text . ' ' .$more ;
68
  }
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ /////////////////////////////////////////////////////////////////
77
+ // SKOPE HELPERS
78
  /**
79
  * Return the current skope
80
  * Front / Back agnostic.
91
  * @return a string of all concatenated ctx parts (default) 0R an array of the ctx parts
92
  */
93
  function skp_get_skope( $_requesting_wot = null, $_return_string = true, $requested_parts = array() ) {
94
+ //skope builder from the wp $query
95
+ //=> returns :
96
+ // the meta_type : post, tax, user
97
+ // the type : post_type, taxonomy name, author
98
+ // the id : post id, term id, user id
99
+
100
+ // if $parts are provided, use them.
101
  $parts = ( is_array( $requested_parts ) && ! empty( $requested_parts ) ) ? $requested_parts : skp_get_query_skope();
102
 
103
+ // error_log( '<SKOPE PARTS>' );
104
+ // error_log( print_r( $parts, true ) );
105
+ // error_log( '</SKOPE PARTS>' );
106
+
107
  $_return = array();
108
  $meta_type = $type = $obj_id = false;
109
 
133
  break;
134
 
135
  default:
136
+ //LOCAL
137
+ //here we don't check if there's a type this is the case where there must be one when a meta type (post, tax, user) is defined.
138
+ //typically the skope will look like post_page_25
139
  if ( false !== $meta_type && false !== $obj_id ) {
140
  $_return = array( "meta_type" => "{$meta_type}" , "type" => "{$type}", "id" => "{$obj_id}" );
141
  }
142
+ //GROUP
143
  else if ( false !== $meta_type && ! $obj_id ) {
144
  $_return = array( "meta_type" => "{$meta_type}", "type" => "{$type}" );
145
  }
146
+ //LOCAL WITH NO GROUP : home ( when home displays "Your latests posts" ) , 404, search, date, post type archive
147
  else if ( false !== $obj_id ) {
148
  $_return = array( "id" => "{$obj_id}" );
149
  }
150
  else {
151
+ // don't print the skope error log if not in dev mode
152
+ // fixes : https://github.com/presscustomizr/czr-skope/issues/1
153
  if ( defined( 'NIMBLE_DEV' ) && NIMBLE_DEV ) {
154
  error_log( __FUNCTION__ . ' error when building the local skope, no object_id provided.');
155
  error_log( print_r( $parts, true) );
157
  }
158
  break;
159
  }
160
+
161
+ //return the parts array if not a string requested
162
  if ( ! $_return_string ) {
163
  return $_return;
164
  }
165
+
166
+ //don't go further if not an array or empty
167
  if ( ! is_array( $_return ) || ( is_array( $_return ) && empty( $_return ) ) ) {
168
  return '';
169
  }
170
+
171
+ //if a specific part of the ctx is requested, don't concatenate
172
+ //return the part if exists
173
  if ( ! is_null( $_requesting_wot ) ) {
174
  return isset( $_return[ $_requesting_wot ] ) ? $_return[ $_requesting_wot ] : '';
175
  }
176
+
177
+ //generate the ctx string from the array of ctx_parts
178
  $_concat = "";
179
  foreach ( $_return as $_key => $_part ) {
180
  if ( empty( $_concat) ) {
194
  * @return array of ctx parts
195
  */
196
  function skp_get_query_skope() {
197
+ //don't call get_queried_object if the $query is not defined yet
198
  global $wp_the_query;
199
  if ( ! isset( $wp_the_query ) || empty( $wp_the_query ) )
200
  return array();
201
+ // is it cached already ?
202
  if ( ! empty( Flat_Skop_Base()->query_skope ) )
203
  return Flat_Skop_Base()->query_skope;
204
 
205
  $queried_object = get_queried_object();
206
 
207
+ // error_log( '<GET QUERIED OBJECT>' . gettype( $queried_object ) );
208
+ // error_log( print_r( $wp_the_query , true ) );
209
+ // error_log( '</GET QUERIED OBJECT>' );
210
+
211
  $meta_type = $type = $obj_id = false;
212
+
213
+ // The queried object is NULL on
214
+ // - home when displaying the latest posts
215
+ // - date archives
216
+ // - 404 page
217
+ // - search page
218
  if ( ! is_null( $queried_object ) && is_object( $queried_object ) ) {
219
+ //post, custom post types, page
220
  if ( isset($queried_object -> post_type) ) {
221
  $meta_type = 'post';
222
  $type = $queried_object -> post_type;
223
  $obj_id = $queried_object -> ID;
224
  }
225
+
226
+ //taxinomies : tags, categories, custom tax type
227
  if ( isset($queried_object -> taxonomy) && isset($queried_object -> term_id) ) {
228
  $meta_type = 'tax';
229
  $type = $queried_object -> taxonomy;
230
  $obj_id = $queried_object -> term_id;
231
  }
232
  }
233
+
234
+ //author archive page
235
  if ( is_author() ) {
236
  $meta_type = 'user';
237
  $type = 'author';
238
  $obj_id = $wp_the_query ->get( 'author' );
239
  }
240
+
241
+ //SKOPES WITH NO GROUPS
242
+ //post type archive object
243
  if ( is_post_type_archive() ) {
244
  $obj_id = 'post_type_archive' . '_'. $wp_the_query ->get( 'post_type' );
245
  }
255
 
256
  if ( skp_is_real_home() ) {
257
  $obj_id = 'home';
258
+ // December 2018
259
+ // when the home page is a page, the skope now includes the page id, instead of being generic as it was since then : skp__post_page_home
260
+ // This has been introduced to facilitate the compatibility of the Nimble Builder with multilanguage plugins like polylang
261
+ // => Allows user to create a different home page for each languages
262
+ //
263
+ // To summarize,
264
+ // Before dec 2018 :
265
+ // - home page is blog page => skope_id = skp___home
266
+ // - home page is page => skope_id = skp__post_page_home
267
+ //
268
+ // After Dec 2018
269
+ // - hope page is blog page => skope_id is unchanged = skp__home
270
+ // - home page is a page => skope_id is changed to = skp__post_page_{$static_home_page_id}
271
+ //
272
+ // This means that if Nimble sections, or any other contextualizations had been made on home when 'page' === get_option( 'show_on_front' ),
273
+ // for which the corresponding skope_id was skp__post_page_home,
274
+ // those settings have to be copied in the skp__post_page_{$static_home_page_id} skope settings
275
+
276
+ // If we are on the real home page, but displaying a static page then set the static page id as obj_id
277
  if ( ! is_home() && 'page' === get_option( 'show_on_front' ) ) {
278
  $home_page_id = get_option( 'page_on_front' );
279
  if ( 0 < $home_page_id ) {
281
  }
282
  }
283
  }
284
+
285
+ // cache now
286
  if ( did_action( 'wp' ) ) {
287
  Flat_Skop_Base()->query_skope = apply_filters( 'skp_get_query_skope' , array( 'meta_type' => $meta_type , 'type' => $type , 'obj_id' => $obj_id ) , $queried_object );
288
  }
289
 
290
  return Flat_Skop_Base()->query_skope;
291
  }
292
+
293
+
294
+ //@return the skope prefix used both when customizing and on front
295
  function skp_get_skope_id( $level = 'local' ) {
296
+ // CACHE THE SKOPE WHEN 'wp' DONE
297
+ // the skope id is used when filtering the options, called hundreds of times.
298
+ // We'll get hight performances with a cached value instead of using the skp_get_skope_id() function on each call.
299
  $new_skope_ids = array( 'local' => '_skope_not_set_', 'group' => '_skope_not_set_' );
300
  if ( did_action( 'wp' ) ) {
301
  if ( empty( Flat_Skop_Base()->current_skope_ids ) ) {
305
  Flat_Skop_Base()->current_skope_ids = $new_skope_ids;
306
 
307
  $skope_id_to_return = $new_skope_ids[ $level ];
308
+ // error_log('<SKOPE ID cached in skp_get_skope_id>');
309
+ // error_log( print_r( $new_skope_ids, true ) );
310
+ // error_log('</SKOPE ID cached in skp_get_skope_id>');
311
  } else {
312
  $new_skope_ids = Flat_Skop_Base()->current_skope_ids;
313
  $skope_id_to_return = $new_skope_ids[ $level ];
315
  } else {
316
  $skope_id_to_return = array_key_exists( $level, $new_skope_ids ) ? $new_skope_ids[ $level ] : '_skope_not_set_';
317
  }
318
+ // error_log('$skope_id_to_return => ' . $level . ' ' . $skope_id_to_return );
319
+ // error_log( print_r( Flat_Skop_Base() -> current_skope_ids , true ) );
320
  return apply_filters( 'skp_get_skope_id', $skope_id_to_return, $level );
321
  }
322
+
323
+ //@param args = array(
324
+ // 'skope_string' => skp_get_skope(),
325
+ // 'skope_type' => $skp_type,
326
+ // 'skope_level' => 'local'
327
+ //)
328
+ //@return string
329
  function skp_build_skope_id( $args = array() ) {
330
  $skope_id = '_skope_not_set_';
331
+
332
+ // normalizes
333
  $args = is_array( $args ) ? $args : array();
334
  $args = wp_parse_args(
335
  $args,
336
  array( 'skope_string' => '', 'skope_type' => '', 'skope_level' => '' )
337
  );
338
+
339
+ // set params if not provided
340
  $args['skope_level'] = empty( $args['skope_level'] ) ? 'local' : $args['skope_level'];
341
  $args['skope_string'] = ( 'local' == $args['skope_level'] && empty( $args['skope_string'] ) ) ? skp_get_skope() : $args['skope_string'];
342
  $args['skope_type'] = ( 'group' == $args['skope_level'] && empty( $args['skope_type'] ) ) ? skp_get_skope( 'type' ) : $args['skope_type'];
343
+
344
+ // generate skope_id for two cases : local or group
345
  switch( $args[ 'skope_level'] ) {
346
  case 'local' :
347
  $skope_id = strtolower( NIMBLE_SKOPE_ID_PREFIX . $args[ 'skope_string' ] );
444
  $title = ucfirst( $title );
445
  return skp_trim_text( $title, $long ? 45 : 28, '...');
446
  }
447
+
448
+ //@return bool
449
+ //=> tells if the current skope is part of the ones without group
450
  function skp_skope_has_no_group( $meta_type ) {
451
  return in_array(
452
  $meta_type,
453
  skp_get_no_group_skope_list()
454
  ) || is_post_type_archive();
455
  }
456
+
457
+ //@return bool
458
+ //Tells if the current skope has a group level
459
  function skp_skope_has_a_group( $meta_type ) {
460
  return in_array(
461
  $meta_type,
462
  array('post', 'tax', 'user')
463
  );
464
  }
465
+
466
+
467
+
468
+ //@return bool
469
  function skp_is_real_home() {
470
+ // Warning : when show_on_front is a page, but no page_on_front has been picked yet, is_home() is true
471
+ // beware of https://github.com/presscustomizr/nimble-builder/issues/349
472
  return ( is_home() && ( 'posts' == get_option( 'show_on_front' ) || '__nothing__' == get_option( 'show_on_front' ) ) )
473
  || ( is_home() && 0 == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) )//<= this is the case when the user want to display a page on home but did not pick a page yet
474
  || is_front_page();
479
  * Returns a boolean
480
  */
481
  function skp_is_customizing() {
482
+ //checks if is customizing : two contexts, admin and front (preview frame)
483
  global $pagenow;
484
  $_is_ajaxing_from_customizer = isset( $_POST['customized'] ) || isset( $_POST['wp_customize'] );
485
 
486
  $is_customizing = false;
487
+ // the check on $pagenow does NOT work on multisite install @see https://github.com/presscustomizr/nimble-builder/issues/240
488
+ // That's why we also check with other global vars
489
+ // @see wp-includes/theme.php, _wp_customize_include()
490
  $is_customize_php_page = ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) );
491
  $is_customize_admin_page_one = (
492
  $is_customize_php_page
499
 
500
  if ( $is_customize_admin_page_one || $is_customize_admin_page_two ) {
501
  $is_customizing = true;
502
+ //hu_is_customize_preview_frame() ?
503
+ // Note : is_customize_preview() is not able to differentiate when previewing in the customizer and when previewing a changeset draft.
504
+ // @todo => change this
505
  } else if ( is_customize_preview() || ( ! is_admin() && isset($_REQUEST['customize_messenger_channel']) ) ) {
506
  $is_customizing = true;
507
+ // hu_doing_customizer_ajax()
508
  } else if ( $_is_ajaxing_from_customizer && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
509
  $is_customizing = true;
510
  }
526
  return ! isset( $_POST['customize_messenger_channel']) && is_customize_preview();
527
  }
528
  ?><?php
529
+
530
+ ////////////////////////////////////////////////////////////////
531
+ // FLAT SKOPE BASE
532
  if ( ! class_exists( 'Flat_Skop_Base' ) ) :
533
  class Flat_Skop_Base {
534
  static $instance;
555
  }
556
  endif;
557
  ?><?php
558
+ /////////////////////////////////////////////////////////////////
559
+ // PRINT CUSTOMIZER JAVASCRIPT + LOCALIZED DATA
560
  if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
561
  class Flat_Skop_Register_And_Load_Control_Assets extends Flat_Skop_Base {
562
+ // Fired in Flat_Skop_Base::__construct()
563
  public function skp_register_and_load_control_assets() {
564
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'skp_enqueue_controls_js_css' ), 20 );
565
  }
567
  public function skp_enqueue_controls_js_css() {
568
  $_use_unminified = defined('CZR_DEV')
569
  && true === CZR_DEV
570
+ // && false === strpos( dirname( dirname( dirname (__FILE__) ) ) , 'inc/wfc' )
571
  && file_exists( sprintf( '%s/assets/czr/js/czr-skope-base.js' , dirname( __FILE__ ) ) );
572
 
573
  $_prod_script_path = sprintf(
578
 
579
  wp_enqueue_script(
580
  'czr-skope-base',
581
+ //dev / debug mode mode?
582
  $_prod_script_path,
583
  array('customize-controls' , 'jquery', 'underscore'),
584
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : wp_get_theme() -> version,
604
  /* ------------------------------------------------------------------------- */
605
  if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
606
  class Flat_Export_Skope_Data_And_Send_To_Panel extends Flat_Skop_Register_And_Load_Control_Assets {
607
+ // Fired in Flat_Skop_Base::__construct()
608
  public function skp_export_skope_data_and_schedule_sending_to_panel() {
609
  add_action( 'wp_footer', array( $this, 'skp_print_server_skope_data') , 30 );
610
  }
611
+
612
+
613
+ //hook : 'wp_footer'
614
  public function skp_print_server_skope_data() {
615
  if ( ! skp_is_customize_preview_frame() )
616
  return;
617
 
618
  global $wp_query, $wp_customize;
619
  $_meta_type = skp_get_skope( 'meta_type', true );
620
+
621
+ // $_czr_scopes = array( );
622
  $_czr_skopes = $this->_skp_get_json_export_ready_skopes();
623
  ?>
624
  <script type="text/javascript" id="czr-print-skop">
646
  /* ------------------------------------------------------------------------- *
647
  * CUSTOMIZE PREVIEW : BUILD SKOPES JSON
648
  /* ------------------------------------------------------------------------- */
649
+ //generates the array of available scopes for a given context
650
+ //ex for a single post tagged #tag1 and #tag2 and categroized #cat1 :
651
+ //global
652
+ //all posts
653
+ //local
654
+ //posts tagged #tag1
655
+ //posts tagged #tag2
656
+ //posts categorized #cat1
657
+ //@return array()
658
+ //
659
+ //skp_get_skope_title() takes the following default args
660
+ //array(
661
+ // 'level' => '',
662
+ // 'meta_type' => null,
663
+ // 'long' => false,
664
+ // 'is_prefixed' => true
665
+ //)
666
  private function _skp_get_json_export_ready_skopes() {
667
  $skopes = array();
668
  $_meta_type = skp_get_skope( 'meta_type', true );
669
+
670
+ //default properties of the scope object
671
  $defaults = skp_get_default_skope_model();
672
+ //global and local and always sent
673
  $skopes[] = wp_parse_args(
674
  array(
675
  'title' => skp_get_skope_title( array( 'level' => 'global' ) ),
680
  ),
681
  $defaults
682
  );
683
+
684
+
685
+ //SPECIAL GROUPS
686
+ //@todo
687
+
688
+
689
+ //GROUP
690
+ //Do we have a group ? => if yes, then there must be a meta type
691
  if ( skp_get_skope('meta_type') ) {
692
  $skopes[] = wp_parse_args(
693
  array(
701
  $defaults
702
  );
703
  }
704
+
705
+
706
+ //LOCAL
707
  $skopes[] = wp_parse_args(
708
  array(
709
  'title' => skp_get_skope_title( array( 'level' => 'local', 'meta_type' => $_meta_type ) ),
725
 
726
  if ( ! class_exists( 'Flat_Skope_Clean_Final' ) ) :
727
  final class Flat_Skope_Clean_Final extends Flat_Export_Skope_Data_And_Send_To_Panel {
728
+ // Fired in Flat_Skop_Base::__construct()
729
  public function skp_schedule_cleaning_on_object_delete() {
730
  add_action( 'delete_post', array( $this, 'skp_clean_skopified_posts' ) );
731
  add_action( 'delete_term_taxonomy', array( $this, 'skp_clean_skopified_taxonomies' ) );
732
  add_action( 'delete_user', array( $this, 'skp_clean_skopified_users' ) );
733
  }
734
+
735
+
736
+ // Clean any associated skope post for all public post types : post, page, public cpt
737
+ // 'delete_post' Fires immediately before a post is deleted from the database.
738
+ // @see wp-includes/post.php
739
+ // don't have to return anything
740
  public function skp_clean_skopified_posts( $postid ) {
741
  $deletion_candidate = get_post( $postid );
742
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
743
  return;
744
+
745
+ // Stop here if the post type is not considered "viewable".
746
+ // For built-in post types such as posts and pages, the 'public' value will be evaluated.
747
+ // For all others, the 'publicly_queryable' value will be used.
748
+ // For example, the 'revision' post type, which is purely internal and not skopable, won't pass this test.
749
  if ( ! is_post_type_viewable( $deletion_candidate -> post_type ) )
750
  return;
751
+
752
+ // Force the skope parts normally retrieved with skp_get_query_skope()
753
  $skope_string = skp_get_skope( null, true, array(
754
  'meta_type' => 'post',
755
  'type' => $deletion_candidate -> post_type,
756
  'obj_id' => $postid
757
  ) );
758
+
759
+ // build a skope_id with the normalized function
760
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
761
+
762
+ // fetch the skope post id which, if exists, is set as a theme mod
763
  $skope_post_id_candidate = get_theme_mod( $skope_id );
764
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
765
+ // permanently delete the skope post from db
766
  wp_delete_post( $skope_post_id_candidate );
767
+ // remove the theme_mod
768
  remove_theme_mod( $skope_id );
769
  }
770
  }
771
+
772
+
773
+ // 'delete_term_taxonomy' Fires immediately before a term taxonomy ID is deleted.
774
  public function skp_clean_skopified_taxonomies( $term_id ) {
775
  $deletion_candidate = get_term( $term_id );
776
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
777
  return;
778
+
779
+ //error_log( print_r( $deletion_candidate, true ) );
780
+
781
+ // Force the skope parts normally retrieved with skp_get_query_skope()
782
  $skope_string = skp_get_skope( null, true, array(
783
  'meta_type' => 'tax',
784
  'type' => $deletion_candidate -> taxonomy,
785
  'obj_id' => $term_id
786
  ) );
787
+
788
+ // build a skope_id with the normalized function
789
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
790
+
791
+ // fetch the skope post id which, if exists, is set as a theme mod
792
  $skope_post_id_candidate = get_theme_mod( $skope_id );
793
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
794
+ // permanently delete the skope post from db
795
  wp_delete_post( $skope_post_id_candidate );
796
+ // remove the theme_mod
797
  remove_theme_mod( $skope_id );
798
+ //error_log( 'SUCCESSFULLY REMOVED SKOPE POST ID ' . $skope_post_id_candidate . ' AND THEME MOD ' . $skope_id );
799
  }
800
  }
801
+
802
+
803
+ // 'delete_user' Fires immediately before a user is deleted from the database.
804
  public function skp_clean_skopified_users( $user_id ) {
805
+ // Force the skope parts normally retrieved with skp_get_query_skope()
806
  $skope_string = skp_get_skope( null, true, array(
807
  'meta_type' => 'user',
808
  'type' => 'author',
809
  'obj_id' => $user_id
810
  ) );
811
+
812
+ // build a skope_id with the normalized function
813
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
814
+
815
+ // fetch the skope post id which, if exists, is set as a theme mod
816
  $skope_post_id_candidate = get_theme_mod( $skope_id );
817
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
818
+ // permanently delete the skope post from db
819
  wp_delete_post( $skope_post_id_candidate );
820
+ // remove the theme_mod
821
  remove_theme_mod( $skope_id );
822
+ //error_log( 'SUCCESSFULLY REMOVED SKOPE POST ID ' . $skope_post_id_candidate . ' AND THEME MOD ' . $skope_id );
823
  }
824
  }
825
  }//class
inc/sektions/ccat-czr-sektions.php CHANGED
@@ -3,6 +3,10 @@ namespace Nimble;
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
 
 
 
 
6
  add_action ( 'customize_controls_enqueue_scripts', '\Nimble\sek_enqueue_controls_js_css', 20 );
7
  function sek_enqueue_controls_js_css() {
8
  wp_enqueue_style(
@@ -20,6 +24,7 @@ function sek_enqueue_controls_js_css() {
20
 
21
  wp_enqueue_script(
22
  'czr-sektions',
 
23
  sprintf(
24
  '%1$s/assets/czr/sek/js/%2$s' ,
25
  NIMBLE_BASE_URL,
@@ -39,6 +44,7 @@ function sek_enqueue_controls_js_css() {
39
  'nimbleVersion' => NIMBLE_VERSION,
40
  'isDevMode' => sek_is_dev_mode(),
41
  'baseUrl' => NIMBLE_BASE_URL,
 
42
  'ajaxUrl' => admin_url( 'admin-ajax.php' ),
43
  'customizerURL' => admin_url( 'customize.php' ),
44
  'sektionsPanelId' => '__sektions__',
@@ -60,11 +66,23 @@ function sek_enqueue_controls_js_css() {
60
 
61
  'userSavedSektions' => get_option(NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS),
62
 
 
 
63
  'registeredModules' => CZR_Fmk_Base()->registered_modules,
 
 
64
  'preDropElementClass' => 'sortable-placeholder',
65
  'dropSelectors' => implode(',', [
 
 
 
 
 
 
66
  '.sek-drop-zone', //This is the selector for all eligible drop zones printed statically or dynamically on dragstart
67
  'body',// body will not be eligible for drop, but setting the body as drop zone allows us to fire dragenter / dragover actions, like toggling the "approaching" or "close" css class to real drop zone
 
 
68
  '.sek-content-preset_section-drop-zone'//between sections
69
  ]),
70
 
@@ -77,19 +95,27 @@ function sek_enqueue_controls_js_css() {
77
  'localOptionsMap' => SEK_Front_Construct::$local_options_map,
78
 
79
  'registeredLocations' => sek_get_locations(),
 
80
  'moduleCollection' => sek_get_module_collection(),
81
  'moduleIconPath' => NIMBLE_MODULE_ICON_PATH,
82
 
83
  'hasActiveCachePlugin' => sek_has_active_cache_plugin(),
 
 
84
  'idOfDetachedTinyMceTextArea' => NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID,
85
  'tinyMceNimbleEditorStylesheetUrl' => sprintf( '%1$s/assets/czr/sek/css/sek-tinymce-content.css', NIMBLE_BASE_URL ),
 
86
  'defaultToolbarBtns' => "formatselect,fontsizeselect,forecolor,bold,italic,underline,strikethrough,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,spellchecker,hr,pastetext,removeformat,charmap,outdent,indent,undo,redo",
 
87
  'basic_btns' => array('forecolor','bold','italic','underline','strikethrough','link','unlink'),
88
  'basic_btns_nolink' => array('forecolor','bold','italic','underline','strikethrough'),
89
 
90
  'eligibleForFeedbackNotification' => sek_get_feedback_notif_status(),
91
 
92
- 'presetSectionsModules' => array_keys( sek_get_sections_registration_params_api_data() )
 
 
 
93
  )
94
  )
95
  );//wp_localize_script()
@@ -164,6 +190,7 @@ function nimble_get_code_editor_settings( $args ) {
164
  'outline-none' => true,
165
  ),
166
  'jshint' => array(
 
167
  'boss' => true,
168
  'curly' => true,
169
  'eqeqeq' => true,
@@ -209,6 +236,8 @@ function nimble_get_code_editor_settings( $args ) {
209
 
210
  if ( isset( $args['type'] ) ) {
211
  $type = $args['type'];
 
 
212
  if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) {
213
  $type = 'text/x-diff';
214
  }
@@ -324,6 +353,8 @@ function nimble_get_code_editor_settings( $args ) {
324
  if ( ! empty( $settings['codemirror']['lint'] ) ) {
325
  $settings['codemirror']['gutters'][] = 'CodeMirror-lint-markers';
326
  }
 
 
327
  foreach ( wp_array_slice_assoc( $args, array( 'codemirror', 'csslint', 'jshint', 'htmlhint' ) ) as $key => $value ) {
328
  $settings[ $key ] = array_merge(
329
  $settings[ $key ],
@@ -371,7 +402,11 @@ function nimble_add_i18n_localized_control_params( $params ) {
371
  'Reset' => __('Reset', 'nimble-builder'),
372
  'Reset complete' => __('Reset complete', 'nimble-builder'),
373
  'Reset failed' => __('Reset failed', 'nimble-builder'),
 
 
374
  'Drag and drop content' => __('Drag and drop content', 'nimble-builder'),
 
 
375
  'Content Picker' => __('Content Picker', 'nimble-builder'),
376
  'Pick a module' => __('Pick a module', 'nimble-builder'),
377
  'Pick a pre-designed section' => __('Pick a pre-designed section', 'nimble-builder'),
@@ -404,6 +439,8 @@ function nimble_add_i18n_localized_control_params( $params ) {
404
  'Responsive settings : breakpoint, column direction' => __('Responsive settings : breakpoint, column direction', 'nimble-builder'),
405
 
406
  'Settings for the' => __('Settings for the', 'nimble-builder'),//section / column / module
 
 
407
  'Current page options' => __( 'Current page options', 'nimble-builder'),
408
  'Page template' => __( 'Page template', 'nimble-builder'),
409
  'This page uses a custom template.' => __( 'This page uses a custom template.', 'nimble-builder'),
@@ -421,20 +458,33 @@ function nimble_add_i18n_localized_control_params( $params ) {
421
  'Site wide page speed optimizations' => __( 'Site wide page speed optimizations', 'nimble-builder'),
422
  'Beta features' => __( 'Beta features', 'nimble-builder'),
423
  'Protect your contact forms with Google reCAPTCHA' => __( 'Protect your contact forms with Google reCAPTCHA', 'nimble-builder'),
 
 
424
  'Options for the sections of the current page' => __( 'Options for the sections of the current page', 'nimble-builder'),
425
  'General options applied for the sections site wide' => __( 'General options applied for the sections site wide', 'nimble-builder'),
 
426
 
427
  'Site wide options' => __( 'Site wide options', 'nimble-builder'),
 
 
 
428
  'location' => __('location', 'nimble-builder'),
429
  'section' => __('section', 'nimble-builder'),
430
  'nested section' => __('nested section', 'nimble-builder'),
431
  'column' => __('column', 'nimble-builder'),
432
  'module' => __('module', 'nimble-builder'),
 
 
433
  'This browser does not support drag and drop. You might need to update your browser or use another one.' => __('This browser does not support drag and drop. You might need to update your browser or use another one.', 'nimble-builder'),
434
  'You first need to click on a target ( with a + icon ) in the preview.' => __('You first need to click on a target ( with a + icon ) in the preview.', 'nimble-builder'),
435
  'Insert here' => __('Insert here', 'nimble-builder'),
436
  'Insert in a new section' => __('Insert in a new section', 'nimble-builder'),
437
  'Insert a new section here' => __('Insert a new section here', 'nimble-builder'),
 
 
 
 
 
438
  'Select a font family' => __('Select a font family', 'nimble-builder'),
439
  'Web Safe Fonts' => __('Web Safe Fonts', 'nimble-builder'),
440
  'Google Fonts' => __('Google Fonts', 'nimble-builder'),
@@ -444,15 +494,27 @@ function nimble_add_i18n_localized_control_params( $params ) {
444
  'Something went wrong, please refresh this page.' => __('Something went wrong, please refresh this page.', 'nimble-builder'),
445
 
446
  'Select an icon' => __( 'Select an icon', 'nimble-builder' ),
 
 
447
  'codeEditorSingular' => __( 'There is %d error in your %s code which might break your site. Please fix it before saving.', 'nimble-builder' ),
448
  'codeEditorPlural' => __( 'There are %d errors in your %s code which might break your site. Please fix them before saving.', 'nimble-builder' ),
 
 
449
  'Settings on desktops' => __('Settings on desktops', 'nimble-builder'),
450
  'Settings on tablets' => __('Settings on tablets', 'nimble-builder'),
451
  'Settings on mobiles' => __('Settings on mobiles', 'nimble-builder'),
 
 
452
  'No sections to navigate' => __('No sections to navigate', 'nimble-builder'),
453
  'Remove this element' => __('Remove this element', 'nimble-builder'),
 
 
 
454
  'You seem to be using a cache plugin.' => __('You seem to be using a cache plugin.', 'nimble-builder'),
455
  'It is recommended to disable your cache plugin when customizing your website.' => __('It is recommended to disable your cache plugin when customizing your website.', 'nimble-builder'),
 
 
 
456
  'Revision history of local sections' => __('Revision history of local sections', 'nimble-builder'),
457
  'Revision history of global sections' => __('Revision history of global sections', 'nimble-builder'),
458
  'The revision could not be restored.' => __('The revision could not be restored.', 'nimble-builder'),
@@ -461,6 +523,8 @@ function nimble_add_i18n_localized_control_params( $params ) {
461
  'No revision history available for the moment.' => __('No revision history available for the moment.', 'nimble-builder'),
462
  'This is the current version.' => __('This is the current version.', 'nimble-builder'),
463
  '(currently published version)' => __('(currently published version)','nimble-builder'),
 
 
464
  'You need to publish before exporting.' => __( 'Nimble Builder : you need to publish before exporting.', 'nimble-builder'),
465
  'Export / Import' => __('Export / Import', 'nimble-builder'),
466
  'Export failed' => __('Export failed', 'nimble-builder'),
@@ -472,11 +536,21 @@ function nimble_add_i18n_localized_control_params( $params ) {
472
  'Import failed, invalid file content' => __('Import failed, invalid file content', 'nimble-builder'),
473
  'Import failed, file problem' => __('Import failed, file problem', 'nimble-builder'),
474
  'Some image(s) could not be imported' => __('Some image(s) could not be imported', 'nimble-builder')
 
 
475
 
476
  )//array()
477
  )//array()
478
  );//array_merge
479
  }//'nimble_add_i18n_localized_control_params'
 
 
 
 
 
 
 
 
480
  add_filter( 'skp_json_export_ready_skopes', '\Nimble\add_sektion_values_to_skope_export' );
481
  function add_sektion_values_to_skope_export( $skopes ) {
482
  if ( ! is_array( $skopes ) ) {
@@ -501,9 +575,23 @@ function add_sektion_values_to_skope_export( $skopes ) {
501
  'db_values' => sek_get_skoped_seks( $skope_id ),
502
  'setting_id' => sek_get_seks_setting_id( $skope_id )//nimble___loop_start[skp__post_page_home], nimble___custom_location_id[skp__global]
503
  );
 
 
 
 
 
 
 
 
 
 
 
 
504
  $new_skopes[] = $skp_data;
505
  }
506
 
 
 
507
  return $new_skopes;
508
  }
509
 
@@ -640,6 +728,8 @@ function sek_print_nimble_customizer_tmpl() {
640
  </div>
641
  <!-- <textarea style="height:250px;width:100%" id="czr-customize-content_editor"></textarea> -->
642
  <?php
 
 
643
  sek_setup_nimble_editor( '', NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID , array(
644
  '_content_editor_dfw' => false,
645
  'drag_drop_upload' => true,
@@ -657,6 +747,11 @@ function sek_print_nimble_customizer_tmpl() {
657
  </div>
658
  <?php
659
  }
 
 
 
 
 
660
  function sek_has_active_cache_plugin() {
661
  $cache_plugins = array(
662
  'WP Fastest Cache' => 'wp-fastest-cache/wpFastestCache.php',
@@ -717,6 +812,7 @@ function sek_is_plugin_active_for_network( $plugin ) {
717
  /* ------------------------------------------------------------------------- *
718
  * SETUP DYNAMIC SERVER REGISTRATION FOR SETTING
719
  /* ------------------------------------------------------------------------- */
 
720
  if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
721
  class SEK_CZR_Dyn_Register {
722
  static $instance;
@@ -729,22 +825,32 @@ if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
729
  }
730
 
731
  function __construct( $params = array() ) {
 
732
  add_action( 'customize_register', array( $this, 'load_nimble_setting_class' ) );
733
 
734
  add_filter( 'customize_dynamic_setting_args', array( $this, 'set_dyn_setting_args' ), 10, 2 );
735
  add_filter( 'customize_dynamic_setting_class', array( $this, 'set_dyn_setting_class') , 10, 3 );
736
  }//__construct
 
 
737
  function load_nimble_setting_class() {
738
  require_once( NIMBLE_BASE_PATH . '/inc/sektions/seks_setting_class.php' );
739
  }
 
 
740
  function set_dyn_setting_args( $setting_args, $setting_id ) {
 
741
  if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) || 0 === strpos( $setting_id, NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS ) ) {
 
742
  return array(
743
  'transport' => 'refresh',
744
  'type' => 'option',
745
  'default' => array(),
 
 
746
  );
747
  } else if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_LEVEL_UI ) ) {
 
748
  return array(
749
  'transport' => 'refresh',
750
  'type' => '_nimble_ui_',//won't be saved as is,
@@ -754,12 +860,21 @@ if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
754
  );
755
  }
756
  return $setting_args;
 
757
  }
 
 
 
758
  function set_dyn_setting_class( $class, $setting_id, $args ) {
 
759
  if ( 0 !== strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) )
760
  return $class;
 
761
  return '\Nimble\Nimble_Customizer_Setting';
762
  }
 
 
 
763
  function sanitize_callback( $setting_data, $setting_instance ) {
764
  if ( isset( $_POST['location_skope_id'] ) ) {
765
  $sektionSettingValue = sek_get_skoped_seks( $_POST['location_skope_id'] );
@@ -776,8 +891,12 @@ if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
776
  }
777
  }
778
  }
 
779
  return $setting_data;
780
  }
 
 
 
781
  function validate_callback( $validity, $setting_data, $setting_instance ) {
782
  $validated = true;
783
  if ( isset( $_POST['location_skope_id'] ) ) {
@@ -795,6 +914,7 @@ if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
795
  }
796
  }
797
  }
 
798
  if ( true !== $validated ) {
799
  if ( is_wp_error( $validated ) ) {
800
  $validation_msg = $validation_msg->get_error_message();
@@ -902,6 +1022,7 @@ final class _NIMBLE_Editors {
902
  $set = wp_parse_args(
903
  $settings,
904
  array(
 
905
  'wpautop' => ! has_blocks(),
906
  'media_buttons' => true,
907
  'default_editor' => '',
@@ -948,6 +1069,7 @@ final class _NIMBLE_Editors {
948
  }
949
 
950
  if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
 
951
  $cookie = (int) get_user_setting( 'ed_size' );
952
 
953
  if ( $cookie ) {
@@ -998,6 +1120,7 @@ final class _NIMBLE_Editors {
998
 
999
  if ( self::$this_quicktags ) {
1000
  $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
 
1001
  if ( 'html' !== $default_editor ) {
1002
  $default_editor = 'tinymce';
1003
  }
@@ -1082,6 +1205,8 @@ final class _NIMBLE_Editors {
1082
  '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' .
1083
  'id="' . $editor_id_attr . '">%s</textarea></div>'
1084
  );
 
 
1085
  if ( self::$this_tinymce ) {
1086
  add_filter( 'the_nimble_editor_content', 'format_for_editor', 10, 2 );
1087
  }
@@ -1096,9 +1221,13 @@ final class _NIMBLE_Editors {
1096
  * Either 'html' or 'tinymce'.
1097
  */
1098
  $content = apply_filters( 'the_nimble_editor_content', $content, $default_editor );
 
 
1099
  if ( self::$this_tinymce ) {
1100
  remove_filter( 'the_editor_content', 'format_for_editor' );
1101
  }
 
 
1102
  if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) {
1103
  /** This filter is documented in wp-includes/deprecated.php */
1104
  $content = apply_filters_deprecated( 'htmledit_pre', array( $content ), '4.3.0', 'format_for_editor' );
@@ -1144,6 +1273,8 @@ final class _NIMBLE_Editors {
1144
  }
1145
 
1146
  if ( empty( $qtInit['buttons'] ) ) {
 
 
1147
  $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code';
1148
  }
1149
 
@@ -1243,6 +1374,8 @@ final class _NIMBLE_Editors {
1243
  $plugins = array_unique( apply_filters( 'nimble_tiny_mce_plugins', $plugins ) );
1244
 
1245
  if ( ( $key = array_search( 'spellchecker', $plugins ) ) !== false ) {
 
 
1246
  unset( $plugins[ $key ] );
1247
  }
1248
 
@@ -1286,6 +1419,8 @@ final class _NIMBLE_Editors {
1286
  $mce_external_plugins[ $name ] = $url;
1287
  $plugurl = dirname( $url );
1288
  $strings = '';
 
 
1289
  if ( ! in_array( $name, $loaded_langs, true ) ) {
1290
  $path = str_replace( content_url(), '', $plugurl );
1291
  $path = WP_CONTENT_DIR . $path . '/langs/';
@@ -1343,6 +1478,7 @@ final class _NIMBLE_Editors {
1343
  $editor_styles = get_editor_stylesheets();
1344
 
1345
  if ( ! empty( $editor_styles ) ) {
 
1346
  foreach ( $editor_styles as $key => $url ) {
1347
  if ( strpos( $url, ',' ) !== false ) {
1348
  $editor_styles[ $key ] = str_replace( ',', '%2C', $url );
@@ -1383,6 +1519,8 @@ final class _NIMBLE_Editors {
1383
  $mce_buttons = apply_filters( 'nimble_teeny_mce_buttons', array( 'bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'fullscreen' ), $editor_id );
1384
  $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
1385
  } else {
 
 
1386
  $mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'spellchecker' );
1387
 
1388
  if ( ! wp_is_mobile() ) {
@@ -1407,6 +1545,11 @@ final class _NIMBLE_Editors {
1407
 
1408
  $mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo' );
1409
 
 
 
 
 
 
1410
  /**
1411
  * Filters the second-row list of TinyMCE buttons (Visual tab).
1412
  *
@@ -1478,6 +1621,8 @@ final class _NIMBLE_Editors {
1478
  'tabfocus_elements' => $set['tabfocus_elements'],
1479
  'body_class' => $body_class,
1480
  );
 
 
1481
  $mceInit = array_merge( self::$first_init, $mceInit );
1482
 
1483
  if ( is_array( $set['tinymce'] ) ) {
@@ -1608,11 +1753,14 @@ final class _NIMBLE_Editors {
1608
  * @since 4.8.0
1609
  */
1610
  public static function enqueue_default_editor() {
 
1611
  if ( did_action( 'wp_enqueue_editor' ) ) {
1612
  return;
1613
  }
1614
 
1615
  self::enqueue_scripts( true );
 
 
1616
  wp_enqueue_style( 'editor-buttons' );
1617
 
1618
  add_action( 'customize_controls_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 );
@@ -1640,6 +1788,10 @@ final class _NIMBLE_Editors {
1640
  if ( is_rtl() ) {
1641
  $settings['directionality'] = 'rtl';
1642
  }
 
 
 
 
1643
  $settings['plugins'] = implode(
1644
  ',',
1645
  array(
@@ -1781,6 +1933,8 @@ final class _NIMBLE_Editors {
1781
  'resize' => 'vertical',
1782
  'menubar' => false,
1783
  'branding' => false,
 
 
1784
  'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
1785
 
1786
  'end_container_on_empty_block' => true,
@@ -1792,6 +1946,8 @@ final class _NIMBLE_Editors {
1792
 
1793
  $suffix = SCRIPT_DEBUG ? '' : '.min';
1794
  $version = 'ver=' . get_bloginfo( 'version' );
 
 
1795
  $settings['content_css'] = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
1796
  includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
1797
 
@@ -1801,6 +1957,7 @@ final class _NIMBLE_Editors {
1801
  private static function get_translation() {
1802
  if ( empty( self::$translation ) ) {
1803
  self::$translation = array(
 
1804
  'New document' => __( 'New document', 'nimble-builder' ),
1805
  'Formats' => _x( 'Formats', 'TinyMCE', 'nimble-builder' ),
1806
 
@@ -1864,12 +2021,16 @@ final class _NIMBLE_Editors {
1864
  'Upper Alpha' => _x( 'Upper Alpha', 'list style', 'nimble-builder' ),
1865
  'Upper Roman' => _x( 'Upper Roman', 'list style', 'nimble-builder' ),
1866
  'Lower Roman' => _x( 'Lower Roman', 'list style', 'nimble-builder' ),
 
 
1867
  'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)', 'nimble-builder' ),
1868
  'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)', 'nimble-builder' ),
1869
  'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)', 'nimble-builder' ),
1870
  'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' =>
1871
  __( 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.', 'nimble-builder' ),
1872
  'Id' => _x( 'Id', 'Id for link anchor (TinyMCE)', 'nimble-builder' ),
 
 
1873
  'Document properties' => __( 'Document properties', 'nimble-builder' ),
1874
  'Robots' => __( 'Robots', 'nimble-builder' ),
1875
  'Title' => __( 'Title', 'nimble-builder' ),
@@ -1877,6 +2038,8 @@ final class _NIMBLE_Editors {
1877
  'Encoding' => __( 'Encoding', 'nimble-builder' ),
1878
  'Description' => __( 'Description', 'nimble-builder' ),
1879
  'Author' => __( 'Author', 'nimble-builder' ),
 
 
1880
  'Image' => __( 'Image', 'nimble-builder' ),
1881
  'Insert/edit image' => array( __( 'Insert/edit image', 'nimble-builder' ), 'accessM' ),
1882
  'General' => __( 'General', 'nimble-builder' ),
@@ -1901,6 +2064,8 @@ final class _NIMBLE_Editors {
1901
  'Paste your embed code below:' => __( 'Paste your embed code below:', 'nimble-builder' ),
1902
  'Insert video' => __( 'Insert video', 'nimble-builder' ),
1903
  'Embed' => __( 'Embed', 'nimble-builder' ),
 
 
1904
  'Special character' => __( 'Special character', 'nimble-builder' ),
1905
  'Right to left' => _x( 'Right to left', 'editor button', 'nimble-builder' ),
1906
  'Left to right' => _x( 'Left to right', 'editor button', 'nimble-builder' ),
@@ -1917,6 +2082,8 @@ final class _NIMBLE_Editors {
1917
  'Restore last draft' => __( 'Restore last draft', 'nimble-builder' ),
1918
  'Insert/edit link' => array( __( 'Insert/edit link', 'nimble-builder' ), 'metaK' ),
1919
  'Remove link' => array( __( 'Remove link', 'nimble-builder' ), 'accessS' ),
 
 
1920
  'Link' => __( 'Link', 'nimble-builder' ),
1921
  'Insert link' => __( 'Insert link', 'nimble-builder' ),
1922
  'Insert/edit link' => __( 'Insert/edit link', 'nimble-builder' ),
@@ -1936,6 +2103,8 @@ final class _NIMBLE_Editors {
1936
  'R' => _x( 'R', 'Short for red in RGB', 'nimble-builder' ),
1937
  'G' => _x( 'G', 'Short for green in RGB', 'nimble-builder' ),
1938
  'B' => _x( 'B', 'Short for blue in RGB', 'nimble-builder' ),
 
 
1939
  'Could not find the specified string.' => __( 'Could not find the specified string.', 'nimble-builder' ),
1940
  'Replace' => _x( 'Replace', 'find/replace', 'nimble-builder' ),
1941
  'Next' => _x( 'Next', 'find/replace', 'nimble-builder' ),
@@ -1952,6 +2121,8 @@ final class _NIMBLE_Editors {
1952
  'Ignore all' => _x( 'Ignore all', 'spellcheck', 'nimble-builder' ),
1953
  'Ignore' => _x( 'Ignore', 'spellcheck', 'nimble-builder' ),
1954
  'Add to Dictionary' => __( 'Add to Dictionary', 'nimble-builder' ),
 
 
1955
  'Insert table' => __( 'Insert table', 'nimble-builder' ),
1956
  'Delete table' => __( 'Delete table', 'nimble-builder' ),
1957
  'Table properties' => __( 'Table properties', 'nimble-builder' ),
@@ -2024,6 +2195,8 @@ final class _NIMBLE_Editors {
2024
  __( 'The changes you made will be lost if you navigate away from this page.', 'nimble-builder' ),
2025
  'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' =>
2026
  __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser&#8217;s edit menu instead.', 'nimble-builder' ),
 
 
2027
  'Insert' => _x( 'Insert', 'TinyMCE menu', 'nimble-builder' ),
2028
  'File' => _x( 'File', 'TinyMCE menu', 'nimble-builder' ),
2029
  'Edit' => _x( 'Edit', 'TinyMCE menu', 'nimble-builder' ),
@@ -2031,6 +2204,8 @@ final class _NIMBLE_Editors {
2031
  'View' => _x( 'View', 'TinyMCE menu', 'nimble-builder' ),
2032
  'Table' => _x( 'Table', 'TinyMCE menu', 'nimble-builder' ),
2033
  'Format' => _x( 'Format', 'TinyMCE menu', 'nimble-builder' ),
 
 
2034
  'Toolbar Toggle' => array( __( 'Toolbar Toggle', 'nimble-builder' ), 'accessZ' ),
2035
  'Insert Read More tag' => array( __( 'Insert Read More tag', 'nimble-builder' ), 'accessT' ),
2036
  'Insert Page Break tag' => array( __( 'Insert Page Break tag', 'nimble-builder' ), 'accessP' ),
@@ -2045,6 +2220,8 @@ final class _NIMBLE_Editors {
2045
  'Visual' => _x( 'Visual', 'Name for the Visual editor tab', 'nimble-builder' ), // Editor switch tab label
2046
  'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)', 'nimble-builder' ), // Editor switch tab label
2047
  'Add Media' => array( __( 'Add Media', 'nimble-builder' ), 'accessM' ), // Tooltip for the 'Add Media' button in the Block Editor Classic block
 
 
2048
  'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts', 'nimble-builder' ), 'accessH' ),
2049
  'Classic Block Keyboard Shortcuts' => __( 'Classic Block Keyboard Shortcuts', 'nimble-builder' ),
2050
  'Default shortcuts,' => __( 'Default shortcuts,', 'nimble-builder' ),
@@ -2129,6 +2306,7 @@ final class _NIMBLE_Editors {
2129
  $mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale );
2130
 
2131
  foreach ( $mce_translation as $key => $value ) {
 
2132
  if ( $key === $value ) {
2133
  unset( $mce_translation[ $key ] );
2134
  continue;
@@ -2138,6 +2316,8 @@ final class _NIMBLE_Editors {
2138
  $mce_translation[ $key ] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8' );
2139
  }
2140
  }
 
 
2141
  if ( is_rtl() ) {
2142
  $mce_translation['_dir'] = 'rtl';
2143
  }
@@ -2279,6 +2459,7 @@ final class _NIMBLE_Editors {
2279
  self::print_tinymce_scripts();
2280
 
2281
  if ( self::$ext_plugins ) {
 
2282
  echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
2283
  }
2284
  }
@@ -2407,8 +2588,12 @@ final class _NIMBLE_Editors {
2407
  * @param array $query An array of WP_Query arguments.
2408
  */
2409
  $query = apply_filters( 'wp_link_query_args', $query );
 
 
2410
  $get_posts = new WP_Query;
2411
  $posts = $get_posts->query( $query );
 
 
2412
  $results = array();
2413
  foreach ( $posts as $post ) {
2414
  if ( 'post' == $post->post_type ) {
@@ -2458,11 +2643,14 @@ final class _NIMBLE_Editors {
2458
  * @since 3.1.0
2459
  */
2460
  public static function wp_link_dialog() {
 
2461
  if ( self::$link_dialog_printed ) {
2462
  return;
2463
  }
2464
 
2465
  self::$link_dialog_printed = true;
 
 
2466
  ?>
2467
  <div id="wp-link-backdrop" style="display: none"></div>
2468
  <div id="wp-link-wrap" class="wp-core-ui" style="display: none" role="dialog" aria-labelledby="link-modal-title">
@@ -2535,6 +2723,8 @@ function sek_catch_export_action( $wp_customize ) {
2535
  }
2536
  }
2537
  }
 
 
2538
  function sek_maybe_export() {
2539
  $nonce = 'save-customize_' . get_stylesheet();
2540
  if ( ! isset( $_REQUEST['sek_export_nonce'] ) ) {
@@ -2562,26 +2752,47 @@ function sek_maybe_export() {
2562
  return;
2563
  }
2564
  $seks_data = sek_get_skoped_seks( $_REQUEST['skope_id'] );
 
 
 
 
 
2565
  $seks_data = apply_filters( 'nimble_pre_export', $seks_data );
2566
  $theme_name = sanitize_title_with_dashes( get_stylesheet() );
 
 
2567
  $export = array(
2568
  'data' => $seks_data,
2569
  'metas' => array(
2570
  'skope_id' => $_REQUEST['skope_id'],
2571
  'version' => NIMBLE_VERSION,
 
2572
  'active_locations' => is_string( $_REQUEST['active_locations'] ) ? explode( ',', $_REQUEST['active_locations'] ) : array(),
2573
  'date' => date("Y-m-d"),
2574
  'theme' => $theme_name
2575
  )
2576
  );
 
 
2577
 
2578
  $skope_id = str_replace('skp__', '', $_REQUEST['skope_id'] );
2579
  $filename = $theme_name . '_' . $skope_id . '.nimblebuilder';
 
 
2580
  header( 'Content-disposition: attachment; filename=' . $filename );
2581
  header( 'Content-Type: application/octet-stream; charset=' . get_option( 'blog_charset' ) );
 
 
 
2582
  echo wp_json_encode( $export );
 
 
2583
  die();
2584
  }
 
 
 
 
2585
  add_action( 'wp_ajax_sek_pre_export_checks', '\Nimble\sek_ajax_pre_export_checks' );
2586
  function sek_ajax_pre_export_checks() {
2587
  $action = 'save-customize_' . get_stylesheet();
@@ -2609,8 +2820,19 @@ function sek_ajax_pre_export_checks() {
2609
  }
2610
  wp_send_json_success();
2611
  }
 
 
 
 
 
 
 
 
2612
  add_action( 'wp_ajax_sek_get_imported_file_content', '\Nimble\sek_ajax_get_imported_file_content' );
2613
  function sek_ajax_get_imported_file_content() {
 
 
 
2614
 
2615
  $action = 'save-customize_' . get_stylesheet();
2616
  if ( ! check_ajax_referer( $action, 'nonce', false ) ) {
@@ -2635,9 +2857,15 @@ function sek_ajax_get_imported_file_content() {
2635
  if ( ! isset( $_POST['skope'] ) || empty( $_POST['skope'] ) ) {
2636
  wp_send_json_error( 'missing_skope' );
2637
  }
 
 
2638
  if ( ! function_exists( 'wp_handle_upload' ) ) {
2639
  require_once( ABSPATH . 'wp-admin/includes/file.php' );
2640
  }
 
 
 
 
2641
  $file = wp_handle_upload(
2642
  $_FILES['file_candidate'],
2643
  array(
@@ -2645,11 +2873,14 @@ function sek_ajax_get_imported_file_content() {
2645
  'test_type' => false,
2646
  'mimes' => array(
2647
  'text' => 'text/plain',
 
2648
  'json' => 'application/json',
2649
  'nimblebuilder' => 'application/json'
2650
  )
2651
  )
2652
  );
 
 
2653
  if ( isset( $file['error'] ) ) {
2654
  unlink( $file['file'] );
2655
  wp_send_json_error( 'import_file_error' );
@@ -2660,18 +2891,41 @@ function sek_ajax_get_imported_file_content() {
2660
  wp_send_json_error( 'import_file_do_not_exist' );
2661
  return;
2662
  }
 
 
2663
  $raw = file_get_contents( $file['file'] );
 
2664
  $raw_unserialized_data = json_decode( $raw, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2665
  if ( ! is_array( $raw_unserialized_data ) || empty( $raw_unserialized_data['data']) || !is_array( $raw_unserialized_data['data'] ) || empty( $raw_unserialized_data['metas'] ) || !is_array( $raw_unserialized_data['metas'] ) ) {
2666
  unlink( $file['file'] );
2667
  wp_send_json_error( 'invalid_import_content' );
2668
  return;
2669
  }
 
 
2670
  if ( !empty( $raw_unserialized_data['metas']['version'] ) && version_compare( NIMBLE_VERSION, $raw_unserialized_data['metas']['version'], '<' ) ) {
2671
  unlink( $file['file'] );
2672
  wp_send_json_error( 'nimble_builder_needs_update' );
2673
  return;
2674
  }
 
 
 
 
2675
  if ( isset( $_POST['pre_import_check'] ) && true == $_POST['pre_import_check'] ) {
2676
  remove_filter( 'nimble_pre_import', '\Nimble\sek_sniff_imported_img_url' );
2677
  }
@@ -2679,11 +2933,24 @@ function sek_ajax_get_imported_file_content() {
2679
  $imported_content = array(
2680
  'data' => apply_filters( 'nimble_pre_import', $raw_unserialized_data['data'] ),
2681
  'metas' => $raw_unserialized_data['metas'],
 
 
2682
  'img_errors' => !empty( Nimble_Manager()->img_import_errors ) ? implode(',', Nimble_Manager()->img_import_errors) : array()
2683
  );
 
 
 
 
2684
  unlink( $file['file'] );
 
2685
  wp_send_json_success( $imported_content );
2686
  }
 
 
 
 
 
 
2687
  add_filter( 'nimble_pre_export', '\Nimble\sek_parse_img_and_clean_id' );
2688
  function sek_parse_img_and_clean_id( $seks_data ) {
2689
  $new_seks_data = array();
@@ -2709,6 +2976,8 @@ function sek_parse_img_and_clean_id( $seks_data ) {
2709
  }
2710
  return $new_seks_data;
2711
  }
 
 
2712
  add_filter( 'nimble_pre_import', '\Nimble\sek_sniff_imported_img_url' );
2713
  function sek_sniff_imported_img_url( $seks_data ) {
2714
  $new_seks_data = array();
@@ -2718,6 +2987,7 @@ function sek_sniff_imported_img_url( $seks_data ) {
2718
  } else {
2719
  if ( is_string( $value ) && false !== strpos( $value, '__img_url__' ) && sek_is_img_url( $value ) ) {
2720
  $url = str_replace( '__img_url__', '', $value );
 
2721
  $id = sek_sideload_img_and_return_attachment_id( $url );
2722
  if ( is_wp_error( $id ) ) {
2723
  $value = null;
@@ -2733,6 +3003,8 @@ function sek_sniff_imported_img_url( $seks_data ) {
2733
  }
2734
  return $new_seks_data;
2735
  }
 
 
2736
  function sek_is_img_url( $url = '' ) {
2737
  if ( is_string( $url ) ) {
2738
  if ( preg_match( '/\.(jpg|jpeg|png|gif)/i', $url ) ) {
@@ -2743,6 +3015,10 @@ function sek_is_img_url( $url = '' ) {
2743
  }
2744
 
2745
  ?><?php
 
 
 
 
2746
  add_action( 'customize_save_validation_before', '\Nimble\sek_remove_callback_wp_targeted_link_rel' );
2747
  function sek_remove_callback_wp_targeted_link_rel( $wp_customize ) {
2748
  if ( false !== has_filter( 'content_save_pre', 'wp_targeted_link_rel' ) ) {
@@ -2751,12 +3027,18 @@ function sek_remove_callback_wp_targeted_link_rel( $wp_customize ) {
2751
  };
2752
 
2753
  ?><?php
 
 
 
2754
  add_action( 'czr_set_input_tmpl_content', '\Nimble\sek_set_input_tmpl_content', 10, 3 );
2755
  function sek_set_input_tmpl_content( $input_type, $input_id, $input_data ) {
 
 
2756
  if ( ! array_key_exists( 'input_type', $input_data ) || empty( $input_data[ 'input_type' ] ) ) {
2757
  wp_send_json_error( 'sek_set_input_tmpl_content => missing input type for input id : ' . $input_id );
2758
  }
2759
  switch( $input_type ) {
 
2760
  case 'content_type_switcher' :
2761
  sek_set_input_tmpl___content_type_switcher( $input_id, $input_data );
2762
  break;
@@ -2843,6 +3125,7 @@ function sek_set_input_tmpl_content( $input_type, $input_id, $input_data ) {
2843
  /* ------------------------------------------------------------------------- *
2844
  * CONTENT TYPE SWITCHER INPUT
2845
  /* ------------------------------------------------------------------------- */
 
2846
  function sek_set_input_tmpl___content_type_switcher( $input_id, $input_data ) {
2847
  ?>
2848
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
@@ -2859,6 +3142,7 @@ function sek_set_input_tmpl___content_type_switcher( $input_id, $input_data ) {
2859
  /* ------------------------------------------------------------------------- *
2860
  * MODULE PICKER INPUT
2861
  /* ------------------------------------------------------------------------- */
 
2862
  function sek_set_input_tmpl___module_picker( $input_id, $input_data ) {
2863
  ?>
2864
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
@@ -2868,6 +3152,9 @@ function sek_set_input_tmpl___module_picker( $input_id, $input_data ) {
2868
 
2869
  $i = 0;
2870
  foreach( $content_collection as $_params ) {
 
 
 
2871
  $_params = wp_parse_args( $_params, array(
2872
  'content-type' => 'module',
2873
  'content-id' => '',
@@ -2911,7 +3198,10 @@ function sek_set_input_tmpl___module_picker( $input_id, $input_data ) {
2911
  /* ------------------------------------------------------------------------- *
2912
  * SECTION PICKER INPUT
2913
  /* ------------------------------------------------------------------------- */
 
2914
  function sek_set_input_tmpl___section_picker( $input_id, $input_data ) {
 
 
2915
  ?>
2916
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2917
  <div class="sek-content-type-wrapper">
@@ -2923,8 +3213,9 @@ function sek_set_input_tmpl___section_picker( $input_id, $input_data ) {
2923
  }
2924
  $content_collection = $input_data['section_collection'];
2925
 
2926
- foreach( $content_collection as $_params) {
2927
  $section_type = 'content';
 
2928
  if ( !empty($input_data['section_type']) ) {
2929
  $section_type = $input_data['section_type'];
2930
  }
@@ -2933,7 +3224,12 @@ function sek_set_input_tmpl___section_picker( $input_id, $input_data ) {
2933
  'preset_section',
2934
  $_params['content-id'],
2935
  sprintf( 'background: url(%1$s) 50% 50% / cover no-repeat;%2$s',
2936
- $_params['thumb'] . '?ver=' . NIMBLE_VERSION,
 
 
 
 
 
2937
  isset( $_params['height'] ) ? 'height:'.$_params['height'] : ''
2938
  ),
2939
  $_params['title'],
@@ -2950,6 +3246,7 @@ function sek_set_input_tmpl___section_picker( $input_id, $input_data ) {
2950
  /* ------------------------------------------------------------------------- *
2951
  * SPACING INPUT
2952
  /* ------------------------------------------------------------------------- */
 
2953
  function sek_set_input_tmpl___spacing( $input_id, $input_data ) {
2954
  ?>
2955
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
@@ -3028,6 +3325,7 @@ function sek_set_input_tmpl___spacing( $input_id, $input_data ) {
3028
  /* ------------------------------------------------------------------------- *
3029
  * BACKGROUND POSITION INPUT
3030
  /* ------------------------------------------------------------------------- */
 
3031
  function sek_set_input_tmpl___bg_position( $input_id, $input_data ) {
3032
  ?>
3033
  <div class="sek-bg-pos-wrapper">
@@ -3122,9 +3420,11 @@ function sek_set_input_tmpl___bg_position( $input_id, $input_data ) {
3122
  /* ------------------------------------------------------------------------- *
3123
  * HORIZONTAL ALIGNMENT INPUT
3124
  /* ------------------------------------------------------------------------- */
 
3125
  /* ------------------------------------------------------------------------- *
3126
  * HORIZONTAL ALIGNMENT INPUT FOR TEXT => includes the 'justify' icon
3127
  /* ------------------------------------------------------------------------- */
 
3128
  function sek_set_input_tmpl___h_alignment( $input_id, $input_data ) {
3129
  ?>
3130
  <div class="sek-h-align-wrapper">
@@ -3155,6 +3455,7 @@ function sek_set_input_tmpl___h_text_alignment( $input_id, $input_data ) {
3155
  /* ------------------------------------------------------------------------- *
3156
  * VERTICAL ALIGNMENT INPUT
3157
  /* ------------------------------------------------------------------------- */
 
3158
  function sek_set_input_tmpl___v_alignment( $input_id, $input_data ) {
3159
  ?>
3160
  <div class="sek-v-align-wrapper">
@@ -3172,12 +3473,24 @@ function sek_set_input_tmpl___v_alignment( $input_id, $input_data ) {
3172
  /* ------------------------------------------------------------------------- *
3173
  * FONT AWESOME ICON PICKER INPUT
3174
  /* ------------------------------------------------------------------------- */
 
3175
  function sek_set_input_tmpl___fa_icon_picker( $input_id, $input_data ) {
3176
  ?>
3177
  <select data-czrtype="<?php echo $input_id; ?>"></select>
3178
  <?php
3179
  }
 
 
 
 
 
3180
  add_filter( "ac_set_ajax_czr_tmpl___fa_icon_picker_input", '\Nimble\sek_get_fa_icon_list_tmpl', 10, 3 );
 
 
 
 
 
 
3181
  function sek_get_fa_icon_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
3182
  if ( empty( $requested_tmpl ) ) {
3183
  wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
@@ -3187,7 +3500,15 @@ function sek_get_fa_icon_list_tmpl( $html, $requested_tmpl = '', $posted_params
3187
  sek_retrieve_decoded_font_awesome_icons()
3188
  );//will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
3189
  }
 
 
 
 
 
 
 
3190
  function sek_retrieve_decoded_font_awesome_icons() {
 
3191
  $faicons_json_path = NIMBLE_BASE_PATH . '/assets/faicons.json';
3192
  $faicons_transient_name = 'sek_font_awesome_november_2018';
3193
  if ( false == get_transient( $faicons_transient_name ) ) {
@@ -3216,12 +3537,20 @@ function sek_retrieve_decoded_font_awesome_icons() {
3216
  /* ------------------------------------------------------------------------- *
3217
  * FONT PICKER INPUT
3218
  /* ------------------------------------------------------------------------- */
 
3219
  function sek_set_input_tmpl___font_picker( $input_id, $input_data ) {
3220
  ?>
3221
  <select data-czrtype="<?php echo $input_id; ?>"></select>
3222
  <?php
3223
  }
 
 
 
 
 
3224
  add_filter( "ac_set_ajax_czr_tmpl___font_picker_input", '\Nimble\sek_get_font_list_tmpl', 10, 3 );
 
 
3225
  function sek_get_font_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
3226
  if ( empty( $requested_tmpl ) ) {
3227
  wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
@@ -3253,6 +3582,7 @@ function sek_get_cfonts() {
3253
  'Verdana,Geneva,sans-serif',
3254
  );
3255
  foreach ( $raw_cfonts as $font ) {
 
3256
  $cfonts[] = array(
3257
  'name' => $font ,
3258
  'subsets' => array()
@@ -3260,6 +3590,18 @@ function sek_get_cfonts() {
3260
  }
3261
  return apply_filters( 'sek_font_picker_cfonts', $cfonts );
3262
  }
 
 
 
 
 
 
 
 
 
 
 
 
3263
  function sek_retrieve_decoded_gfonts() {
3264
  if ( false == get_transient( 'sek_gfonts_may_2018' ) ) {
3265
  $gfont_raw = @file_get_contents( NIMBLE_BASE_PATH ."/assets/webfonts.json" );
@@ -3277,20 +3619,48 @@ function sek_retrieve_decoded_gfonts() {
3277
 
3278
  return $gfonts_decoded;
3279
  }
 
 
 
 
3280
  function sek_get_gfonts( $what = null ) {
 
3281
 
3282
  $gfonts_decoded = sek_retrieve_decoded_gfonts();
3283
  $gfonts = array();
 
 
 
 
 
 
 
3284
 
3285
  foreach ( $gfonts_decoded['items'] as $font ) {
3286
  foreach ( $font['variants'] as $variant ) {
3287
  $name = str_replace( ' ', '+', $font['family'] );
3288
  $gfonts[] = array(
3289
  'name' => $name . ':' .$variant
 
3290
  );
3291
  }
 
 
 
 
3292
  }
3293
 
 
 
 
 
 
 
 
 
 
 
 
3294
  return ('subsets' == $what) ? apply_filters( 'sek_font_picker_gfonts_subsets ', $subsets ) : apply_filters( 'sek_font_picker_gfonts', $gfonts ) ;
3295
  }
3296
 
@@ -3299,12 +3669,17 @@ function sek_get_gfonts( $what = null ) {
3299
  /* ------------------------------------------------------------------------- *
3300
  * FONT SIZE
3301
  /* ------------------------------------------------------------------------- */
 
3302
  /* ------------------------------------------------------------------------- *
3303
  * LINE HEIGHT INPUT TMPLS
3304
  /* ------------------------------------------------------------------------- */
 
3305
  function sek_set_input_tmpl___font_size_line_height( $input_id, $input_data ) {
3306
  ?>
3307
  <?php
 
 
 
3308
  ?>
3309
  <#
3310
  var value = data['<?php echo $input_id; ?>'],
@@ -3332,6 +3707,7 @@ function sek_set_input_tmpl___font_size_line_height( $input_id, $input_data ) {
3332
  /* ------------------------------------------------------------------------- *
3333
  * CODE EDITOR INPUT TEMPLATE
3334
  /* ------------------------------------------------------------------------- */
 
3335
  function sek_set_input_tmpl___code_editor( $input_id, $input_data ) {
3336
  /*
3337
  * Needed to form the correct params to pass to the code mirror editor, based on the code type
@@ -3348,9 +3724,13 @@ function sek_set_input_tmpl___code_editor( $input_id, $input_data ) {
3348
  /* ------------------------------------------------------------------------- *
3349
  * CODE EDITOR INPUT TEMPLATE
3350
  /* ------------------------------------------------------------------------- */
 
3351
  function sek_set_input_tmpl___range_simple( $input_id, $input_data ) {
3352
  ?>
3353
  <?php
 
 
 
3354
  ?>
3355
  <#
3356
  var value = data['<?php echo $input_id; ?>'],
@@ -3383,9 +3763,13 @@ function sek_set_input_tmpl___range_simple( $input_id, $input_data ) {
3383
  /* ------------------------------------------------------------------------- *
3384
  * CODE EDITOR INPUT TEMPLATE
3385
  /* ------------------------------------------------------------------------- */
 
3386
  function sek_set_input_tmpl___range_with_unit_picker( $input_id, $input_data ) {
3387
  ?>
3388
  <?php
 
 
 
3389
  ?>
3390
  <#
3391
  var value = data['<?php echo $input_id; ?>'],
@@ -3422,9 +3806,13 @@ function sek_set_input_tmpl___range_with_unit_picker( $input_id, $input_data ) {
3422
  /* ------------------------------------------------------------------------- *
3423
  * CODE EDITOR INPUT TEMPLATE
3424
  /* ------------------------------------------------------------------------- */
 
3425
  function sek_set_input_tmpl___range_with_unit_picker_device_switcher( $input_id, $input_data ) {
3426
  ?>
3427
  <?php
 
 
 
3428
  ?>
3429
  <#
3430
  var value = data['<?php echo $input_id; ?>'],
@@ -3461,9 +3849,13 @@ function sek_set_input_tmpl___range_with_unit_picker_device_switcher( $input_id,
3461
  /* ------------------------------------------------------------------------- *
3462
  * BORDERS INPUT TEMPLATE
3463
  /* ------------------------------------------------------------------------- */
 
3464
  function sek_set_input_tmpl___borders( $input_id, $input_data ) {
3465
  ?>
3466
  <?php
 
 
 
3467
  ?>
3468
  <div class="sek-borders">
3469
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___borders() => data range_slide => ', data ); #> ?>
@@ -3502,9 +3894,13 @@ function sek_set_input_tmpl___borders( $input_id, $input_data ) {
3502
  /* ------------------------------------------------------------------------- *
3503
  * BORDER RADIUS INPUT TEMPLATE
3504
  /* ------------------------------------------------------------------------- */
 
3505
  function sek_set_input_tmpl___border_radius( $input_id, $input_data ) {
3506
  ?>
3507
  <?php
 
 
 
3508
  ?>
3509
  <div class="sek-borders">
3510
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___border_radius() => data range_slide => ', data ); #> ?>
@@ -3540,6 +3936,7 @@ function sek_set_input_tmpl___border_radius( $input_id, $input_data ) {
3540
  /* ------------------------------------------------------------------------- *
3541
  * MULTIPLE BUTTON CHOICES INPUT TEMPLATE
3542
  /* ------------------------------------------------------------------------- */
 
3543
  function sek_set_input_tmpl___buttons_choice( $input_id, $input_data ) {
3544
  ?>
3545
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #> ?>
@@ -3569,6 +3966,7 @@ function sek_set_input_tmpl___buttons_choice( $input_id, $input_data ) {
3569
  /* ------------------------------------------------------------------------- *
3570
  * RESET BUTTON INPUT TEMPLATE
3571
  /* ------------------------------------------------------------------------- */
 
3572
  function sek_set_input_tmpl___reset_button( $input_id, $input_data ) {
3573
  ?>
3574
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #> ?>
@@ -3589,6 +3987,7 @@ function sek_set_input_tmpl___reset_button( $input_id, $input_data ) {
3589
  /* ------------------------------------------------------------------------- *
3590
  * RESET BUTTON INPUT TEMPLATE
3591
  /* ------------------------------------------------------------------------- */
 
3592
  function sek_set_input_tmpl___revision_history( $input_id, $input_data ) {
3593
  ?>
3594
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #> ?>
@@ -3606,6 +4005,7 @@ function sek_set_input_tmpl___revision_history( $input_id, $input_data ) {
3606
  /* ------------------------------------------------------------------------- *
3607
  * DETACHED WP EDITOR INPUT TEMPLATE
3608
  /* ------------------------------------------------------------------------- */
 
3609
  function sek_set_input_tmpl___detached_tinymce_editor( $input_id, $input_data ) {
3610
  ?>
3611
  <?php ////console.log( 'IN php::sek_set_input_tmpl___detached_tinymce_edito() => input data => ', data ); #> ?>
@@ -3619,6 +4019,8 @@ function sek_set_input_tmpl___detached_tinymce_editor( $input_id, $input_data )
3619
  * WP EDITOR INPUT TEMPLATE
3620
  /* ------------------------------------------------------------------------- */
3621
  function sek_set_input_tmpl___nimble_tinymce_editor( $input_id, $input_data ) {
 
 
3622
  ?>
3623
  <?php //<# console.log( 'IN php::ac_get_default_input_tmpl() => data range_slide => ', data ); #> ?>
3624
  <textarea id="textarea-{{ data.control_id }}" data-czrtype="<?php echo $input_id; ?>" class="width-100" name="textarea" rows="10" cols="">{{ data.value }}</textarea>
@@ -3629,6 +4031,7 @@ function sek_set_input_tmpl___nimble_tinymce_editor( $input_id, $input_data ) {
3629
  /* ------------------------------------------------------------------------- *
3630
  * IMPORT / EXPORT
3631
  /* ------------------------------------------------------------------------- */
 
3632
  function sek_set_input_tmpl___imp_exp( $input_id, $input_data ) {
3633
  ?>
3634
  <?php //<# console.log( 'IN php::sek_set_input_tmpl___detached_tinymce_edito() => input data => ', data ); #> ?>
@@ -3662,6 +4065,7 @@ function sek_set_input_tmpl___imp_exp( $input_id, $input_data ) {
3662
  /* ------------------------------------------------------------------------- *
3663
  * POST GRID LAYOUT PICKER
3664
  /* ------------------------------------------------------------------------- */
 
3665
  function sek_set_input_tmpl___grid_layout( $input_id, $input_data ) {
3666
  ?>
3667
  <div class="sek-grid-layout-wrapper">
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
+
7
+
8
+
9
+ // ENQUEUE CUSTOMIZER JAVASCRIPT + PRINT LOCALIZED DATA
10
  add_action ( 'customize_controls_enqueue_scripts', '\Nimble\sek_enqueue_controls_js_css', 20 );
11
  function sek_enqueue_controls_js_css() {
12
  wp_enqueue_style(
24
 
25
  wp_enqueue_script(
26
  'czr-sektions',
27
+ //dev / debug mode mode?
28
  sprintf(
29
  '%1$s/assets/czr/sek/js/%2$s' ,
30
  NIMBLE_BASE_URL,
44
  'nimbleVersion' => NIMBLE_VERSION,
45
  'isDevMode' => sek_is_dev_mode(),
46
  'baseUrl' => NIMBLE_BASE_URL,
47
+ //ajaxURL is not mandatory because is normally available in the customizer window.ajaxurl
48
  'ajaxUrl' => admin_url( 'admin-ajax.php' ),
49
  'customizerURL' => admin_url( 'customize.php' ),
50
  'sektionsPanelId' => '__sektions__',
66
 
67
  'userSavedSektions' => get_option(NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS),
68
 
69
+ //'presetSections' => sek_get_preset_sections_api_data(), <= fetched on demand in ajax
70
+
71
  'registeredModules' => CZR_Fmk_Base()->registered_modules,
72
+
73
+ // Dnd
74
  'preDropElementClass' => 'sortable-placeholder',
75
  'dropSelectors' => implode(',', [
76
+ // 'module' type
77
+ //'.sek-module-drop-zone-for-first-module',//the drop zone when there's no module or nested sektion in the column
78
+ //'[data-sek-level="location"]',
79
+ //'.sek-not-empty-col',// the drop zone when there is at least one module
80
+ //'.sek-column > .sek-column-inner sek-section',// the drop zone when there is at least one nested section
81
+ //'.sek-content-module-drop-zone',//between sections
82
  '.sek-drop-zone', //This is the selector for all eligible drop zones printed statically or dynamically on dragstart
83
  'body',// body will not be eligible for drop, but setting the body as drop zone allows us to fire dragenter / dragover actions, like toggling the "approaching" or "close" css class to real drop zone
84
+
85
+ // 'preset_section' type
86
  '.sek-content-preset_section-drop-zone'//between sections
87
  ]),
88
 
95
  'localOptionsMap' => SEK_Front_Construct::$local_options_map,
96
 
97
  'registeredLocations' => sek_get_locations(),
98
+ // added for the module tree #359
99
  'moduleCollection' => sek_get_module_collection(),
100
  'moduleIconPath' => NIMBLE_MODULE_ICON_PATH,
101
 
102
  'hasActiveCachePlugin' => sek_has_active_cache_plugin(),
103
+
104
+ // Tiny MCE
105
  'idOfDetachedTinyMceTextArea' => NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID,
106
  'tinyMceNimbleEditorStylesheetUrl' => sprintf( '%1$s/assets/czr/sek/css/sek-tinymce-content.css', NIMBLE_BASE_URL ),
107
+ // defaultToolbarBtns is used for the detached tinymce editor
108
  'defaultToolbarBtns' => "formatselect,fontsizeselect,forecolor,bold,italic,underline,strikethrough,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,spellchecker,hr,pastetext,removeformat,charmap,outdent,indent,undo,redo",
109
+ // basic btns are used for the heading, the quote content and quote cite
110
  'basic_btns' => array('forecolor','bold','italic','underline','strikethrough','link','unlink'),
111
  'basic_btns_nolink' => array('forecolor','bold','italic','underline','strikethrough'),
112
 
113
  'eligibleForFeedbackNotification' => sek_get_feedback_notif_status(),
114
 
115
+ // May 21st, v1.7.5 => back to the local data
116
+ // after problem was reported when fetching data remotely : https://github.com/presscustomizr/nimble-builder/issues/445
117
+ //'presetSectionsModules' => array_keys( sek_get_sections_registration_params_api_data() )
118
+ 'presetSectionsModules' => array_keys( sek_get_sections_registration_params() )
119
  )
120
  )
121
  );//wp_localize_script()
190
  'outline-none' => true,
191
  ),
192
  'jshint' => array(
193
+ // The following are copied from <https://github.com/WordPress/wordpress-develop/blob/4.8.1/.jshintrc>.
194
  'boss' => true,
195
  'curly' => true,
196
  'eqeqeq' => true,
236
 
237
  if ( isset( $args['type'] ) ) {
238
  $type = $args['type'];
239
+
240
+ // Remap MIME types to ones that CodeMirror modes will recognize.
241
  if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) {
242
  $type = 'text/x-diff';
243
  }
353
  if ( ! empty( $settings['codemirror']['lint'] ) ) {
354
  $settings['codemirror']['gutters'][] = 'CodeMirror-lint-markers';
355
  }
356
+
357
+ // Let settings supplied via args override any defaults.
358
  foreach ( wp_array_slice_assoc( $args, array( 'codemirror', 'csslint', 'jshint', 'htmlhint' ) ) as $key => $value ) {
359
  $settings[ $key ] = array_merge(
360
  $settings[ $key ],
402
  'Reset' => __('Reset', 'nimble-builder'),
403
  'Reset complete' => __('Reset complete', 'nimble-builder'),
404
  'Reset failed' => __('Reset failed', 'nimble-builder'),
405
+
406
+ // Header button title text
407
  'Drag and drop content' => __('Drag and drop content', 'nimble-builder'),
408
+
409
+ // Generated UI
410
  'Content Picker' => __('Content Picker', 'nimble-builder'),
411
  'Pick a module' => __('Pick a module', 'nimble-builder'),
412
  'Pick a pre-designed section' => __('Pick a pre-designed section', 'nimble-builder'),
439
  'Responsive settings : breakpoint, column direction' => __('Responsive settings : breakpoint, column direction', 'nimble-builder'),
440
 
441
  'Settings for the' => __('Settings for the', 'nimble-builder'),//section / column / module
442
+
443
+ // UI global and local options
444
  'Current page options' => __( 'Current page options', 'nimble-builder'),
445
  'Page template' => __( 'Page template', 'nimble-builder'),
446
  'This page uses a custom template.' => __( 'This page uses a custom template.', 'nimble-builder'),
458
  'Site wide page speed optimizations' => __( 'Site wide page speed optimizations', 'nimble-builder'),
459
  'Beta features' => __( 'Beta features', 'nimble-builder'),
460
  'Protect your contact forms with Google reCAPTCHA' => __( 'Protect your contact forms with Google reCAPTCHA', 'nimble-builder'),
461
+
462
+ // DEPRECATED
463
  'Options for the sections of the current page' => __( 'Options for the sections of the current page', 'nimble-builder'),
464
  'General options applied for the sections site wide' => __( 'General options applied for the sections site wide', 'nimble-builder'),
465
+ //
466
 
467
  'Site wide options' => __( 'Site wide options', 'nimble-builder'),
468
+
469
+
470
+ // Levels
471
  'location' => __('location', 'nimble-builder'),
472
  'section' => __('section', 'nimble-builder'),
473
  'nested section' => __('nested section', 'nimble-builder'),
474
  'column' => __('column', 'nimble-builder'),
475
  'module' => __('module', 'nimble-builder'),
476
+
477
+ // DRAG n DROP
478
  'This browser does not support drag and drop. You might need to update your browser or use another one.' => __('This browser does not support drag and drop. You might need to update your browser or use another one.', 'nimble-builder'),
479
  'You first need to click on a target ( with a + icon ) in the preview.' => __('You first need to click on a target ( with a + icon ) in the preview.', 'nimble-builder'),
480
  'Insert here' => __('Insert here', 'nimble-builder'),
481
  'Insert in a new section' => __('Insert in a new section', 'nimble-builder'),
482
  'Insert a new section here' => __('Insert a new section here', 'nimble-builder'),
483
+
484
+ // DOUBLE CLICK INSERTION
485
+
486
+
487
+ // MODULES
488
  'Select a font family' => __('Select a font family', 'nimble-builder'),
489
  'Web Safe Fonts' => __('Web Safe Fonts', 'nimble-builder'),
490
  'Google Fonts' => __('Google Fonts', 'nimble-builder'),
494
  'Something went wrong, please refresh this page.' => __('Something went wrong, please refresh this page.', 'nimble-builder'),
495
 
496
  'Select an icon' => __( 'Select an icon', 'nimble-builder' ),
497
+
498
+ // Code Editor
499
  'codeEditorSingular' => __( 'There is %d error in your %s code which might break your site. Please fix it before saving.', 'nimble-builder' ),
500
  'codeEditorPlural' => __( 'There are %d errors in your %s code which might break your site. Please fix them before saving.', 'nimble-builder' ),
501
+
502
+ // Various
503
  'Settings on desktops' => __('Settings on desktops', 'nimble-builder'),
504
  'Settings on tablets' => __('Settings on tablets', 'nimble-builder'),
505
  'Settings on mobiles' => __('Settings on mobiles', 'nimble-builder'),
506
+
507
+ // Level Tree
508
  'No sections to navigate' => __('No sections to navigate', 'nimble-builder'),
509
  'Remove this element' => __('Remove this element', 'nimble-builder'),
510
+
511
+ // Cache plugin warning
512
+ // @see https://github.com/presscustomizr/nimble-builder/issues/395
513
  'You seem to be using a cache plugin.' => __('You seem to be using a cache plugin.', 'nimble-builder'),
514
  'It is recommended to disable your cache plugin when customizing your website.' => __('It is recommended to disable your cache plugin when customizing your website.', 'nimble-builder'),
515
+
516
+ // Revision history
517
+ // @see https://github.com/presscustomizr/nimble-builder/issues/392
518
  'Revision history of local sections' => __('Revision history of local sections', 'nimble-builder'),
519
  'Revision history of global sections' => __('Revision history of global sections', 'nimble-builder'),
520
  'The revision could not be restored.' => __('The revision could not be restored.', 'nimble-builder'),
523
  'No revision history available for the moment.' => __('No revision history available for the moment.', 'nimble-builder'),
524
  'This is the current version.' => __('This is the current version.', 'nimble-builder'),
525
  '(currently published version)' => __('(currently published version)','nimble-builder'),
526
+
527
+ // Import / export
528
  'You need to publish before exporting.' => __( 'Nimble Builder : you need to publish before exporting.', 'nimble-builder'),
529
  'Export / Import' => __('Export / Import', 'nimble-builder'),
530
  'Export failed' => __('Export failed', 'nimble-builder'),
536
  'Import failed, invalid file content' => __('Import failed, invalid file content', 'nimble-builder'),
537
  'Import failed, file problem' => __('Import failed, file problem', 'nimble-builder'),
538
  'Some image(s) could not be imported' => __('Some image(s) could not be imported', 'nimble-builder')
539
+ // 'Module' => __('Module', 'text_doma'),
540
+ //
541
 
542
  )//array()
543
  )//array()
544
  );//array_merge
545
  }//'nimble_add_i18n_localized_control_params'
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+ // ADD SEKTION VALUES TO EXPORTED DATA IN THE CUSTOMIZER PREVIEW
554
  add_filter( 'skp_json_export_ready_skopes', '\Nimble\add_sektion_values_to_skope_export' );
555
  function add_sektion_values_to_skope_export( $skopes ) {
556
  if ( ! is_array( $skopes ) ) {
575
  'db_values' => sek_get_skoped_seks( $skope_id ),
576
  'setting_id' => sek_get_seks_setting_id( $skope_id )//nimble___loop_start[skp__post_page_home], nimble___custom_location_id[skp__global]
577
  );
578
+ // foreach( [
579
+ // 'loop_start',
580
+ // 'loop_end',
581
+ // 'before_content',
582
+ // 'after_content',
583
+ // 'global'
584
+ // ] as $location ) {
585
+ // $skp_data[ 'sektions' ][ $location ] = array(
586
+ // 'db_values' => sek_get_skoped_seks( $skope_id, $location ),
587
+ // 'setting_id' => sek_get_seks_setting_id( $skope_id, $location )//nimble___loop_start[skp__post_page_home]
588
+ // );
589
+ // }
590
  $new_skopes[] = $skp_data;
591
  }
592
 
593
+ // sek_error_log( '//////////////////// => new_skopes', $new_skopes);
594
+
595
  return $new_skopes;
596
  }
597
 
728
  </div>
729
  <!-- <textarea style="height:250px;width:100%" id="czr-customize-content_editor"></textarea> -->
730
  <?php
731
+ // the textarea id for the detached editor is 'czr-customize-content_editor'
732
+ // this function generates the <textarea> markup
733
  sek_setup_nimble_editor( '', NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID , array(
734
  '_content_editor_dfw' => false,
735
  'drag_drop_upload' => true,
747
  </div>
748
  <?php
749
  }
750
+
751
+
752
+
753
+
754
+ // Introduced for https://github.com/presscustomizr/nimble-builder/issues/395
755
  function sek_has_active_cache_plugin() {
756
  $cache_plugins = array(
757
  'WP Fastest Cache' => 'wp-fastest-cache/wpFastestCache.php',
812
  /* ------------------------------------------------------------------------- *
813
  * SETUP DYNAMIC SERVER REGISTRATION FOR SETTING
814
  /* ------------------------------------------------------------------------- */
815
+ // Fired @'after_setup_theme:20'
816
  if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
817
  class SEK_CZR_Dyn_Register {
818
  static $instance;
825
  }
826
 
827
  function __construct( $params = array() ) {
828
+ // Schedule the loading the skoped settings class
829
  add_action( 'customize_register', array( $this, 'load_nimble_setting_class' ) );
830
 
831
  add_filter( 'customize_dynamic_setting_args', array( $this, 'set_dyn_setting_args' ), 10, 2 );
832
  add_filter( 'customize_dynamic_setting_class', array( $this, 'set_dyn_setting_class') , 10, 3 );
833
  }//__construct
834
+
835
+ //@action 'customize_register'
836
  function load_nimble_setting_class() {
837
  require_once( NIMBLE_BASE_PATH . '/inc/sektions/seks_setting_class.php' );
838
  }
839
+
840
+ //@filter 'customize_dynamic_setting_args'
841
  function set_dyn_setting_args( $setting_args, $setting_id ) {
842
+ // shall start with "nimble___" or "__nimble_options__"
843
  if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) || 0 === strpos( $setting_id, NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS ) ) {
844
+ //sek_error_log( 'DYNAMICALLY REGISTERING SEK SETTING => ' . $setting_id, $setting_args);
845
  return array(
846
  'transport' => 'refresh',
847
  'type' => 'option',
848
  'default' => array(),
849
+ //'sanitize_callback' => array( $this, 'sanitize_callback' )
850
+ //'validate_callback' => array( $this, 'validate_callback' )
851
  );
852
  } else if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_LEVEL_UI ) ) {
853
+ //sek_error_log( 'DYNAMICALLY REGISTERING SEK SETTING => ' . $setting_id, $setting_args);
854
  return array(
855
  'transport' => 'refresh',
856
  'type' => '_nimble_ui_',//won't be saved as is,
860
  );
861
  }
862
  return $setting_args;
863
+ //return wp_parse_args( array( 'default' => array() ), $setting_args );
864
  }
865
+
866
+
867
+ //@filter 'customize_dynamic_setting_class'
868
  function set_dyn_setting_class( $class, $setting_id, $args ) {
869
+ // shall start with 'nimble___'
870
  if ( 0 !== strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) )
871
  return $class;
872
+ //sek_error_log( 'REGISTERING CLASS DYNAMICALLY for setting =>' . $setting_id );
873
  return '\Nimble\Nimble_Customizer_Setting';
874
  }
875
+
876
+
877
+ // Uses the sanitize_callback function specified on module registration if any
878
  function sanitize_callback( $setting_data, $setting_instance ) {
879
  if ( isset( $_POST['location_skope_id'] ) ) {
880
  $sektionSettingValue = sek_get_skoped_seks( $_POST['location_skope_id'] );
891
  }
892
  }
893
  }
894
+ //return new \WP_Error( 'required', __( 'Error in a sektion', 'text_doma' ), $setting_data );
895
  return $setting_data;
896
  }
897
+
898
+ // Uses the validate_callback function specified on module registration if any
899
+ // @return validity object
900
  function validate_callback( $validity, $setting_data, $setting_instance ) {
901
  $validated = true;
902
  if ( isset( $_POST['location_skope_id'] ) ) {
914
  }
915
  }
916
  }
917
+ //return new \WP_Error( 'required', __( 'Error in a sektion', 'text_doma' ), $setting_data );
918
  if ( true !== $validated ) {
919
  if ( is_wp_error( $validated ) ) {
920
  $validation_msg = $validation_msg->get_error_message();
1022
  $set = wp_parse_args(
1023
  $settings,
1024
  array(
1025
+ // Disable autop if the current post has blocks in it.
1026
  'wpautop' => ! has_blocks(),
1027
  'media_buttons' => true,
1028
  'default_editor' => '',
1069
  }
1070
 
1071
  if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
1072
+ // A cookie (set when a user resizes the editor) overrides the height.
1073
  $cookie = (int) get_user_setting( 'ed_size' );
1074
 
1075
  if ( $cookie ) {
1120
 
1121
  if ( self::$this_quicktags ) {
1122
  $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
1123
+ // 'html' is used for the "Text" editor tab.
1124
  if ( 'html' !== $default_editor ) {
1125
  $default_editor = 'tinymce';
1126
  }
1205
  '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' .
1206
  'id="' . $editor_id_attr . '">%s</textarea></div>'
1207
  );
1208
+
1209
+ // Prepare the content for the Visual or Text editor, only when TinyMCE is used (back-compat).
1210
  if ( self::$this_tinymce ) {
1211
  add_filter( 'the_nimble_editor_content', 'format_for_editor', 10, 2 );
1212
  }
1221
  * Either 'html' or 'tinymce'.
1222
  */
1223
  $content = apply_filters( 'the_nimble_editor_content', $content, $default_editor );
1224
+
1225
+ // Remove the filter as the next editor on the same page may not need it.
1226
  if ( self::$this_tinymce ) {
1227
  remove_filter( 'the_editor_content', 'format_for_editor' );
1228
  }
1229
+
1230
+ // Back-compat for the `htmledit_pre` and `richedit_pre` filters
1231
  if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) {
1232
  /** This filter is documented in wp-includes/deprecated.php */
1233
  $content = apply_filters_deprecated( 'htmledit_pre', array( $content ), '4.3.0', 'format_for_editor' );
1273
  }
1274
 
1275
  if ( empty( $qtInit['buttons'] ) ) {
1276
+ //$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
1277
+ //@nikeo modif
1278
  $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code';
1279
  }
1280
 
1374
  $plugins = array_unique( apply_filters( 'nimble_tiny_mce_plugins', $plugins ) );
1375
 
1376
  if ( ( $key = array_search( 'spellchecker', $plugins ) ) !== false ) {
1377
+ // Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
1378
+ // It can be added with 'mce_external_plugins'.
1379
  unset( $plugins[ $key ] );
1380
  }
1381
 
1419
  $mce_external_plugins[ $name ] = $url;
1420
  $plugurl = dirname( $url );
1421
  $strings = '';
1422
+
1423
+ // Try to load langs/[locale].js and langs/[locale]_dlg.js
1424
  if ( ! in_array( $name, $loaded_langs, true ) ) {
1425
  $path = str_replace( content_url(), '', $plugurl );
1426
  $path = WP_CONTENT_DIR . $path . '/langs/';
1478
  $editor_styles = get_editor_stylesheets();
1479
 
1480
  if ( ! empty( $editor_styles ) ) {
1481
+ // Force urlencoding of commas.
1482
  foreach ( $editor_styles as $key => $url ) {
1483
  if ( strpos( $url, ',' ) !== false ) {
1484
  $editor_styles[ $key ] = str_replace( ',', '%2C', $url );
1519
  $mce_buttons = apply_filters( 'nimble_teeny_mce_buttons', array( 'bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'fullscreen' ), $editor_id );
1520
  $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
1521
  } else {
1522
+ //@nikeo modif
1523
+ //$mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'wp_more', 'spellchecker' );
1524
  $mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'spellchecker' );
1525
 
1526
  if ( ! wp_is_mobile() ) {
1545
 
1546
  $mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo' );
1547
 
1548
+ // @nikeo modif
1549
+ // if ( ! wp_is_mobile() ) {
1550
+ // $mce_buttons_2[] = 'wp_help';
1551
+ // }
1552
+
1553
  /**
1554
  * Filters the second-row list of TinyMCE buttons (Visual tab).
1555
  *
1621
  'tabfocus_elements' => $set['tabfocus_elements'],
1622
  'body_class' => $body_class,
1623
  );
1624
+
1625
+ // Merge with the first part of the init array
1626
  $mceInit = array_merge( self::$first_init, $mceInit );
1627
 
1628
  if ( is_array( $set['tinymce'] ) ) {
1753
  * @since 4.8.0
1754
  */
1755
  public static function enqueue_default_editor() {
1756
+ // We are past the point where scripts can be enqueued properly.
1757
  if ( did_action( 'wp_enqueue_editor' ) ) {
1758
  return;
1759
  }
1760
 
1761
  self::enqueue_scripts( true );
1762
+
1763
+ // Also add wp-includes/css/editor.css
1764
  wp_enqueue_style( 'editor-buttons' );
1765
 
1766
  add_action( 'customize_controls_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 );
1788
  if ( is_rtl() ) {
1789
  $settings['directionality'] = 'rtl';
1790
  }
1791
+
1792
+ // In production all plugins are loaded (they are in wp-editor.js.gz).
1793
+ // The 'wpview', 'wpdialogs', and 'media' TinyMCE plugins are not initialized by default.
1794
+ // Can be added from js by using the 'wp-before-tinymce-init' event.
1795
  $settings['plugins'] = implode(
1796
  ',',
1797
  array(
1933
  'resize' => 'vertical',
1934
  'menubar' => false,
1935
  'branding' => false,
1936
+
1937
+ // Limit the preview styles in the menu/toolbar
1938
  'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
1939
 
1940
  'end_container_on_empty_block' => true,
1946
 
1947
  $suffix = SCRIPT_DEBUG ? '' : '.min';
1948
  $version = 'ver=' . get_bloginfo( 'version' );
1949
+
1950
+ // Default stylesheets
1951
  $settings['content_css'] = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
1952
  includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
1953
 
1957
  private static function get_translation() {
1958
  if ( empty( self::$translation ) ) {
1959
  self::$translation = array(
1960
+ // Default TinyMCE strings
1961
  'New document' => __( 'New document', 'nimble-builder' ),
1962
  'Formats' => _x( 'Formats', 'TinyMCE', 'nimble-builder' ),
1963
 
2021
  'Upper Alpha' => _x( 'Upper Alpha', 'list style', 'nimble-builder' ),
2022
  'Upper Roman' => _x( 'Upper Roman', 'list style', 'nimble-builder' ),
2023
  'Lower Roman' => _x( 'Lower Roman', 'list style', 'nimble-builder' ),
2024
+
2025
+ // Anchor plugin
2026
  'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)', 'nimble-builder' ),
2027
  'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)', 'nimble-builder' ),
2028
  'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)', 'nimble-builder' ),
2029
  'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' =>
2030
  __( 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.', 'nimble-builder' ),
2031
  'Id' => _x( 'Id', 'Id for link anchor (TinyMCE)', 'nimble-builder' ),
2032
+
2033
+ // Fullpage plugin
2034
  'Document properties' => __( 'Document properties', 'nimble-builder' ),
2035
  'Robots' => __( 'Robots', 'nimble-builder' ),
2036
  'Title' => __( 'Title', 'nimble-builder' ),
2038
  'Encoding' => __( 'Encoding', 'nimble-builder' ),
2039
  'Description' => __( 'Description', 'nimble-builder' ),
2040
  'Author' => __( 'Author', 'nimble-builder' ),
2041
+
2042
+ // Media, image plugins
2043
  'Image' => __( 'Image', 'nimble-builder' ),
2044
  'Insert/edit image' => array( __( 'Insert/edit image', 'nimble-builder' ), 'accessM' ),
2045
  'General' => __( 'General', 'nimble-builder' ),
2064
  'Paste your embed code below:' => __( 'Paste your embed code below:', 'nimble-builder' ),
2065
  'Insert video' => __( 'Insert video', 'nimble-builder' ),
2066
  'Embed' => __( 'Embed', 'nimble-builder' ),
2067
+
2068
+ // Each of these have a corresponding plugin
2069
  'Special character' => __( 'Special character', 'nimble-builder' ),
2070
  'Right to left' => _x( 'Right to left', 'editor button', 'nimble-builder' ),
2071
  'Left to right' => _x( 'Left to right', 'editor button', 'nimble-builder' ),
2082
  'Restore last draft' => __( 'Restore last draft', 'nimble-builder' ),
2083
  'Insert/edit link' => array( __( 'Insert/edit link', 'nimble-builder' ), 'metaK' ),
2084
  'Remove link' => array( __( 'Remove link', 'nimble-builder' ), 'accessS' ),
2085
+
2086
+ // Link plugin
2087
  'Link' => __( 'Link', 'nimble-builder' ),
2088
  'Insert link' => __( 'Insert link', 'nimble-builder' ),
2089
  'Insert/edit link' => __( 'Insert/edit link', 'nimble-builder' ),
2103
  'R' => _x( 'R', 'Short for red in RGB', 'nimble-builder' ),
2104
  'G' => _x( 'G', 'Short for green in RGB', 'nimble-builder' ),
2105
  'B' => _x( 'B', 'Short for blue in RGB', 'nimble-builder' ),
2106
+
2107
+ // Spelling, search/replace plugins
2108
  'Could not find the specified string.' => __( 'Could not find the specified string.', 'nimble-builder' ),
2109
  'Replace' => _x( 'Replace', 'find/replace', 'nimble-builder' ),
2110
  'Next' => _x( 'Next', 'find/replace', 'nimble-builder' ),
2121
  'Ignore all' => _x( 'Ignore all', 'spellcheck', 'nimble-builder' ),
2122
  'Ignore' => _x( 'Ignore', 'spellcheck', 'nimble-builder' ),
2123
  'Add to Dictionary' => __( 'Add to Dictionary', 'nimble-builder' ),
2124
+
2125
+ // TinyMCE tables
2126
  'Insert table' => __( 'Insert table', 'nimble-builder' ),
2127
  'Delete table' => __( 'Delete table', 'nimble-builder' ),
2128
  'Table properties' => __( 'Table properties', 'nimble-builder' ),
2195
  __( 'The changes you made will be lost if you navigate away from this page.', 'nimble-builder' ),
2196
  'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' =>
2197
  __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser&#8217;s edit menu instead.', 'nimble-builder' ),
2198
+
2199
+ // TinyMCE menus
2200
  'Insert' => _x( 'Insert', 'TinyMCE menu', 'nimble-builder' ),
2201
  'File' => _x( 'File', 'TinyMCE menu', 'nimble-builder' ),
2202
  'Edit' => _x( 'Edit', 'TinyMCE menu', 'nimble-builder' ),
2204
  'View' => _x( 'View', 'TinyMCE menu', 'nimble-builder' ),
2205
  'Table' => _x( 'Table', 'TinyMCE menu', 'nimble-builder' ),
2206
  'Format' => _x( 'Format', 'TinyMCE menu', 'nimble-builder' ),
2207
+
2208
+ // WordPress strings
2209
  'Toolbar Toggle' => array( __( 'Toolbar Toggle', 'nimble-builder' ), 'accessZ' ),
2210
  'Insert Read More tag' => array( __( 'Insert Read More tag', 'nimble-builder' ), 'accessT' ),
2211
  'Insert Page Break tag' => array( __( 'Insert Page Break tag', 'nimble-builder' ), 'accessP' ),
2220
  'Visual' => _x( 'Visual', 'Name for the Visual editor tab', 'nimble-builder' ), // Editor switch tab label
2221
  'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)', 'nimble-builder' ), // Editor switch tab label
2222
  'Add Media' => array( __( 'Add Media', 'nimble-builder' ), 'accessM' ), // Tooltip for the 'Add Media' button in the Block Editor Classic block
2223
+
2224
+ // Shortcuts help modal
2225
  'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts', 'nimble-builder' ), 'accessH' ),
2226
  'Classic Block Keyboard Shortcuts' => __( 'Classic Block Keyboard Shortcuts', 'nimble-builder' ),
2227
  'Default shortcuts,' => __( 'Default shortcuts,', 'nimble-builder' ),
2306
  $mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale );
2307
 
2308
  foreach ( $mce_translation as $key => $value ) {
2309
+ // Remove strings that are not translated.
2310
  if ( $key === $value ) {
2311
  unset( $mce_translation[ $key ] );
2312
  continue;
2316
  $mce_translation[ $key ] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8' );
2317
  }
2318
  }
2319
+
2320
+ // Set direction
2321
  if ( is_rtl() ) {
2322
  $mce_translation['_dir'] = 'rtl';
2323
  }
2459
  self::print_tinymce_scripts();
2460
 
2461
  if ( self::$ext_plugins ) {
2462
+ // Load the old-format English strings to prevent unsightly labels in old style popups
2463
  echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
2464
  }
2465
  }
2588
  * @param array $query An array of WP_Query arguments.
2589
  */
2590
  $query = apply_filters( 'wp_link_query_args', $query );
2591
+
2592
+ // Do main query.
2593
  $get_posts = new WP_Query;
2594
  $posts = $get_posts->query( $query );
2595
+
2596
+ // Build results.
2597
  $results = array();
2598
  foreach ( $posts as $post ) {
2599
  if ( 'post' == $post->post_type ) {
2643
  * @since 3.1.0
2644
  */
2645
  public static function wp_link_dialog() {
2646
+ // Run once
2647
  if ( self::$link_dialog_printed ) {
2648
  return;
2649
  }
2650
 
2651
  self::$link_dialog_printed = true;
2652
+
2653
+ // display: none is required here, see #WP27605
2654
  ?>
2655
  <div id="wp-link-backdrop" style="display: none"></div>
2656
  <div id="wp-link-wrap" class="wp-core-ui" style="display: none" role="dialog" aria-labelledby="link-modal-title">
2723
  }
2724
  }
2725
  }
2726
+
2727
+ // fire from sek_catch_export_action() @hook 'customize_register'
2728
  function sek_maybe_export() {
2729
  $nonce = 'save-customize_' . get_stylesheet();
2730
  if ( ! isset( $_REQUEST['sek_export_nonce'] ) ) {
2752
  return;
2753
  }
2754
  $seks_data = sek_get_skoped_seks( $_REQUEST['skope_id'] );
2755
+
2756
+ //sek_error_log('EXPORT BEFORE FILTER ? ' . $_REQUEST['skope_id'] , $seks_data );
2757
+ // the filter 'nimble_pre_export' is used to :
2758
+ // replace image id by the absolute url
2759
+ // clean level ids and replace them with a placeholder string
2760
  $seks_data = apply_filters( 'nimble_pre_export', $seks_data );
2761
  $theme_name = sanitize_title_with_dashes( get_stylesheet() );
2762
+
2763
+ //sek_error_log('EXPORT AFTER FILTER ?', $seks_data );
2764
  $export = array(
2765
  'data' => $seks_data,
2766
  'metas' => array(
2767
  'skope_id' => $_REQUEST['skope_id'],
2768
  'version' => NIMBLE_VERSION,
2769
+ // is sent as a string : "__after_header,__before_main_wrapper,loop_start,__before_footer"
2770
  'active_locations' => is_string( $_REQUEST['active_locations'] ) ? explode( ',', $_REQUEST['active_locations'] ) : array(),
2771
  'date' => date("Y-m-d"),
2772
  'theme' => $theme_name
2773
  )
2774
  );
2775
+ // sek_error_log('$_REQUEST ?', $_REQUEST );
2776
+ //sek_error_log('$export ?', $export );
2777
 
2778
  $skope_id = str_replace('skp__', '', $_REQUEST['skope_id'] );
2779
  $filename = $theme_name . '_' . $skope_id . '.nimblebuilder';
2780
+
2781
+ // Set the download headers.
2782
  header( 'Content-disposition: attachment; filename=' . $filename );
2783
  header( 'Content-Type: application/octet-stream; charset=' . get_option( 'blog_charset' ) );
2784
+
2785
+ // Serialize the export data.
2786
+ //echo serialize( $export );
2787
  echo wp_json_encode( $export );
2788
+
2789
+ // Start the download.
2790
  die();
2791
  }
2792
+
2793
+ // Ajax action before processing the export
2794
+ // control that all required fields are there
2795
+ // This is to avoid a white screen when generating the download window afterwards
2796
  add_action( 'wp_ajax_sek_pre_export_checks', '\Nimble\sek_ajax_pre_export_checks' );
2797
  function sek_ajax_pre_export_checks() {
2798
  $action = 'save-customize_' . get_stylesheet();
2820
  }
2821
  wp_send_json_success();
2822
  }
2823
+
2824
+
2825
+
2826
+
2827
+
2828
+
2829
+
2830
+ // fetch the content from a user imported file
2831
  add_action( 'wp_ajax_sek_get_imported_file_content', '\Nimble\sek_ajax_get_imported_file_content' );
2832
  function sek_ajax_get_imported_file_content() {
2833
+ // sek_error_log(__FUNCTION__ . ' AJAX $_POST ?', $_POST );
2834
+ // sek_error_log(__FUNCTION__ . ' AJAX $_FILES ?', $_FILES );
2835
+ // sek_error_log(__FUNCTION__ . ' AJAX $_REQUEST ?', $_REQUEST );
2836
 
2837
  $action = 'save-customize_' . get_stylesheet();
2838
  if ( ! check_ajax_referer( $action, 'nonce', false ) ) {
2857
  if ( ! isset( $_POST['skope'] ) || empty( $_POST['skope'] ) ) {
2858
  wp_send_json_error( 'missing_skope' );
2859
  }
2860
+
2861
+ // load WP upload if not done yet
2862
  if ( ! function_exists( 'wp_handle_upload' ) ) {
2863
  require_once( ABSPATH . 'wp-admin/includes/file.php' );
2864
  }
2865
+
2866
+ // @see https://codex.wordpress.org/Function_Reference/wp_handle_upload
2867
+ // Important => always run unlink( $file['file'] ) before sending the json success or error
2868
+ // otherwise WP will write the file in the /wp-content folder
2869
  $file = wp_handle_upload(
2870
  $_FILES['file_candidate'],
2871
  array(
2873
  'test_type' => false,
2874
  'mimes' => array(
2875
  'text' => 'text/plain',
2876
+ //'nimblebuilder' => 'text/plain',
2877
  'json' => 'application/json',
2878
  'nimblebuilder' => 'application/json'
2879
  )
2880
  )
2881
  );
2882
+
2883
+ // Make sure we have an uploaded file.
2884
  if ( isset( $file['error'] ) ) {
2885
  unlink( $file['file'] );
2886
  wp_send_json_error( 'import_file_error' );
2891
  wp_send_json_error( 'import_file_do_not_exist' );
2892
  return;
2893
  }
2894
+
2895
+ // Get the upload data.
2896
  $raw = file_get_contents( $file['file'] );
2897
+ //$raw_unserialized_data = @unserialize( $raw );
2898
  $raw_unserialized_data = json_decode( $raw, true );
2899
+
2900
+ // VALIDATE IMPORTED CONTENT
2901
+ // data structure :
2902
+ // $raw_unserialized_data = array(
2903
+ // 'data' => $seks_data,
2904
+ // 'metas' => array(
2905
+ // 'skope_id' => $_REQUEST['skope_id'],
2906
+ // 'version' => NIMBLE_VERSION,
2907
+ // // is sent as a string : "__after_header,__before_main_wrapper,loop_start,__before_footer"
2908
+ // 'active_locations' => is_string( $_REQUEST['active_locations'] ) ? explode( ',', $_REQUEST['active_locations'] ) : array(),
2909
+ // 'date' => date("Y-m-d")
2910
+ // )
2911
+ // );
2912
+ // check import structure
2913
  if ( ! is_array( $raw_unserialized_data ) || empty( $raw_unserialized_data['data']) || !is_array( $raw_unserialized_data['data'] ) || empty( $raw_unserialized_data['metas'] ) || !is_array( $raw_unserialized_data['metas'] ) ) {
2914
  unlink( $file['file'] );
2915
  wp_send_json_error( 'invalid_import_content' );
2916
  return;
2917
  }
2918
+ // check version
2919
+ // => current Nimble Version must be at least import version
2920
  if ( !empty( $raw_unserialized_data['metas']['version'] ) && version_compare( NIMBLE_VERSION, $raw_unserialized_data['metas']['version'], '<' ) ) {
2921
  unlink( $file['file'] );
2922
  wp_send_json_error( 'nimble_builder_needs_update' );
2923
  return;
2924
  }
2925
+
2926
+ //sek_error_log('IMPORT BEFORE FILTER ?', $raw_unserialized_data );
2927
+
2928
+ // in a pre-import-check context, we don't need to sniff and upload images
2929
  if ( isset( $_POST['pre_import_check'] ) && true == $_POST['pre_import_check'] ) {
2930
  remove_filter( 'nimble_pre_import', '\Nimble\sek_sniff_imported_img_url' );
2931
  }
2933
  $imported_content = array(
2934
  'data' => apply_filters( 'nimble_pre_import', $raw_unserialized_data['data'] ),
2935
  'metas' => $raw_unserialized_data['metas'],
2936
+ // the image import errors won't block the import
2937
+ // they are used when notifying user in the customizer
2938
  'img_errors' => !empty( Nimble_Manager()->img_import_errors ) ? implode(',', Nimble_Manager()->img_import_errors) : array()
2939
  );
2940
+
2941
+ // Remove the uploaded file
2942
+ // Important => always run unlink( $file['file'] ) before sending the json success or error
2943
+ // otherwise WP will write the file in the /wp-content folder
2944
  unlink( $file['file'] );
2945
+ // Send
2946
  wp_send_json_success( $imported_content );
2947
  }
2948
+
2949
+
2950
+
2951
+
2952
+
2953
+ // EXPORT FILTER
2954
  add_filter( 'nimble_pre_export', '\Nimble\sek_parse_img_and_clean_id' );
2955
  function sek_parse_img_and_clean_id( $seks_data ) {
2956
  $new_seks_data = array();
2976
  }
2977
  return $new_seks_data;
2978
  }
2979
+
2980
+ // IMPORT FILTER
2981
  add_filter( 'nimble_pre_import', '\Nimble\sek_sniff_imported_img_url' );
2982
  function sek_sniff_imported_img_url( $seks_data ) {
2983
  $new_seks_data = array();
2987
  } else {
2988
  if ( is_string( $value ) && false !== strpos( $value, '__img_url__' ) && sek_is_img_url( $value ) ) {
2989
  $url = str_replace( '__img_url__', '', $value );
2990
+ //sek_error_log( __FUNCTION__ . ' URL?', $url );
2991
  $id = sek_sideload_img_and_return_attachment_id( $url );
2992
  if ( is_wp_error( $id ) ) {
2993
  $value = null;
3003
  }
3004
  return $new_seks_data;
3005
  }
3006
+
3007
+ // @return bool
3008
  function sek_is_img_url( $url = '' ) {
3009
  if ( is_string( $url ) ) {
3010
  if ( preg_match( '/\.(jpg|jpeg|png|gif)/i', $url ) ) {
3015
  }
3016
 
3017
  ?><?php
3018
+ // WP 5.0.0 compat. until the bug is fixed
3019
+ // this hook fires before the customize changeset is inserter / updated in database
3020
+ // Removing the wp_targeted_link_rel callback from the 'content_save_pre' filter prevents corrupting the changeset JSON
3021
+ // more details in this ticket : https://core.trac.wordpress.org/ticket/45292
3022
  add_action( 'customize_save_validation_before', '\Nimble\sek_remove_callback_wp_targeted_link_rel' );
3023
  function sek_remove_callback_wp_targeted_link_rel( $wp_customize ) {
3024
  if ( false !== has_filter( 'content_save_pre', 'wp_targeted_link_rel' ) ) {
3027
  };
3028
 
3029
  ?><?php
3030
+ // Set input content
3031
+ // the default input type templates are declared in inc/czr-base-fmk/_dev_php/0_3_czr-base-fmk-tmpl_builder.php
3032
+ // the template of input specific to Nimble are declared here
3033
  add_action( 'czr_set_input_tmpl_content', '\Nimble\sek_set_input_tmpl_content', 10, 3 );
3034
  function sek_set_input_tmpl_content( $input_type, $input_id, $input_data ) {
3035
+ // error_log( print_r( $input_data, true ) );
3036
+ // error_log('$input_type' . $input_type );
3037
  if ( ! array_key_exists( 'input_type', $input_data ) || empty( $input_data[ 'input_type' ] ) ) {
3038
  wp_send_json_error( 'sek_set_input_tmpl_content => missing input type for input id : ' . $input_id );
3039
  }
3040
  switch( $input_type ) {
3041
+ // Content picker group
3042
  case 'content_type_switcher' :
3043
  sek_set_input_tmpl___content_type_switcher( $input_id, $input_data );
3044
  break;
3125
  /* ------------------------------------------------------------------------- *
3126
  * CONTENT TYPE SWITCHER INPUT
3127
  /* ------------------------------------------------------------------------- */
3128
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3129
  function sek_set_input_tmpl___content_type_switcher( $input_id, $input_data ) {
3130
  ?>
3131
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
3142
  /* ------------------------------------------------------------------------- *
3143
  * MODULE PICKER INPUT
3144
  /* ------------------------------------------------------------------------- */
3145
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3146
  function sek_set_input_tmpl___module_picker( $input_id, $input_data ) {
3147
  ?>
3148
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
3152
 
3153
  $i = 0;
3154
  foreach( $content_collection as $_params ) {
3155
+ // if ( $i % 2 == 0 ) {
3156
+ // //printf('<div class="sek-module-raw"></div');
3157
+ // }
3158
  $_params = wp_parse_args( $_params, array(
3159
  'content-type' => 'module',
3160
  'content-id' => '',
3198
  /* ------------------------------------------------------------------------- *
3199
  * SECTION PICKER INPUT
3200
  /* ------------------------------------------------------------------------- */
3201
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3202
  function sek_set_input_tmpl___section_picker( $input_id, $input_data ) {
3203
+ //sek_error_log('$input_data ? for input_id ' . $input_id, $input_data );
3204
+ //sek_error_log('CURRENT MODULE PARAMS ?', CZR_Fmk_Base()->current_module_params_when_ajaxing );
3205
  ?>
3206
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
3207
  <div class="sek-content-type-wrapper">
3213
  }
3214
  $content_collection = $input_data['section_collection'];
3215
 
3216
+ foreach( $content_collection as $_params ) {
3217
  $section_type = 'content';
3218
+ // Section type has to be specified for header and footer sections
3219
  if ( !empty($input_data['section_type']) ) {
3220
  $section_type = $input_data['section_type'];
3221
  }
3224
  'preset_section',
3225
  $_params['content-id'],
3226
  sprintf( 'background: url(%1$s) 50% 50% / cover no-repeat;%2$s',
3227
+ // v1.4.2 : added the ?ver param to make sure we always display the latest shot of the section
3228
+ // May 21st, v1.7.5 => back to the local data
3229
+ // after problem was reported when fetching data remotely : https://github.com/presscustomizr/nimble-builder/issues/445
3230
+ NIMBLE_BASE_URL . '/assets/img/section_assets/thumbs/' . $_params['thumb'] . '?ver=' . NIMBLE_VERSION,
3231
+
3232
+ //$_params['thumb'] . '?ver=' . NIMBLE_VERSION,
3233
  isset( $_params['height'] ) ? 'height:'.$_params['height'] : ''
3234
  ),
3235
  $_params['title'],
3246
  /* ------------------------------------------------------------------------- *
3247
  * SPACING INPUT
3248
  /* ------------------------------------------------------------------------- */
3249
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3250
  function sek_set_input_tmpl___spacing( $input_id, $input_data ) {
3251
  ?>
3252
  <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
3325
  /* ------------------------------------------------------------------------- *
3326
  * BACKGROUND POSITION INPUT
3327
  /* ------------------------------------------------------------------------- */
3328
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3329
  function sek_set_input_tmpl___bg_position( $input_id, $input_data ) {
3330
  ?>
3331
  <div class="sek-bg-pos-wrapper">
3420
  /* ------------------------------------------------------------------------- *
3421
  * HORIZONTAL ALIGNMENT INPUT
3422
  /* ------------------------------------------------------------------------- */
3423
+ // AND
3424
  /* ------------------------------------------------------------------------- *
3425
  * HORIZONTAL ALIGNMENT INPUT FOR TEXT => includes the 'justify' icon
3426
  /* ------------------------------------------------------------------------- */
3427
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3428
  function sek_set_input_tmpl___h_alignment( $input_id, $input_data ) {
3429
  ?>
3430
  <div class="sek-h-align-wrapper">
3455
  /* ------------------------------------------------------------------------- *
3456
  * VERTICAL ALIGNMENT INPUT
3457
  /* ------------------------------------------------------------------------- */
3458
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3459
  function sek_set_input_tmpl___v_alignment( $input_id, $input_data ) {
3460
  ?>
3461
  <div class="sek-v-align-wrapper">
3473
  /* ------------------------------------------------------------------------- *
3474
  * FONT AWESOME ICON PICKER INPUT
3475
  /* ------------------------------------------------------------------------- */
3476
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3477
  function sek_set_input_tmpl___fa_icon_picker( $input_id, $input_data ) {
3478
  ?>
3479
  <select data-czrtype="<?php echo $input_id; ?>"></select>
3480
  <?php
3481
  }
3482
+
3483
+
3484
+ // this dynamic filter is declared on wp_ajax_ac_get_template in the czr_base_fmk
3485
+ // It allows us to populate the server response with the relevant module html template
3486
+ // $html = apply_filters( "ac_set_ajax_czr_tmpl___{$module_type}", '', $tmpl );
3487
  add_filter( "ac_set_ajax_czr_tmpl___fa_icon_picker_input", '\Nimble\sek_get_fa_icon_list_tmpl', 10, 3 );
3488
+ // hook : ac_set_ajax_czr_tmpl___czr_tiny_mce_editor_module
3489
+ // this dynamic filter is declared on wp_ajax_ac_get_template
3490
+ // It allows us to populate the server response with the relevant module html template
3491
+ // $html = apply_filters( "ac_set_ajax_czr_tmpl___{$module_type}", '', $tmpl );
3492
+ //
3493
+ // For czr_tiny_mce_editor_module, we request the font_list tmpl
3494
  function sek_get_fa_icon_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
3495
  if ( empty( $requested_tmpl ) ) {
3496
  wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
3500
  sek_retrieve_decoded_font_awesome_icons()
3501
  );//will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
3502
  }
3503
+
3504
+
3505
+
3506
+ //retrieves faicons:
3507
+ // 1) from faicons.json if needed (transient doesn't exists, or is new version => set in TC_wfc ) and decodes them
3508
+ // otherwise
3509
+ // 2) from the transient set if it exists
3510
  function sek_retrieve_decoded_font_awesome_icons() {
3511
+ // this file must be generated with: https://github.com/presscustomizr/nimble-builder/issues/57
3512
  $faicons_json_path = NIMBLE_BASE_PATH . '/assets/faicons.json';
3513
  $faicons_transient_name = 'sek_font_awesome_november_2018';
3514
  if ( false == get_transient( $faicons_transient_name ) ) {
3537
  /* ------------------------------------------------------------------------- *
3538
  * FONT PICKER INPUT
3539
  /* ------------------------------------------------------------------------- */
3540
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3541
  function sek_set_input_tmpl___font_picker( $input_id, $input_data ) {
3542
  ?>
3543
  <select data-czrtype="<?php echo $input_id; ?>"></select>
3544
  <?php
3545
  }
3546
+
3547
+
3548
+ // this dynamic filter is declared on wp_ajax_ac_get_template in the czr_base_fmk
3549
+ // It allows us to populate the server response with the relevant module html template
3550
+ // $html = apply_filters( "ac_set_ajax_czr_tmpl___{$module_type}", '', $tmpl );
3551
  add_filter( "ac_set_ajax_czr_tmpl___font_picker_input", '\Nimble\sek_get_font_list_tmpl', 10, 3 );
3552
+ // hook : ac_set_ajax_czr_tmpl___czr_tiny_mce_editor_module
3553
+ // For czr_tiny_mce_editor_module, we request the font_list tmpl
3554
  function sek_get_font_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
3555
  if ( empty( $requested_tmpl ) ) {
3556
  wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
3582
  'Verdana,Geneva,sans-serif',
3583
  );
3584
  foreach ( $raw_cfonts as $font ) {
3585
+ //no subsets for cfonts => epty array()
3586
  $cfonts[] = array(
3587
  'name' => $font ,
3588
  'subsets' => array()
3590
  }
3591
  return apply_filters( 'sek_font_picker_cfonts', $cfonts );
3592
  }
3593
+
3594
+
3595
+ //retrieves gfonts:
3596
+ // 1) from webfonts.json if needed (transient doesn't exists, or is new version => set in TC_wfc ) and decodes them
3597
+ // otherwise
3598
+ // 2) from the transiet set if it exists
3599
+ //
3600
+ // => Until June 2017, the webfonts have been stored in 'tc_gfonts' transient
3601
+ // => In June 2017, the Google Fonts have been updated with a new webfonts.json
3602
+ // generated from : https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyBID8gp8nBOpWyH5MrsF7doP4fczXGaHdA
3603
+ //
3604
+ // => The transient name is now : czr_gfonts_june_2017
3605
  function sek_retrieve_decoded_gfonts() {
3606
  if ( false == get_transient( 'sek_gfonts_may_2018' ) ) {
3607
  $gfont_raw = @file_get_contents( NIMBLE_BASE_PATH ."/assets/webfonts.json" );
3619
 
3620
  return $gfonts_decoded;
3621
  }
3622
+
3623
+
3624
+
3625
+ //@return the google fonts
3626
  function sek_get_gfonts( $what = null ) {
3627
+ //checks if transient exists or has expired
3628
 
3629
  $gfonts_decoded = sek_retrieve_decoded_gfonts();
3630
  $gfonts = array();
3631
+ //$subsets = array();
3632
+
3633
+ // $subsets['all-subsets'] = sprintf( '%1$s ( %2$s %3$s )',
3634
+ // __( 'All languages' , 'text_doma' ),
3635
+ // count($gfonts_decoded['items']) + count( $this -> get_cfonts() ),
3636
+ // __('fonts' , 'text_doma' )
3637
+ // );
3638
 
3639
  foreach ( $gfonts_decoded['items'] as $font ) {
3640
  foreach ( $font['variants'] as $variant ) {
3641
  $name = str_replace( ' ', '+', $font['family'] );
3642
  $gfonts[] = array(
3643
  'name' => $name . ':' .$variant
3644
+ //'subsets' => $font['subsets']
3645
  );
3646
  }
3647
+ //generates subset list : subset => font number
3648
+ // foreach ( $font['subsets'] as $sub ) {
3649
+ // $subsets[$sub] = isset($subsets[$sub]) ? $subsets[$sub]+1 : 1;
3650
+ // }
3651
  }
3652
 
3653
+ //finalizes the subset array
3654
+ // foreach ( $subsets as $subset => $font_number ) {
3655
+ // if ( 'all-subsets' == $subset )
3656
+ // continue;
3657
+ // $subsets[$subset] = sprintf('%1$s ( %2$s %3$s )',
3658
+ // $subset,
3659
+ // $font_number,
3660
+ // __('fonts' , 'text_doma' )
3661
+ // );
3662
+ // }
3663
+
3664
  return ('subsets' == $what) ? apply_filters( 'sek_font_picker_gfonts_subsets ', $subsets ) : apply_filters( 'sek_font_picker_gfonts', $gfonts ) ;
3665
  }
3666
 
3669
  /* ------------------------------------------------------------------------- *
3670
  * FONT SIZE
3671
  /* ------------------------------------------------------------------------- */
3672
+ // AND
3673
  /* ------------------------------------------------------------------------- *
3674
  * LINE HEIGHT INPUT TMPLS
3675
  /* ------------------------------------------------------------------------- */
3676
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3677
  function sek_set_input_tmpl___font_size_line_height( $input_id, $input_data ) {
3678
  ?>
3679
  <?php
3680
+ // we save the int value + unit
3681
+ // we want to keep only the numbers when printing the tmpl
3682
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
3683
  ?>
3684
  <#
3685
  var value = data['<?php echo $input_id; ?>'],
3707
  /* ------------------------------------------------------------------------- *
3708
  * CODE EDITOR INPUT TEMPLATE
3709
  /* ------------------------------------------------------------------------- */
3710
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3711
  function sek_set_input_tmpl___code_editor( $input_id, $input_data ) {
3712
  /*
3713
  * Needed to form the correct params to pass to the code mirror editor, based on the code type
3724
  /* ------------------------------------------------------------------------- *
3725
  * CODE EDITOR INPUT TEMPLATE
3726
  /* ------------------------------------------------------------------------- */
3727
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3728
  function sek_set_input_tmpl___range_simple( $input_id, $input_data ) {
3729
  ?>
3730
  <?php
3731
+ // we save the int value + unit
3732
+ // we want to keep only the numbers when printing the tmpl
3733
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
3734
  ?>
3735
  <#
3736
  var value = data['<?php echo $input_id; ?>'],
3763
  /* ------------------------------------------------------------------------- *
3764
  * CODE EDITOR INPUT TEMPLATE
3765
  /* ------------------------------------------------------------------------- */
3766
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3767
  function sek_set_input_tmpl___range_with_unit_picker( $input_id, $input_data ) {
3768
  ?>
3769
  <?php
3770
+ // we save the int value + unit
3771
+ // we want to keep only the numbers when printing the tmpl
3772
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
3773
  ?>
3774
  <#
3775
  var value = data['<?php echo $input_id; ?>'],
3806
  /* ------------------------------------------------------------------------- *
3807
  * CODE EDITOR INPUT TEMPLATE
3808
  /* ------------------------------------------------------------------------- */
3809
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3810
  function sek_set_input_tmpl___range_with_unit_picker_device_switcher( $input_id, $input_data ) {
3811
  ?>
3812
  <?php
3813
+ // we save the int value + unit
3814
+ // we want to keep only the numbers when printing the tmpl
3815
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
3816
  ?>
3817
  <#
3818
  var value = data['<?php echo $input_id; ?>'],
3849
  /* ------------------------------------------------------------------------- *
3850
  * BORDERS INPUT TEMPLATE
3851
  /* ------------------------------------------------------------------------- */
3852
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3853
  function sek_set_input_tmpl___borders( $input_id, $input_data ) {
3854
  ?>
3855
  <?php
3856
+ // we save the int value + unit
3857
+ // we want to keep only the numbers when printing the tmpl
3858
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
3859
  ?>
3860
  <div class="sek-borders">
3861
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___borders() => data range_slide => ', data ); #> ?>
3894
  /* ------------------------------------------------------------------------- *
3895
  * BORDER RADIUS INPUT TEMPLATE
3896
  /* ------------------------------------------------------------------------- */
3897
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3898
  function sek_set_input_tmpl___border_radius( $input_id, $input_data ) {
3899
  ?>
3900
  <?php
3901
+ // we save the int value + unit
3902
+ // we want to keep only the numbers when printing the tmpl
3903
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
3904
  ?>
3905
  <div class="sek-borders">
3906
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___border_radius() => data range_slide => ', data ); #> ?>
3936
  /* ------------------------------------------------------------------------- *
3937
  * MULTIPLE BUTTON CHOICES INPUT TEMPLATE
3938
  /* ------------------------------------------------------------------------- */
3939
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3940
  function sek_set_input_tmpl___buttons_choice( $input_id, $input_data ) {
3941
  ?>
3942
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #> ?>
3966
  /* ------------------------------------------------------------------------- *
3967
  * RESET BUTTON INPUT TEMPLATE
3968
  /* ------------------------------------------------------------------------- */
3969
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3970
  function sek_set_input_tmpl___reset_button( $input_id, $input_data ) {
3971
  ?>
3972
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #> ?>
3987
  /* ------------------------------------------------------------------------- *
3988
  * RESET BUTTON INPUT TEMPLATE
3989
  /* ------------------------------------------------------------------------- */
3990
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
3991
  function sek_set_input_tmpl___revision_history( $input_id, $input_data ) {
3992
  ?>
3993
  <?php //<# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #> ?>
4005
  /* ------------------------------------------------------------------------- *
4006
  * DETACHED WP EDITOR INPUT TEMPLATE
4007
  /* ------------------------------------------------------------------------- */
4008
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
4009
  function sek_set_input_tmpl___detached_tinymce_editor( $input_id, $input_data ) {
4010
  ?>
4011
  <?php ////console.log( 'IN php::sek_set_input_tmpl___detached_tinymce_edito() => input data => ', data ); #> ?>
4019
  * WP EDITOR INPUT TEMPLATE
4020
  /* ------------------------------------------------------------------------- */
4021
  function sek_set_input_tmpl___nimble_tinymce_editor( $input_id, $input_data ) {
4022
+ // Added an id attribute for https://github.com/presscustomizr/nimble-builder/issues/403
4023
+ // needed to instantiate wp.editor.initialize(...)
4024
  ?>
4025
  <?php //<# console.log( 'IN php::ac_get_default_input_tmpl() => data range_slide => ', data ); #> ?>
4026
  <textarea id="textarea-{{ data.control_id }}" data-czrtype="<?php echo $input_id; ?>" class="width-100" name="textarea" rows="10" cols="">{{ data.value }}</textarea>
4031
  /* ------------------------------------------------------------------------- *
4032
  * IMPORT / EXPORT
4033
  /* ------------------------------------------------------------------------- */
4034
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
4035
  function sek_set_input_tmpl___imp_exp( $input_id, $input_data ) {
4036
  ?>
4037
  <?php //<# console.log( 'IN php::sek_set_input_tmpl___detached_tinymce_edito() => input data => ', data ); #> ?>
4065
  /* ------------------------------------------------------------------------- *
4066
  * POST GRID LAYOUT PICKER
4067
  /* ------------------------------------------------------------------------- */
4068
+ // @fired from sek_set_input_tmpl_content( $input_type, $input_id, $input_data )
4069
  function sek_set_input_tmpl___grid_layout( $input_id, $input_data ) {
4070
  ?>
4071
  <div class="sek-grid-layout-wrapper">
inc/sektions/ccat-sektions.php CHANGED
@@ -6,6 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
6
  function sek_is_debug_mode() {
7
  return isset( $_GET['nimble_debug'] );
8
  }
 
9
  function sek_is_dev_mode() {
10
  return ( defined( 'NIMBLE_DEV' ) && NIMBLE_DEV ) || ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || sek_is_debug_mode();
11
  }
@@ -23,24 +24,38 @@ if ( !defined( 'NIMBLE_MODULE_ICON_PATH' ) ) { define( 'NIMBLE_MODULE_ICON_PATH'
23
  if ( !defined( 'NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID') ) { define( 'NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID' , 'czr-customize-content_editor' ); }
24
 
25
  if ( !defined( 'NIMBLE_WELCOME_NOTICE_ID' ) ) { define ( 'NIMBLE_WELCOME_NOTICE_ID', 'nimble-welcome-notice-12-2018' ); }
 
26
  if ( !defined( 'NIMBLE_FEEDBACK_NOTICE_ID' ) ) { define ( 'NIMBLE_FEEDBACK_NOTICE_ID', 'nimble-feedback-notice-04-2019' ); }
27
 
28
 
29
  /* ------------------------------------------------------------------------- *
30
  * LOCATIONS UTILITIES
31
  /* ------------------------------------------------------------------------- */
 
32
  function sek_get_locations() {
33
  if ( ! is_array( Nimble_Manager()->registered_locations ) ) {
34
  sek_error_log( __FUNCTION__ . ' error => the registered locations must be an array');
35
  return Nimble_Manager()->default_locations;
36
  }
 
37
  return apply_filters( 'sek_get_locations', Nimble_Manager()->registered_locations );
38
  }
 
 
 
 
39
  function sek_get_local_content_locations() {
40
  $locations = array();
41
  $all_locations = sek_get_locations();
42
  if ( is_array( $all_locations ) ) {
43
  foreach ( $all_locations as $loc_id => $loc_data) {
 
 
 
 
 
 
 
44
  $loc_data = wp_parse_args( $loc_data, Nimble_Manager()->default_registered_location_model );
45
  if ( true === $loc_data['is_header_location'] || true === $loc_data['is_footer_location'] )
46
  continue;
@@ -52,9 +67,14 @@ function sek_get_local_content_locations() {
52
  }
53
  return $locations;
54
  }
 
 
 
55
  function sek_get_local_locations() {
56
  return sek_get_local_content_locations();
57
  }
 
 
58
  function sek_get_global_locations() {
59
  $locations = array();
60
  $all_locations = sek_get_locations();
@@ -67,9 +87,13 @@ function sek_get_global_locations() {
67
  }
68
  return $locations;
69
  }
 
 
 
70
  function sek_get_registered_location_property( $location_id, $property_name = '' ) {
71
  $all_locations = sek_get_locations();
72
  $default_property_val = 'not_set';
 
73
  if ( ! isset( $all_locations[$location_id] ) || ! is_array( $all_locations[$location_id] ) ) {
74
  sek_error_log( __FUNCTION__ . ' error => the location ' . $location_id . ' is invalid or not registered.');
75
  return $default_property_val;
@@ -83,6 +107,8 @@ function sek_get_registered_location_property( $location_id, $property_name = ''
83
  $location_params = wp_parse_args( $all_locations[$location_id], Nimble_Manager()->default_registered_location_model );
84
  return ! empty( $location_params[$property_name] ) ? $location_params[$property_name] : $default_property_val;
85
  }
 
 
86
  function sek_is_global_location( $location_id ) {
87
  if ( ! is_string( $location_id ) || empty( $location_id ) ) {
88
  sek_error_log( __FUNCTION__ . ' error => missing or invalid location_id param' );
@@ -91,6 +117,8 @@ function sek_is_global_location( $location_id ) {
91
  $is_global_location = sek_get_registered_location_property( $location_id, 'is_global_location' );
92
  return 'not_set' === $is_global_location ? false : true === $is_global_location;
93
  }
 
 
94
  function register_location( $location_id, $params = array() ) {
95
  $params = is_array( $params ) ? $params : array();
96
  $params = wp_parse_args( $params, Nimble_Manager()->default_registered_location_model );
@@ -99,7 +127,13 @@ function register_location( $location_id, $params = array() ) {
99
  $registered_locations[$location_id] = $params;
100
  }
101
  Nimble_Manager()->registered_locations = $registered_locations;
 
102
  }
 
 
 
 
 
103
  function sek_get_default_location_model( $skope_id = null ) {
104
  $is_global_skope = NIMBLE_GLOBAL_SKOPE_ID === $skope_id;
105
  if ( $is_global_skope ) {
@@ -123,18 +157,30 @@ function sek_get_default_location_model( $skope_id = null ) {
123
  }
124
  return $defaut_sektions_value;
125
  }
 
 
 
126
  function sek_get_seks_setting_id( $skope_id = '' ) {
127
  if ( empty( $skope_id ) ) {
128
  sek_error_log( 'sek_get_seks_setting_id => empty skope id or location => collection setting id impossible to build' );
129
  }
130
  return NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . "[{$skope_id}]";
131
  }
 
 
 
132
  function sek_has_global_sections() {
133
  if ( skp_is_customizing() )
134
  return true;
135
  $maybe_global_sek_post = sek_get_seks_post( NIMBLE_GLOBAL_SKOPE_ID );
136
  return ! is_null($maybe_global_sek_post) || !!$maybe_global_sek_post;
137
  }
 
 
 
 
 
 
138
  /*function sek_get_module_placeholder( $placeholder_icon = 'short_text' ) {
139
  $placeholder_icon = empty( $placeholder_icon ) ? 'not_interested' : $placeholder_icon;
140
  ?>
@@ -143,6 +189,13 @@ function sek_has_global_sections() {
143
  </div>
144
  <?php
145
  }*/
 
 
 
 
 
 
 
146
  function sek_get_level_model( $id, $collection = array() ) {
147
  $_data = 'no_match';
148
  if ( ! is_array( $collection ) ) {
@@ -150,6 +203,7 @@ function sek_get_level_model( $id, $collection = array() ) {
150
  return $_data;
151
  }
152
  foreach ( $collection as $level_data ) {
 
153
  if ( 'no_match' != $_data )
154
  break;
155
  if ( array_key_exists( 'id', $level_data ) && $id === $level_data['id'] ) {
@@ -162,17 +216,27 @@ function sek_get_level_model( $id, $collection = array() ) {
162
  }
163
  return $_data;
164
  }
 
 
 
 
 
 
165
  function sek_get_parent_level_model( $child_level_id = '', $collection = array(), $skope_id = '' ) {
166
  $_parent_level_data = 'no_match';
167
  if ( ! is_string( $child_level_id ) || empty( $child_level_id ) ) {
168
  sek_error_log( __FUNCTION__ . ' => missing or invalid child_level_id param.');
169
  return $_parent_level_data;
170
  }
 
 
171
  if ( empty( $collection ) ) {
172
  if ( empty( $skope_id ) ) {
173
  if ( is_array( $_POST ) && ! empty( $_POST['location_skope_id'] ) ) {
174
  $skope_id = $_POST['location_skope_id'];
175
  } else {
 
 
176
  $skope_id = skp_get_skope_id();
177
  }
178
  }
@@ -188,12 +252,14 @@ function sek_get_parent_level_model( $child_level_id = '', $collection = array()
188
  }
189
 
190
  foreach ( $collection as $level_data ) {
 
191
  if ( 'no_match' !== $_parent_level_data )
192
  break;
193
  if ( array_key_exists( 'collection', $level_data ) && is_array( $level_data['collection'] ) ) {
194
  foreach ( $level_data['collection'] as $child_level_data ) {
195
  if ( array_key_exists( 'id', $child_level_data ) && $child_level_id == $child_level_data['id'] ) {
196
  $_parent_level_data = $level_data;
 
197
  break;
198
  } else {
199
  $_parent_level_data = sek_get_parent_level_model( $child_level_id, $level_data['collection'], $skope_id );
@@ -203,15 +269,21 @@ function sek_get_parent_level_model( $child_level_id = '', $collection = array()
203
  }
204
  return $_parent_level_data;
205
  }
 
 
 
 
206
  function sek_section_has_modules( $model, $has_module = null ) {
207
  $has_module = is_null( $has_module ) ? false : (bool)$has_module;
208
  foreach ( $model as $level_data ) {
 
209
  if ( true === $has_module )
210
  break;
211
  if ( is_array( $level_data ) && array_key_exists( 'collection', $level_data ) && is_array( $level_data['collection'] ) ) {
212
  foreach ( $level_data['collection'] as $child_level_data ) {
213
  if ( 'module'== $child_level_data['level'] ) {
214
  $has_module = true;
 
215
  break;
216
  } else {
217
  $has_module = sek_section_has_modules( $child_level_data, $has_module );
@@ -221,6 +293,15 @@ function sek_section_has_modules( $model, $has_module = null ) {
221
  }
222
  return $has_module;
223
  }
 
 
 
 
 
 
 
 
 
224
  function sek_get_level_skope_id( $level_id = '' ) {
225
  $level_skope_id = skp_get_skope_id();
226
  if ( ! is_string( $level_id ) || empty( $level_id ) ) {
@@ -230,6 +311,8 @@ function sek_get_level_skope_id( $level_id = '' ) {
230
 
231
  $local_skope_settings = sek_get_skoped_seks( skp_get_skope_id() );
232
  $local_collection = ( is_array( $local_skope_settings ) && !empty( $local_skope_settings['collection'] ) ) ? $local_skope_settings['collection'] : array();
 
 
233
  if ( 'no_match' === sek_get_level_model( $level_id, $local_collection ) ) {
234
  $level_skope_id = NIMBLE_GLOBAL_SKOPE_ID;
235
  if ( sek_is_dev_mode() ) {
@@ -248,7 +331,10 @@ function sek_get_level_skope_id( $level_id = '' ) {
248
  /* ------------------------------------------------------------------------- *
249
  * HEADER FOOTER
250
  /* ------------------------------------------------------------------------- */
 
 
251
  function sek_page_uses_nimble_header_footer() {
 
252
  Nimble_Manager()->sek_maybe_set_nimble_header_footer();
253
  return true === Nimble_Manager()->has_local_header_footer || true === Nimble_Manager()->has_global_header_footer;
254
  }
@@ -258,11 +344,15 @@ function sek_page_uses_nimble_header_footer() {
258
  /* ------------------------------------------------------------------------- *
259
  * REGISTERED MODULES => GET PROPERTY
260
  /* ------------------------------------------------------------------------- */
 
261
  function sek_get_registered_module_type_property( $module_type, $property = '' ) {
 
 
262
  if ( !class_exists('\Nimble\CZR_Fmk_Base') ) {
263
  sek_error_log( __FUNCTION__ . ' => error => CZR_Fmk_Base not loaded' );
264
  return;
265
  }
 
266
  $registered_modules = CZR_Fmk_Base()->registered_modules;
267
  if ( ! array_key_exists( $module_type, $registered_modules ) ) {
268
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' not registered.' );
@@ -280,6 +370,37 @@ function sek_get_registered_module_type_property( $module_type, $property = '' )
280
  /* ------------------------------------------------------------------------- *
281
  * GET THE INPUT VALUE OF A GIVEN MODULE MODEL
282
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  function sek_get_input_value_in_module_model( $input_id, $module_model ) {
284
  if ( ! is_string( $input_id ) ) {
285
  sek_error_log( __FUNCTION__ . ' => error => the $input_id param should be a string', $module_model);
@@ -312,14 +433,25 @@ function sek_get_input_value_in_module_model( $input_id, $module_model ) {
312
  /* ------------------------------------------------------------------------- *
313
  * REGISTERED MODULES => DEFAULT MODULE MODEL
314
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
315
  function sek_get_default_module_model( $module_type = '' ) {
316
  $default = array();
317
  if ( empty( $module_type ) || is_null( $module_type ) )
318
  return $default;
 
 
 
319
  if ( !class_exists('\Nimble\CZR_Fmk_Base') ) {
320
  sek_error_log( __FUNCTION__ . ' => error => CZR_Fmk_Base not loaded' );
321
  return $default;
322
  }
 
 
323
  $default_models = Nimble_Manager()->default_models;
324
  if ( ! empty( $default_models[ $module_type ] ) ) {
325
  $default = $default_models[ $module_type ];
@@ -329,6 +461,8 @@ function sek_get_default_module_model( $module_type = '' ) {
329
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' is not registered in the $CZR_Fmk_Base_fn()->registered_modules;' );
330
  return $default;
331
  }
 
 
332
  if ( !empty( $registered_modules[ $module_type ]['is_father'] ) && true === $registered_modules[ $module_type ]['is_father'] ) {
333
  if ( empty( $registered_modules[ $module_type ][ 'children' ] ) ) {
334
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' missing children modules' );
@@ -350,15 +484,61 @@ function sek_get_default_module_model( $module_type = '' ) {
350
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' => missing "tmpl" property => impossible to build the default model.' );
351
  return $default;
352
  }
 
353
  $default = _sek_build_default_model( $registered_modules[ $module_type ][ 'tmpl' ] );
354
  }
 
 
355
  $default_models[ $module_type ] = $default;
356
  Nimble_Manager()->default_models = $default_models;
 
357
  }
358
  return $default;
359
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  function _sek_build_default_model( $module_tmpl_data, $default_model = null ) {
361
  $default_model = is_array( $default_model ) ? $default_model : array();
 
362
  foreach( $module_tmpl_data as $key => $data ) {
363
  if ( 'pre-item' === $key )
364
  continue;
@@ -386,23 +566,37 @@ function _sek_build_default_model( $module_tmpl_data, $default_model = null ) {
386
  /* ------------------------------------------------------------------------- *
387
  * REGISTERED MODULES => INPUT LIST
388
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
389
  function sek_get_registered_module_input_list( $module_type = '' ) {
390
  $input_list = array();
391
  if ( empty( $module_type ) || is_null( $module_type ) )
392
  return $input_list;
 
 
 
393
  if ( !class_exists('\Nimble\CZR_Fmk_Base') ) {
394
  sek_error_log( __FUNCTION__ . ' => error => CZR_Fmk_Base not loaded' );
395
  return $input_list;
396
  }
 
 
397
  $cached_input_lists = Nimble_Manager()->cached_input_lists;
398
  if ( ! empty( $cached_input_lists[ $module_type ] ) ) {
399
  $input_list = $cached_input_lists[ $module_type ];
400
  } else {
401
  $registered_modules = CZR_Fmk_Base()->registered_modules;
 
402
  if ( ! array( $registered_modules ) || ! array_key_exists( $module_type, $registered_modules ) ) {
403
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' is not registered in the $CZR_Fmk_Base_fn()->registered_modules;' );
404
  return $input_list;
405
  }
 
 
 
406
  if ( !empty( $registered_modules[ $module_type ]['is_father'] ) && true === $registered_modules[ $module_type ]['is_father'] ) {
407
  if ( empty( $registered_modules[ $module_type ][ 'children' ] ) ) {
408
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' missing children modules' );
@@ -418,6 +612,8 @@ function sek_get_registered_module_input_list( $module_type = '' ) {
418
  sek_error_log( __FUNCTION__ . ' => ' . $mod_type . ' => missing "tmpl" property => impossible to build the master input_list.' );
419
  continue;
420
  }
 
 
421
 
422
  $input_list[$opt_group] = _sek_build_input_list( $registered_modules[ $mod_type ][ 'tmpl' ] );
423
  }
@@ -426,19 +622,78 @@ function sek_get_registered_module_input_list( $module_type = '' ) {
426
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' => missing "tmpl" property => impossible to build the input_list.' );
427
  return $input_list;
428
  }
 
429
  $input_list = _sek_build_input_list( $registered_modules[ $module_type ][ 'tmpl' ] );
430
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  $cached_input_lists[ $module_type ] = $input_list;
432
  Nimble_Manager()->cached_input_lists = $cached_input_lists;
 
433
  }
434
  return $input_list;
435
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  function _sek_build_input_list( $module_tmpl_data, $input_list = null ) {
437
  $input_list = is_array( $input_list ) ? $input_list : array();
 
438
  foreach( $module_tmpl_data as $key => $data ) {
439
  if ( 'pre-item' === $key )
440
  continue;
441
  if ( is_array( $data ) && array_key_exists( 'input_type', $data ) ) {
 
442
  if ( array_key_exists( $key, $input_list ) ) {
443
  sek_error_log( __FUNCTION__ . ' => error => duplicated input_id found => ' . $key );
444
  } else {
@@ -464,6 +719,7 @@ function _sek_build_input_list( $module_tmpl_data, $input_list = null ) {
464
  * preprocessing the module model before printing the module template.
465
  * used before rendering or generating css
466
  /* ------------------------------------------------------------------------- */
 
467
  function sek_normalize_module_value_with_defaults( $raw_module_model ) {
468
  $normalized_model = $raw_module_model;
469
  if ( empty( $normalized_model['module_type'] ) ) {
@@ -473,6 +729,8 @@ function sek_normalize_module_value_with_defaults( $raw_module_model ) {
473
  $is_father = sek_get_registered_module_type_property( $module_type, 'is_father' );
474
 
475
  $raw_module_value = ( ! empty( $raw_module_model['value'] ) && is_array( $raw_module_model['value'] ) ) ? $raw_module_model['value'] : array();
 
 
476
  $normalized_model['value'] = array();
477
  if ( $is_father ) {
478
  $children = sek_get_registered_module_type_property( $module_type, 'children' );
@@ -491,10 +749,15 @@ function sek_normalize_module_value_with_defaults( $raw_module_model ) {
491
  } else {
492
  $normalized_model['value'] = _sek_normalize_single_module_values( $raw_module_value, $module_type );
493
  }
 
494
  return $normalized_model;
495
  }
 
 
496
  function _sek_normalize_single_module_values( $raw_module_value, $module_type ) {
497
  $default_value_model = sek_get_default_module_model( $module_type );//<= walk the registered modules tree and generates the module default if not already cached
 
 
498
  $module_values = array();
499
  if ( czr_is_multi_item_module( $module_type ) ) {
500
  foreach ( $raw_module_value as $item ) {
@@ -514,6 +777,7 @@ function _sek_normalize_single_module_values( $raw_module_value, $module_type )
514
  * HELPER FOR CHECKBOX OPTIONS
515
  /* ------------------------------------------------------------------------- */
516
  function sek_is_checked( $val ) {
 
517
  $val = is_array($val) ? $val[0] : $val;
518
  return sek_booleanize_checkbox_val( $val );
519
  }
@@ -544,6 +808,7 @@ function sek_booleanize_checkbox_val( $val ) {
544
  /* ------------------------------------------------------------------------- *
545
  * LOCAL OPTIONS HELPERS
546
  /* ------------------------------------------------------------------------- */
 
547
  function sek_get_locale_template(){
548
  $path = null;
549
  $local_template_data = sek_get_local_option_value( 'template' );
@@ -559,6 +824,10 @@ function sek_get_locale_template(){
559
  }
560
  return $path;
561
  }
 
 
 
 
562
  function sek_get_local_option_value( $option_name = '', $skope_id = null ) {
563
  if ( empty($option_name) ) {
564
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
@@ -567,25 +836,34 @@ function sek_get_local_option_value( $option_name = '', $skope_id = null ) {
567
  if ( !skp_is_customizing() && did_action('nimble_front_classes_ready') && '_not_cached_yet_' !== Nimble_Manager()->local_options ) {
568
  $local_options = Nimble_Manager()->local_options;
569
  } else {
 
570
  $skope_id = ( !empty( $skope_id ) && is_string( $skope_id ))? $skope_id : skp_get_skope_id();
571
  $localSkopeNimble = sek_get_skoped_seks( skp_get_skope_id() );
572
  $local_options = ( is_array( $localSkopeNimble ) && !empty( $localSkopeNimble['local_options'] ) && is_array( $localSkopeNimble['local_options'] ) ) ? $localSkopeNimble['local_options'] : array();
 
 
573
  if ( did_action('nimble_front_classes_ready') && did_action('wp') && !defined('DOING_AJAX') ) {
574
  Nimble_Manager()->local_options = $local_options;
575
  }
576
  }
 
577
  $values = ( ! empty( $local_options ) && ! empty( $local_options[ $option_name ] ) ) ? $local_options[ $option_name ] : null;
578
  if ( did_action('nimble_front_classes_ready') ) {
579
  $values = sek_normalize_local_options_with_defaults( $option_name, $values );
580
  }
581
  return $values;
582
  }
 
 
 
 
583
  function sek_normalize_local_options_with_defaults( $option_name, $raw_module_values ) {
584
  if ( empty($option_name) ) {
585
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
586
  return array();
587
  }
588
  $normalized_values = ( !empty($raw_module_values) && is_array( $raw_module_values ) ) ? $raw_module_values : array();
 
589
  $local_option_map = SEK_Front_Construct::$local_options_map;
590
 
591
  if ( !array_key_exists($option_name, $local_option_map) ) {
@@ -594,6 +872,10 @@ function sek_normalize_local_options_with_defaults( $option_name, $raw_module_va
594
  } else {
595
  $module_type = $local_option_map[$option_name];
596
  }
 
 
 
 
597
  if ( class_exists('\Nimble\CZR_Fmk_Base') ) {
598
  if( CZR_Fmk_Base()->czr_is_module_registered($module_type) ) {
599
  $normalized_values = _sek_normalize_single_module_values( $normalized_values, $module_type );
@@ -606,6 +888,8 @@ function sek_normalize_local_options_with_defaults( $option_name, $raw_module_va
606
  /* ------------------------------------------------------------------------- *
607
  * GLOBAL OPTIONS HELPERS
608
  /* ------------------------------------------------------------------------- */
 
 
609
  function sek_get_global_option_value( $option_name = '' ) {
610
  if ( empty($option_name) ) {
611
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
@@ -615,30 +899,47 @@ function sek_get_global_option_value( $option_name = '' ) {
615
  $global_nimble_options = Nimble_Manager()->global_nimble_options;
616
  } else {
617
  $global_nimble_options = get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
 
 
 
 
618
  if ( did_action('nimble_front_classes_ready') && !defined('DOING_AJAX') ) {
619
  Nimble_Manager()->global_nimble_options = $global_nimble_options;
620
  }
621
  }
 
622
  $values = ( is_array( $global_nimble_options ) && !empty( $global_nimble_options[ $option_name ] ) ) ? $global_nimble_options[ $option_name ] : null;
623
  if ( did_action('nimble_front_classes_ready') ) {
624
  $values = sek_normalize_global_options_with_defaults( $option_name, $values );
625
  }
626
  return $values;
627
  }
 
 
 
 
 
628
  function sek_normalize_global_options_with_defaults( $option_name, $raw_module_values ) {
629
  if ( empty($option_name) ) {
630
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
631
  return array();
632
  }
633
  $normalized_values = ( !empty($raw_module_values) && is_array( $raw_module_values ) ) ? $raw_module_values : array();
 
634
  $global_option_map = SEK_Front_Construct::$global_options_map;
635
 
 
 
636
  if ( !array_key_exists($option_name, $global_option_map) ) {
637
  sek_error_log( __FUNCTION__ . ' => invalid option name', $option_name );
638
  return $raw_module_values;
639
  } else {
640
  $module_type = $global_option_map[$option_name];
641
  }
 
 
 
 
642
  if ( class_exists('\Nimble\CZR_Fmk_Base') ) {
643
  if( CZR_Fmk_Base()->czr_is_module_registered($module_type) ) {
644
  $normalized_values = _sek_normalize_single_module_values( $normalized_values, $module_type );
@@ -664,6 +965,8 @@ function sek_get_global_custom_breakpoint() {
664
 
665
  return intval( $global_breakpoint_data['global-custom-breakpoint'] );
666
  }
 
 
667
  function sek_get_section_custom_breakpoint( $section ) {
668
  if ( ! is_array( $section ) )
669
  return;
@@ -694,6 +997,9 @@ function sek_get_section_custom_breakpoint( $section ) {
694
  /* ------------------------------------------------------------------------- *
695
  * FRONT ASSET SNIFFERS
696
  /* ------------------------------------------------------------------------- */
 
 
 
697
  function sek_front_needs_font_awesome( $bool = false, $recursive_data = null ) {
698
  if ( !$bool ) {
699
  if ( is_null( $recursive_data ) ) {
@@ -718,6 +1024,9 @@ function sek_front_needs_font_awesome( $bool = false, $recursive_data = null ) {
718
  }
719
  return $bool;
720
  }
 
 
 
721
  function sek_front_sections_include_a_form( $bool = false, $recursive_data = null ) {
722
  if ( !$bool ) {
723
  if ( is_null( $recursive_data ) ) {
@@ -740,6 +1049,11 @@ function sek_front_sections_include_a_form( $bool = false, $recursive_data = nul
740
  }
741
  return $bool;
742
  }
 
 
 
 
 
743
  function sek_front_needs_magnific_popup( $bool = false, $recursive_data = null ) {
744
  if ( !$bool ) {
745
  if ( is_null( $recursive_data ) ) {
@@ -752,6 +1066,7 @@ function sek_front_needs_magnific_popup( $bool = false, $recursive_data = null )
752
  }
753
 
754
  foreach ($recursive_data as $key => $value) {
 
755
  if ( is_string( $value ) && 'img-lightbox' === $value ) {
756
  $bool = true;
757
  break;
@@ -770,6 +1085,8 @@ function sek_front_needs_magnific_popup( $bool = false, $recursive_data = null )
770
  /* ------------------------------------------------------------------------- *
771
  * IMAGE HELPER
772
  /* ------------------------------------------------------------------------- */
 
 
773
  function sek_get_img_sizes() {
774
  global $_wp_additional_image_sizes;
775
 
@@ -787,11 +1104,13 @@ function sek_get_img_sizes() {
787
  $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
788
  $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
789
  $sizes[ $_size ]['title'] = $first_to_upper_size;
 
790
  } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
791
  $sizes[ $_size ] = array(
792
  'width' => $_wp_additional_image_sizes[ $_size ]['width'],
793
  'height' => $_wp_additional_image_sizes[ $_size ]['height'],
794
  'title' => $first_to_upper_size
 
795
  );
796
  }
797
  }
@@ -835,6 +1154,14 @@ function nimble_regex_callback( $matches ) {
835
  );
836
  }
837
  }
 
 
 
 
 
 
 
 
838
  function sek_is_img_smartload_enabled() {
839
  if ( skp_is_customizing() )
840
  return false;
@@ -842,6 +1169,9 @@ function sek_is_img_smartload_enabled() {
842
  return Nimble_Manager()->img_smartload_enabled;
843
  }
844
  $is_img_smartload_enabled = false;
 
 
 
845
  $local_performances_data = sek_get_local_option_value( 'local_performances' );
846
  $local_smartload = 'inherit';
847
  if ( !is_null( $local_performances_data ) && is_array( $local_performances_data ) ) {
@@ -853,11 +1183,14 @@ function sek_is_img_smartload_enabled() {
853
  if ( 'inherit' !== $local_smartload ) {
854
  $is_img_smartload_enabled = $local_smartload;
855
  } else {
 
856
  $glob_performances_data = sek_get_global_option_value( 'performances' );
857
  if ( !is_null( $glob_performances_data ) && is_array( $glob_performances_data ) && !empty( $glob_performances_data['global-img-smart-load'] ) ) {
858
  $is_img_smartload_enabled = sek_booleanize_checkbox_val( $glob_performances_data['global-img-smart-load'] );
859
  }
860
  }
 
 
861
  Nimble_Manager()->img_smartload_enabled = $is_img_smartload_enabled;
862
 
863
  return Nimble_Manager()->img_smartload_enabled;
@@ -867,6 +1200,9 @@ function sek_is_img_smartload_enabled() {
867
  /* ------------------------------------------------------------------------- *
868
  * reCAPTCHA HELPER
869
  /* ------------------------------------------------------------------------- */
 
 
 
870
  function sek_is_recaptcha_globally_enabled() {
871
  if ( did_action('nimble_front_classes_ready') && '_not_cached_yet_' !== Nimble_Manager()->recaptcha_enabled ) {
872
  return Nimble_Manager()->recaptcha_enabled;
@@ -878,12 +1214,18 @@ function sek_is_recaptcha_globally_enabled() {
878
  if ( !is_null( $glob_recaptcha_opts ) && is_array( $glob_recaptcha_opts ) && !empty( $glob_recaptcha_opts['enable'] ) ) {
879
  $recaptcha_enabled = sek_booleanize_checkbox_val( $glob_recaptcha_opts['enable'] ) && !empty( $glob_recaptcha_opts['public_key'] ) && !empty($glob_recaptcha_opts['private_key'] );
880
  }
 
 
881
  if ( !defined( 'DOING_AJAX') || true !== DOING_AJAX ) {
882
  Nimble_Manager()->recaptcha_enabled = $recaptcha_enabled;
883
  }
884
 
885
  return $recaptcha_enabled;
886
  }
 
 
 
 
887
  function sek_is_recaptcha_badge_globally_displayed() {
888
  if ( did_action('nimble_front_classes_ready') && '_not_cached_yet_' !== Nimble_Manager()->recaptcha_badge_displayed ) {
889
  return Nimble_Manager()->recaptcha_badge_displayed;
@@ -895,6 +1237,8 @@ function sek_is_recaptcha_badge_globally_displayed() {
895
  if ( !is_null( $glob_recaptcha_opts ) && is_array( $glob_recaptcha_opts ) && !empty( $glob_recaptcha_opts['badge'] ) ) {
896
  $display_badge = sek_booleanize_checkbox_val( $glob_recaptcha_opts['badge'] ) && sek_is_recaptcha_globally_enabled();
897
  }
 
 
898
  if ( !defined( 'DOING_AJAX') || true !== DOING_AJAX ) {
899
  Nimble_Manager()->recaptcha_badge_displayed = $display_badge;
900
  }
@@ -913,6 +1257,7 @@ function sek_is_recaptcha_badge_globally_displayed() {
913
  */
914
  function sek_user_started_before_version( $requested_version ) {
915
  $started_with = get_option( 'nimble_started_with_version' );
 
916
  if ( ! $started_with )
917
  return false;
918
 
@@ -921,8 +1266,16 @@ function sek_user_started_before_version( $requested_version ) {
921
 
922
  return version_compare( $started_with , $requested_version, '<' );
923
  }
 
 
 
924
  add_filter( 'skp_get_skope_id', '\Nimble\sek_filter_skp_get_skope_id', 10, 2 );
925
  function sek_filter_skp_get_skope_id( $skope_id, $level ) {
 
 
 
 
 
926
  if ( 'local' === $level && is_array( $_POST ) && ! empty( $_POST['local_skope_id'] ) && 'customize_save' === $_POST['action'] ) {
927
  $skope_id = $_POST['local_skope_id'];
928
  }
@@ -933,10 +1286,13 @@ function sek_filter_skp_get_skope_id( $skope_id, $level ) {
933
  /* ------------------------------------------------------------------------- *
934
  * HAS USER STARTED CREATING SECTIONS ?
935
  /* ------------------------------------------------------------------------- */
 
 
936
  function sek_site_has_nimble_sections_created() {
937
  $sek_post_query_vars = array(
938
  'post_type' => NIMBLE_CPT,
939
  'post_status' => get_post_stati(),
 
940
  'posts_per_page' => -1,
941
  'no_found_rows' => true,
942
  'cache_results' => true,
@@ -945,6 +1301,7 @@ function sek_site_has_nimble_sections_created() {
945
  'lazy_load_term_meta' => false,
946
  );
947
  $query = new \WP_Query( $sek_post_query_vars );
 
948
  return is_array( $query->posts ) && ! empty( $query->posts );
949
  }
950
 
@@ -991,6 +1348,10 @@ function sek_error_log( $title, $content = null ) {
991
  error_log( '</' . $title . '>' );
992
  }
993
  }
 
 
 
 
994
  function render_content_sections_for_nimble_template() {
995
  Nimble_Manager()->render_nimble_locations(
996
  array_keys( Nimble_Manager()->default_locations ),//array( 'loop_start', 'before_content', 'after_content', 'loop_end'),
@@ -1014,6 +1375,8 @@ function sek_page_menu_fallback( $args = array() ) {
1014
  $args = apply_filters( 'wp_page_menu_args', $args );
1015
  $menu = '';
1016
  $list_args = $args;
 
 
1017
  if ( ! empty($args['show_home']) ) {
1018
  if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) {
1019
  $text = __('Home' , 'nimble-builder');
@@ -1025,6 +1388,7 @@ function sek_page_menu_fallback( $args = array() ) {
1025
  $class = 'class="current_page_item"';
1026
  }
1027
  $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
 
1028
  if (get_option('show_on_front') == 'page') {
1029
  if ( !empty( $list_args['exclude'] ) ) {
1030
  $list_args['exclude'] .= ',';
@@ -1037,12 +1401,19 @@ function sek_page_menu_fallback( $args = array() ) {
1037
 
1038
  $list_args['echo'] = false;
1039
  $list_args['title_li'] = '';
 
 
1040
  $list_args['number'] = 4;
1041
 
1042
  $menu .= str_replace( array( "\r", "\n", "\t" ), '', sek_list_pages( $list_args ) );
 
 
 
1043
  if ( $menu ) {
1044
  $menu = '<ul class="' . esc_attr( $args['menu_class'] ) . '">' . $menu . '</ul>';
1045
  }
 
 
1046
  if ( $args['echo'] )
1047
  echo $menu;
1048
  else
@@ -1071,9 +1442,12 @@ function sek_list_pages( $args = '' ) {
1071
  $r = wp_parse_args( $args, $defaults );
1072
  $output = '';
1073
  $current_page = 0;
 
1074
  $r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] );
 
1075
  $exclude_array = ( $r['exclude'] ) ? explode( ',', $r['exclude'] ) : array();
1076
  $r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
 
1077
  $r['hierarchical'] = 0;
1078
  $pages = get_pages( $r );
1079
  if ( ! empty( $pages ) ) {
@@ -1111,6 +1485,10 @@ function sek_list_pages( $args = '' ) {
1111
  * @see Walker_Page::walk() for parameters and return description.
1112
  */
1113
  function sek_walk_page_tree( $pages, $depth, $current_page, $r ) {
 
 
 
 
1114
  $walker = new \Walker_Page;
1115
  foreach ( (array) $pages as $page ) {
1116
  if ( $page->post_parent ) {
@@ -1122,6 +1500,8 @@ function sek_walk_page_tree( $pages, $depth, $current_page, $r ) {
1122
  }
1123
 
1124
  function sek_get_user_created_menus() {
 
 
1125
  $all_menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
1126
  $user_menus = array();
1127
  foreach ( $all_menus as $menu_obj ) {
@@ -1129,6 +1509,9 @@ function sek_get_user_created_menus() {
1129
  $user_menus[ $menu_obj->slug ] = $menu_obj->name;
1130
  }
1131
  }
 
 
 
1132
  return array_merge(
1133
  array( 'nimble_page_menu' => __('Default page menu', 'nimble-builder') )
1134
  , $user_menus );
@@ -1138,6 +1521,7 @@ function sek_get_user_created_menus() {
1138
  /* ------------------------------------------------------------------------- *
1139
  * Nimble Widgets Areas
1140
  /* ------------------------------------------------------------------------- */
 
1141
  function sek_get_registered_widget_areas() {
1142
  global $wp_registered_sidebars;
1143
  $widget_areas = array();
@@ -1151,7 +1535,10 @@ function sek_get_registered_widget_areas() {
1151
  }
1152
  return $widget_areas;
1153
  }
 
 
1154
  function sek_is_nimble_widget_id( $id ) {
 
1155
  return NIMBLE_WIDGET_PREFIX === substr( $id, 0, strlen( NIMBLE_WIDGET_PREFIX ) );
1156
  }
1157
 
@@ -1177,7 +1564,10 @@ function sek_find_pattern_match($matches) {
1177
  }
1178
  return null;
1179
  }
 
1180
  function sek_parse_template_tags( $val ) {
 
 
1181
  return is_string( $val ) ? preg_replace_callback( '!\{\{\s?(\w+)\s?\}\}!', '\Nimble\sek_find_pattern_match', $val) : $val;
1182
  }
1183
  add_filter( 'nimble_parse_template_tags', '\Nimble\sek_parse_template_tags' );
@@ -1186,6 +1576,9 @@ add_filter( 'nimble_parse_template_tags', '\Nimble\sek_parse_template_tags' );
1186
  /* ------------------------------------------------------------------------- *
1187
  * Beta Features
1188
  /* ------------------------------------------------------------------------- */
 
 
 
1189
  function sek_is_header_footer_enabled() {
1190
  $global_beta_feature = sek_get_global_option_value( 'beta_features');
1191
  if ( is_array( $global_beta_feature ) && array_key_exists('beta-enabled', $global_beta_feature ) ) {
@@ -1204,6 +1597,12 @@ function sek_is_pro() {
1204
  /* ------------------------------------------------------------------------- *
1205
  * OTHER HELPERS
1206
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
1207
  function sek_is_customize_previewing_a_changeset_post() {
1208
  return !( defined('DOING_AJAX') && DOING_AJAX ) && is_customize_preview() && !isset( $_REQUEST['customize_messenger_channel']);
1209
  }
@@ -1213,6 +1612,7 @@ function sek_is_customize_previewing_a_changeset_post() {
1213
  /* ------------------------------------------------------------------------- *
1214
  * MODULES
1215
  /* ------------------------------------------------------------------------- */
 
1216
  function sek_get_module_collection() {
1217
  return array(
1218
  array(
@@ -1322,13 +1722,33 @@ function sek_get_module_collection() {
1322
  'active' => sek_is_header_footer_enabled()
1323
  ),
1324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1325
 
1326
  );
1327
  }
 
 
 
1328
  function sek_get_parent_theme_slug() {
1329
  $theme_slug = get_option( 'stylesheet' );
 
1330
  $theme_slug = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : $theme_slug; //old wp versions
1331
  $theme_slug = isset($_REQUEST['customize_theme']) ? $_REQUEST['customize_theme'] : $theme_slug;
 
 
1332
  $theme_data = wp_get_theme( $theme_slug );
1333
  if ( $theme_data -> parent() ) {
1334
  $theme_slug = $theme_data -> parent() -> Name;
@@ -1336,18 +1756,32 @@ function sek_get_parent_theme_slug() {
1336
 
1337
  return sanitize_file_name( strtolower( $theme_slug ) );
1338
  }
 
 
 
 
 
 
 
 
 
 
1339
  function sek_get_feedback_notif_status() {
1340
  if ( sek_feedback_notice_is_dismissed() )
1341
  return;
1342
  if ( sek_feedback_notice_is_postponed() )
1343
  return;
1344
  $start_version = get_option( 'nimble_started_with_version', NIMBLE_VERSION );
 
 
 
1345
  if ( ! version_compare( $start_version, '1.6.0', '<=' ) )
1346
  return;
1347
 
1348
  $sek_post_query_vars = array(
1349
  'post_type' => NIMBLE_CPT,
1350
  'post_status' => get_post_stati(),
 
1351
  'posts_per_page' => -1,
1352
  'no_found_rows' => true,
1353
  'cache_results' => true,
@@ -1361,6 +1795,7 @@ function sek_get_feedback_notif_status() {
1361
 
1362
  $customized_pages = 0;
1363
  $nb_section_created = 0;
 
1364
  global $modules_used;
1365
  $module_used = array();
1366
 
@@ -1376,8 +1811,15 @@ function sek_get_feedback_notif_status() {
1376
  return;
1377
 
1378
  $modules_used = array_unique($modules_used);
 
 
 
 
 
1379
  return $customized_pages > 0 && $nb_section_created > 3 && count($modules_used) > 3;
1380
  }
 
 
1381
  function sek_count_not_empty_sections_in_page( $seks_data, $count = 0 ) {
1382
  if ( ! is_array( $seks_data ) ) {
1383
  sek_error_log( __FUNCTION__ . ' => invalid seks_data param');
@@ -1396,6 +1838,8 @@ function sek_count_not_empty_sections_in_page( $seks_data, $count = 0 ) {
1396
  }
1397
  return $count;
1398
  }
 
 
1399
  function sek_populate_list_of_modules_used( $seks_data ) {
1400
  global $modules_used;
1401
  if ( ! is_array( $seks_data ) ) {
@@ -1407,6 +1851,7 @@ function sek_populate_list_of_modules_used( $seks_data ) {
1407
  if ( !empty( $data['level'] ) && 'module' === $data['level'] && !empty( $data['module_type'] ) ) {
1408
  $modules_used[] = $data['module_type'];
1409
  } else {
 
1410
  sek_populate_list_of_modules_used( $data, $modules_used );
1411
  }
1412
  }
@@ -1418,13 +1863,24 @@ function sek_feedback_notice_is_dismissed() {
1418
  $dismissed_array = array_filter( explode( ',', (string) $dismissed ) );
1419
  return in_array( NIMBLE_FEEDBACK_NOTICE_ID, $dismissed_array );
1420
  }
 
 
 
1421
  function sek_feedback_notice_is_postponed() {
1422
  return 'maybe_later' === get_transient( NIMBLE_FEEDBACK_NOTICE_ID );
1423
  }
 
 
 
 
 
 
 
1424
  function sek_is_presscustomizr_theme( $theme_name ) {
1425
  $bool = false;
1426
  if ( is_string( $theme_name ) ) {
1427
  foreach ( ['customizr', 'hueman'] as $pc_theme ) {
 
1428
  if ( !$bool && $pc_theme === substr( $theme_name, 0, strlen($pc_theme) ) ) {
1429
  $bool = true;
1430
  }
@@ -1432,9 +1888,12 @@ function sek_is_presscustomizr_theme( $theme_name ) {
1432
  }
1433
  return $bool;
1434
  }
 
 
1435
  function sek_maybe_get_presscustomizr_theme_name( $theme_name ) {
1436
  if ( is_string( $theme_name ) ) {
1437
  foreach ( ['customizr', 'hueman'] as $pc_theme ) {
 
1438
  if ( $pc_theme === substr( $theme_name, 0, strlen($pc_theme) ) ) {
1439
  $theme_name = $pc_theme;
1440
  }
@@ -1442,17 +1901,40 @@ function sek_maybe_get_presscustomizr_theme_name( $theme_name ) {
1442
  }
1443
  return $theme_name;
1444
  }
 
 
 
 
 
 
 
 
 
 
 
1445
  function sek_sideload_img_and_return_attachment_id( $img_url ) {
 
1446
  preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $img_url, $matches );
1447
  $filename = basename( $matches[0] );
 
 
1448
  if ( 'nimble_asset_' !== substr($filename, 0, strlen('nimble_asset_') ) ) {
1449
  $filename = 'nimble_asset_' . $filename;
1450
  }
 
 
1451
  $img_title = preg_replace( '/\.[^.]+$/', '', trim( $filename ) );
 
 
 
 
 
 
1452
  $args = array(
1453
  'posts_per_page' => 1,
1454
  'post_type' => 'attachment',
1455
  'post_status' => 'inherit',
 
1456
  'meta_query' => array(
1457
  array(
1458
  'key' => '_wp_attachment_image_alt',
@@ -1462,22 +1944,42 @@ function sek_sideload_img_and_return_attachment_id( $img_url ) {
1462
  ),
1463
  );
1464
  $get_attachment = new \WP_Query( $args );
 
 
1465
  if ( is_array( $get_attachment->posts ) && array_key_exists(0, $get_attachment->posts) ) {
 
1466
  $img_id_already_uploaded = $get_attachment->posts[0] -> ID;
1467
  }
 
1468
  if ( isset($img_id_already_uploaded) ) {
 
1469
  return $img_id_already_uploaded;
1470
  }
 
 
 
1471
  $file_array = array();
1472
  $file_array['name'] = $filename;
 
 
1473
  $file_array['tmp_name'] = download_url( $img_url );
 
 
1474
  if ( is_wp_error( $file_array['tmp_name'] ) ) {
1475
  return $file_array['tmp_name'];
1476
  }
 
 
1477
  $id = media_handle_sideload( $file_array, 0 );
 
 
1478
  if ( is_wp_error( $id ) ) {
1479
  @unlink( $file_array['tmp_name'] );
1480
  } else {
 
 
 
 
1481
  add_post_meta( $id, '_wp_attachment_image_alt', $img_title, true );
1482
  }
1483
 
@@ -1485,16 +1987,44 @@ function sek_sideload_img_and_return_attachment_id( $img_url ) {
1485
  }
1486
  ?><?php
1487
  namespace Nimble;
 
 
 
1488
  if ( !defined( "NIMBLE_SECTIONS_LIBRARY_OPT_NAME" ) ) { define( "NIMBLE_SECTIONS_LIBRARY_OPT_NAME", 'nimble_api_prebuilt_sections_data' ); }
1489
  if ( !defined( "NIMBLE_NEWS_OPT_NAME" ) ) { define( "NIMBLE_NEWS_OPT_NAME", 'nimble_api_news_data' ); }
1490
- if ( !defined( "NIMBLE_DATA_API_URL" ) ) { define( "NIMBLE_DATA_API_URL", 'https://api.nimblebuilder.com/wp-json/nimble/v1/cravan' ); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1491
  function sek_get_nimble_api_data( $force_update = false ) {
1492
  $api_data_transient_name = 'nimble_api_data_' . NIMBLE_VERSION;
1493
  $info_data = get_transient( $api_data_transient_name );
 
1494
  $force_update = ( defined( 'NIMBLE_FORCE_UPDATE_API_DATA') && NIMBLE_FORCE_UPDATE_API_DATA ) ? true : $force_update;
 
 
1495
  if ( $force_update || false === $info_data ) {
1496
  $timeout = ( $force_update ) ? 25 : 8;
1497
- $response = wp_remote_get( NIMBLE_DATA_API_URL, array(
1498
  'timeout' => $timeout,
1499
  'body' => [
1500
  'api_version' => NIMBLE_VERSION,
@@ -1504,6 +2034,7 @@ function sek_get_nimble_api_data( $force_update = false ) {
1504
  ) );
1505
 
1506
  if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) {
 
1507
  set_transient( $api_data_transient_name, [], 2 * HOUR_IN_SECONDS );
1508
  return false;
1509
  }
@@ -1515,12 +2046,14 @@ function sek_get_nimble_api_data( $force_update = false ) {
1515
  return false;
1516
  }
1517
 
1518
- if ( !empty( $info_data['library'] ) ) {
1519
- if ( !empty( $info_data['library']['sections'] ) ) {
1520
- update_option( NIMBLE_SECTIONS_LIBRARY_OPT_NAME, $info_data['library']['sections'], 'no' );
1521
- }
1522
- unset( $info_data['library'] );
1523
- }
 
 
1524
 
1525
  if ( isset( $info_data['latest_posts'] ) ) {
1526
  update_option( NIMBLE_NEWS_OPT_NAME, $info_data['latest_posts'], 'no' );
@@ -1532,7 +2065,15 @@ function sek_get_nimble_api_data( $force_update = false ) {
1532
 
1533
  return $info_data;
1534
  }
 
 
 
 
1535
  function sek_get_sections_registration_params_api_data( $force_update = false ) {
 
 
 
 
1536
  $sections_data = get_option( NIMBLE_SECTIONS_LIBRARY_OPT_NAME );
1537
  if ( empty( $sections_data ) || !is_array( $sections_data ) || empty( $sections_data['registration_params'] ) ) {
1538
  sek_get_nimble_api_data( true );//<= true for "force_update"
@@ -1547,6 +2088,10 @@ function sek_get_sections_registration_params_api_data( $force_update = false )
1547
  }
1548
 
1549
  function sek_get_preset_sections_api_data( $force_update = false ) {
 
 
 
 
1550
  $sections_data = get_option( NIMBLE_SECTIONS_LIBRARY_OPT_NAME );
1551
  if ( empty( $sections_data ) || !is_array( $sections_data ) || empty( $sections_data['json_collection'] ) ) {
1552
  sek_get_nimble_api_data( true );//<= true for "force_update"
@@ -1559,6 +2104,11 @@ function sek_get_preset_sections_api_data( $force_update = false ) {
1559
  }
1560
  return $sections_data['json_collection'];
1561
  }
 
 
 
 
 
1562
  function sek_get_latest_posts_api_data( $force_update = false ) {
1563
  sek_get_nimble_api_data( $force_update );
1564
  $latest_posts = get_option( NIMBLE_NEWS_OPT_NAME );
@@ -1568,6 +2118,8 @@ function sek_get_latest_posts_api_data( $force_update = false ) {
1568
  }
1569
  return $latest_posts;
1570
  }
 
 
1571
  function sek_get_cta_message_from_api( $theme_name, $force_update = false ) {
1572
  $info_data = sek_get_nimble_api_data( $force_update );
1573
  if ( !sek_is_presscustomizr_theme( $theme_name ) || ! is_array( $info_data ) ) {
@@ -1582,16 +2134,179 @@ function sek_get_cta_message_from_api( $theme_name, $force_update = false ) {
1582
  }
1583
  return $message;
1584
  }
 
 
1585
  add_action( 'after_switch_theme', '\Nimble\sek_refresh_nimble_api_data');
1586
  add_action( 'upgrader_process_complete', '\Nimble\sek_refresh_nimble_api_data');
1587
  function sek_refresh_nimble_api_data() {
 
 
1588
  sek_get_nimble_api_data(true);
1589
  }
1590
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1591
  ?><?php
1592
  add_action( 'admin_bar_menu', '\Nimble\sek_add_customize_link', 1000 );
1593
  function sek_add_customize_link() {
1594
  global $wp_admin_bar;
 
1595
  if ( ! current_user_can( 'customize' ) )
1596
  return;
1597
 
@@ -1605,6 +2320,7 @@ function sek_add_customize_link() {
1605
  $customize_url = sek_get_customize_url_when_is_admin( $return_customize_url );
1606
  } else {
1607
  global $wp_customize;
 
1608
  if ( is_customize_preview() && $wp_customize->changeset_post_id() && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) {
1609
  return;
1610
  }
@@ -1641,6 +2357,9 @@ function sek_add_customize_link() {
1641
  ),
1642
  ) );
1643
  }//sek_add_customize_link
 
 
 
1644
  function sek_get_customize_url_when_is_admin( $return_customize_url ) {
1645
  global $tag, $user_id;
1646
 
@@ -1690,26 +2409,51 @@ function sek_get_customize_url_when_is_admin( $return_customize_url ) {
1690
  return $customize_url;
1691
  }
1692
  ?><?php
 
 
1693
  function sek_maybe_do_version_mapping() {
1694
  if ( ! is_user_logged_in() || ! current_user_can( 'edit_theme_options' ) )
1695
  return;
 
1696
  $global_options = get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
1697
  $global_options = is_array( $global_options ) ? $global_options : array();
1698
  $global_options['retro_compat_mappings'] = isset( $global_options['retro_compat_mappings'] ) ? $global_options['retro_compat_mappings'] : array();
 
 
 
1699
  if ( ! array_key_exists( 'to_1_4_0', $global_options['retro_compat_mappings'] ) || 'done' != $global_options['retro_compat_mappings']['to_1_4_0'] ) {
1700
  $status_to_1_4_0 = sek_do_compat_to_1_4_0();
 
1701
  $global_options['retro_compat_mappings']['to_1_4_0'] = 'done';
1702
  }
 
 
1703
  if ( ! array_key_exists( '1_0_4_to_1_1_0', $global_options['retro_compat_mappings'] ) || 'done' != $global_options['retro_compat_mappings']['1_0_4_to_1_1_0'] ) {
1704
  $status_1_0_4_to_1_1_0 = sek_do_compat_1_0_4_to_1_1_0();
 
1705
  $global_options['retro_compat_mappings']['1_0_4_to_1_1_0'] = 'done';
1706
  }
1707
  update_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS, $global_options );
1708
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1709
  function sek_do_compat_to_1_4_0() {
1710
  if ( 'page' === get_option( 'show_on_front' ) ) {
1711
  $home_page_id = (int)get_option( 'page_on_front' );
1712
  if ( 0 < $home_page_id ) {
 
 
1713
  $current_option_name = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . 'skp__post_page_home';
1714
  $post_id_storing_home_page_sections = (int)get_option( $current_option_name );
1715
  if ( $post_id_storing_home_page_sections > 0 ) {
@@ -1719,10 +2463,18 @@ function sek_do_compat_to_1_4_0() {
1719
  }
1720
  }
1721
  }
 
 
 
 
 
 
 
1722
  function sek_do_compat_1_0_4_to_1_1_0() {
1723
  $sek_post_query_vars = array(
1724
  'post_type' => NIMBLE_CPT,
1725
  'post_status' => get_post_stati(),
 
1726
  'posts_per_page' => -1,
1727
  'no_found_rows' => true,
1728
  'cache_results' => true,
@@ -1752,6 +2504,7 @@ function sek_do_compat_1_0_4_to_1_1_0() {
1752
  'post_status' => 'publish',
1753
  'post_content' => maybe_serialize( $seks_data )
1754
  );
 
1755
  $r = wp_update_post( wp_slash( $new_post_data ), true );
1756
  if ( is_wp_error( $r ) ) {
1757
  $status = 'error';
@@ -1760,14 +2513,34 @@ function sek_do_compat_1_0_4_to_1_1_0() {
1760
  }//foreach
1761
  return $status;
1762
  }
 
 
 
 
 
 
 
1763
  function sek_walk_levels_and_do_map_compat_1_0_4_to_1_1_0( $seks_data ) {
1764
  $new_seks_data = array();
1765
  foreach ( $seks_data as $key => $value ) {
 
 
 
1766
  if ( is_array($value) && array_key_exists('level', $value) && ! array_key_exists('ver_ini', $value) ) {
1767
  $value['ver_ini'] = '1.0.4';
1768
  }
1769
  $new_seks_data[$key] = $value;
 
 
 
 
 
 
 
 
 
1770
  if ( ! empty( $value ) && is_array( $value ) && 'options' === $key ) {
 
1771
  if ( array_key_exists( 'bg', $value ) )
1772
  continue;
1773
  $new_seks_data[$key] = array();
@@ -1786,17 +2559,21 @@ function sek_walk_levels_and_do_map_compat_1_0_4_to_1_1_0( $seks_data ) {
1786
  }
1787
  }
1788
  } // end of Level mapping
 
1789
  else if ( is_array( $value ) && array_key_exists('module_type', $value ) ) {
1790
  $new_seks_data[$key] = $value;
 
1791
  $new_value = $value['value'];
1792
 
1793
  switch ( $value['module_type'] ) {
1794
  case 'czr_image_module':
1795
  if ( is_array( $value['value'] ) ) {
 
1796
  if ( array_key_exists( 'main_settings', $value['value'] ) || array_key_exists( 'borders_corners', $value['value'] ) )
1797
  break;
1798
  $new_value = array( 'main_settings' => array(), 'borders_corners' => array() );
1799
  foreach ( $value['value'] as $input_id => $input_data ) {
 
1800
  if ( in_array( $input_id, array( 'main_settings', 'borders_corners' ) ) )
1801
  break;
1802
  switch ($input_id) {
@@ -1816,10 +2593,12 @@ function sek_walk_levels_and_do_map_compat_1_0_4_to_1_1_0( $seks_data ) {
1816
 
1817
  case 'czr_tiny_mce_editor_module':
1818
  if ( is_array( $value['value'] ) ) {
 
1819
  if ( array_key_exists( 'main_settings', $value['value'] ) || array_key_exists( 'font_settings', $value['value'] ) )
1820
  break;
1821
  $new_value = array( 'main_settings' => array(), 'font_settings' => array() );
1822
  foreach ( $value['value'] as $input_id => $input_data ) {
 
1823
  if ( in_array( $input_id, array( 'main_settings', 'font_settings' ) ) )
1824
  break;
1825
  switch ($input_id) {
@@ -1841,12 +2620,54 @@ function sek_walk_levels_and_do_map_compat_1_0_4_to_1_1_0( $seks_data ) {
1841
  }
1842
  $new_seks_data[$key]['value'] = $new_value;
1843
  } // End of module mapping
 
1844
  else if ( is_array($value) ) {
1845
  $new_seks_data[$key] = sek_walk_levels_and_do_map_compat_1_0_4_to_1_1_0( $value );
1846
  }
1847
  }
1848
  return $new_seks_data;
1849
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1850
  function sek_map_compat_1_0_4_to_1_1_0_do_level_spacing_mapping( $old_user_data ) {
1851
  $old_data_structure = array(
1852
  'desktop_pad_marg',
@@ -1856,6 +2677,7 @@ function sek_map_compat_1_0_4_to_1_1_0_do_level_spacing_mapping( $old_user_data
1856
  'mobile_pad_marg',
1857
  'mobile_unit'
1858
  );
 
1859
  $mapped_data = array();
1860
  foreach ( $old_data_structure as $old_key ) {
1861
  if ( false !== strpos( $old_key , 'pad_marg' ) ) {
@@ -1875,6 +2697,7 @@ function sek_map_compat_1_0_4_to_1_1_0_do_level_spacing_mapping( $old_user_data
1875
  return $mapped_data;
1876
  }
1877
  ?><?php
 
1878
  register_post_type( NIMBLE_CPT , array(
1879
  'labels' => array(
1880
  'name' => __( 'Nimble sections', 'nimble-builder' ),
@@ -1917,6 +2740,7 @@ register_post_type( NIMBLE_CPT , array(
1917
  * @return WP_Post|null The skope post or null if none exists.
1918
  */
1919
  function sek_get_seks_post( $skope_id = '', $skope_level = 'local' ) {
 
1920
  if ( empty( $skope_id ) ) {
1921
  $skope_id = skp_get_skope_id( $skope_level );
1922
  }
@@ -1938,7 +2762,10 @@ function sek_get_seks_post( $skope_id = '', $skope_level = 'local' ) {
1938
  $option_name = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id;
1939
 
1940
  $post_id = (int)get_option( $option_name );
 
 
1941
  if ( 1 > $post_id ) {
 
1942
  return;
1943
  }
1944
 
@@ -1949,6 +2776,8 @@ function sek_get_seks_post( $skope_id = '', $skope_level = 'local' ) {
1949
  if ( is_int( $post_id ) && $post_id > 0 && get_post( $post_id ) ) {
1950
  $post = get_post( $post_id );
1951
  }
 
 
1952
  if ( ! $post && -1 !== $post_id ) {
1953
  $query = new \WP_Query( $sek_post_query_vars );
1954
  $post = $query->post;
@@ -1978,6 +2807,8 @@ function sek_get_skoped_seks( $skope_id = '', $location_id = '', $skope_level =
1978
  }
1979
  $is_global_skope = NIMBLE_GLOBAL_SKOPE_ID === $skope_id;
1980
  $is_cached = false;
 
 
1981
  if ( did_action('wp') ) {
1982
  if ( !$is_global_skope && 'not_cached' != Nimble_Manager()->local_seks ) {
1983
  $is_cached = true;
@@ -1996,8 +2827,13 @@ function sek_get_skoped_seks( $skope_id = '', $location_id = '', $skope_level =
1996
  $seks_data = maybe_unserialize( $post->post_content );
1997
  }
1998
  $seks_data = is_array( $seks_data ) ? $seks_data : array();
 
 
 
1999
  $default_collection = sek_get_default_location_model( $skope_id );
2000
  $seks_data = wp_parse_args( $seks_data, $default_collection );
 
 
2001
  $maybe_incomplete_locations = [];
2002
  foreach( $seks_data['collection'] as $location_data ) {
2003
  if ( !empty( $location_data['id'] ) ) {
@@ -2012,6 +2848,7 @@ function sek_get_skoped_seks( $skope_id = '', $location_id = '', $skope_level =
2012
  }
2013
  }
2014
  }
 
2015
  if ( $is_global_skope ) {
2016
  Nimble_Manager()->global_seks = $seks_data;
2017
  } else {
@@ -2019,12 +2856,17 @@ function sek_get_skoped_seks( $skope_id = '', $location_id = '', $skope_level =
2019
  }
2020
 
2021
  }//end if
 
 
2022
  $seks_data = apply_filters(
2023
  'sek_get_skoped_seks',
2024
  $seks_data,
2025
  $skope_id,
2026
  $location_id
2027
  );
 
 
 
2028
  if ( array_key_exists( 'collection', $seks_data ) && ! empty( $location_id ) ) {
2029
  if ( ! array_key_exists( $location_id, sek_get_locations() ) ) {
2030
  error_log( __FUNCTION__ . ' Error => location ' . $location_id . ' is not registered in the available locations' );
@@ -2072,6 +2914,8 @@ function sek_update_sek_post( $seks_data, $args = array() ) {
2072
  'post_status' => 'publish',
2073
  'post_content' => maybe_serialize( $seks_data )
2074
  );
 
 
2075
  $post = sek_get_seks_post( $skope_id );
2076
 
2077
  if ( $post ) {
@@ -2084,6 +2928,8 @@ function sek_update_sek_post( $seks_data, $args = array() ) {
2084
  $post_id = $r;//$r is the post ID
2085
 
2086
  update_option( $option_name, (int)$post_id );
 
 
2087
  if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
2088
  wp_save_post_revision( $r );
2089
  }
@@ -2100,6 +2946,7 @@ function sek_update_sek_post( $seks_data, $args = array() ) {
2100
  /* ------------------------------------------------------------------------- *
2101
  * SAVED SEKTIONS
2102
  /* ------------------------------------------------------------------------- */
 
2103
  register_post_type( 'nimble_saved_seks' , array(
2104
  'labels' => array(
2105
  'name' => __( 'Nimble saved sections', 'nimble-builder' ),
@@ -2128,11 +2975,24 @@ register_post_type( 'nimble_saved_seks' , array(
2128
  'publish_posts' => 'edit_theme_options',
2129
  )
2130
  ));
 
 
2131
  function sek_get_saved_sektion_data( $saved_section_id ) {
2132
  $sek_post = sek_get_saved_seks_post( $saved_section_id );
2133
  $section_data = array();
2134
  if ( $sek_post ) {
2135
  $section_data_decoded = maybe_unserialize( $sek_post -> post_content );
 
 
 
 
 
 
 
 
 
 
 
2136
  if ( is_array( $section_data_decoded ) && ! empty( $section_data_decoded['data'] ) && is_string( $section_data_decoded['data'] ) ) {
2137
  $section_data = json_decode( wp_unslash( $section_data_decoded['data'], true ) );
2138
  }
@@ -2149,12 +3009,26 @@ function sek_get_saved_sektion_data( $saved_section_id ) {
2149
  * @return WP_Post|null The skope post or null if none exists.
2150
  */
2151
  function sek_get_saved_seks_post( $saved_section_id ) {
 
 
 
 
 
 
 
 
 
 
 
2152
 
2153
  $post = null;
2154
  $all_saved_seks = get_option( NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS );
2155
  $section_data = array_key_exists( $saved_section_id, $all_saved_seks ) ? $all_saved_seks[$saved_section_id] : array();
2156
  $post_id = array_key_exists( 'post_id', $section_data ) ? $section_data['post_id'] : -1;
 
 
2157
  if ( 0 > $post_id ) {
 
2158
  return;
2159
  }
2160
 
@@ -2166,8 +3040,36 @@ function sek_get_saved_seks_post( $saved_section_id ) {
2166
  $post = get_post( $post_id );
2167
  }
2168
 
 
 
 
 
 
 
 
 
 
 
 
 
2169
  return $post;
2170
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2171
  function sek_update_saved_seks_post( $seks_data ) {
2172
  if ( ! is_array( $seks_data ) ) {
2173
  error_log( 'sek_update_saved_seks_post => $seks_data is not an array' );
@@ -2194,6 +3096,8 @@ function sek_update_saved_seks_post( $seks_data ) {
2194
  'post_status' => 'publish',
2195
  'post_content' => maybe_serialize( $seks_data )
2196
  );
 
 
2197
  $post = sek_get_saved_seks_post( $saved_section_id );
2198
 
2199
  if ( $post ) {
@@ -2217,6 +3121,8 @@ function sek_update_saved_seks_post( $seks_data ) {
2217
  );
2218
 
2219
  update_option( NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS, $all_saved_seks );
 
 
2220
  if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
2221
  wp_save_post_revision( $r );
2222
  }
@@ -2238,9 +3144,11 @@ function sek_update_saved_seks_post( $seks_data ) {
2238
  * @return string $skope_level optional
2239
  */
2240
  function sek_get_revision_history_from_posts( $skope_id = '', $skope_level = 'local' ) {
 
2241
  if ( empty( $skope_id ) ) {
2242
  $skope_id = skp_get_skope_id( $skope_level );
2243
  }
 
2244
  if ( defined('DOING_AJAX') && DOING_AJAX && '_skope_not_set_' === $skope_id ) {
2245
  wp_send_json_error( __FUNCTION__ . ' => invalid skope id' );
2246
  }
@@ -2271,6 +3179,8 @@ function sek_get_revision_history_from_posts( $skope_id = '', $skope_level = 'lo
2271
  * @return string $skope_level optional
2272
  */
2273
  function sek_get_single_post_revision( $post_id = null ) {
 
 
2274
  if ( defined('DOING_AJAX') && DOING_AJAX && ( is_null( $post_id ) || !is_numeric( (int)$post_id ) ) ) {
2275
  wp_send_json_error( __FUNCTION__ . ' => invalid post id' );
2276
  }
@@ -2283,6 +3193,34 @@ function sek_get_single_post_revision( $post_id = null ) {
2283
  }
2284
 
2285
  ?><?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2286
  function sek_generate_css_rules_for_multidimensional_border_options( $rules, $border_settings, $border_type, $css_selectors = '' ) {
2287
  if ( ! is_array( $rules ) )
2288
  return array();
@@ -2300,11 +3238,16 @@ function sek_generate_css_rules_for_multidimensional_border_options( $rules, $bo
2300
  $data = wp_parse_args( $data, $default_data );
2301
 
2302
  $border_properties = array();
 
2303
  $numeric = sek_extract_numeric_value( $data['wght'] );
2304
  if ( is_numeric( $numeric ) ) {
2305
  $unit = sek_extract_unit( $data['wght'] );
 
2306
  $border_properties[] = $numeric . $unit;
 
2307
  $border_properties[] = $border_type;
 
 
2308
  if ( ! empty( $data[ 'col' ] ) ) {
2309
  $border_properties[] = $data[ 'col' ];
2310
  }
@@ -2315,8 +3258,11 @@ function sek_generate_css_rules_for_multidimensional_border_options( $rules, $bo
2315
  }
2316
 
2317
  $css_rules[] = "{$css_property}:" . implode( ' ', array_filter( $border_properties ) );
 
2318
  }//if ( !empty( $numeric ) )
2319
  }//foreach
 
 
2320
  $rules[] = array(
2321
  'selector' => $css_selectors,
2322
  'css_rules' => implode( ';', array_filter( $css_rules ) ),//"border:" . implode( ' ', array_filter( $border_properties ) ),
@@ -2324,6 +3270,24 @@ function sek_generate_css_rules_for_multidimensional_border_options( $rules, $bo
2324
  );
2325
  return $rules;
2326
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2327
  function sek_generate_css_rules_for_border_radius_options( $rules, $border_radius_settings, $css_selectors = '' ) {
2328
  if ( ! is_array( $rules ) )
2329
  return array();
@@ -2339,6 +3303,10 @@ function sek_generate_css_rules_for_border_radius_options( $rules, $border_radiu
2339
  $default_radius = $default_val . $unit;
2340
  }
2341
  }
 
 
 
 
2342
  $radius_dimensions_default = array(
2343
  'top_left' => $default_radius,
2344
  'top_right' => $default_radius,
@@ -2350,6 +3318,7 @@ function sek_generate_css_rules_for_border_radius_options( $rules, $border_radiu
2350
  if ( array_key_exists( '_all_', $border_radius_settings ) && 1 === count( $border_radius_settings ) ) {
2351
  $css_rules = "border-radius:" . $default_radius.';';
2352
  } else {
 
2353
  $normalized_border_radius_values = array();
2354
  foreach ( $radius_dimensions_default as $dim => $default_radius) {
2355
  if ( array_key_exists( $dim, $border_radius_settings ) ) {
@@ -2368,6 +3337,7 @@ function sek_generate_css_rules_for_border_radius_options( $rules, $border_radiu
2368
  }
2369
 
2370
  if ( ! empty( $css_rules ) ) {
 
2371
  $rules[] = array(
2372
  'selector' => $css_selectors,
2373
  'css_rules' => $css_rules,
@@ -2377,17 +3347,42 @@ function sek_generate_css_rules_for_border_radius_options( $rules, $border_radiu
2377
 
2378
  return $rules;
2379
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2380
  function sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $spacing_settings, $css_selectors = '' ) {
 
2381
  if ( empty( $spacing_settings ) || ! is_array( $spacing_settings ) )
2382
  return $rules;
2383
 
2384
 
2385
  $default_unit = 'px';
 
 
2386
  $_desktop_rules = $_mobile_rules = $_tablet_rules = null;
2387
 
2388
  if ( !empty( $spacing_settings['desktop'] ) ) {
2389
  $_desktop_rules = array( 'rules' => $spacing_settings['desktop'] );
2390
  }
 
 
2391
  $_pad_marg = array(
2392
  'desktop' => array(),
2393
  'tablet' => array(),
@@ -2397,6 +3392,7 @@ function sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $spaci
2397
  foreach( array_keys( $_pad_marg ) as $device ) {
2398
  if ( !empty( $spacing_settings[ $device ] ) ) {
2399
  $rules_candidates = $spacing_settings[ $device ];
 
2400
  $unit = !empty( $rules_candidates['unit'] ) ? $rules_candidates['unit'] : $default_unit;
2401
  $unit = 'percent' == $unit ? '%' : $unit;
2402
 
@@ -2411,6 +3407,7 @@ function sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $spaci
2411
 
2412
  array_walk( $_pad_marg[ $device ][ 'rules' ],
2413
  function( &$val, $key, $unit ) {
 
2414
  if ( FALSE !== strpos( 'padding', $key ) ) {
2415
  $val = abs( $val );
2416
  }
@@ -2424,6 +3421,13 @@ function sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $spaci
2424
  /*
2425
  * TABLETS AND MOBILES WILL INHERIT UPPER MQ LEVELS IF NOT OTHERWISE SPECIFIED
2426
  */
 
 
 
 
 
 
 
2427
  if ( ! empty( $_pad_marg[ 'desktop' ] ) ) {
2428
  $_pad_marg[ 'desktop' ][ 'mq' ] = null;
2429
  }
@@ -2451,7 +3455,39 @@ function sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $spaci
2451
  }
2452
  return $rules;
2453
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2454
  function sek_set_mq_css_rules( $params, $rules ) {
 
 
 
 
 
 
 
 
2455
  $params = wp_parse_args( $params, array(
2456
  'value' => array(),
2457
  'css_property' => '',
@@ -2469,12 +3505,20 @@ function sek_set_mq_css_rules( $params, $rules ) {
2469
  if ( ! empty( $params['value'][ 'mobile' ] ) ) {
2470
  $_font_size_mq[ 'mobile' ] = '(max-width:'. ( Sek_Dyn_CSS_Builder::$breakpoints['sm'] - 1 ) . 'px)'; //max-width: 575
2471
  }
 
 
 
 
 
 
2472
  foreach ( $params['value'] as $device => $val ) {
2473
  if ( ! in_array( $device, array( 'desktop', 'tablet', 'mobile' ) ) ) {
2474
  sek_error_log( __FUNCTION__ . ' => error => unknown device : ' . $device );
2475
  continue;
2476
  }
2477
  if ( ! empty( $val ) ) {
 
 
2478
  $css_property = $params['css_property'];
2479
  if ( is_array( $css_property ) ) {
2480
  $css_rules_array = array();
@@ -2494,6 +3538,15 @@ function sek_set_mq_css_rules( $params, $rules ) {
2494
  }
2495
  return $rules;
2496
  }
 
 
 
 
 
 
 
 
 
2497
  /**
2498
  * SASS COLOR DARKEN/LIGHTEN UTILS
2499
  */
@@ -2657,6 +3710,8 @@ function sek_rgb2hex( $rgb, $make_prop_value = false ) {
2657
  $rgb = is_array( $rgb ) ? $rgb : explode( ',', $rgb );
2658
  $rgb = is_array( $rgb) ? $rgb : array( $rgb );
2659
  $rgb = count( $rgb ) < 3 ? array_pad( $rgb, 3, 255 ) : $rgb;
 
 
2660
  $hex[0] = str_pad( dechex( $rgb[0] ), 2, '0', STR_PAD_LEFT );
2661
  $hex[1] = str_pad( dechex( $rgb[1] ), 2, '0', STR_PAD_LEFT );
2662
  $hex[2] = str_pad( dechex( $rgb[2] ), 2, '0', STR_PAD_LEFT );
@@ -2675,6 +3730,7 @@ function sek_rgba2rgb_a( $rgba ) {
2675
  $rgba = is_array( $rgba) ? $rgba : array( $rgba );
2676
  return array(
2677
  array_slice( $rgba, 0, 3 ),
 
2678
  isset( $rgba[3] ) ? $rgba[3] : 1
2679
  );
2680
  }
@@ -2691,6 +3747,8 @@ function sek_rgb2hsl( $rgb, $array = false ) {
2691
  $rgb = count( $rgb ) < 3 ? array_pad( $rgb, 3, 255 ) : $rgb;
2692
 
2693
  $deltas = array();
 
 
2694
  $RGB = array(
2695
  'R' => is_numeric($rgb[0]) ? ( $rgb[0] / 255 ) : 1,
2696
  'G' => is_numeric($rgb[1]) ? ( $rgb[1] / 255 ) : 1,
@@ -2828,6 +3886,8 @@ function sek_hue2rgbtone( $v1, $v2, $vH ) {
2828
  * Returns the complementary hsl color
2829
  */
2830
  function sek_rgb_invert( $rgb ) {
 
 
2831
  $rgb_inverted = array(
2832
  255 - $rgb[0],
2833
  255 - $rgb[1],
@@ -2847,11 +3907,19 @@ function sek_hex_invert( $hex, $make_prop_value = true ) {
2847
 
2848
  return sek_rgb2hex( $rgb_inverted, $make_prop_value );
2849
  }
 
 
 
2850
  function sek_extract_unit( $value ) {
 
2851
  $unit = preg_replace('/[0-9]|\.|,/', '', $value );
 
2852
  $unit = str_replace('-', '', $unit );
2853
  return 0 === preg_match( "/(px|em|%)/i", $unit ) ? 'px' : $unit;
2854
  }
 
 
 
2855
  function sek_extract_numeric_value( $value ) {
2856
  if ( ! is_scalar( $value ) )
2857
  return null;
@@ -2861,17 +3929,30 @@ function sek_extract_numeric_value( $value ) {
2861
 
2862
 
2863
  ?><?php
 
2864
  add_action( 'after_setup_theme', '\Nimble\sek_schedule_module_registration', 50 );
 
 
2865
  function sek_schedule_module_registration() {
 
 
 
 
 
 
2866
  if ( isset( $_POST['nimble_simple_cf'] ) ) {
2867
  sek_register_modules_when_customizing_or_ajaxing();
2868
  } else if ( skp_is_customizing() || ( defined('DOING_AJAX') && DOING_AJAX ) ) {
2869
  sek_register_modules_when_customizing_or_ajaxing();
 
2870
  sek_register_prebuilt_section_modules();
2871
  } else {
2872
  add_action( 'wp', '\Nimble\sek_register_modules_when_not_customizing_and_not_ajaxing', PHP_INT_MAX );
2873
  }
2874
  }
 
 
 
2875
  function sek_register_modules_when_customizing_or_ajaxing() {
2876
  $modules = array_merge(
2877
  SEK_Front_Construct::$ui_picker_modules,
@@ -2879,20 +3960,37 @@ function sek_register_modules_when_customizing_or_ajaxing() {
2879
  SEK_Front_Construct::$ui_local_global_options_modules,
2880
  SEK_Front_Construct::$ui_front_modules
2881
  );
 
 
 
2882
  if ( sek_is_header_footer_enabled() ) {
2883
  $modules = array_merge( $modules, SEK_Front_Construct::$ui_front_beta_modules );
2884
  }
2885
  sek_do_register_module_collection( $modules );
2886
  }
 
 
 
 
 
2887
  function sek_register_modules_when_not_customizing_and_not_ajaxing() {
 
2888
  sek_populate_contextually_active_module_list();
2889
 
2890
  $contextually_actives = array();
2891
  $front_modules = array_merge( SEK_Front_Construct::$ui_front_modules, SEK_Front_Construct::$ui_front_beta_modules );
 
 
 
2892
  foreach ( Nimble_Manager()->contextually_active_modules as $module_name ) {
 
 
2893
  if ( array_key_exists( $module_name, $front_modules ) ) {
 
 
2894
  $contextually_actives[] = $front_modules[ $module_name ];
2895
  }
 
2896
  if ( in_array( $module_name, $front_modules ) ) {
2897
  $contextually_actives[] = $module_name;
2898
  }
@@ -2905,8 +4003,24 @@ function sek_register_modules_when_not_customizing_and_not_ajaxing() {
2905
  );
2906
  sek_do_register_module_collection( $modules );
2907
  }
 
 
 
2908
  function sek_do_register_module_collection( $modules ) {
2909
  $module_candidates = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
2910
  foreach ($modules as $key => $value) {
2911
  if ( is_array( $value ) ) {
2912
  $module_candidates = array_merge( $module_candidates, $value );
@@ -2914,8 +4028,14 @@ function sek_do_register_module_collection( $modules ) {
2914
  $module_candidates[] = $value;
2915
  }
2916
  }
 
 
2917
  $module_candidates = array_unique( $module_candidates );
2918
  foreach ( $module_candidates as $module_name ) {
 
 
 
 
2919
  $fn = "Nimble\sek_get_module_params_for_{$module_name}";
2920
  if ( function_exists( $fn ) ) {
2921
  $params = $fn();
@@ -2929,6 +4049,9 @@ function sek_do_register_module_collection( $modules ) {
2929
  }
2930
  }
2931
  }
 
 
 
2932
  function sek_populate_contextually_active_module_list( $recursive_data = null ) {
2933
  if ( is_null( $recursive_data ) ) {
2934
  $local_skope_settings = sek_get_skoped_seks( skp_get_skope_id() );
@@ -2941,6 +4064,7 @@ function sek_populate_contextually_active_module_list( $recursive_data = null )
2941
  if ( is_array( $value ) ) {
2942
  sek_populate_contextually_active_module_list( $value );
2943
  }
 
2944
  if ( is_string( $key ) && 'module_type' === $key ) {
2945
  $module_collection = Nimble_Manager()->contextually_active_modules;
2946
  $module_collection[] = $value;
@@ -2948,8 +4072,47 @@ function sek_populate_contextually_active_module_list( $recursive_data = null )
2948
  }
2949
  }
2950
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2951
  function sek_register_prebuilt_section_modules() {
2952
- $registration_params = sek_get_sections_registration_params_api_data();
2953
  $default_module_params = array(
2954
  'dynamic_registration' => true,
2955
  'module_type' => '',
@@ -2972,6 +4135,8 @@ function sek_register_prebuilt_section_modules() {
2972
  'module_title' => '',
2973
  'section_collection' => array()
2974
  ));
 
 
2975
  $normalized_params = $default_module_params;
2976
  $normalized_params['module_type'] = $module_type;
2977
  $normalized_params['name'] = $module_params['module_title'];
@@ -2980,6 +4145,15 @@ function sek_register_prebuilt_section_modules() {
2980
  }
2981
 
2982
  }
 
 
 
 
 
 
 
 
 
2983
  function sek_get_select_options_for_input_id( $input_id ) {
2984
  $options = array();
2985
  switch( $input_id ) {
@@ -2999,12 +4173,16 @@ function sek_get_select_options_for_input_id( $input_id ) {
2999
  case 'img-size' :
3000
  $options = sek_get_img_sizes();
3001
  break;
 
 
3002
  case 'link-to' :
3003
  $options = array(
3004
  'no-link' => __('No link', 'nimble-builder' ),
3005
  'url' => __('Site content or custom url', 'nimble-builder' ),
3006
  );
3007
  break;
 
 
3008
  case 'img-type' :
3009
  $options = array(
3010
  'none' => __( 'No image', 'nimble-builder' ),
@@ -3019,6 +4197,8 @@ function sek_get_select_options_for_input_id( $input_id ) {
3019
  'custom' => __( 'Use a custom text', 'nimble-builder' ),
3020
  );
3021
  break;
 
 
3022
  case 'heading_tag':
3023
  $options = array(
3024
  /* Not totally sure these should be localized as they strictly refer to html tags */
@@ -3030,6 +4210,8 @@ function sek_get_select_options_for_input_id( $input_id ) {
3030
  'h6' => __('H6', 'nimble-builder' ),
3031
  );
3032
  break;
 
 
3033
  case 'font_weight_css' :
3034
  $options = array(
3035
  'normal' => __( 'normal', 'nimble-builder' ),
@@ -3073,6 +4255,8 @@ function sek_get_select_options_for_input_id( $input_id ) {
3073
  'lowercase' => __( 'lowercase', 'nimble-builder' )
3074
  );
3075
  break;
 
 
3076
  case 'css_unit' :
3077
  $options = array(
3078
  'px' => __('Pixels', 'nimble-builder' ),
@@ -3080,6 +4264,8 @@ function sek_get_select_options_for_input_id( $input_id ) {
3080
  'percent' => __('Percents', 'nimble-builder' )
3081
  );
3082
  break;
 
 
3083
  case 'quote_design' :
3084
  $options = array(
3085
  'none' => __( 'Text only', 'nimble-builder' ),
@@ -3087,6 +4273,8 @@ function sek_get_select_options_for_input_id( $input_id ) {
3087
  'quote-icon-before' => __( 'Quote Icon', 'nimble-builder' ),
3088
  );
3089
  break;
 
 
3090
  case 'boxed-wide' :
3091
  $options = array(
3092
  'boxed' => __('Boxed', 'nimble-builder'),
@@ -3139,11 +4327,14 @@ function sek_get_select_options_for_input_id( $input_id ) {
3139
  /* ------------------------------------------------------------------------- *
3140
  * CONTENT TYPE SWITCHER
3141
  /* ------------------------------------------------------------------------- */
 
3142
  function sek_get_module_params_for_sek_content_type_switcher_module() {
3143
  return array(
3144
  'dynamic_registration' => true,
3145
  'module_type' => 'sek_content_type_switcher_module',
3146
  'name' => __('Content type', 'nimble-builder'),
 
 
3147
  'tmpl' => array(
3148
  'item-inputs' => array(
3149
  'content_type' => array(
@@ -3157,6 +4348,7 @@ function sek_get_module_params_for_sek_content_type_switcher_module() {
3157
  __('use the Nimble page template', 'nimble-builder'),
3158
  "javascript:wp.customize.section('__localOptionsSection', function( _s_ ){_s_.container.find('.accordion-section-title').first().trigger('click');})"
3159
  ),
 
3160
  sek_is_header_footer_enabled() ? sprintf('<a href="#" onclick="%2$s" title="%1$s">%1$s</a>',
3161
  __('header and footer', 'nimble-builder'),
3162
  "javascript:wp.customize.section('__globalOptionsSectionId', function( _s_ ){ _s_.focus(); })"
@@ -3172,11 +4364,14 @@ function sek_get_module_params_for_sek_content_type_switcher_module() {
3172
  /* ------------------------------------------------------------------------- *
3173
  * MODULE PICKER MODULE
3174
  /* ------------------------------------------------------------------------- */
 
3175
  function sek_get_module_params_for_sek_module_picker_module() {
3176
  return array(
3177
  'dynamic_registration' => true,
3178
  'module_type' => 'sek_module_picker_module',
3179
  'name' => __('Content Picker', 'nimble-builder'),
 
 
3180
  'tmpl' => array(
3181
  'item-inputs' => array(
3182
  'module_id' => array(
@@ -3194,12 +4389,39 @@ function sek_get_module_params_for_sek_module_picker_module() {
3194
  /* ------------------------------------------------------------------------- *
3195
  * SEKTION PICKER MODULES
3196
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3197
  ?><?php
 
3198
  function sek_get_module_params_for_sek_level_bg_module() {
3199
  return array(
3200
  'dynamic_registration' => true,
3201
  'module_type' => 'sek_level_bg_module',
3202
  'name' => __('Background', 'nimble-builder'),
 
 
 
 
 
 
3203
  'tmpl' => array(
3204
  'item-inputs' => array(
3205
  'bg-color' => array(
@@ -3226,6 +4448,10 @@ function sek_get_module_params_for_sek_level_bg_module() {
3226
  'default' => array( 'desktop' => 'center' ),
3227
  'title_width' => 'width-100',
3228
  ),
 
 
 
 
3229
  'bg-attachment' => array(
3230
  'input_type' => 'nimblecheck',
3231
  'title' => __('Fixed background', 'nimble-builder'),
@@ -3249,6 +4475,7 @@ function sek_get_module_params_for_sek_level_bg_module() {
3249
  'orientation' => 'horizontal',
3250
  'min' => 0,
3251
  'max' => 100,
 
3252
  'default' => '60',
3253
  'width-100' => true,
3254
  'title_width' => 'width-100',
@@ -3275,6 +4502,11 @@ function sek_get_module_params_for_sek_level_bg_module() {
3275
  'space' => __('Space', 'nimble-builder'),
3276
  )
3277
  ),
 
 
 
 
 
3278
  'bg-apply-overlay' => array(
3279
  'input_type' => 'nimblecheck',
3280
  'title' => __('Apply a background overlay', 'nimble-builder'),
@@ -3294,6 +4526,7 @@ function sek_get_module_params_for_sek_level_bg_module() {
3294
  'orientation' => 'horizontal',
3295
  'min' => 0,
3296
  'max' => 100,
 
3297
  'default' => '40',
3298
  'width-100' => true,
3299
  'title_width' => 'width-100'
@@ -3312,6 +4545,22 @@ add_filter( 'sek_add_css_rules_for_level_options', '\Nimble\sek_add_css_rules_fo
3312
 
3313
  function sek_add_css_rules_for_level_background( $rules, $level ) {
3314
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3315
  $default_value_model = sek_get_default_module_model( 'sek_level_bg_module' );
3316
  $bg_options = ( ! empty( $options[ 'bg' ] ) && is_array( $options[ 'bg' ] ) ) ? $options[ 'bg' ] : array();
3317
  $bg_options = wp_parse_args( $bg_options , is_array( $default_value_model ) ? $default_value_model : array() );
@@ -3326,10 +4575,16 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3326
  * https://www.webpagefx.com/blog/web-design/background-css-shorthand/
3327
  * background: [background-image] [background-position] / [background-size] [background-repeat] [background-attachment] [background-origin] [background-clip] [background-color];
3328
  */
 
3329
  if ( ! empty( $bg_options[ 'bg-image'] ) && is_numeric( $bg_options[ 'bg-image'] ) ) {
 
3330
  if ( ! sek_is_img_smartload_enabled() ) {
 
3331
  $background_properties[ 'background-image' ] = 'url("'. wp_get_attachment_url( $bg_options[ 'bg-image'] ) .'")';
3332
  }
 
 
 
3333
  if ( ! empty( $bg_options[ 'bg-position'] ) && 'center' != $bg_options[ 'bg-position'] ) {
3334
  $pos_map = array(
3335
  'top_left' => '0% 0%',
@@ -3342,11 +4597,13 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3342
  'bottom' => '50% 100%',
3343
  'bottom_right'=> '100% 100%'
3344
  );
 
3345
  if ( is_string( $bg_options[ 'bg-position'] ) ) {
3346
  $raw_pos = $bg_options[ 'bg-position'];
3347
  $background_properties[ 'background-position' ] = array_key_exists($raw_pos, $pos_map) ? $pos_map[ $raw_pos ] : $pos_map[ 'center' ];
3348
  } else if ( is_array( $bg_options[ 'bg-position'] ) ) {
3349
  $mapped_bg_options = array();
 
3350
  foreach ($bg_options[ 'bg-position'] as $device => $user_val ) {
3351
  if ( ! in_array( $device, array( 'desktop', 'tablet', 'mobile' ) ) ) {
3352
  sek_error_log( __FUNCTION__ . ' => error => unknown device : ' . $device );
@@ -3362,20 +4619,34 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3362
  ), $rules );
3363
  }
3364
  }
 
 
 
3365
  if ( ! empty( $bg_options['bg-scale'] ) && 'default' != $bg_options['bg-scale'] && 'cover' != $bg_options['bg-scale'] ) {
 
3366
  $background_properties['background-size'] = $bg_options['bg-scale'];
3367
  }
 
 
 
3368
  if ( ! empty( $bg_options['bg-repeat'] ) && 'default' != $bg_options['bg-repeat'] ) {
3369
  $background_properties['background-repeat'] = $bg_options['bg-repeat'];
3370
  }
 
 
3371
  if ( ! empty( $bg_options['bg-attachment'] ) && sek_is_checked( $bg_options['bg-attachment'] ) ) {
3372
  $background_properties['background-attachment'] = 'fixed';
3373
  }
3374
 
3375
  }
 
 
3376
  if ( ! empty( $bg_options['bg-color'] ) ) {
3377
  $background_properties['background-color'] = $bg_options[ 'bg-color' ];
3378
  }
 
 
 
3379
  if ( ! empty( $background_properties ) ) {
3380
  $background_css_rules = '';
3381
  foreach ($background_properties as $bg_prop => $bg_css_val ) {
@@ -3387,10 +4658,19 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3387
  'mq' =>null
3388
  );
3389
  }
 
 
 
 
3390
  if ( !empty( $bg_options['bg-image']) && ! empty( $bg_options[ 'bg-apply-overlay'] ) && sek_is_checked( $bg_options[ 'bg-apply-overlay'] ) ) {
 
3391
  $bg_color_overlay = isset( $bg_options[ 'bg-color-overlay' ] ) ? $bg_options[ 'bg-color-overlay' ] : null;
3392
  if ( $bg_color_overlay ) {
 
3393
  $bg_overlay_css_rules = 'content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:'.$bg_color_overlay;
 
 
 
3394
  $bg_overlay_opacity = isset( $bg_options[ 'bg-opacity-overlay' ] ) ? filter_var( $bg_options[ 'bg-opacity-overlay' ], FILTER_VALIDATE_INT, array( 'options' =>
3395
  array( "min_range"=>0, "max_range"=>100 ) )
3396
  ) : FALSE;
@@ -3403,6 +4683,9 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3403
  'css_rules' => $bg_overlay_css_rules,
3404
  'mq' =>null
3405
  );
 
 
 
3406
  $rules[] = array(
3407
  'selector' => '[data-sek-id="'.$level['id'].'"]',
3408
  'css_rules' => 'position:relative',
@@ -3410,6 +4693,10 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3410
  );
3411
 
3412
  $first_child_selector = '[data-sek-id="'.$level['id'].'"]>*';
 
 
 
 
3413
  if ( is_customize_preview() ) {
3414
  $first_child_selector .= ':not(.ui-resizable-handle):not(.sek-dyn-ui-wrapper):not(.sek-add-content-button)';
3415
  }
@@ -3425,6 +4712,7 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3425
  }
3426
 
3427
  ?><?php
 
3428
  function sek_get_module_params_for_sek_level_border_module() {
3429
  return array(
3430
  'dynamic_registration' => true,
@@ -3435,6 +4723,8 @@ function sek_get_module_params_for_sek_level_border_module() {
3435
  '_all_' => array( 'wght' => '1px', 'col' => '#000000' )
3436
  )
3437
  ),
 
 
3438
  'tmpl' => array(
3439
  'item-inputs' => array(
3440
  'border-type' => array(
@@ -3462,6 +4752,10 @@ function sek_get_module_params_for_sek_level_border_module() {
3462
  'title_width' => 'width-100',
3463
  'min' => 0,
3464
  'max' => 500,
 
 
 
 
3465
  ),
3466
  'shadow' => array(
3467
  'input_type' => 'nimblecheck',
@@ -3486,6 +4780,38 @@ add_filter( 'sek_add_css_rules_for_level_options', '\Nimble\sek_add_css_rules_fo
3486
 
3487
  function sek_add_css_rules_for_border( $rules, $level ) {
3488
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3489
  $default_value_model = sek_get_default_module_model( 'sek_level_border_module' );
3490
  $normalized_border_options = ( ! empty( $options[ 'border' ] ) && is_array( $options[ 'border' ] ) ) ? $options[ 'border' ] : array();
3491
  $normalized_border_options = wp_parse_args( $normalized_border_options , is_array( $default_value_model ) ? $default_value_model : array() );
@@ -3496,6 +4822,8 @@ function sek_add_css_rules_for_border( $rules, $level ) {
3496
  $border_settings = ! empty( $normalized_border_options[ 'borders' ] ) ? $normalized_border_options[ 'borders' ] : FALSE;
3497
  $border_type = $normalized_border_options[ 'border-type' ];
3498
  $has_border_settings = FALSE !== $border_settings && is_array( $border_settings ) && ! empty( $border_type ) && 'none' != $border_type;
 
 
3499
  if ( $has_border_settings ) {
3500
  $rules = sek_generate_css_rules_for_multidimensional_border_options( $rules, $border_settings, $border_type, '[data-sek-id="'.$level['id'].'"]' );
3501
  }
@@ -3513,6 +4841,21 @@ function sek_add_css_rules_for_border( $rules, $level ) {
3513
 
3514
  function sek_add_css_rules_for_boxshadow( $rules, $level ) {
3515
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3516
  $default_value_model = sek_get_default_module_model( 'sek_level_border_module' );
3517
  $normalized_border_options = ( ! empty( $options[ 'border' ] ) && is_array( $options[ 'border' ] ) ) ? $options[ 'border' ] : array();
3518
  $normalized_border_options = wp_parse_args( $normalized_border_options , is_array( $default_value_model ) ? $default_value_model : array() );
@@ -3521,7 +4864,9 @@ function sek_add_css_rules_for_boxshadow( $rules, $level ) {
3521
  return $rules;
3522
 
3523
  if ( !empty( $normalized_border_options[ 'shadow' ] ) && sek_is_checked( $normalized_border_options[ 'shadow'] ) ) {
 
3524
  $css_rules = '-webkit-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px;-moz-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px;box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px;';
 
3525
  if ( skp_is_customizing() ) {
3526
  $css_rules = '-webkit-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px!important;-moz-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px!important;box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px!important;';
3527
  }
@@ -3534,6 +4879,7 @@ function sek_add_css_rules_for_boxshadow( $rules, $level ) {
3534
  return $rules;
3535
  }
3536
  ?><?php
 
3537
  function sek_get_module_params_for_sek_level_height_module() {
3538
  return array(
3539
  'dynamic_registration' => true,
@@ -3542,6 +4888,8 @@ function sek_get_module_params_for_sek_level_height_module() {
3542
  'starting_value' => array(
3543
  'custom-height' => array( 'desktop' => '50%' ),
3544
  ),
 
 
3545
  'tmpl' => array(
3546
  'item-inputs' => array(
3547
  'height-type' => array(
@@ -3560,6 +4908,7 @@ function sek_get_module_params_for_sek_level_height_module() {
3560
  'title_width' => 'width-100',
3561
  'notice_before' => 'Note that when using a custom height, the inner content can be larger than the parent container, in particular on mobile devices. To prevent this problem, preview your page with the device switcher icons. You can also activate the overflow hidden option below.'
3562
  ),
 
3563
  'overflow_hidden' => array(
3564
  'input_type' => 'nimblecheck',
3565
  'title' => __('Overflow hidden', 'nimble-builder'),
@@ -3576,6 +4925,7 @@ function sek_get_module_params_for_sek_level_height_module() {
3576
  'default' => array( 'desktop' => 'center' ),
3577
  'refresh_markup' => false,
3578
  'refresh_stylesheet' => true,
 
3579
  'title_width' => 'width-100',
3580
  'width-100' => true,
3581
  )
@@ -3596,6 +4946,8 @@ function sek_add_css_rules_for_level_height( $rules, $level ) {
3596
  return $rules;
3597
 
3598
  $height_options = is_array( $options[ 'height' ] ) ? $options[ 'height' ] : array();
 
 
3599
  if ( ! empty( $height_options[ 'v_alignment' ] ) ) {
3600
  if ( ! is_array( $height_options[ 'v_alignment' ] ) ) {
3601
  sek_error_log( __FUNCTION__ . ' => error => the v_alignment option should be an array( {device} => {alignment} )');
@@ -3626,6 +4978,8 @@ function sek_add_css_rules_for_level_height( $rules, $level ) {
3626
  'selector' => '[data-sek-id="'.$level['id'].'"]'
3627
  ), $rules );
3628
  }
 
 
3629
  if ( ! empty( $height_options[ 'height-type' ] ) ) {
3630
  if ( 'custom' === $height_options[ 'height-type' ] ) {
3631
  $custom_user_height = array_key_exists( 'custom-height', $height_options ) ? $height_options[ 'custom-height' ] : array();
@@ -3656,6 +5010,9 @@ function sek_add_css_rules_for_level_height( $rules, $level ) {
3656
  ), $rules );
3657
  }
3658
  }
 
 
 
3659
  if ( ! empty( $height_options[ 'overflow_hidden' ] ) && sek_booleanize_checkbox_val( $height_options[ 'overflow_hidden' ] ) ) {
3660
  $rules[] = array(
3661
  'selector' => '[data-sek-id="'.$level['id'].'"]',
@@ -3663,6 +5020,7 @@ function sek_add_css_rules_for_level_height( $rules, $level ) {
3663
  'mq' =>null
3664
  );
3665
  }
 
3666
  return $rules;
3667
  }
3668
 
@@ -3670,11 +5028,14 @@ function sek_add_css_rules_for_level_height( $rules, $level ) {
3670
  /* ------------------------------------------------------------------------- *
3671
  * SPACING MODULE
3672
  /* ------------------------------------------------------------------------- */
 
3673
  function sek_get_module_params_for_sek_level_spacing_module() {
3674
  return array(
3675
  'dynamic_registration' => true,
3676
  'module_type' => 'sek_level_spacing_module',
3677
  'name' => __('Spacing options', 'nimble-builder'),
 
 
3678
 
3679
  'tmpl' => array(
3680
  'item-inputs' => array(
@@ -3699,15 +5060,21 @@ function sek_get_module_params_for_sek_level_spacing_module() {
3699
  * SCHEDULE CSS RULES FILTERING
3700
  /* ------------------------------------------------------------------------- */
3701
  add_filter( 'sek_add_css_rules_for_level_options', '\Nimble\sek_add_css_rules_for_spacing', 10, 2 );
 
 
3702
  function sek_add_css_rules_for_spacing( $rules, $level ) {
3703
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
 
3704
  if ( empty( $options[ 'spacing' ] ) || empty( $options[ 'spacing' ][ 'pad_marg' ] ) )
3705
  return $rules;
3706
  $pad_marg_options = $options[ 'spacing' ][ 'pad_marg' ];
 
3707
  if ( ! is_array( $pad_marg_options ) )
3708
  return $rules;
3709
 
3710
  $rules = sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $pad_marg_options, '[data-sek-id="'.$level['id'].'"]' );
 
 
3711
  if ( 'column' === $level['level'] && ! empty( $pad_marg_options['desktop'] ) ) {
3712
  $margin_left = array_key_exists('margin-left', $pad_marg_options['desktop'] ) ? $pad_marg_options['desktop']['margin-left'] : 0;
3713
  $margin_right = array_key_exists('margin-right', $pad_marg_options['desktop'] ) ? $pad_marg_options['desktop']['margin-right'] : 0;
@@ -3729,38 +5096,62 @@ function sek_add_css_rules_for_spacing( $rules, $level ) {
3729
 
3730
  $col_width_in_percent = 100/$col_number;
3731
  $col_suffix = floor( $col_width_in_percent );
 
 
 
 
3732
  $custom_width = ( ! empty( $level[ 'width' ] ) && is_numeric( $level[ 'width' ] ) ) ? $level['width'] : null;
3733
  if ( ! is_null( $custom_width ) ) {
3734
  $col_width_in_percent = $custom_width;
3735
  }
 
 
3736
  if ( $col_suffix < 1 )
3737
  return $rules;
 
 
3738
  $breakpoint = Sek_Dyn_CSS_Builder::$breakpoints[ Sek_Dyn_CSS_Builder::COLS_MOBILE_BREAKPOINT ];//COLS_MOBILE_BREAKPOINT = 'md' <=> 768px
 
 
3739
  $selector = sprintf('[data-sek-level="location"] [data-sek-id="%1$s"] .sek-sektion-inner > .sek-col-%2$s[data-sek-id="%3$s"]', $parent_section['id'], $col_suffix, $level['id'] );
 
 
3740
  $global_custom_breakpoint = intval( sek_get_global_custom_breakpoint() );
3741
  $has_global_custom_breakpoint = $global_custom_breakpoint >= 1;
 
 
3742
  $section_custom_breakpoint = intval( sek_get_section_custom_breakpoint( $parent_section ) );
3743
  $has_section_custom_breakpoint = $section_custom_breakpoint >= 1;
3744
 
3745
  if ( $has_section_custom_breakpoint ) {
3746
  $breakpoint = $section_custom_breakpoint;
 
 
3747
  $selector = sprintf('[data-sek-level="location"] [data-sek-id="%1$s"] .sek-sektion-inner > .sek-section-custom-breakpoint-col-%2$s[data-sek-id="%3$s"]', $parent_section['id'], $col_suffix, $level['id'] );
3748
  } else if ( $has_global_custom_breakpoint ) {
3749
  $breakpoint = $global_custom_breakpoint;
3750
  }
3751
 
3752
  $responsive_css_rules = sprintf( '-ms-flex: 0 0 calc(%1$s%% - %2$s) ;flex: 0 0 calc(%1$s%% - %2$s);max-width: calc(%1$s%% - %2$s)', $col_width_in_percent, $total_horizontal_margin_with_unit );
 
 
 
3753
  $rules[] = array(
3754
  'selector' => $selector,
3755
  'css_rules' => $responsive_css_rules,
3756
  'mq' => "(min-width: {$breakpoint}px)"
3757
  );
 
 
 
3758
  $responsive_css_rules_for_100_percent_width = sprintf( '-ms-flex: 0 0 calc(%1$s%% - %2$s) ;flex: 0 0 calc(%1$s%% - %2$s);max-width: calc(%1$s%% - %2$s)', 100, $total_horizontal_margin_with_unit );
3759
  $rules[] = array(
3760
  'selector' => sprintf('.sek-sektion-inner > [data-sek-id="%1$s"]', $level['id'] ),
3761
  'css_rules' => $responsive_css_rules_for_100_percent_width,
 
3762
  'mq' => null,// "(max-width: {$breakpoint_for_100_percent_width}px)"
3763
  );
 
3764
  }//if ( $total_horizontal_margin > 0 && !empty( $parent_section ) ) {
3765
  }// if column
3766
 
@@ -3768,11 +5159,14 @@ function sek_add_css_rules_for_spacing( $rules, $level ) {
3768
  }
3769
 
3770
  ?><?php
 
3771
  function sek_get_module_params_for_sek_level_width_module() {
3772
  return array(
3773
  'dynamic_registration' => true,
3774
  'module_type' => 'sek_level_width_module',
3775
  'name' => __('Width options', 'nimble-builder'),
 
 
3776
  'tmpl' => array(
3777
  'item-inputs' => array(
3778
  'width-type' => array(
@@ -3817,6 +5211,8 @@ function sek_add_css_rules_for_module_width( $rules, $module ) {
3817
  return $rules;
3818
 
3819
  $width_options = is_array( $options[ 'width' ] ) ? $options[ 'width' ] : array();
 
 
3820
  if ( ! empty( $width_options[ 'h_alignment' ] ) ) {
3821
  if ( ! is_array( $width_options[ 'h_alignment' ] ) ) {
3822
  sek_error_log( __FUNCTION__ . ' => error => the h_alignment option should be an array( {device} => {alignment} )');
@@ -3848,6 +5244,9 @@ function sek_add_css_rules_for_module_width( $rules, $module ) {
3848
  'selector' => '[data-sek-id="'.$module['id'].'"]'
3849
  ), $rules );
3850
  }
 
 
 
3851
  if ( ! empty( $width_options[ 'width-type' ] ) ) {
3852
  if ( 'custom' == $width_options[ 'width-type' ] && array_key_exists( 'custom-width', $width_options ) ) {
3853
  $user_custom_width_value = $width_options[ 'custom-width' ];
@@ -3878,15 +5277,23 @@ function sek_add_css_rules_for_module_width( $rules, $module ) {
3878
  ), $rules );
3879
  }
3880
  }
 
3881
  return $rules;
3882
  }
3883
 
3884
  ?><?php
 
3885
  function sek_get_module_params_for_sek_level_width_section() {
3886
  return array(
3887
  'dynamic_registration' => true,
3888
  'module_type' => 'sek_level_width_section',
3889
  'name' => __('Width options', 'nimble-builder'),
 
 
 
 
 
 
3890
  'tmpl' => array(
3891
  'item-inputs' => array(
3892
  'use-custom-outer-width' => array(
@@ -3935,6 +5342,33 @@ function sek_get_module_params_for_sek_level_width_section() {
3935
  /* ------------------------------------------------------------------------- *
3936
  * SCHEDULE CSS RULES FILTERING
3937
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3938
  add_filter( 'sek_add_css_rules_for__section__options', '\Nimble\sek_add_css_rules_for_section_width', 10, 3 );
3939
  function sek_add_css_rules_for_section_width( $rules, $section ) {
3940
  $options = empty( $section[ 'options' ] ) ? array() : $section['options'];
@@ -3953,10 +5387,15 @@ function sek_add_css_rules_for_section_width( $rules, $section ) {
3953
 
3954
  if ( empty( $user_defined_widths ) )
3955
  return $rules;
 
 
 
3956
  foreach ( $user_defined_widths as $width_opt_name => $selector ) {
3957
  if ( ! empty( $width_options[ $width_opt_name ] ) && ! is_array( $width_options[ $width_opt_name ] ) ) {
3958
  sek_error_log( __FUNCTION__ . ' => error => the width option should be an array( {device} => {number}{unit} )');
3959
  }
 
 
3960
  $user_custom_width_value = ( empty( $width_options[ $width_opt_name ] ) || ! is_array( $width_options[ $width_opt_name ] ) ) ? array('desktop' => '100%') : $width_options[ $width_opt_name ];
3961
  $user_custom_width_value = wp_parse_args( $user_custom_width_value, array(
3962
  'desktop' => '100%',
@@ -3981,6 +5420,9 @@ function sek_add_css_rules_for_section_width( $rules, $section ) {
3981
  'css_property' => 'max-width',
3982
  'selector' => $selector
3983
  ), $rules );
 
 
 
3984
  if ( 'inner-section-width' === $width_opt_name ) {
3985
  $rules = sek_set_mq_css_rules(array(
3986
  'value' => $padding_of_the_parent_container,
@@ -4007,11 +5449,14 @@ function sek_add_css_rules_for_section_width( $rules, $section ) {
4007
  }
4008
 
4009
  ?><?php
 
4010
  function sek_get_module_params_for_sek_level_anchor_module() {
4011
  return array(
4012
  'dynamic_registration' => true,
4013
  'module_type' => 'sek_level_anchor_module',
4014
  'name' => __('Set a custom anchor', 'nimble-builder'),
 
 
4015
  'tmpl' => array(
4016
  'item-inputs' => array(
4017
  'custom_anchor' => array(
@@ -4034,11 +5479,14 @@ function sek_get_module_params_for_sek_level_anchor_module() {
4034
  }
4035
 
4036
  ?><?php
 
4037
  function sek_get_module_params_for_sek_level_visibility_module() {
4038
  return array(
4039
  'dynamic_registration' => true,
4040
  'module_type' => 'sek_level_visibility_module',
4041
  'name' => __('Set visibility on devices', 'nimble-builder'),
 
 
4042
  'tmpl' => array(
4043
  'item-inputs' => array(
4044
  'desktops' => array(
@@ -4075,12 +5523,15 @@ function sek_get_module_params_for_sek_level_visibility_module() {
4075
  }
4076
 
4077
  ?><?php
 
4078
  function sek_get_module_params_for_sek_level_breakpoint_module() {
4079
  $global_custom_breakpoint = sek_get_global_custom_breakpoint();
4080
  return array(
4081
  'dynamic_registration' => true,
4082
  'module_type' => 'sek_level_breakpoint_module',
4083
  'name' => __('Set a custom breakpoint', 'nimble-builder'),
 
 
4084
  'tmpl' => array(
4085
  'item-inputs' => array(
4086
  'use-custom-breakpoint' => array(
@@ -4101,6 +5552,7 @@ function sek_get_module_params_for_sek_level_breakpoint_module() {
4101
  'step' => 1,
4102
  'refresh_markup' => true,
4103
  'refresh_stylesheet' => true,
 
4104
  'width-100' => true,
4105
  'title_width' => 'width-100',
4106
  'notice_after' => __( 'This is the breakpoint under which columns are reorganized vertically. The default breakpoint is 768px.', 'nimble-builder')
@@ -4138,6 +5590,8 @@ function sek_add_css_rules_for_sections_breakpoint( $rules, $section ) {
4138
  'mq' => "(min-width: {$custom_breakpoint}px)"
4139
  );
4140
  }
 
 
4141
  if ( isset( $section[ 'options' ] ) && isset( $section[ 'options' ]['breakpoint'] ) && array_key_exists( 'reverse-col-at-breakpoint', $section[ 'options' ]['breakpoint'] ) ) {
4142
  $default_md_breakpoint = '768';
4143
  if ( class_exists('\Nimble\Sek_Dyn_CSS_Builder') ) {
@@ -4157,12 +5611,15 @@ function sek_add_css_rules_for_sections_breakpoint( $rules, $section ) {
4157
  }
4158
 
4159
  ?><?php
 
4160
  function sek_get_module_params_for_sek_local_template() {
4161
  return array(
4162
  'dynamic_registration' => true,
4163
  'module_type' => 'sek_local_template',
4164
  'name' => __('Template for the current page', 'nimble-builder'),
4165
  'starting_value' => array(),
 
 
4166
  'tmpl' => array(
4167
  'item-inputs' => array(
4168
  'local_template' => array(
@@ -4176,17 +5633,25 @@ function sek_get_module_params_for_sek_local_template() {
4176
  ),
4177
  'refresh_preview' => true,
4178
  'notice_before_title' => __('Use the Nimble Builder template to display content created only with the Nimble Builder on this page. Your theme\'s default template will be overriden','nimble-builder')
 
4179
  )
4180
  )
4181
  )//tmpl
4182
  );
4183
  }
4184
  ?><?php
 
4185
  function sek_get_module_params_for_sek_local_widths() {
4186
  return array(
4187
  'dynamic_registration' => true,
4188
  'module_type' => 'sek_local_widths',
4189
  'name' => __('Width settings of the sections in the current page', 'nimble-builder'),
 
 
 
 
 
 
4190
  'tmpl' => array(
4191
  'item-inputs' => array(
4192
  'use-custom-outer-width' => array(
@@ -4242,12 +5707,48 @@ function sek_get_module_params_for_sek_local_widths() {
4242
  )//tmpl
4243
  );
4244
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4245
  add_filter( 'nimble_get_dynamic_stylesheet', '\Nimble\sek_add_raw_local_widths_css', 10, 2 );
 
 
 
4246
  function sek_add_raw_local_widths_css( $css, $is_global_stylesheet ) {
 
4247
  if ( $is_global_stylesheet )
4248
  return $css;
4249
 
4250
  $css = is_string( $css ) ? $css : '';
 
 
4251
  $local_options = sek_get_skoped_seks( !empty( $_POST['local_skope_id'] ) ? $_POST['local_skope_id'] : skp_build_skope_id() );
4252
 
4253
  if ( ! is_array( $local_options ) || empty( $local_options['local_options']) || empty( $local_options['local_options']['widths'] ) )
@@ -4264,10 +5765,15 @@ function sek_add_raw_local_widths_css( $css, $is_global_stylesheet ) {
4264
  }
4265
 
4266
  $rules = array();
 
 
 
4267
  foreach ( $user_defined_widths as $width_opt_name => $selector ) {
4268
  if ( ! empty( $width_options[ $width_opt_name ] ) && ! is_array( $width_options[ $width_opt_name ] ) ) {
4269
  sek_error_log( __FUNCTION__ . ' => error => the width option should be an array( {device} => {number}{unit} )');
4270
  }
 
 
4271
  $user_custom_width_value = ( empty( $width_options[ $width_opt_name ] ) || ! is_array( $width_options[ $width_opt_name ] ) ) ? array('desktop' => '100%') : $width_options[ $width_opt_name ];
4272
  $user_custom_width_value = wp_parse_args( $user_custom_width_value, array(
4273
  'desktop' => '100%',
@@ -4292,6 +5798,9 @@ function sek_add_raw_local_widths_css( $css, $is_global_stylesheet ) {
4292
  'css_property' => 'max-width',
4293
  'selector' => $selector
4294
  ), $rules );
 
 
 
4295
  if ( 'inner-section-width' === $width_opt_name ) {
4296
  $rules = sek_set_mq_css_rules(array(
4297
  'value' => $padding_of_the_parent_container,
@@ -4319,11 +5828,17 @@ function sek_add_raw_local_widths_css( $css, $is_global_stylesheet ) {
4319
  return is_string( $width_options_css ) ? $css . $width_options_css : $css;
4320
  }
4321
  ?><?php
 
4322
  function sek_get_module_params_for_sek_local_custom_css() {
4323
  return array(
4324
  'dynamic_registration' => true,
4325
  'module_type' => 'sek_local_custom_css',
4326
  'name' => __('Custom CSS for the sections of the current page', 'nimble-builder'),
 
 
 
 
 
4327
  'tmpl' => array(
4328
  'item-inputs' => array(
4329
  'local_custom_css' => array(
@@ -4339,10 +5854,19 @@ function sek_get_module_params_for_sek_local_custom_css() {
4339
  )//tmpl
4340
  );
4341
  }
 
 
 
 
 
4342
  add_filter( 'nimble_get_dynamic_stylesheet', '\Nimble\sek_add_raw_local_custom_css', 10, 2 );
 
4343
  function sek_add_raw_local_custom_css( $css, $is_global_stylesheet ) {
 
4344
  if ( $is_global_stylesheet )
4345
  return $css;
 
 
4346
  $local_options = sek_get_skoped_seks( !empty( $_POST['local_skope_id'] ) ? $_POST['local_skope_id'] : skp_build_skope_id() );
4347
  if ( is_array( $local_options ) && !empty( $local_options['local_options']) && ! empty( $local_options['local_options']['custom_css'] ) ) {
4348
  $options = $local_options['local_options']['custom_css'];
@@ -4353,6 +5877,7 @@ function sek_add_raw_local_custom_css( $css, $is_global_stylesheet ) {
4353
  return $css;
4354
  }
4355
  ?><?php
 
4356
  function sek_get_module_params_for_sek_local_reset() {
4357
  return array(
4358
  'dynamic_registration' => true,
@@ -4373,11 +5898,17 @@ function sek_get_module_params_for_sek_local_reset() {
4373
  );
4374
  }
4375
  ?><?php
 
4376
  function sek_get_module_params_for_sek_local_performances() {
4377
  return array(
4378
  'dynamic_registration' => true,
4379
  'module_type' => 'sek_local_performances',
4380
  'name' => __('Performance optimizations', 'nimble-builder'),
 
 
 
 
 
4381
  'tmpl' => array(
4382
  'item-inputs' => array(
4383
  'local-img-smart-load' => array(
@@ -4389,6 +5920,7 @@ function sek_get_module_params_for_sek_local_performances() {
4389
  'yes' => __('Load images on scroll ( optimized )', 'nimble-builder' ),
4390
  'no' => __('Load all images on page load ( not optimized )', 'nimble-builder' )
4391
  ),
 
4392
  'notice_after' => sprintf('%1$s <br/><strong>%2$s</strong>',
4393
  __( 'When you select "Load images on scroll", images below the window are loaded dynamically when scrolling. This can improve performance by reducing the weight of long web pages including multiple images.', 'nimble-builder'),
4394
  __( 'If you use a cache plugin, make sure that this option does not conflict with your caching options.', 'nimble-builder')
@@ -4401,11 +5933,17 @@ function sek_get_module_params_for_sek_local_performances() {
4401
  );
4402
  }
4403
  ?><?php
 
4404
  function sek_get_module_params_for_sek_local_header_footer() {
4405
  return array(
4406
  'dynamic_registration' => true,
4407
  'module_type' => 'sek_local_header_footer',
4408
  'name' => __('Page header', 'nimble-builder'),
 
 
 
 
 
4409
  'tmpl' => array(
4410
  'item-inputs' => array(
4411
  'header-footer' => array(
@@ -4433,11 +5971,17 @@ function sek_get_module_params_for_sek_local_header_footer() {
4433
  );
4434
  }
4435
  ?><?php
 
4436
  function sek_get_module_params_for_sek_local_revisions() {
4437
  return array(
4438
  'dynamic_registration' => true,
4439
  'module_type' => 'sek_local_revisions',
4440
  'name' => __('Revision history', 'nimble-builder'),
 
 
 
 
 
4441
  'tmpl' => array(
4442
  'item-inputs' => array(
4443
  'local_revisions' => array(
@@ -4455,11 +5999,17 @@ function sek_get_module_params_for_sek_local_revisions() {
4455
  );
4456
  }
4457
  ?><?php
 
4458
  function sek_get_module_params_for_sek_local_imp_exp() {
4459
  return array(
4460
  'dynamic_registration' => true,
4461
  'module_type' => 'sek_local_imp_exp',
4462
  'name' => __('Export / Import', 'nimble-builder'),
 
 
 
 
 
4463
  'tmpl' => array(
4464
  'item-inputs' => array(
4465
  'import_export' => array(
@@ -4470,6 +6020,8 @@ function sek_get_module_params_for_sek_local_imp_exp() {
4470
  'refresh_stylesheet' => false,
4471
  'width-100' => true,
4472
  'title_width' => 'width-100',
 
 
4473
  ),
4474
  'keep_existing_sections' => array(
4475
  'input_type' => 'nimblecheck',
@@ -4487,11 +6039,17 @@ function sek_get_module_params_for_sek_local_imp_exp() {
4487
  );
4488
  }
4489
  ?><?php
 
4490
  function sek_get_module_params_for_sek_global_breakpoint() {
4491
  return array(
4492
  'dynamic_registration' => true,
4493
  'module_type' => 'sek_global_breakpoint',
4494
  'name' => __('Site wide breakpoint options', 'nimble-builder'),
 
 
 
 
 
4495
  'tmpl' => array(
4496
  'item-inputs' => array(
4497
  'use-custom-breakpoint' => array(
@@ -4511,6 +6069,7 @@ function sek_get_module_params_for_sek_global_breakpoint() {
4511
  'step' => 1,
4512
  'refresh_markup' => true,
4513
  'refresh_stylesheet' => true,
 
4514
  'width-100' => true,
4515
  'title_width' => 'width-100'
4516
  )//0,
@@ -4523,6 +6082,7 @@ function sek_get_module_params_for_sek_global_breakpoint() {
4523
  add_action('wp_head', '\Nimble\sek_write_global_custom_breakpoint', 1000 );
4524
  function sek_write_global_custom_breakpoint() {
4525
  $css = '';
 
4526
  $custom_breakpoint = sek_get_global_custom_breakpoint();
4527
  if ( $custom_breakpoint >= 1 ) {
4528
  $css .= '@media (min-width:' . $custom_breakpoint . 'px) {.sek-global-custom-breakpoint-col-8 {-ms-flex: 0 0 8.333%;flex: 0 0 8.333%;max-width: 8.333%;}.sek-global-custom-breakpoint-col-9 {-ms-flex: 0 0 9.090909%;flex: 0 0 9.090909%;max-width: 9.090909%;}.sek-global-custom-breakpoint-col-10 {-ms-flex: 0 0 10%;flex: 0 0 10%;max-width: 10%;}.sek-global-custom-breakpoint-col-11 {-ms-flex: 0 0 11.111%;flex: 0 0 11.111%;max-width: 11.111%;}.sek-global-custom-breakpoint-col-12 {-ms-flex: 0 0 12.5%;flex: 0 0 12.5%;max-width: 12.5%;}.sek-global-custom-breakpoint-col-14 {-ms-flex: 0 0 14.285%;flex: 0 0 14.285%;max-width: 14.285%;}.sek-global-custom-breakpoint-col-16 {-ms-flex: 0 0 16.666%;flex: 0 0 16.666%;max-width: 16.666%;}.sek-global-custom-breakpoint-col-20 {-ms-flex: 0 0 20%;flex: 0 0 20%;max-width: 20%;}.sek-global-custom-breakpoint-col-25 {-ms-flex: 0 0 25%;flex: 0 0 25%;max-width: 25%;}.sek-global-custom-breakpoint-col-30 {-ms-flex: 0 0 30%;flex: 0 0 30%;max-width: 30%;}.sek-global-custom-breakpoint-col-33 {-ms-flex: 0 0 33.333%;flex: 0 0 33.333%;max-width: 33.333%;}.sek-global-custom-breakpoint-col-40 {-ms-flex: 0 0 40%;flex: 0 0 40%;max-width: 40%;}.sek-global-custom-breakpoint-col-50 {-ms-flex: 0 0 50%;flex: 0 0 50%;max-width: 50%;}.sek-global-custom-breakpoint-col-60 {-ms-flex: 0 0 60%;flex: 0 0 60%;max-width: 60%;}.sek-global-custom-breakpoint-col-66 {-ms-flex: 0 0 66.666%;flex: 0 0 66.666%;max-width: 66.666%;}.sek-global-custom-breakpoint-col-70 {-ms-flex: 0 0 70%;flex: 0 0 70%;max-width: 70%;}.sek-global-custom-breakpoint-col-75 {-ms-flex: 0 0 75%;flex: 0 0 75%;max-width: 75%;}.sek-global-custom-breakpoint-col-80 {-ms-flex: 0 0 80%;flex: 0 0 80%;max-width: 80%;}.sek-global-custom-breakpoint-col-83 {-ms-flex: 0 0 83.333%;flex: 0 0 83.333%;max-width: 83.333%;}.sek-global-custom-breakpoint-col-90 {-ms-flex: 0 0 90%;flex: 0 0 90%;max-width: 90%;}.sek-global-custom-breakpoint-col-100 {-ms-flex: 0 0 100%;flex: 0 0 100%;max-width: 100%;}}';
@@ -4531,11 +6091,17 @@ function sek_write_global_custom_breakpoint() {
4531
  printf('<style type="text/css" id="nimble-global-breakpoint-options">%1$s</style>', $css );
4532
  }
4533
  ?><?php
 
4534
  function sek_get_module_params_for_sek_global_widths() {
4535
  return array(
4536
  'dynamic_registration' => true,
4537
  'module_type' => 'sek_global_widths',
4538
  'name' => __('Site wide width options', 'nimble-builder'),
 
 
 
 
 
4539
  'tmpl' => array(
4540
  'item-inputs' => array(
4541
  'use-custom-outer-width' => array(
@@ -4587,6 +6153,36 @@ function sek_get_module_params_for_sek_global_widths() {
4587
  )//tmpl
4588
  );
4589
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4590
  add_action('wp_head', '\Nimble\sek_write_global_custom_section_widths', 1000 );
4591
  function sek_write_global_custom_section_widths() {
4592
  $global_options = get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
@@ -4605,10 +6201,15 @@ function sek_write_global_custom_section_widths() {
4605
  }
4606
 
4607
  $rules = array();
 
 
 
4608
  foreach ( $user_defined_widths as $width_opt_name => $selector ) {
4609
  if ( ! empty( $width_options[ $width_opt_name ] ) && ! is_array( $width_options[ $width_opt_name ] ) ) {
4610
  sek_error_log( __FUNCTION__ . ' => error => the width option should be an array( {device} => {number}{unit} )');
4611
  }
 
 
4612
  $user_custom_width_value = ( empty( $width_options[ $width_opt_name ] ) || ! is_array( $width_options[ $width_opt_name ] ) ) ? array('desktop' => '100%') : $width_options[ $width_opt_name ];
4613
  $user_custom_width_value = wp_parse_args( $user_custom_width_value, array(
4614
  'desktop' => '100%',
@@ -4633,6 +6234,9 @@ function sek_write_global_custom_section_widths() {
4633
  'css_property' => 'max-width',
4634
  'selector' => $selector
4635
  ), $rules );
 
 
 
4636
  if ( 'inner-section-width' === $width_opt_name ) {
4637
  $rules = sek_set_mq_css_rules(array(
4638
  'value' => $padding_of_the_parent_container,
@@ -4662,6 +6266,7 @@ function sek_write_global_custom_section_widths() {
4662
  }
4663
  }
4664
  ?><?php
 
4665
  function sek_get_module_params_for_sek_global_reset() {
4666
  return array(
4667
  'dynamic_registration' => true,
@@ -4683,11 +6288,17 @@ function sek_get_module_params_for_sek_global_reset() {
4683
  }
4684
 
4685
  ?><?php
 
4686
  function sek_get_module_params_for_sek_global_performances() {
4687
  return array(
4688
  'dynamic_registration' => true,
4689
  'module_type' => 'sek_global_performances',
4690
  'name' => __('Site wide performance options', 'nimble-builder'),
 
 
 
 
 
4691
  'tmpl' => array(
4692
  'item-inputs' => array(
4693
  'global-img-smart-load' => array(
@@ -4707,11 +6318,17 @@ function sek_get_module_params_for_sek_global_performances() {
4707
  }
4708
 
4709
  ?><?php
 
4710
  function sek_get_module_params_for_sek_global_header_footer() {
4711
  return array(
4712
  'dynamic_registration' => true,
4713
  'module_type' => 'sek_global_header_footer',
4714
  'name' => __('Site wide header', 'nimble-builder'),
 
 
 
 
 
4715
  'tmpl' => array(
4716
  'item-inputs' => array(
4717
  'header-footer' => array(
@@ -4722,6 +6339,7 @@ function sek_get_module_params_for_sek_global_header_footer() {
4722
  'theme' => __('Use the active theme\'s header and footer', 'nimble-builder' ),
4723
  'nimble_global' => __('Nimble site wide header and footer ( beta )', 'nimble-builder' )
4724
  ),
 
4725
  'notice_before_title' => sprintf( __( 'The Nimble Builder allows you to build your own header and footer, or to use your theme\'s ones. This option can be overriden in the %1$s.', 'nimble-builder'),
4726
  sprintf( '<a href="#" onclick="%1$s">%2$s</a>',
4727
  "javascript:wp.customize.section('__localOptionsSection', function( _s_ ){_s_.container.find('.accordion-section-title').first().trigger('click');})",
@@ -4737,11 +6355,17 @@ function sek_get_module_params_for_sek_global_header_footer() {
4737
  }
4738
 
4739
  ?><?php
 
4740
  function sek_get_module_params_for_sek_global_recaptcha() {
4741
  return array(
4742
  'dynamic_registration' => true,
4743
  'module_type' => 'sek_global_recaptcha',
4744
  'name' => __('Protect your contact forms with Google reCAPTCHA', 'nimble-builder'),
 
 
 
 
 
4745
  'tmpl' => array(
4746
  'item-inputs' => array(
4747
  'enable' => array(
@@ -4813,11 +6437,17 @@ function sek_get_module_params_for_sek_global_recaptcha() {
4813
  }
4814
 
4815
  ?><?php
 
4816
  function sek_get_module_params_for_sek_global_revisions() {
4817
  return array(
4818
  'dynamic_registration' => true,
4819
  'module_type' => 'sek_global_revisions',
4820
  'name' => __('Revision history', 'nimble-builder'),
 
 
 
 
 
4821
  'tmpl' => array(
4822
  'item-inputs' => array(
4823
  'global_revisions' => array(
@@ -4836,11 +6466,17 @@ function sek_get_module_params_for_sek_global_revisions() {
4836
  }
4837
 
4838
  ?><?php
 
4839
  function sek_get_module_params_for_sek_global_beta_features() {
4840
  return array(
4841
  'dynamic_registration' => true,
4842
  'module_type' => 'sek_global_beta_features',
4843
  'name' => __('Beta features', 'nimble-builder'),
 
 
 
 
 
4844
  'tmpl' => array(
4845
  'item-inputs' => array(
4846
  'beta-enabled' => array(
@@ -4861,6 +6497,7 @@ function sek_get_module_params_for_sek_global_beta_features() {
4861
  /* ------------------------------------------------------------------------- *
4862
  * LOAD AND REGISTER SIMPLE HTML MODULE
4863
  /* ------------------------------------------------------------------------- */
 
4864
 
4865
  function sek_get_module_params_for_czr_simple_html_module() {
4866
  return array(
@@ -4873,6 +6510,7 @@ function sek_get_module_params_for_czr_simple_html_module() {
4873
  'html_content' => array(
4874
  'input_type' => 'code_editor',
4875
  'title' => __( 'HTML Content' , 'nimble-builder' )
 
4876
  )
4877
  )
4878
  ),
@@ -4894,6 +6532,7 @@ function sanitize_callback__czr_simple_html_module( $value ) {
4894
  /* ------------------------------------------------------------------------- *
4895
  * TEXT EDITOR FATHER MODULE
4896
  /* ------------------------------------------------------------------------- */
 
4897
  function sek_get_module_params_for_czr_tiny_mce_editor_module() {
4898
  return array(
4899
  'dynamic_registration' => true,
@@ -4909,7 +6548,11 @@ function sek_get_module_params_for_czr_tiny_mce_editor_module() {
4909
  'content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.'
4910
  )
4911
  ),
 
 
4912
  'css_selectors' => array(
 
 
4913
  '.sek-module-inner',
4914
  'p',
4915
  'a',
@@ -4925,11 +6568,14 @@ function sek_get_module_params_for_czr_tiny_mce_editor_module() {
4925
  /* ------------------------------------------------------------------------- *
4926
  * TEXT EDITOR CONTENT CHILD
4927
  /* ------------------------------------------------------------------------- */
 
4928
  function sek_get_module_params_for_czr_tinymce_child() {
4929
  return array(
4930
  'dynamic_registration' => true,
4931
  'module_type' => 'czr_tinymce_child',
4932
  'name' => __('Content', 'nimble-builder'),
 
 
4933
  'tmpl' => array(
4934
  'item-inputs' => array(
4935
  'content' => array(
@@ -4967,6 +6613,7 @@ function sek_get_module_params_for_czr_tinymce_child() {
4967
  /* ------------------------------------------------------------------------- *
4968
  * LOAD AND REGISTER IMAGE MODULE
4969
  /* ------------------------------------------------------------------------- */
 
4970
  function sek_get_module_params_for_czr_image_module() {
4971
  $css_selectors = '.sek-module-inner img';
4972
  return array(
@@ -4984,6 +6631,8 @@ function sek_get_module_params_for_czr_image_module() {
4984
  'custom_width' => ''
4985
  )
4986
  ),
 
 
4987
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/image_module_tmpl.php",
4988
  'placeholder_icon' => 'short_text'
4989
  );
@@ -5000,6 +6649,19 @@ function sek_get_module_params_for_czr_image_main_settings_child() {
5000
  'dynamic_registration' => true,
5001
  'module_type' => 'czr_image_main_settings_child',
5002
  'name' => __( 'Image main settings', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
5003
  'tmpl' => array(
5004
  'item-inputs' => array(
5005
  'img' => array(
@@ -5082,6 +6744,7 @@ function sek_get_module_params_for_czr_image_main_settings_child() {
5082
  'title' => __('Width', 'nimble-builder'),
5083
  'min' => 1,
5084
  'max' => 100,
 
5085
  'default' => array( 'desktop' => '100%' ),
5086
  'max' => 500,
5087
  'width-100' => true,
@@ -5120,6 +6783,19 @@ function sek_get_module_params_for_czr_image_borders_corners_child() {
5120
  'dynamic_registration' => true,
5121
  'module_type' => 'czr_image_borders_corners_child',
5122
  'name' => __( 'Borders and corners', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
5123
  'tmpl' => array(
5124
  'item-inputs' => array(
5125
  'border-type' => array(
@@ -5174,6 +6850,9 @@ function sek_get_module_params_for_czr_image_borders_corners_child() {
5174
  * SCHEDULE CSS RULES FILTERING
5175
  /* ------------------------------------------------------------------------- */
5176
  add_filter( 'sek_add_css_rules_for_module_type___czr_image_module', '\Nimble\sek_add_css_rules_for_czr_image_module', 10, 2 );
 
 
 
5177
  function sek_add_css_rules_for_czr_image_module( $rules, $complete_modul_model ) {
5178
  if ( empty( $complete_modul_model['value'] ) )
5179
  return $rules;
@@ -5181,6 +6860,8 @@ function sek_add_css_rules_for_czr_image_module( $rules, $complete_modul_model )
5181
  $value = $complete_modul_model['value'];
5182
  $main_settings = $complete_modul_model['value']['main_settings'];
5183
  $borders_corners_settings = $complete_modul_model['value']['borders_corners'];
 
 
5184
  if ( sek_booleanize_checkbox_val( $main_settings['use_custom_width'] ) ) {
5185
  $width = $main_settings[ 'custom_width' ];
5186
  $css_rules = '';
@@ -5190,6 +6871,7 @@ function sek_add_css_rules_for_czr_image_module( $rules, $complete_modul_model )
5190
  $unit = sek_extract_unit( $width );
5191
  $css_rules .= 'width:' . $numeric . $unit . ';';
5192
  }
 
5193
  if ( is_string( $width ) ) {
5194
  $numeric = sek_extract_numeric_value($width);
5195
  if ( ! empty( $numeric ) ) {
@@ -5202,6 +6884,7 @@ function sek_add_css_rules_for_czr_image_module( $rules, $complete_modul_model )
5202
  'tablet' => '',
5203
  'mobile' => ''
5204
  ));
 
5205
  $ready_value = $width;
5206
  foreach ($width as $device => $num_unit ) {
5207
  $numeric = sek_extract_numeric_value( $num_unit );
@@ -5229,9 +6912,13 @@ function sek_add_css_rules_for_czr_image_module( $rules, $complete_modul_model )
5229
  );
5230
  }
5231
  }
 
 
5232
  $border_settings = $borders_corners_settings[ 'borders' ];
5233
  $border_type = $borders_corners_settings[ 'border-type' ];
5234
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
 
 
5235
  if ( $has_border_settings ) {
5236
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
5237
  $rules,
@@ -5247,14 +6934,24 @@ function sek_add_css_rules_for_czr_image_module( $rules, $complete_modul_model )
5247
  /* ------------------------------------------------------------------------- *
5248
  * LOAD AND REGISTER FEATURED PAGES MODULE
5249
  /* ------------------------------------------------------------------------- */
 
5250
  function sek_get_module_params_for_czr_featured_pages_module() {
5251
  return array(
5252
  'dynamic_registration' => true,
5253
  'module_type' => 'czr_featured_pages_module',
5254
  'is_crud' => true,
5255
  'name' => __('Featured Pages', 'nimble-builder'),
 
 
 
 
 
5256
  'tmpl' => array(
5257
  'pre-item' => array(
 
 
 
 
5258
  'img-type' => array(
5259
  'input_type' => 'simpleselect',
5260
  'title' => __('Display an image', 'nimble-builder'),
@@ -5262,6 +6959,17 @@ function sek_get_module_params_for_czr_featured_pages_module() {
5262
  'choices' => sek_get_select_options_for_input_id( 'img-type' )
5263
  ),
5264
  ),
 
 
 
 
 
 
 
 
 
 
 
5265
  'item-inputs' => array(
5266
  'page-id' => array(
5267
  'input_type' => 'content_picker',
@@ -5319,6 +7027,7 @@ function sek_get_module_params_for_czr_featured_pages_module() {
5319
  /* ------------------------------------------------------------------------- *
5320
  * TEXT EDITOR FATHER MODULE
5321
  /* ------------------------------------------------------------------------- */
 
5322
  function sek_get_module_params_for_czr_heading_module() {
5323
  return array(
5324
  'dynamic_registration' => true,
@@ -5336,6 +7045,8 @@ function sek_get_module_params_for_czr_heading_module() {
5336
  )
5337
  ),
5338
  'css_selectors' => array( '.sek-module-inner > .sek-heading' ),
 
 
5339
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/heading_module_tmpl.php",
5340
  'placeholder_icon' => 'short_text'
5341
  );
@@ -5346,11 +7057,14 @@ function sek_get_module_params_for_czr_heading_module() {
5346
  /* ------------------------------------------------------------------------- *
5347
  * TEXT EDITOR CONTENT CHILD
5348
  /* ------------------------------------------------------------------------- */
 
5349
  function sek_get_module_params_for_czr_heading_child() {
5350
  return array(
5351
  'dynamic_registration' => true,
5352
  'module_type' => 'czr_heading_child',
5353
  'name' => __('Content', 'nimble-builder'),
 
 
5354
  'tmpl' => array(
5355
  'item-inputs' => array(
5356
  'heading_text' => array(
@@ -5364,6 +7078,7 @@ function sek_get_module_params_for_czr_heading_child() {
5364
  'default' => '',
5365
  'width-100' => true,
5366
  'refresh_markup' => '.sek-heading [data-sek-input-type="textarea"]'
 
5367
 
5368
  ),
5369
  'heading_tag' => array(
@@ -5424,11 +7139,14 @@ function sek_get_module_params_for_czr_heading_child() {
5424
  /* ------------------------------------------------------------------------- *
5425
  * HEADING SPACING CHILD
5426
  /* ------------------------------------------------------------------------- */
 
5427
  function sek_get_module_params_for_czr_heading_spacing_child() {
5428
  return array(
5429
  'dynamic_registration' => true,
5430
  'module_type' => 'czr_heading_spacing_child',
5431
  'name' => __('Spacing', 'nimble-builder'),
 
 
5432
  'tmpl' => array(
5433
  'item-inputs' => array(
5434
  'spacing_css' => array(
@@ -5440,6 +7158,7 @@ function sek_get_module_params_for_czr_heading_spacing_child() {
5440
  'refresh_markup' => false,
5441
  'refresh_stylesheet' => true,
5442
  'css_identifier' => 'spacing_with_device_switcher',
 
5443
  )
5444
  )
5445
  ),
@@ -5452,13 +7171,19 @@ function sek_get_module_params_for_czr_heading_spacing_child() {
5452
 
5453
  function sanitize_callback__czr_heading_module( $value ) {
5454
  if ( !current_user_can( 'unfiltered_html' ) && array_key_exists('main_settings', $value ) && is_array( $value['main_settings'] ) && array_key_exists('heading_text', $value['main_settings'] ) ) {
 
5455
  if ( function_exists( 'czr_heading_module_kses_text' ) ) {
5456
  $value['main_settings'][ 'heading_text' ] = czr_heading_module_kses_text( $value['main_settings'][ 'heading_text' ] );
5457
  }
5458
  }
5459
  return $value;
 
5460
  }
 
 
 
5461
  function validate_callback__czr_heading_module( $value ) {
 
5462
  return true;
5463
  }
5464
 
@@ -5468,6 +7193,7 @@ function validate_callback__czr_heading_module( $value ) {
5468
  /* ------------------------------------------------------------------------- *
5469
  * LOAD AND REGISTER SPACER MODULE
5470
  /* ------------------------------------------------------------------------- */
 
5471
 
5472
 
5473
  function sek_get_module_params_for_czr_spacer_module() {
@@ -5476,6 +7202,8 @@ function sek_get_module_params_for_czr_spacer_module() {
5476
  'module_type' => 'czr_spacer_module',
5477
  'name' => __('Spacer', 'nimble-builder'),
5478
  'css_selectors' => array( '.sek-module-inner > *' ),
 
 
5479
  'tmpl' => array(
5480
  'item-inputs' => array(
5481
  'height_css' => array(
@@ -5501,6 +7229,7 @@ function sek_get_module_params_for_czr_spacer_module() {
5501
  /* ------------------------------------------------------------------------- *
5502
  * LOAD AND REGISTER DIVIDER MODULE
5503
  /* ------------------------------------------------------------------------- */
 
5504
 
5505
  function sek_get_module_params_for_czr_divider_module() {
5506
  return array(
@@ -5515,6 +7244,7 @@ function sek_get_module_params_for_czr_divider_module() {
5515
  'title' => __('Weight', 'nimble-builder'),
5516
  'min' => 1,
5517
  'max' => 50,
 
5518
  'default' => '1px',
5519
  'width-100' => true,
5520
  'refresh_markup' => false,
@@ -5544,6 +7274,7 @@ function sek_get_module_params_for_czr_divider_module() {
5544
  'title' => __('Width', 'nimble-builder'),
5545
  'min' => 1,
5546
  'max' => 100,
 
5547
  'default' => '100%',
5548
  'width-100' => true,
5549
  'refresh_markup' => false,
@@ -5561,6 +7292,7 @@ function sek_get_module_params_for_czr_divider_module() {
5561
  'refresh_markup' => false,
5562
  'refresh_stylesheet' => true,
5563
  'css_identifier' => 'border_radius'
 
5564
  ),
5565
  'h_alignment_css' => array(
5566
  'input_type' => 'horizAlignmentWithDeviceSwitcher',
@@ -5594,6 +7326,7 @@ function sek_get_module_params_for_czr_divider_module() {
5594
  /* ------------------------------------------------------------------------- *
5595
  * LOAD AND REGISTER ICON MODULE
5596
  /* ------------------------------------------------------------------------- */
 
5597
 
5598
  function sek_get_module_params_for_czr_icon_module() {
5599
  return array(
@@ -5613,12 +7346,16 @@ function sek_get_module_params_for_czr_icon_module() {
5613
  'color_hover' => '#969696'
5614
  )
5615
  ),
 
 
5616
  'css_selectors' => array( '.sek-icon-wrapper' ),//array( '.sek-icon i' ),
5617
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/icon_module_tmpl.php",
5618
  'front_assets' => array(
5619
  'czr-font-awesome' => array(
5620
  'type' => 'css',
 
5621
  'src' => NIMBLE_BASE_URL . '/assets/front/fonts/css/fontawesome-all.min.css'
 
5622
  )
5623
  )
5624
  );
@@ -5636,12 +7373,25 @@ function sek_get_module_params_for_czr_icon_settings_child() {
5636
  'dynamic_registration' => true,
5637
  'module_type' => 'czr_icon_settings_child',
5638
  'name' => __( 'Icon settings', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
5639
  'css_selectors' => array( '.sek-icon-wrapper' ),//array( '.sek-icon i' ),
5640
  'tmpl' => array(
5641
  'item-inputs' => array(
5642
  'icon' => array(
5643
  'input_type' => 'fa_icon_picker',
5644
  'title' => __('Select an Icon', 'nimble-builder'),
 
5645
  ),
5646
  'link-to' => array(
5647
  'input_type' => 'simpleselect',
@@ -5714,6 +7464,7 @@ function sek_get_module_params_for_czr_icon_settings_child() {
5714
  'default' => '#969696',
5715
  'refresh_markup' => false,
5716
  'refresh_stylesheet' => true,
 
5717
  )
5718
  )
5719
  ),
@@ -5736,6 +7487,18 @@ function sek_get_module_params_for_czr_icon_spacing_border_child() {
5736
  'dynamic_registration' => true,
5737
  'module_type' => 'czr_icon_spacing_border_child',
5738
  'name' => __( 'Icon options for background, spacing, border, shadow', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
5739
  'css_selectors' => array( '.sek-icon-wrapper' ),//array( '.sek-icon i' ),
5740
  'tmpl' => array(
5741
  'item-inputs' => array(
@@ -5747,6 +7510,7 @@ function sek_get_module_params_for_czr_icon_spacing_border_child() {
5747
  'refresh_markup' => false,
5748
  'refresh_stylesheet' => true,
5749
  'css_identifier' => 'spacing_with_device_switcher',
 
5750
  ),
5751
  'bg_color_css' => array(
5752
  'input_type' => 'wp_color_alpha',
@@ -5757,6 +7521,7 @@ function sek_get_module_params_for_czr_icon_spacing_border_child() {
5757
  'refresh_markup' => false,
5758
  'refresh_stylesheet' => true,
5759
  'css_identifier' => 'background_color',
 
5760
  ),
5761
  'border-type' => array(
5762
  'input_type' => 'simpleselect',
@@ -5778,6 +7543,7 @@ function sek_get_module_params_for_czr_icon_spacing_border_child() {
5778
  'refresh_stylesheet' => true,
5779
  'width-100' => true,
5780
  'title_width' => 'width-100',
 
5781
  ),
5782
  'border_radius_css' => array(
5783
  'input_type' => 'border_radius',
@@ -5790,6 +7556,7 @@ function sek_get_module_params_for_czr_icon_spacing_border_child() {
5790
  'refresh_markup' => false,
5791
  'refresh_stylesheet' => true,
5792
  'css_identifier' => 'border_radius',
 
5793
  ),
5794
  'use_box_shadow' => array(
5795
  'input_type' => 'nimblecheck',
@@ -5816,6 +7583,9 @@ function sek_get_module_params_for_czr_icon_spacing_border_child() {
5816
  * SCHEDULE CSS RULES FILTERING
5817
  /* ------------------------------------------------------------------------- */
5818
  add_filter( 'sek_add_css_rules_for_module_type___czr_icon_module', '\Nimble\sek_add_css_rules_for_icon_front_module', 10, 2 );
 
 
 
5819
  function sek_add_css_rules_for_icon_front_module( $rules, $complete_modul_model ) {
5820
  if ( empty( $complete_modul_model['value'] ) )
5821
  return $rules;
@@ -5823,10 +7593,13 @@ function sek_add_css_rules_for_icon_front_module( $rules, $complete_modul_model
5823
  $value = $complete_modul_model['value'];
5824
 
5825
  $icon_settings = $value['icon_settings'];
 
 
5826
  $icon_color = $icon_settings['color_css'];
5827
  if ( sek_booleanize_checkbox_val( $icon_settings['use_custom_color_on_hover'] ) ) {
5828
  $color_hover = $icon_settings['color_hover'];
5829
  } else {
 
5830
  if ( 0 === strpos( $icon_color, 'rgba' ) ) {
5831
  list( $rgb, $alpha ) = sek_rgba2rgb_a( $icon_color );
5832
  $color_hover_rgb = sek_lighten_rgb( $rgb, $percent=15, $array = true );
@@ -5842,9 +7615,13 @@ function sek_add_css_rules_for_icon_front_module( $rules, $complete_modul_model
5842
  'css_rules' => 'color:' . $color_hover . ';',
5843
  'mq' =>null
5844
  );
 
 
5845
  $border_settings = $value[ 'spacing_border' ][ 'borders' ];
5846
  $border_type = $value[ 'spacing_border' ][ 'border-type' ];
5847
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
 
 
5848
  if ( $has_border_settings ) {
5849
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
5850
  $rules,
@@ -5860,12 +7637,16 @@ function sek_add_css_rules_for_icon_front_module( $rules, $complete_modul_model
5860
  /* ------------------------------------------------------------------------- *
5861
  * LOAD AND REGISTER MAP MODULE
5862
  /* ------------------------------------------------------------------------- */
 
5863
 
5864
  function sek_get_module_params_for_czr_map_module() {
5865
  return array(
5866
  'dynamic_registration' => true,
5867
  'module_type' => 'czr_map_module',
5868
  'name' => __('Map', 'nimble-builder'),
 
 
 
5869
  'starting_value' => array(
5870
  'address' => 'Nice, France',
5871
  'zoom' => 10,
@@ -5921,6 +7702,7 @@ function sek_get_module_params_for_czr_map_module() {
5921
  /* ------------------------------------------------------------------------- *
5922
  * LOAD AND REGISTER QUOTE MODULE
5923
  /* ------------------------------------------------------------------------- */
 
5924
 
5925
  function sek_get_module_params_for_czr_quote_module() {
5926
  return array(
@@ -5934,6 +7716,7 @@ function sek_get_module_params_for_czr_quote_module() {
5934
  ),
5935
  'name' => __('Quote', 'nimble-builder' ),
5936
  'sanitize_callback' => __NAMESPACE__ . '\sanitize_callback__czr_quote_module',
 
5937
  'starting_value' => array(
5938
  'quote_content' => array(
5939
  'quote_text' => __('Hey, careful, man, there\'s a beverage here!','nimble-builder'),
@@ -5973,6 +7756,8 @@ function sek_get_module_params_for_czr_quote_quote_child() {
5973
  'dynamic_registration' => true,
5974
  'module_type' => 'czr_quote_quote_child',
5975
  'name' => __( 'Quote content', 'nimble-builder' ),
 
 
5976
  'tmpl' => array(
5977
  'item-inputs' => array(
5978
  'quote_text' => array(
@@ -5984,6 +7769,7 @@ function sek_get_module_params_for_czr_quote_quote_child() {
5984
  'title' => __( 'Main quote content', 'nimble-builder' ),
5985
  'default' => '',
5986
  'width-100' => true,
 
5987
  'refresh_markup' => '.sek-quote-content'
5988
  ),
5989
  'quote_font_family_css' => array(
@@ -6095,6 +7881,7 @@ function sek_get_module_params_for_czr_quote_quote_child() {
6095
  'css_selectors' => $quote_font_selectors,
6096
  'width-100' => true,
6097
  ),//0,
 
6098
  'quote___flag_important' => array(
6099
  'input_type' => 'nimblecheck',
6100
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
@@ -6103,6 +7890,9 @@ function sek_get_module_params_for_czr_quote_quote_child() {
6103
  'refresh_stylesheet' => true,
6104
  'title_width' => 'width-80',
6105
  'input_width' => 'width-20',
 
 
 
6106
  'important_input_list' => array(
6107
  'quote_font_family_css',
6108
  'quote_font_size_css',
@@ -6135,6 +7925,8 @@ function sek_get_module_params_for_czr_quote_cite_child() {
6135
  'dynamic_registration' => true,
6136
  'module_type' => 'czr_quote_cite_child',
6137
  'name' => __( 'Cite content', 'nimble-builder' ),
 
 
6138
  'tmpl' => array(
6139
  'item-inputs' => array(
6140
  'cite_text' => array(
@@ -6148,6 +7940,7 @@ function sek_get_module_params_for_czr_quote_cite_child() {
6148
  'title' => __( 'Cite text', 'nimble-builder' ),
6149
  'default' => '',
6150
  'width-100' => true,
 
6151
  ),
6152
  'cite_font_family_css' => array(
6153
  'input_type' => 'font_picker',
@@ -6258,6 +8051,7 @@ function sek_get_module_params_for_czr_quote_cite_child() {
6258
  'css_selectors' => $cite_font_selectors,
6259
  'width-100' => true,
6260
  ),//0,
 
6261
  'cite___flag_important' => array(
6262
  'input_type' => 'nimblecheck',
6263
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
@@ -6266,6 +8060,9 @@ function sek_get_module_params_for_czr_quote_cite_child() {
6266
  'refresh_stylesheet' => true,
6267
  'title_width' => 'width-80',
6268
  'input_width' => 'width-20',
 
 
 
6269
  'important_input_list' => array(
6270
  'cite_font_family_css',
6271
  'cite_font_size_css',
@@ -6303,6 +8100,8 @@ function sek_get_module_params_for_czr_quote_design_child() {
6303
  'dynamic_registration' => true,
6304
  'module_type' => 'czr_quote_design_child',
6305
  'name' => __( 'Design', 'nimble-builder' ),
 
 
6306
  'tmpl' => array(
6307
  'item-inputs' => array(
6308
  'quote_design' => array(
@@ -6373,9 +8172,11 @@ function sek_get_module_params_for_czr_quote_design_child() {
6373
  function sanitize_callback__czr_quote_module( $value ) {
6374
  if ( !current_user_can( 'unfiltered_html' ) ) {
6375
  if ( array_key_exists( 'quote_text', $value ) ) {
 
6376
  $value[ 'quote_text' ] = wp_kses_post( $value[ 'quote_text' ] );
6377
  }
6378
  if ( array_key_exists( 'cite_text', $value ) ) {
 
6379
  $value[ 'cite_text' ] = wp_kses_post( $value[ 'cite_text' ] );
6380
  }
6381
  }
@@ -6387,6 +8188,7 @@ function sanitize_callback__czr_quote_module( $value ) {
6387
  /* ------------------------------------------------------------------------- *
6388
  * LOAD AND REGISTER BUTTON MODULE
6389
  /* ------------------------------------------------------------------------- */
 
6390
 
6391
  function sek_get_module_params_for_czr_button_module() {
6392
  $css_selectors = '.sek-btn';
@@ -6434,6 +8236,8 @@ function sek_get_module_params_for_czr_btn_content_child() {
6434
  'dynamic_registration' => true,
6435
  'module_type' => 'czr_btn_content_child',
6436
  'name' => __( 'Button content', 'nimble-builder' ),
 
 
6437
  'tmpl' => array(
6438
  'item-inputs' => array(
6439
  'button_text' => array(
@@ -6482,6 +8286,7 @@ function sek_get_module_params_for_czr_btn_content_child() {
6482
  'icon' => array(
6483
  'input_type' => 'fa_icon_picker',
6484
  'title' => __( 'Icon next to the button text', 'nimble-builder' ),
 
6485
  ),
6486
  'icon-side' => array(
6487
  'input_type' => 'buttons_choice',
@@ -6506,6 +8311,8 @@ function sek_get_module_params_for_czr_btn_design_child() {
6506
  'dynamic_registration' => true,
6507
  'module_type' => 'czr_btn_design_child',
6508
  'name' => __( 'Button design', 'nimble-builder' ),
 
 
6509
  'tmpl' => array(
6510
  'item-inputs' => array(
6511
  'bg_color_css' => array(
@@ -6516,6 +8323,7 @@ function sek_get_module_params_for_czr_btn_design_child() {
6516
  'refresh_markup' => false,
6517
  'refresh_stylesheet' => true,
6518
  'css_identifier' => 'background_color',
 
6519
  ),
6520
  'use_custom_bg_color_on_hover' => array(
6521
  'input_type' => 'nimblecheck',
@@ -6534,6 +8342,8 @@ function sek_get_module_params_for_czr_btn_design_child() {
6534
  'refresh_markup' => false,
6535
  'refresh_stylesheet' => true,
6536
  'notice_after' => __( 'You can also customize the text color on mouseover in the group of text settings below.', 'nimble-builder')
 
 
6537
  ),
6538
  'border-type' => array(
6539
  'input_type' => 'simpleselect',
@@ -6568,6 +8378,7 @@ function sek_get_module_params_for_czr_btn_design_child() {
6568
  'refresh_markup' => false,
6569
  'refresh_stylesheet' => true,
6570
  'css_identifier' => 'border_radius',
 
6571
  ),
6572
  'h_alignment_css' => array(
6573
  'input_type' => 'horizAlignmentWithDeviceSwitcher',
@@ -6642,15 +8453,21 @@ function sanitize_callback__czr_button_module( $value ) {
6642
  * SCHEDULE CSS RULES FILTERING
6643
  /* ------------------------------------------------------------------------- */
6644
  add_filter( 'sek_add_css_rules_for_module_type___czr_button_module', '\Nimble\sek_add_css_rules_for_button_front_module', 10, 2 );
 
 
 
6645
  function sek_add_css_rules_for_button_front_module( $rules, $complete_modul_model ) {
6646
  if ( empty( $complete_modul_model['value'] ) )
6647
  return $rules;
 
 
6648
  $value = $complete_modul_model['value'];
6649
  $design_settings = $value['design'];
6650
  $bg_color = $design_settings['bg_color_css'];
6651
  if ( sek_booleanize_checkbox_val( $design_settings['use_custom_bg_color_on_hover'] ) ) {
6652
  $bg_color_hover = $design_settings['bg_color_hover'];
6653
  } else {
 
6654
  if ( 0 === strpos( $bg_color, 'rgba' ) ) {
6655
  list( $rgb, $alpha ) = sek_rgba2rgb_a( $bg_color );
6656
  $bg_color_hover_rgb = sek_lighten_rgb( $rgb, $percent=15, $array = true );
@@ -6666,9 +8483,13 @@ function sek_add_css_rules_for_button_front_module( $rules, $complete_modul_mode
6666
  'css_rules' => 'background-color:' . $bg_color_hover . ';',
6667
  'mq' =>null
6668
  );
 
 
6669
  $border_settings = $design_settings[ 'borders' ];
6670
  $border_type = $design_settings[ 'border-type' ];
6671
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
 
 
6672
  if ( $has_border_settings ) {
6673
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
6674
  $rules,
@@ -6685,6 +8506,7 @@ function sek_add_css_rules_for_button_front_module( $rules, $complete_modul_mode
6685
  /* ------------------------------------------------------------------------- *
6686
  * LOAD AND REGISTER SIMPLE FORM MODULES
6687
  /* ------------------------------------------------------------------------- */
 
6688
 
6689
  function sek_get_module_params_for_czr_simple_form_module() {
6690
  $css_selectors = '.sek-btn';
@@ -6701,6 +8523,7 @@ function sek_get_module_params_for_czr_simple_form_module() {
6701
  'form_submission' => 'czr_simple_form_submission_child'
6702
  ),
6703
  'name' => __( 'Simple Form', 'nimble-builder' ),
 
6704
  'starting_value' => array(
6705
  'fields_design' => array(
6706
  'border' => array(
@@ -6752,6 +8575,18 @@ function sek_get_module_params_for_czr_simple_form_fields_child() {
6752
  'dynamic_registration' => true,
6753
  'module_type' => 'czr_simple_form_fields_child',
6754
  'name' => __( 'Form fields and button labels', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
6755
  'css_selectors' => array( '.sek-module-inner' ),
6756
  'tmpl' => array(
6757
  'item-inputs' => array(
@@ -6852,6 +8687,18 @@ function sek_get_module_params_for_czr_simple_form_design_child() {
6852
  'dynamic_registration' => true,
6853
  'module_type' => 'czr_simple_form_design_child',
6854
  'name' => __( 'Form fields design', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
6855
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
6856
  'tmpl' => array(
6857
  'item-inputs' => array(
@@ -6928,6 +8775,18 @@ function sek_get_module_params_for_czr_simple_form_button_child() {
6928
  'dynamic_registration' => true,
6929
  'module_type' => 'czr_simple_form_button_child',
6930
  'name' => __( 'Form button design', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
6931
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
6932
  'tmpl' => array(
6933
  'item-inputs' => array(
@@ -6957,6 +8816,7 @@ function sek_get_module_params_for_czr_simple_form_button_child() {
6957
  'default' => '',
6958
  'refresh_markup' => false,
6959
  'refresh_stylesheet' => true,
 
6960
  'css_selectors'=> $css_selectors
6961
  ),
6962
  'border-type' => array(
@@ -7063,6 +8923,9 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7063
  'dynamic_registration' => true,
7064
  'module_type' => 'czr_simple_form_fonts_child',
7065
  'name' => __( 'Form texts options : fonts, colors, ...', 'nimble-builder' ),
 
 
 
7066
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
7067
  'tmpl' => array(
7068
  'item-inputs' => array(
@@ -7179,6 +9042,7 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7179
  'css_selectors' => $fl_font_selectors,
7180
  'width-100' => true,
7181
  ),//0,
 
7182
  'fl___flag_important' => array(
7183
  'input_type' => 'nimblecheck',
7184
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
@@ -7187,6 +9051,9 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7187
  'refresh_stylesheet' => true,
7188
  'title_width' => 'width-80',
7189
  'input_width' => 'width-20',
 
 
 
7190
  'important_input_list' => array(
7191
  'fl_font_family_css',
7192
  'fl_font_size_css',
@@ -7314,6 +9181,7 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7314
  'css_selectors' => $ft_font_selectors,
7315
  'width-100' => true,
7316
  ),//0,
 
7317
  'ft___flag_important' => array(
7318
  'input_type' => 'nimblecheck',
7319
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
@@ -7322,6 +9190,9 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7322
  'refresh_stylesheet' => true,
7323
  'title_width' => 'width-80',
7324
  'input_width' => 'width-20',
 
 
 
7325
  'important_input_list' => array(
7326
  'ft_font_family_css',
7327
  'ft_font_size_css',
@@ -7449,6 +9320,7 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7449
  'css_selectors' => $btn_font_selectors,
7450
  'width-100' => true,
7451
  ),//0,
 
7452
  'btn___flag_important' => array(
7453
  'input_type' => 'nimblecheck',
7454
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
@@ -7457,6 +9329,9 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7457
  'refresh_stylesheet' => true,
7458
  'title_width' => 'width-80',
7459
  'input_width' => 'width-20',
 
 
 
7460
  'important_input_list' => array(
7461
  'btn_font_family_css',
7462
  'btn_font_size_css',
@@ -7479,6 +9354,11 @@ function sek_get_module_params_for_czr_simple_form_fonts_child() {
7479
  );
7480
  }
7481
 
 
 
 
 
 
7482
 
7483
 
7484
  /* ------------------------------------------------------------------------- *
@@ -7490,6 +9370,18 @@ function sek_get_module_params_for_czr_simple_form_submission_child() {
7490
  'dynamic_registration' => true,
7491
  'module_type' => 'czr_simple_form_submission_child',
7492
  'name' => __( 'Form submission options', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
7493
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
7494
  'tmpl' => array(
7495
  'item-inputs' => array(
@@ -7578,18 +9470,31 @@ function sek_get_module_params_for_czr_simple_form_submission_child() {
7578
  /* ------------------------------------------------------------------------- *
7579
  * SCHEDULE CSS RULES FILTERING FOR THE FORM MODULE
7580
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
 
7581
  add_filter( 'sek_add_css_rules_for_module_type___czr_simple_form_module', '\Nimble\sek_add_css_rules_for_czr_simple_form_module', 10, 2 );
 
 
 
7582
  function sek_add_css_rules_for_czr_simple_form_module( $rules, $complete_modul_model ) {
7583
  if ( empty( $complete_modul_model['value'] ) )
7584
  return $rules;
7585
 
7586
  $value = $complete_modul_model['value'];
 
 
7587
  if ( ! empty( $value['form_button'] ) && is_array( $value['form_button'] ) ) {
7588
  $form_button_options = $value['form_button'];
7589
  $bg_color = $form_button_options['bg_color_css'];
7590
  if ( sek_booleanize_checkbox_val( $form_button_options['use_custom_bg_color_on_hover'] ) ) {
7591
  $bg_color_hover = $form_button_options['bg_color_hover'];
7592
  } else {
 
7593
  if ( 0 === strpos( $bg_color, 'rgba' ) ) {
7594
  list( $rgb, $alpha ) = sek_rgba2rgb_a( $bg_color );
7595
  $bg_color_hover_rgb = sek_lighten_rgb( $rgb, $percent=15, $array = true );
@@ -7606,9 +9511,13 @@ function sek_add_css_rules_for_czr_simple_form_module( $rules, $complete_modul_m
7606
  'css_rules' => 'background-color:' . $bg_color_hover . ';',
7607
  'mq' =>null
7608
  );
 
 
7609
  $border_settings = $form_button_options[ 'borders' ];
7610
  $border_type = $form_button_options[ 'border-type' ];
7611
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
 
 
7612
  if ( $has_border_settings ) {
7613
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
7614
  $rules,
@@ -7618,9 +9527,14 @@ function sek_add_css_rules_for_czr_simple_form_module( $rules, $complete_modul_m
7618
  );
7619
  }
7620
  }
 
 
 
7621
  $border_settings = $value[ 'fields_design' ][ 'borders' ];
7622
  $border_type = $value[ 'fields_design' ][ 'border-type' ];
7623
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
 
 
7624
  if ( $has_border_settings ) {
7625
  $selector_list = array( 'form input[type="text"]', 'input[type="text"]:focus', 'form textarea', 'form textarea:focus' );
7626
  $css_selectors = array();
@@ -7669,6 +9583,18 @@ function sek_get_module_params_for_czr_post_grid_main_child() {
7669
  'dynamic_registration' => true,
7670
  'module_type' => 'czr_post_grid_main_child',
7671
  'name' => __( 'Main grid settings : layout, number of posts, columns,...', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
7672
  'css_selectors' => array( '.sek-module-inner' ),
7673
  'tmpl' => array(
7674
  'item-inputs' => array(
@@ -7696,6 +9622,7 @@ function sek_get_module_params_for_czr_post_grid_main_child() {
7696
  'default' => false,
7697
  'title_width' => 'width-80',
7698
  'input_width' => 'width-20'
 
7699
  ),
7700
  'order_by' => array(
7701
  'input_type' => 'simpleselect',
@@ -7745,6 +9672,7 @@ function sek_get_module_params_for_czr_post_grid_main_child() {
7745
  'default' => false,
7746
  'title_width' => 'width-80',
7747
  'input_width' => 'width-20'
 
7748
  ),
7749
  'has_mobile_breakpoint' => array(
7750
  'input_type' => 'nimblecheck',
@@ -7784,6 +9712,7 @@ function sek_get_module_params_for_czr_post_grid_main_child() {
7784
  'title' => __('Space between text blocks', 'nimble-builder'),
7785
  'min' => 1,
7786
  'max' => 100,
 
7787
  'default' => array( 'desktop' => '15px' ),
7788
  'width-100' => true,
7789
  'refresh_markup' => false,
@@ -7816,6 +9745,7 @@ function sek_get_module_params_for_czr_post_grid_main_child() {
7816
  'title' => __('Content blocks padding', 'nimble-builder'),
7817
  'min' => 1,
7818
  'max' => 100,
 
7819
  'default' => array( 'desktop' => '0px' ),
7820
  'width-100' => true,
7821
  'refresh_markup' => false,
@@ -7869,9 +9799,22 @@ function sek_get_module_params_for_czr_post_grid_thumb_child() {
7869
  'dynamic_registration' => true,
7870
  'module_type' => 'czr_post_grid_thumb_child',
7871
  'name' => __( 'Post thumbnail settings : size, design...', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
7872
  'css_selectors' => array( '.sek-module-inner' ),
7873
  'tmpl' => array(
7874
  'item-inputs' => array(
 
7875
  'show_thumb' => array(
7876
  'input_type' => 'nimblecheck',
7877
  'title' => __('Display post thumbnail', 'nimble-builder'),
@@ -7947,6 +9890,18 @@ function sek_get_module_params_for_czr_post_grid_metas_child() {
7947
  'dynamic_registration' => true,
7948
  'module_type' => 'czr_post_grid_metas_child',
7949
  'name' => __( 'Post metas : author, date, category, tags,...', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
7950
  'css_selectors' => array( '.sek-module-inner' ),
7951
  'tmpl' => array(
7952
  'item-inputs' => array(
@@ -8003,6 +9958,9 @@ function sek_get_module_params_for_czr_post_grid_fonts_child() {
8003
  'dynamic_registration' => true,
8004
  'module_type' => 'czr_post_grid_fonts_child',
8005
  'name' => __( 'Grid text settings : fonts, colors, ...', 'nimble-builder' ),
 
 
 
8006
  'css_selectors' => array( '.sek-module-inner .sek-post-grid-wrapper' ),
8007
  'tmpl' => array(
8008
  'item-inputs' => array(
@@ -8388,6 +10346,9 @@ function sek_get_module_params_for_czr_post_grid_fonts_child() {
8388
  * SCHEDULE CSS RULES FILTERING
8389
  /* ------------------------------------------------------------------------- */
8390
  add_filter( 'sek_add_css_rules_for_module_type___czr_post_grid_module', '\Nimble\sek_add_css_rules_for_czr_post_grid_module', 10, 2 );
 
 
 
8391
  function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_model ) {
8392
  if ( empty( $complete_modul_model['value'] ) )
8393
  return $rules;
@@ -8395,6 +10356,9 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8395
  $value = $complete_modul_model['value'];
8396
  $main_settings = $value['grid_main'];
8397
  $thumb_settings = $value['grid_thumb'];
 
 
 
8398
  $margin_bottom = $main_settings['space_between_el'];
8399
  $margin_bottom = is_array( $margin_bottom ) ? $margin_bottom : array();
8400
  $defaults = array(
@@ -8407,6 +10371,9 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8407
  foreach ($margin_bottom as $device => $num_unit ) {
8408
  $num_val = sek_extract_numeric_value( $num_unit );
8409
  $margin_bottom_ready_val[$device] = '';
 
 
 
8410
  if ( ! empty( $num_unit ) && $num_val.'px' !== $defaults[$device].'' ) {
8411
  $unit = sek_extract_unit( $num_unit );
8412
  $num_val = $num_val < 0 ? 0 : $num_val;
@@ -8423,6 +10390,10 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8423
  )),
8424
  'is_important' => false
8425
  ), $rules );
 
 
 
 
8426
  $content_padding = $main_settings['content_padding'];
8427
  $content_padding = is_array( $content_padding ) ? $content_padding : array();
8428
  $defaults = array(
@@ -8435,6 +10406,9 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8435
  foreach ($content_padding as $device => $num_unit ) {
8436
  $num_val = sek_extract_numeric_value( $num_unit );
8437
  $content_padding_ready_val[$device] = '';
 
 
 
8438
  if ( ! empty( $num_unit ) && $num_val.'px' !== $defaults[$device].'' ) {
8439
  $unit = sek_extract_unit( $num_unit );
8440
  $num_val = $num_val < 0 ? 0 : $num_val;
@@ -8447,6 +10421,13 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8447
  'selector' => '[data-sek-id="'.$complete_modul_model['id'].'"] .sek-post-grid-wrapper .sek-grid-items article .sek-pg-content',
8448
  'is_important' => false
8449
  ), $rules );
 
 
 
 
 
 
 
8450
  if ( 'list' === $main_settings['layout'] && true === sek_booleanize_checkbox_val( $thumb_settings['show_thumb'] ) ) {
8451
  $img_column_width = $main_settings['img_column_width'];
8452
  $img_column_width = is_array( $img_column_width ) ? $img_column_width : array();
@@ -8460,6 +10441,9 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8460
  foreach ($img_column_width as $device => $num_val ) {
8461
  $num_val = sek_extract_numeric_value( $num_val );
8462
  $img_column_width_ready_value[$device] = '';
 
 
 
8463
  if ( ! empty( $num_val ) && $num_val.'%' !== $defaults[$device].'' ) {
8464
  $num_val = $num_val > 100 ? 100 : $num_val;
8465
  $num_val = $num_val < 1 ? 1 : $num_val;
@@ -8474,6 +10458,11 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8474
  'is_important' => false
8475
  ), $rules );
8476
  }
 
 
 
 
 
8477
  if ( true === sek_booleanize_checkbox_val( $thumb_settings['img_has_custom_height'] ) ) {
8478
  $img_height = $thumb_settings['img_height'];
8479
  $img_height = is_array( $img_height ) ? $img_height : array();
@@ -8488,6 +10477,9 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8488
  foreach ( $img_height as $device => $num_val ) {
8489
  $num_val = sek_extract_numeric_value( $num_val );
8490
  $img_height_ready_value[$device] = '';
 
 
 
8491
  if ( ! empty( $num_val ) && $num_val.'%' !== $defaults[$device].'' ) {
8492
  $num_val = $num_val < 1 ? 1 : $num_val;
8493
  $img_height_ready_value[$device] = sprintf('%s;', $num_val .'%');
@@ -8500,7 +10492,11 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8500
  'is_important' => false
8501
  ), $rules );
8502
  }
 
 
 
8503
  if ( true === sek_booleanize_checkbox_val( $main_settings['custom_grid_spaces'] ) ) {
 
8504
  $gap = $main_settings['column_gap'];
8505
  $gap = is_array( $gap ) ? $gap : array();
8506
  $defaults = array(
@@ -8509,16 +10505,23 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8509
  'mobile' => ''
8510
  );
8511
  $gap = wp_parse_args( $gap, $defaults );
 
8512
  $gap_ready_value = $gap;
8513
  foreach ($gap as $device => $num_unit ) {
8514
  $numeric = sek_extract_numeric_value( $num_unit );
8515
  $numeric = $numeric < 0 ? '0' : $numeric;
8516
  $gap_ready_value[$device] = '';
 
 
 
8517
  if ( ! empty( $num_unit ) && $numeric.'px' !== $defaults[$device].'' ) {
8518
  $unit = sek_extract_unit( $num_unit );
8519
  $gap_ready_value[$device] = $numeric . $unit;
8520
  }
8521
  }
 
 
 
8522
  $rules = sek_set_mq_css_rules(array(
8523
  'value' => $gap_ready_value,
8524
  'css_property' => 'grid-column-gap',
@@ -8528,6 +10531,8 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8528
  ] ),
8529
  'is_important' => false
8530
  ), $rules );
 
 
8531
  $v_gap = $main_settings['row_gap'];
8532
  $v_gap = is_array( $v_gap ) ? $v_gap : array();
8533
  $defaults = array(
@@ -8536,11 +10541,15 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8536
  'mobile' => ''
8537
  );
8538
  $v_gap = wp_parse_args( $v_gap, $defaults );
 
8539
  $v_gap_ready_value = $v_gap;
8540
  foreach ($v_gap as $device => $num_unit ) {
8541
  $numeric = sek_extract_numeric_value( $num_unit );
8542
  $numeric = $numeric < 0 ? 0 : $numeric;
8543
  $v_gap_ready_value[$device] = '';
 
 
 
8544
  if ( ! empty( $num_unit ) && $numeric.'px' !== $defaults[$device].'' ) {
8545
  $unit = sek_extract_unit( $num_unit );
8546
  $v_gap_ready_value[$device] = $numeric . $unit;
@@ -8560,6 +10569,7 @@ function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_mod
8560
  /* ------------------------------------------------------------------------- *
8561
  * LOAD AND REGISTER BUTTON MODULE
8562
  /* ------------------------------------------------------------------------- */
 
8563
 
8564
  function sek_get_module_params_for_czr_menu_module() {
8565
  $css_selectors = '.sek-btn';
@@ -8570,6 +10580,7 @@ function sek_get_module_params_for_czr_menu_module() {
8570
  'is_father' => true,
8571
  'children' => array(
8572
  'content' => 'czr_menu_content_child',
 
8573
  'font' => 'czr_font_child',
8574
  'mobile_options' => 'czr_menu_mobile_options'
8575
 
@@ -8577,6 +10588,21 @@ function sek_get_module_params_for_czr_menu_module() {
8577
  'name' => __( 'Menu', 'nimble-builder' ),
8578
  'sanitize_callback' => '\Nimble\sanitize_callback__czr_button_module',
8579
  'starting_value' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8580
  ),
8581
  'css_selectors' => array( '.sek-menu-module > li' ),//<=@see tmpl/modules/menu_module_tmpl.php
8582
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/menu_module_tmpl.php"
@@ -8591,6 +10617,8 @@ function sek_get_module_params_for_czr_menu_content_child() {
8591
  'dynamic_registration' => true,
8592
  'module_type' => 'czr_menu_content_child',
8593
  'name' => __( 'Menu content', 'nimble-builder' ),
 
 
8594
  'tmpl' => array(
8595
  'item-inputs' => array(
8596
  'menu-id' => array(
@@ -8630,6 +10658,8 @@ function sek_get_module_params_for_czr_menu_mobile_options() {
8630
  'dynamic_registration' => true,
8631
  'module_type' => 'czr_menu_mobile_options',
8632
  'name' => __( 'Settings for mobile devices', 'nimble-builder' ),
 
 
8633
  'tmpl' => array(
8634
  'item-inputs' => array(
8635
  'expand_below' => array(
@@ -8653,6 +10683,19 @@ function sek_get_module_params_for_czr_font_child() {
8653
  'dynamic_registration' => true,
8654
  'module_type' => 'czr_font_child',
8655
  'name' => __( 'Text settings : font, color, size, ...', 'nimble-builder' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
8656
  'tmpl' => array(
8657
  'item-inputs' => array(
8658
  'font_family_css' => array(
@@ -8667,6 +10710,9 @@ function sek_get_module_params_for_czr_font_child() {
8667
  'font_size_css' => array(
8668
  'input_type' => 'range_with_unit_picker_device_switcher',
8669
  'title' => __( 'Font size', 'nimble-builder' ),
 
 
 
8670
  'min' => 0,
8671
  'max' => 100,
8672
  'title_width' => 'width-100',
@@ -8754,6 +10800,7 @@ function sek_get_module_params_for_czr_font_child() {
8754
  'css_identifier' => 'letter_spacing',
8755
  'width-100' => true,
8756
  ),//0,
 
8757
  'fonts___flag_important' => array(
8758
  'input_type' => 'nimblecheck',
8759
  'title' => __('Apply the style options in priority (uses !important).', 'nimble-builder'),
@@ -8762,6 +10809,9 @@ function sek_get_module_params_for_czr_font_child() {
8762
  'refresh_stylesheet' => true,
8763
  'title_width' => 'width-80',
8764
  'input_width' => 'width-20',
 
 
 
8765
  'important_input_list' => array(
8766
  'font_family_css',
8767
  'font_size_css',
@@ -8784,12 +10834,16 @@ function sek_get_module_params_for_czr_font_child() {
8784
  /* ------------------------------------------------------------------------- *
8785
  * LOAD AND REGISTER WIDGET ZONE MODULE
8786
  /* ------------------------------------------------------------------------- */
 
8787
 
8788
  function sek_get_module_params_for_czr_widget_area_module() {
8789
  return array(
8790
  'dynamic_registration' => true,
8791
  'module_type' => 'czr_widget_area_module',
8792
  'name' => __('Widget Zone', 'nimble-builder'),
 
 
 
8793
  'tmpl' => array(
8794
  'item-inputs' => array(
8795
  'widget-area-id' => array(
@@ -8845,38 +10899,67 @@ class Sek_Dyn_CSS_Builder {
8845
 
8846
  private $collection;//the collection of css rules
8847
  private $sek_model;
 
8848
  private $is_global_stylesheet;
8849
  private $parent_level_model = array();
8850
 
8851
  public function __construct( $sek_model = array(), $is_global_stylesheet = false ) {
8852
  $this->sek_model = $sek_model;
8853
  $this->is_global_stylesheet = $is_global_stylesheet;
 
8854
  /* ------------------------------------------------------------------------- *
8855
  * SCHEDULE CSS RULES FILTERING
8856
  /* ------------------------------------------------------------------------- */
 
8857
  add_filter( 'sek_add_css_rules_for_level_options', array( $this, 'sek_add_rules_for_column_width' ), 10, 2 );
8858
 
 
 
8859
  $this->sek_css_rules_sniffer_walker();
8860
  }
 
 
 
 
 
 
 
 
8861
  public function sek_css_rules_sniffer_walker( $level = null, $parent_level = array() ) {
8862
  $level = is_null( $level ) ? $this->sek_model : $level;
8863
  $level = is_array( $level ) ? $level : array();
 
 
8864
  if ( ! empty( $parent_level ) ) {
8865
  $this -> parent_level_model = $parent_level;
8866
  }
8867
 
8868
  foreach ( $level as $key => $entry ) {
8869
  $rules = array();
 
 
 
 
 
 
 
 
8870
  if ( is_string( $key ) && 1 < strlen( $key ) ) {
 
8871
  if ( !empty( $parent_level ) && is_array( $parent_level ) && !empty( $parent_level['module_type'] ) ) {
 
 
 
8872
  $module_level_css_selectors = sek_get_registered_module_type_property( $parent_level['module_type'], 'css_selectors' );
8873
 
8874
  $registered_input_list = sek_get_registered_module_input_list( $parent_level['module_type'] );
8875
  if ( 'value' === $key && is_array( $entry ) ) {
8876
  $is_father = sek_get_registered_module_type_property( $parent_level['module_type'], 'is_father' );
8877
  $father_mod_type = $parent_level['module_type'];
 
8878
  if ( $is_father ) {
8879
  $children = sek_get_registered_module_type_property( $father_mod_type, 'children' );
 
8880
  foreach ( $entry as $opt_group_type => $input_candidates ) {
8881
  if ( ! is_array( $children ) ) {
8882
  sek_error_log( 'Father module ' . $father_mod_type . ' has invalid children');
@@ -8887,10 +10970,15 @@ class Sek_Dyn_CSS_Builder {
8887
  continue;
8888
  }
8889
  $child_mod_type = $children[ $opt_group_type ];
 
 
8890
  $child_css_selector = sek_get_registered_module_type_property( $child_mod_type, 'css_selectors' );
8891
  $child_css_selector = empty( $child_css_selector ) ? $module_level_css_selectors : $child_css_selector;
8892
 
8893
  foreach ( $input_candidates as $input_id_candidate => $_input_val ) {
 
 
 
8894
  if ( false !== strpos( $input_id_candidate, '_css') ) {
8895
  if ( is_array( $registered_input_list ) && is_array( $registered_input_list[ $opt_group_type ] )&& ! empty( $registered_input_list[ $opt_group_type ][ $input_id_candidate ] ) && ! empty( $registered_input_list[ $opt_group_type ][ $input_id_candidate ]['css_identifier'] ) ) {
8896
  $rules = apply_filters(
@@ -8911,6 +10999,9 @@ class Sek_Dyn_CSS_Builder {
8911
  }//foreach
8912
  } else {
8913
  foreach ( $entry as $input_id_candidate => $_input_val ) {
 
 
 
8914
  if ( false !== strpos( $input_id_candidate, '_css') ) {
8915
  if ( is_array( $registered_input_list ) && ! empty( $registered_input_list[ $input_id_candidate ] ) && ! empty( $registered_input_list[ $input_id_candidate ]['css_identifier'] ) ) {
8916
  $rules = apply_filters(
@@ -8932,20 +11023,34 @@ class Sek_Dyn_CSS_Builder {
8932
  }//if
8933
  }//if
8934
  }//if
 
 
 
8935
  if ( is_array( $entry ) ) {
 
 
8936
  if ( !empty( $entry[ 'level' ] ) && 'location' != $entry[ 'level' ] ) {
8937
  $level_type = $entry[ 'level' ];
8938
  $rules = apply_filters( "sek_add_css_rules_for__{$level_type}__options", $rules, $entry );
 
8939
  $rules = apply_filters( 'sek_add_css_rules_for_level_options', $rules, $entry );
8940
  }
 
 
8941
  if ( !empty( $entry[ 'level' ] ) && 'module' === $entry['level'] ) {
8942
  if ( ! empty( $entry['module_type'] ) ) {
8943
  $module_type = $entry['module_type'];
 
 
8944
  $rules = apply_filters( "sek_add_css_rules_for_module_type___{$module_type}", $rules, sek_normalize_module_value_with_defaults( $entry ) );
8945
  }
8946
  }
8947
  } // if ( is_array( $entry ) ) {
 
 
 
8948
  if ( !empty( $rules ) ) {
 
8949
  foreach( $rules as $rule ) {
8950
  if ( ! is_array( $rule ) ) {
8951
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => a css rule should be represented by an array', $rule );
@@ -8962,24 +11067,41 @@ class Sek_Dyn_CSS_Builder {
8962
  );
8963
  }//foreach
8964
  }
 
 
 
8965
  if ( is_array( $entry ) ) {
 
8966
  if ( !empty( $entry['level'] ) && in_array( $entry['level'], array( 'location', 'section', 'column', 'module' ) ) ) {
8967
  $parent_level = $entry;
8968
  }
 
8969
  $this->sek_css_rules_sniffer_walker( $entry, $parent_level );
8970
  }
 
 
8971
  if ( ! empty( $parent_level ) ) {
8972
  $this -> parent_level_model = $parent_level;
8973
  }
8974
 
8975
  }//foreach
8976
  }//sek_css_rules_sniffer_walker()
 
 
 
 
 
8977
  public function sek_populate( $selector, $css_rules, $mq = '' ) {
8978
  if ( ! is_string( $selector ) )
8979
  return;
8980
  if ( ! is_string( $css_rules ) )
8981
  return;
 
 
 
8982
  $mq_device = 'all_devices';
 
 
8983
  if ( !empty( $mq ) ) {
8984
  if ( false === strpos($mq, 'max') && false === strpos($mq, 'min')) {
8985
  error_log( __FUNCTION__ . ' ' . __CLASS__ . ' => the media queries only accept max-width and min-width rules');
@@ -8987,6 +11109,8 @@ class Sek_Dyn_CSS_Builder {
8987
  $mq_device = $mq;
8988
  }
8989
  }
 
 
8990
  if ( !isset( $this->collection[ $mq_device ] ) ) {
8991
  $this->collection[ $mq_device ] = array();
8992
  }
@@ -8997,6 +11121,10 @@ class Sek_Dyn_CSS_Builder {
8997
 
8998
  $this->collection[ $mq_device ][ $selector ][] = $css_rules;
8999
  }//sek_populate
 
 
 
 
9000
  public static function sek_maybe_wrap_in_media_query( $css, $mq_device = 'all_devices' ) {
9001
  if ( 'all_devices' === $mq_device ) {
9002
  return $css;
@@ -9007,6 +11135,11 @@ class Sek_Dyn_CSS_Builder {
9007
  }
9008
  return sprintf( '@media%1$s{%2$s}', $mq_device, $css);
9009
  }
 
 
 
 
 
9010
  public static function user_defined_array_key_sort_fn($a, $b) {
9011
  if ( 'all_devices' === $a ) {
9012
  return -1;
@@ -9019,11 +11152,16 @@ class Sek_Dyn_CSS_Builder {
9019
 
9020
  return $b_int - $a_int;
9021
  }
 
 
9022
  public function get_stylesheet() {
9023
  $css = '';
9024
  $collection = apply_filters( 'nimble_css_rules_collection_before_printing_stylesheet', $this->collection );
9025
  if ( is_array( $collection ) && !empty( $collection ) ) {
 
9026
  uksort( $collection, array( get_called_class(), 'user_defined_array_key_sort_fn' ) );
 
 
9027
  foreach ( $collection as $mq_device => $selectors ) {
9028
  $_css = '';
9029
  foreach ( $selectors as $selector => $css_rules ) {
@@ -9037,12 +11175,24 @@ class Sek_Dyn_CSS_Builder {
9037
  }
9038
  return apply_filters( 'nimble_get_dynamic_stylesheet', $css, $this->is_global_stylesheet );
9039
  }
 
 
 
 
 
 
 
 
 
 
9040
  public static function sek_generate_css_stylesheet_for_a_set_of_rules( $rules ) {
9041
  $rules_collection = array();
9042
  $css = '';
9043
 
9044
  if ( empty( $rules ) || ! is_array( $rules ) )
9045
  return $css;
 
 
9046
  foreach( $rules as $rule ) {
9047
  if ( ! is_array( $rule ) ) {
9048
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => a css rule should be represented by an array', $rule );
@@ -9059,7 +11209,12 @@ class Sek_Dyn_CSS_Builder {
9059
 
9060
  if ( ! is_string( $css_rules ) )
9061
  continue;
 
 
 
9062
  $mq_device = 'all_devices';
 
 
9063
  if ( !empty( $mq ) ) {
9064
  if ( false === strpos($mq, 'max') && false === strpos($mq, 'min')) {
9065
  error_log( __FUNCTION__ . ' ' . __CLASS__ . ' => the media queries only accept max-width and min-width rules');
@@ -9067,6 +11222,8 @@ class Sek_Dyn_CSS_Builder {
9067
  $mq_device = $mq;
9068
  }
9069
  }
 
 
9070
  if ( !isset( $rules_collection[ $mq_device ] ) ) {
9071
  $rules_collection[ $mq_device ] = array();
9072
  }
@@ -9077,8 +11234,15 @@ class Sek_Dyn_CSS_Builder {
9077
 
9078
  $rules_collection[ $mq_device ][ $selector ][] = $css_rules;
9079
  }//foreach
 
 
9080
  if ( is_array( $rules_collection ) && !empty( $rules_collection ) ) {
 
 
 
9081
  uksort( $rules_collection, array( get_called_class(), 'user_defined_array_key_sort_fn' ) );
 
 
9082
  foreach ( $rules_collection as $mq_device => $selectors ) {
9083
  $_css = '';
9084
  foreach ( $selectors as $selector => $css_rules ) {
@@ -9091,8 +11255,18 @@ class Sek_Dyn_CSS_Builder {
9091
  }
9092
  }
9093
 
9094
- return $css;
9095
- }//sek_generate_css_stylesheet_for_a_set_of_rules()
 
 
 
 
 
 
 
 
 
 
9096
  public function sek_add_rules_for_column_width( $rules, $column ) {
9097
  if ( ! is_array( $column ) )
9098
  return $rules;
@@ -9101,11 +11275,19 @@ class Sek_Dyn_CSS_Builder {
9101
  return $rules;
9102
 
9103
  $width = empty( $column[ 'width' ] ) || !is_numeric( $column[ 'width' ] ) ? '' : $column['width'];
 
 
9104
  if ( empty( $width ) )
9105
  return $rules;
 
 
9106
  $breakpoint = self::$breakpoints[ self::COLS_MOBILE_BREAKPOINT ];
 
 
9107
  $global_custom_breakpoint = intval( sek_get_global_custom_breakpoint() );
9108
  $has_global_custom_breakpoint = $global_custom_breakpoint >= 1;
 
 
9109
  $parent_section = sek_get_parent_level_model( $column['id'] );
9110
  if ( 'no_match' === $parent_section ) {
9111
  sek_error_log( __FUNCTION__ . ' => $parent_section not found for column id : ' . $column['id'] );
@@ -9119,6 +11301,9 @@ class Sek_Dyn_CSS_Builder {
9119
  } else if ( $has_global_custom_breakpoint ) {
9120
  $breakpoint = $global_custom_breakpoint;
9121
  }
 
 
 
9122
  $rules[] = array(
9123
  'selector' => sprintf( '[data-sek-id="%1$s"] .sek-sektion-inner > .sek-column[data-sek-id="%2$s"]', $parent_section['id'], $column['id'] ),
9124
  'css_rules' => sprintf( '-ms-flex: 0 0 %1$s%%;flex: 0 0 %1$s%%;max-width: %1$s%%', $width ),
@@ -9184,6 +11369,8 @@ class Sek_Dyn_CSS_Handler {
9184
  * @var string
9185
  */
9186
  private $skope_id;
 
 
9187
  private $is_global_stylesheet;
9188
 
9189
  /**
@@ -9381,6 +11568,7 @@ class Sek_Dyn_CSS_Handler {
9381
  $defaults = array(
9382
  'id' => 'sek-'.rand(),
9383
  'skope_id' => '',
 
9384
  'is_global_stylesheet' => false,
9385
  'mode' => self::MODE_FILE,
9386
  'css_string_to_enqueue_or_print' => $this->css_string_to_enqueue_or_print,
@@ -9394,8 +11582,12 @@ class Sek_Dyn_CSS_Handler {
9394
 
9395
 
9396
  $args = wp_parse_args( $args, $defaults );
 
 
9397
  $args[ 'dep' ] = is_array( $args[ 'dep' ] ) ? $args[ 'dep' ] : array();
9398
  $args[ 'priority'] = is_numeric( $args[ 'priority' ] ) ? $args[ 'priority' ] : $this->priority;
 
 
9399
  foreach ( $args as $key => $value ) {
9400
  if ( property_exists( $this, $key ) && array_key_exists( $key, $defaults) ) {
9401
  $this->$key = $value;
@@ -9406,18 +11598,43 @@ class Sek_Dyn_CSS_Handler {
9406
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ .' => __construct => skope_id not provided' );
9407
  return;
9408
  }
 
 
9409
  $this->_sek_dyn_css_set_properties();
 
 
 
 
 
 
 
 
 
 
 
 
9410
  if ( is_customize_preview() || ! $this->_sek_dyn_css_file_exists() || $this->force_rewrite || $this->customizer_save ) {
9411
  $this->sek_model = sek_get_skoped_seks( $this -> skope_id );
 
 
 
9412
  if ( !is_customize_preview() && !$this->_sek_dyn_css_file_exists() ) {
9413
  $this->hook = 'wp_head';
9414
  }
 
 
9415
  $this->builder = new Sek_Dyn_CSS_Builder( $this->sek_model, $this->is_global_stylesheet );
 
 
9416
  $this->css_string_to_enqueue_or_print = (string)$this->builder-> get_stylesheet();
9417
  }
 
 
 
9418
  if ( ! $this->customizer_save ) {
9419
  $this->_schedule_css_and_fonts_enqueuing_or_printing_maybe_on_custom_hook();
9420
  } else {
 
9421
  if ( $this->css_string_to_enqueue_or_print ) {
9422
  $this->sek_dyn_css_maybe_write_css_file();
9423
  } else {
@@ -9470,6 +11687,7 @@ class Sek_Dyn_CSS_Handler {
9470
  * @return string
9471
  */
9472
  private function _ssl_maybe_fix_url($url) {
 
9473
  if ( is_ssl() && is_string($url) && stripos($url, 'http://') === 0 ) {
9474
  $url = 'https' . substr($url, 4);
9475
  }
@@ -9490,6 +11708,7 @@ class Sek_Dyn_CSS_Handler {
9490
  if ( $this->hook ) {
9491
  add_action( $this->hook, array( $this, 'sek_dyn_css_enqueue_or_print_and_google_fonts_print' ), $this->priority );
9492
  } else {
 
9493
  $this->sek_dyn_css_enqueue_or_print_and_google_fonts_print();
9494
  }
9495
  }
@@ -9509,22 +11728,33 @@ class Sek_Dyn_CSS_Handler {
9509
  * @return void()
9510
  */
9511
  public function sek_dyn_css_enqueue_or_print_and_google_fonts_print() {
 
 
 
9512
  if ( self::MODE_FILE == $this->mode ) {
 
 
 
9513
  if ( $this->css_string_to_enqueue_or_print ) {
9514
  if ( $this->force_rewrite || ( !$this->file_exists && $this->force_write ) ) {
9515
  $this->file_exists = $this->sek_dyn_css_maybe_write_css_file();
9516
  }
9517
  }
 
 
9518
  if ( $this->file_exists ) {
 
9519
  if ( in_array( current_filter(), array( 'wp_footer', 'wp_head' ) ) ) {
9520
  /*
9521
  * TODO: make sure all the deps are enqueued
9522
  */
9523
  printf( '<link rel="stylesheet" id="sek-dyn-%1$s-css" href="%2$s" type="text/css" media="all" />',
9524
  $this->id,
 
9525
  add_query_arg( array( 'ver' => filemtime($this->uri) ), $this->url )
9526
  );
9527
  } else {
 
9528
  wp_enqueue_style( "sek-dyn-{$this->id}", $this->url, $this->dep, filemtime($this->uri) );
9529
  }
9530
 
@@ -9532,18 +11762,26 @@ class Sek_Dyn_CSS_Handler {
9532
  }
9533
 
9534
  }// if ( self::MODE_FILE )
 
 
 
 
9535
  if ( $this->css_string_to_enqueue_or_print && ! $this->enqueued_or_printed ) {
9536
  $dep = array_pop( $this->dep );
9537
 
9538
  if ( !$dep || wp_style_is( $dep, 'done' ) || !wp_style_is( $dep, 'done' ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
9539
  printf( '<style id="sek-%1$s" type="text/css" media="all">%2$s</style>', $this->id, $this->css_string_to_enqueue_or_print );
9540
  } else {
 
9541
  wp_add_inline_style( $dep , $this->css_string_to_enqueue_or_print );
9542
  }
9543
 
9544
  $this->mode = self::MODE_INLINE;
9545
  $this->enqueued_or_printed = true;
9546
  }
 
 
 
9547
  $print_candidates = $this->sek_get_gfont_print_candidates();
9548
  if ( !empty( $print_candidates ) ) {
9549
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
@@ -9563,6 +11801,10 @@ class Sek_Dyn_CSS_Handler {
9563
  }
9564
  }
9565
  }
 
 
 
 
9566
  function sek_gfont_print( $print_candidates ) {
9567
  if ( ! empty( $print_candidates ) ) {
9568
  printf('<link rel="stylesheet" id="sek-gfonts-%1$s" href="%2$s">',
@@ -9571,7 +11813,10 @@ class Sek_Dyn_CSS_Handler {
9571
  );
9572
  }
9573
  }
 
 
9574
  private function sek_get_gfont_print_candidates() {
 
9575
  $sektions = 'no_set' === $this->sek_model ? sek_get_skoped_seks( $this -> skope_id ) : $this->sek_model;
9576
  $print_candidates = '';
9577
 
@@ -9601,6 +11846,8 @@ class Sek_Dyn_CSS_Handler {
9601
  $error = false;
9602
 
9603
  $base_uri = $this->base_uri;
 
 
9604
  if ( ! $wp_filesystem->is_dir( $base_uri ) ) {
9605
  $error = !wp_mkdir_p( $base_uri );
9606
  }
@@ -9610,6 +11857,7 @@ class Sek_Dyn_CSS_Handler {
9610
  }
9611
 
9612
  if ( ! file_exists( $index_path = wp_normalize_path( trailingslashit( $base_uri ) . 'index.php' ) ) ) {
 
9613
  $wp_filesystem->put_contents( $index_path, "<?php\n// Silence is golden.\n", FS_CHMOD_FILE );
9614
  }
9615
 
@@ -9617,11 +11865,16 @@ class Sek_Dyn_CSS_Handler {
9617
  if ( ! wp_is_writable( $base_uri ) ) {
9618
  return false;
9619
  }
 
 
9620
  $this->file_exists = $wp_filesystem->put_contents(
9621
  $this->uri,
9622
  $this->css_string_to_enqueue_or_print,
 
9623
  FS_CHMOD_FILE
9624
  );
 
 
9625
  return $this->file_exists;
9626
  }
9627
 
@@ -9661,6 +11914,7 @@ class Sek_Dyn_CSS_Handler {
9661
  */
9662
  private function _sek_dyn_css_file_exists() {
9663
  global $wp_filesystem;
 
9664
  if ( $wp_filesystem->exists( $this->uri ) ) {
9665
  $file_content = $wp_filesystem->get_contents( $this->uri );
9666
  return $wp_filesystem->is_readable( $this->uri ) && !empty( $file_content );
@@ -9717,6 +11971,7 @@ class Sek_Dyn_CSS_Handler {
9717
  * @return string The absolute CSS base directory URI
9718
  */
9719
  private function _sek_dyn_css_build_base_uri() {
 
9720
  $upload_dir = wp_get_upload_dir();
9721
 
9722
  $relative_base_path = isset( $this->relative_base_path ) ? $this->relative_base_path : $this->_sek_dyn_css_build_relative_base_path();
@@ -9735,6 +11990,7 @@ class Sek_Dyn_CSS_Handler {
9735
  * @return string The absolute CSS base directory URL
9736
  */
9737
  private function _sek_dyn_css_build_base_url() {
 
9738
  $upload_dir = wp_get_upload_dir();
9739
 
9740
  $relative_base_path = isset( $this->relative_base_path ) ? $this->relative_base_path : $this->_sek_dyn_css_build_relative_base_path();
@@ -9776,8 +12032,11 @@ class Sek_Dyn_CSS_Handler {
9776
  *
9777
  * @return bool Whether or not we have filesystem credentials
9778
  */
 
9779
  private function _sek_dyn_css_write_file_is_possible() {
9780
  $upload_dir = wp_get_upload_dir();
 
 
9781
  if ( 'direct' === get_filesystem_method( array(), $upload_dir['basedir'] ) ) {
9782
  $creds = request_filesystem_credentials( '', '', false, false, array() );
9783
 
@@ -9802,6 +12061,8 @@ class Sek_Dyn_CSS_Handler {
9802
  */
9803
  private function _sek_dyn_css_require_wp_filesystem() {
9804
  global $wp_filesystem;
 
 
9805
  if ( empty( $wp_filesystem ) ) {
9806
  require_once( ABSPATH . '/wp-admin/includes/file.php' );
9807
  WP_Filesystem();
@@ -9811,6 +12072,10 @@ class Sek_Dyn_CSS_Handler {
9811
  }
9812
 
9813
  ?><?php
 
 
 
 
9814
  add_filter( "sek_add_css_rules_for_input_id", '\Nimble\sek_add_css_rules_for_css_sniffed_input_id', 10, 6 );
9815
  function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id, $registered_input_list, $parent_level, $module_level_css_selectors ) {
9816
 
@@ -9830,6 +12095,9 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
9830
 
9831
  $selector = '[data-sek-id="'.$parent_level['id'].'"]';
9832
  $css_identifier = $input_registration_params['css_identifier'];
 
 
 
9833
  if ( !is_null( $module_level_css_selectors ) && !empty( $module_level_css_selectors ) ) {
9834
  if ( is_array( $module_level_css_selectors ) ) {
9835
  $new_selectors = array();
@@ -9842,16 +12110,24 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
9842
  $selector .= ' ' . $module_level_css_selectors;
9843
  }
9844
  }
 
 
9845
  else if ( 'module' === $parent_level['level'] ) {
9846
  $selector .= ' .sek-module-inner';
9847
  }
 
 
 
 
9848
  if ( 'module' === $parent_level['level'] ) {
 
9849
  if ( ! is_array( $registered_input_list ) || empty( $registered_input_list ) ) {
9850
  sek_error_log( __FUNCTION__ . ' => missing input list' );
9851
  } else if ( is_array( $registered_input_list ) && empty( $registered_input_list[ $input_id ] ) ) {
9852
  sek_error_log( __FUNCTION__ . ' => missing input id ' . $input_id . ' in input list for module type ' . $parent_level['module_type'] );
9853
  }
9854
  if ( is_array( $registered_input_list ) && ! empty( $registered_input_list[ $input_id ] ) && ! empty( $registered_input_list[ $input_id ]['css_selectors'] ) ) {
 
9855
  $selector = '[data-sek-id="'.$parent_level['id'].'"]';
9856
  $input_level_css_selectors = $registered_input_list[ $input_id ]['css_selectors'];
9857
  $new_selectors = array();
@@ -9865,7 +12141,14 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
9865
 
9866
  $new_selectors = implode(',', $new_selectors );
9867
  $selector = $new_selectors;
 
9868
  }
 
 
 
 
 
 
9869
  }
9870
 
9871
 
@@ -9873,6 +12156,9 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
9873
  $properties_to_render = array();
9874
 
9875
  switch ( $css_identifier ) {
 
 
 
9876
  case 'font_size' :
9877
  if ( is_string( $value ) ) { // <= simple
9878
  $numeric = sek_extract_numeric_value($value);
@@ -9919,6 +12205,8 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
9919
  $properties_to_render['color'] = $value;
9920
  break;
9921
  case 'color_hover' :
 
 
9922
  $new_selectors = array();
9923
  $exploded = explode(',', $selector);
9924
  foreach ( $exploded as $sel ) {
@@ -9936,6 +12224,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
9936
  if ( 'module' === $parent_level['level'] && !empty( $parent_level['value'] ) ) {
9937
  $important = sek_is_flagged_important( $input_id, $parent_level['value'], $registered_input_list );
9938
  }
 
9939
  $flex_ready_value = array();
9940
  foreach( $value as $device => $val ) {
9941
  switch ( $val ) {
@@ -9967,6 +12256,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
9967
  'is_important' => $important,
9968
  ), $rules );
9969
  break;
 
9970
  case 'h_alignment' :
9971
  if ( is_string( $value ) ) {// <= simple
9972
  $properties_to_render['text-align'] = $value;
@@ -10007,9 +12297,14 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10007
  break;
10008
  case 'font_family' :
10009
  $family = $value;
 
 
 
 
10010
  if ( false != strstr( $value, '[gfont]') ) {
10011
  $split = explode(":", $family);
10012
  $family = $split[0];
 
10013
  $properties_to_render['font-weight'] = $split[1] ? preg_replace('/\D/', '', $split[1]) : '';
10014
  $properties_to_render['font-weight'] = empty($properties_to_render['font-weight']) ? 400 : $properties_to_render['font-weight'];
10015
  $properties_to_render['font-style'] = ( $split[1] && strstr($split[1], 'italic') ) ? 'italic' : 'normal';
@@ -10020,6 +12315,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10020
  break;
10021
 
10022
  /* Spacer */
 
10023
  case 'height' :
10024
  if ( is_string( $value ) ) { // <= simple
10025
  $numeric = sek_extract_numeric_value($value);
@@ -10038,6 +12334,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10038
  'tablet' => '',
10039
  'mobile' => ''
10040
  ));
 
10041
  $ready_value = $value;
10042
  foreach ($value as $device => $num_unit ) {
10043
  $numeric = sek_extract_numeric_value( $num_unit );
@@ -10074,6 +12371,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10074
  $unit = sek_extract_unit( $value );
10075
  $unit = '%' === $unit ? 'vh' : $unit;
10076
  $properties_to_render['border-top-width'] = $numeric . $unit;
 
10077
  }
10078
  break;
10079
  case 'border_top_style' :
@@ -10111,6 +12409,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10111
  'tablet' => '',
10112
  'mobile' => ''
10113
  ));
 
10114
  $ready_value = $value;
10115
  foreach ($value as $device => $num_unit ) {
10116
  $numeric = sek_extract_numeric_value( $num_unit );
@@ -10150,6 +12449,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10150
  'tablet' => '',
10151
  'mobile' => ''
10152
  ));
 
10153
  $ready_value = $value;
10154
  foreach ($value as $device => $num_unit ) {
10155
  $numeric = sek_extract_numeric_value( $num_unit );
@@ -10174,6 +12474,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10174
  ), $rules );
10175
  }
10176
  break;
 
10177
  case 'h_alignment_block' :
10178
  switch ( $value ) {
10179
  case 'right' :
@@ -10196,6 +12497,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10196
  case 'padding_margin_spacing' :
10197
  $default_unit = 'px';
10198
  $rules_candidates = $value;
 
10199
  $unit = !empty( $rules_candidates['unit'] ) ? $rules_candidates['unit'] : $default_unit;
10200
  $unit = 'percent' == $unit ? '%' : $unit;
10201
 
@@ -10210,6 +12512,7 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10210
 
10211
  array_walk( $properties_to_render,
10212
  function( &$val, $key, $unit ) {
 
10213
  if ( FALSE !== strpos( 'padding', $key ) ) {
10214
  $val = abs( $val );
10215
  }
@@ -10222,10 +12525,16 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10222
  $rules = sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $value, $selector );
10223
  }
10224
  break;
 
 
10225
  default :
10226
  sek_error_log( __FUNCTION__ . ' => the css_identifier : ' . $css_identifier . ' has no css rules defined for input id ' . $input_id );
10227
  break;
10228
  }//switch
 
 
 
 
10229
  if ( ! empty( $properties_to_render ) ) {
10230
  $important = false;
10231
  if ( 'module' === $parent_level['level'] && !empty( $parent_level['value'] ) ) {
@@ -10244,6 +12553,37 @@ function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id,
10244
  }
10245
  return $rules;
10246
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10247
  function sek_is_flagged_important( $input_id, $module_value, $registered_input_list ) {
10248
  $important = false;
10249
 
@@ -10251,6 +12591,8 @@ function sek_is_flagged_important( $input_id, $module_value, $registered_input_l
10251
  sek_error_log( __FUNCTION__ . ' => error => the $registered_input_list param should be an array not empty');
10252
  return $important;
10253
  }
 
 
10254
  foreach ( $registered_input_list as $_id => $input_data ) {
10255
  if ( is_string( $_id ) && false !== strpos( $_id, '_flag_important' ) ) {
10256
  if ( empty( $input_data[ 'important_input_list' ] ) ) {
@@ -10266,6 +12608,8 @@ function sek_is_flagged_important( $input_id, $module_value, $registered_input_l
10266
  return $important;
10267
  }
10268
  ?><?php
 
 
10269
  if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10270
  class SEK_Front_Construct {
10271
  static $instance;
@@ -10283,12 +12627,14 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10283
  'loop_end' => array( 'priority' => 10 ),
10284
  ];
10285
  public $registered_locations = [];
 
10286
  public $default_registered_location_model = [
10287
  'priority' => 10,
10288
  'is_global_location' => false,
10289
  'is_header_location' => false,
10290
  'is_footer_location' => false
10291
  ];
 
10292
  public $default_location_model = [
10293
  'id' => '',
10294
  'level' => 'location',
@@ -10301,10 +12647,14 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10301
  public static function get_instance( $params ) {
10302
  if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Sek_Nimble_Manager ) ) {
10303
  self::$instance = new Sek_Nimble_Manager( $params );
 
 
10304
  do_action( 'nimble_front_classes_ready', self::$instance );
10305
  }
10306
  return self::$instance;
10307
  }
 
 
10308
  public $local_options = '_not_cached_yet_';
10309
  public $global_nimble_options = '_not_cached_yet_';
10310
 
@@ -10315,6 +12665,9 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10315
 
10316
  public $recaptcha_enabled = '_not_cached_yet_';//enabled in the global options
10317
  public $recaptcha_badge_displayed = '_not_cached_yet_';//enabled in the global options
 
 
 
10318
  public static $global_options_map = [
10319
  'global_header_footer' => 'sek_global_header_footer',
10320
  'breakpoint' => 'sek_global_breakpoint',
@@ -10325,6 +12678,8 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10325
  'global_reset' => 'sek_global_reset',
10326
  'beta_features' => 'sek_global_beta_features'
10327
  ];
 
 
10328
  public static $local_options_map = [
10329
  'template' => 'sek_local_template',
10330
  'local_header_footer' => 'sek_local_header_footer',
@@ -10335,17 +12690,25 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10335
  'import_export' => 'sek_local_imp_exp',
10336
  'local_revisions' => 'sek_local_revisions'
10337
  ];
 
 
10338
  public $img_import_errors = [];
 
 
 
10339
  public $contextually_active_modules = [];
10340
 
10341
  public static $ui_picker_modules = [
 
10342
  'sek_content_type_switcher_module',
10343
  'sek_module_picker_module'
10344
  ];
10345
 
10346
  public static $ui_level_modules = [
 
10347
  'sek_level_bg_module',
10348
  'sek_level_border_module',
 
10349
  'sek_level_height_module',
10350
  'sek_level_spacing_module',
10351
  'sek_level_width_module',
@@ -10356,6 +12719,7 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10356
  ];
10357
 
10358
  public static $ui_local_global_options_modules = [
 
10359
  'sek_local_template',
10360
  'sek_local_widths',
10361
  'sek_local_custom_css',
@@ -10364,6 +12728,8 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10364
  'sek_local_header_footer',
10365
  'sek_local_revisions',
10366
  'sek_local_imp_exp',
 
 
10367
  'sek_global_breakpoint',
10368
  'sek_global_widths',
10369
  'sek_global_performances',
@@ -10375,6 +12741,7 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10375
  ];
10376
 
10377
  public static $ui_front_modules = [
 
10378
  'czr_simple_html_module',
10379
 
10380
  'czr_tiny_mce_editor_module' => array(
@@ -10388,6 +12755,8 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10388
  'czr_image_main_settings_child',
10389
  'czr_image_borders_corners_child'
10390
  ),
 
 
10391
  'czr_heading_module' => array(
10392
  'czr_heading_module',
10393
  'czr_heading_child',
@@ -10420,6 +12789,8 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10420
  'czr_btn_design_child',
10421
  'czr_font_child'
10422
  ),
 
 
10423
  'czr_simple_form_module' => array(
10424
  'czr_simple_form_module',
10425
  'czr_simple_form_fields_child',
@@ -10439,6 +12810,7 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10439
  ];
10440
 
10441
  public static $ui_front_beta_modules = [
 
10442
  'czr_menu_module' => array(
10443
  'czr_menu_module',
10444
  'czr_menu_content_child',
@@ -10448,21 +12820,38 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
10448
 
10449
 
10450
  'czr_widget_area_module'
 
10451
  ];
 
 
 
 
10452
  function __construct( $params = array() ) {
 
10453
  $this->registered_locations = $this->default_locations;
 
 
10454
  $this -> _schedule_front_ajax_actions();
10455
  $this -> _schedule_img_import_ajax_actions();
10456
  if ( defined( 'NIMBLE_SAVED_SECTIONS_ENABLED' ) && NIMBLE_SAVED_SECTIONS_ENABLED ) {
10457
  $this -> _schedule_section_saving_ajax_actions();
10458
  }
 
10459
  $this -> _schedule_front_and_preview_assets_printing();
 
10460
  $this -> _schedule_front_rendering();
 
10461
  $this -> _setup_hook_for_front_css_printing_or_enqueuing();
 
10462
  $this -> _setup_simple_forms();
 
10463
  add_action( 'widgets_init', array( $this, 'sek_nimble_widgets_init' ) );
10464
  }//__construct
 
 
10465
  public function sek_nimble_widgets_init() {
 
 
10466
  if ( ! sek_is_header_footer_enabled() )
10467
  return;
10468
  $defaults = array(
@@ -10488,20 +12877,34 @@ endif;
10488
  ?><?php
10489
  if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10490
  class SEK_Front_Ajax extends SEK_Front_Construct {
 
10491
  function _schedule_front_ajax_actions() {
10492
  add_action( 'wp_ajax_sek_get_content', array( $this, 'sek_get_level_content_for_injection' ) );
 
 
10493
  add_action( 'wp_ajax_sek_get_preset_sections', array( $this, 'sek_get_preset_sektions' ) );
 
10494
  add_action( 'wp_ajax_sek_get_revision_history', array( $this, 'sek_get_revision_history' ) );
 
10495
  add_action( 'wp_ajax_sek_get_single_revision', array( $this, 'sek_get_single_revision' ) );
 
 
10496
  add_action( 'wp_ajax_sek_get_post_categories', array( $this, 'sek_get_post_categories' ) );
10497
 
10498
  add_action( 'wp_ajax_sek_postpone_feedback', array( $this, 'sek_postpone_feedback_notification' ) );
 
 
 
10499
  $this -> ajax_action_map = array(
10500
  'sek-add-section',
10501
  'sek-remove-section',
10502
  'sek-duplicate-section',
 
 
10503
  'sek-add-content-in-new-nested-sektion',
10504
  'sek-add-content-in-new-sektion',
 
 
10505
  'sek-add-column',
10506
  'sek-remove-column',
10507
  'sek-duplicate-column',
@@ -10518,6 +12921,10 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10518
  'sek-refresh-level'
10519
  );
10520
  }
 
 
 
 
10521
  function sek_do_ajax_pre_checks( $params = array() ) {
10522
  $params = wp_parse_args( $params, array( 'check_nonce' => true ) );
10523
  if ( $params['check_nonce'] ) {
@@ -10544,21 +12951,44 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10544
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => bad_method' );
10545
  }
10546
  }//sek_do_ajax_pre_checks()
 
 
 
 
 
10547
  function _schedule_img_import_ajax_actions() {
10548
  add_action( 'wp_ajax_sek_import_attachment', array( $this, 'sek_ajax_import_attachment' ) );
10549
  }
 
 
 
 
10550
  function _schedule_section_saving_ajax_actions() {
 
10551
  add_action( 'wp_ajax_sek_save_section', array( $this, 'sek_ajax_save_section' ) );
 
10552
  add_action( 'wp_ajax_sek_get_user_saved_sections', array( $this, 'sek_sek_get_user_saved_sections' ) );
10553
  }
 
 
 
 
 
10554
  function sek_get_preset_sektions() {
10555
  $this->sek_do_ajax_pre_checks();
10556
- $preset_sections = sek_get_preset_sections_api_data();
 
 
 
10557
  if ( empty( $preset_sections ) ) {
10558
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => no preset_sections when running sek_get_preset_sections_api_data()' );
10559
  }
10560
  wp_send_json_success( $preset_sections );
10561
  }
 
 
 
 
10562
  function sek_get_level_content_for_injection( $params ) {
10563
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => false ) );
10564
 
@@ -10572,19 +13002,30 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10572
  $sek_action = $_POST['sek_action'];
10573
 
10574
  $exported_setting_validities = array();
 
 
 
 
10575
  if ( is_customize_preview() ) {
10576
  global $wp_customize;
 
10577
  $setting_validities = $wp_customize->validate_setting_values( $wp_customize->unsanitized_post_values() );
10578
  $raw_exported_setting_validities = array_map( array( $wp_customize, 'prepare_setting_validity_for_js' ), $setting_validities );
 
 
10579
  $exported_setting_validities = array();
10580
  foreach( $raw_exported_setting_validities as $setting_id => $validity ) {
 
10581
  if ( false === strpos( $setting_id , NIMBLE_OPT_PREFIX_FOR_LEVEL_UI ) )
10582
  continue;
10583
  $exported_setting_validities[ $setting_id ] = $validity;
10584
  }
10585
  }
 
 
10586
  if ( in_array( $sek_action, $this -> ajax_action_map ) ) {
10587
  $html = $this -> sek_ajax_fetch_content( $sek_action );
 
10588
  if ( is_wp_error( $html ) ) {
10589
  wp_send_json_error( $html );
10590
  } else {
@@ -10600,7 +13041,26 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10600
 
10601
 
10602
  }//sek_get_content_for_injection()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10603
  private function sek_ajax_fetch_content( $sek_action = '' ) {
 
 
 
 
10604
  $sektionSettingValue = sek_get_skoped_seks( $_POST['location_skope_id'] );
10605
  if ( ! is_array( $sektionSettingValue ) ) {
10606
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => invalid sektionSettingValue => it should be an array().' );
@@ -10624,20 +13084,25 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10624
 
10625
  switch ( $sek_action ) {
10626
  case 'sek-add-section' :
 
10627
  case 'sek-add-content-in-new-sektion' :
10628
  case 'sek-add-content-in-new-nested-sektion' :
10629
  if ( array_key_exists( 'is_nested', $_POST ) && true === json_decode( $_POST['is_nested'] ) ) {
 
10630
  $this -> parent_model = sek_get_level_model( $_POST[ 'in_sektion' ], $sektion_collection );
10631
  $level_model = sek_get_level_model( $_POST[ 'in_column' ], $sektion_collection );
10632
  } else {
10633
  $level_model = sek_get_level_model( $_POST[ 'id' ], $sektion_collection );
10634
  }
10635
  break;
 
 
10636
  case 'sek-remove-section' :
10637
  if ( ! array_key_exists( 'is_nested', $_POST ) || true !== json_decode( $_POST['is_nested'] ) ) {
10638
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' sek-remove-section => the section must be nested in this ajax action' );
10639
  break;
10640
  } else {
 
10641
  $this -> parent_model = sek_get_parent_level_model( $_POST[ 'in_column' ], $sektion_collection );
10642
  $level_model = sek_get_level_model( $_POST[ 'in_column' ], $sektion_collection );
10643
  }
@@ -10645,12 +13110,15 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10645
 
10646
  case 'sek-duplicate-section' :
10647
  if ( array_key_exists( 'is_nested', $_POST ) && true === json_decode( $_POST['is_nested'] ) ) {
 
10648
  $this -> parent_model = sek_get_parent_level_model( $_POST[ 'in_column' ], $sektion_collection );
10649
  $level_model = sek_get_level_model( $_POST[ 'in_column' ], $sektion_collection );
10650
  } else {
10651
  $level_model = sek_get_level_model( $_POST[ 'id' ], $sektion_collection );
10652
  }
10653
  break;
 
 
10654
  case 'sek-add-column' :
10655
  case 'sek-remove-column' :
10656
  case 'sek-duplicate-column' :
@@ -10659,8 +13127,11 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10659
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' ' . $sek_action .' => missing in_sektion param' );
10660
  break;
10661
  }
 
10662
  $level_model = sek_get_level_model( $_POST[ 'in_sektion' ], $sektion_collection );
10663
  break;
 
 
10664
  case 'sek-add-module' :
10665
  case 'sek-remove-module' :
10666
  case 'sek-refresh-modules-in-column' :
@@ -10695,12 +13166,15 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10695
  break;
10696
  }
10697
  if ( !empty( $_POST['level'] ) && 'column' === $_POST['level'] ) {
 
10698
  $this -> parent_model = sek_get_parent_level_model( $_POST['id'], $sektion_collection );
10699
  }
10700
  $level_model = sek_get_level_model( $_POST[ 'id' ], $sektion_collection );
10701
  break;
10702
  }//Switch sek_action
10703
 
 
 
10704
  ob_start();
10705
 
10706
  if ( $is_stylesheet ) {
@@ -10716,18 +13190,35 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10716
  ob_end_clean();
10717
  return;
10718
  }
 
10719
  $r = $this -> render( $level_model );
10720
  }
10721
  $html = ob_get_clean();
10722
  if ( is_wp_error( $r ) ) {
10723
  return $r;
10724
  } else {
 
 
10725
  if ( ! $is_stylesheet && empty( $html ) ) {
 
10726
  $html = new \WP_Error( 'ajax_fetch_content_error', __CLASS__ . '::' . __FUNCTION__ . ' => no content returned for sek_action : ' . $sek_action );
10727
  }
10728
  return apply_filters( "sek_set_ajax_content", $html, $sek_action );// this is sent with wp_send_json_success( apply_filters( 'sek_content_results', $html, $sek_action ) );
10729
  }
10730
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
10731
  function sek_ajax_import_attachment() {
10732
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => false ) );
10733
 
@@ -10745,8 +13236,28 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10745
  ]);
10746
  }
10747
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10748
  function sek_ajax_save_section() {
10749
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
 
 
10750
  if ( empty( $_POST['sek_title']) ) {
10751
  wp_send_json_error( __FUNCTION__ . ' => missing title' );
10752
  }
@@ -10759,6 +13270,8 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10759
  if ( ! is_string( $_POST['sek_data'] ) ) {
10760
  wp_send_json_error( __FUNCTION__ . ' => the sektion data must be a json stringified' );
10761
  }
 
 
10762
  $sektion_to_save = array(
10763
  'title' => $_POST['sek_title'],
10764
  'description' => $_POST['sek_description'],
@@ -10773,11 +13286,19 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10773
  if ( is_wp_error( $saved_section_post ) ) {
10774
  wp_send_json_error( __FUNCTION__ . ' => error when invoking sek_update_saved_seks_post()' );
10775
  } else {
 
10776
  wp_send_json_success( [ 'section_post_id' => $saved_section_post -> ID ] );
10777
  }
 
 
10778
  }
 
 
 
10779
  function sek_sek_get_user_saved_sections() {
10780
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
 
 
10781
  if ( empty( $_POST['preset_section_id']) || ! is_string( $_POST['preset_section_id'] ) ) {
10782
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => missing or invalid preset_section_id' );
10783
  }
@@ -10791,10 +13312,28 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10791
  if ( ! is_array( $all_saved_seks ) || empty( $all_saved_seks[$section_id]) ) {
10792
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => missing section data in get_option( NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS )' );
10793
  }
 
 
 
 
 
 
 
 
 
10794
  $section_infos = $all_saved_seks[$section_id];
10795
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => missing post data for section title ' . $section_infos['title'] );
10796
  }
10797
  }
 
 
 
 
 
 
 
 
 
10798
  function sek_get_revision_history() {
10799
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
10800
 
@@ -10815,6 +13354,12 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10815
  $revision = sek_get_single_post_revision( $_POST['revision_post_id'] );
10816
  wp_send_json_success( $revision );
10817
  }
 
 
 
 
 
 
10818
  function sek_get_post_categories() {
10819
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
10820
  $raw_cats = get_categories();
@@ -10829,6 +13374,15 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10829
  }
10830
  wp_send_json_success( $cat_collection );
10831
  }
 
 
 
 
 
 
 
 
 
10832
  function sek_postpone_feedback_notification() {
10833
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
10834
 
@@ -10840,7 +13394,13 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10840
  set_transient( NIMBLE_FEEDBACK_NOTICE_ID, 'maybe_later', $transient_duration );
10841
  wp_die( 1 );
10842
  }
 
 
 
 
10843
  /*function sek_get_ui_content_for_injection( $params ) {
 
 
10844
  if ( ! is_user_logged_in() ) {
10845
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => unauthenticated' );
10846
  return;
@@ -10871,11 +13431,17 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
10871
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => missing skope_id' );
10872
  return;
10873
  }
 
 
 
 
 
10874
  $sektionSettingValue = sek_get_skoped_seks( $_POST['location_skope_id'] );
10875
  if ( ! is_array( $sektionSettingValue ) || ! array_key_exists( 'collection', $sektionSettingValue ) || ! is_array( $sektionSettingValue['collection'] ) ) {
10876
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => invalid sektionSettingValue' );
10877
  return;
10878
  }
 
10879
  $this -> parent_model = sek_get_parent_level_model( $_POST[ 'id' ], $sektionSettingValue['collection'] );
10880
  $this -> model = sek_get_level_model( $_POST[ 'id' ], $sektionSettingValue['collection'] );
10881
 
@@ -10898,12 +13464,20 @@ endif;
10898
  ?><?php
10899
  if ( ! class_exists( 'SEK_Front_Assets' ) ) :
10900
  class SEK_Front_Assets extends SEK_Front_Ajax {
 
10901
  function _schedule_front_and_preview_assets_printing() {
 
10902
  add_action( 'wp_enqueue_scripts', array( $this, 'sek_enqueue_front_assets' ) );
 
10903
  add_action ( 'customize_preview_init' , array( $this, 'sek_schedule_customize_preview_assets' ) );
10904
  }
 
 
10905
  function sek_enqueue_front_assets() {
10906
  $rtl_suffix = is_rtl() ? '-rtl' : '';
 
 
 
10907
  wp_enqueue_style(
10908
  'sek-base',
10909
  sprintf(
@@ -10915,13 +13489,27 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
10915
  NIMBLE_ASSETS_VERSION,
10916
  'all'
10917
  );
 
 
 
 
 
 
 
 
 
10918
  wp_enqueue_script(
10919
  'sek-main-js',
10920
  sek_is_dev_mode() ? NIMBLE_BASE_URL . '/assets/front/js/ccat-nimble-front.js' : NIMBLE_BASE_URL . '/assets/front/js/ccat-nimble-front.min.js',
 
 
10921
  array( 'jquery'),
10922
  NIMBLE_ASSETS_VERSION,
10923
  true
10924
  );
 
 
 
10925
  if ( ! skp_is_customizing() && sek_front_needs_font_awesome() ) {
10926
  wp_enqueue_style(
10927
  'czr-font-awesome',
@@ -10931,6 +13519,8 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
10931
  $media = 'all'
10932
  );
10933
  }
 
 
10934
  if ( ! skp_is_customizing() && sek_front_needs_magnific_popup() ) {
10935
  wp_enqueue_style(
10936
  'czr-magnific-popup',
@@ -10947,6 +13537,8 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
10947
  true
10948
  );
10949
  }
 
 
10950
  $global_recaptcha_opts = sek_get_global_option_value('recaptcha');
10951
  $global_recaptcha_opts = is_array( $global_recaptcha_opts ) ? $global_recaptcha_opts : array();
10952
 
@@ -10955,6 +13547,7 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
10955
  'sekFrontLocalized',
10956
  array(
10957
  'isDevMode' => sek_is_dev_mode(),
 
10958
  'frontNonce' => array( 'id' => 'SEKFrontNonce', 'handle' => wp_create_nonce( 'sek-front-nonce' ) ),
10959
  'localSeks' => sek_is_debug_mode() ? wp_json_encode( sek_get_skoped_seks() ) : '',
10960
  'globalSeks' => sek_is_debug_mode() ? wp_json_encode( sek_get_skoped_seks( NIMBLE_GLOBAL_SKOPE_ID ) ) : '',
@@ -10963,9 +13556,17 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
10963
  )
10964
  );
10965
  }
 
 
 
 
10966
  function sek_schedule_customize_preview_assets() {
 
 
10967
  if ( sek_is_customize_previewing_a_changeset_post() )
10968
  return;
 
 
10969
  add_action( 'wp_footer', array( $this, 'sek_print_ui_tmpl' ) );
10970
 
10971
  wp_enqueue_style(
@@ -10986,6 +13587,7 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
10986
  NIMBLE_ASSETS_VERSION,
10987
  $media = 'all'
10988
  );
 
10989
  wp_enqueue_script(
10990
  'sek-customize-preview',
10991
  sprintf(
@@ -11043,6 +13645,8 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
11043
  );
11044
  wp_enqueue_script( 'jquery-ui-resizable' );
11045
  }
 
 
11046
  function sek_print_ui_tmpl() {
11047
  ?>
11048
  <script type="text/html" id="sek-tmpl-add-content-button">
@@ -11200,31 +13804,59 @@ endif;
11200
  ?><?php
11201
  if ( ! class_exists( 'SEK_Front_Render' ) ) :
11202
  class SEK_Front_Render extends SEK_Front_Assets {
 
11203
  function _schedule_front_rendering() {
11204
  if ( !defined( "NIMBLE_BEFORE_CONTENT_FILTER_PRIORITY" ) ) { define( "NIMBLE_BEFORE_CONTENT_FILTER_PRIORITY", PHP_INT_MAX ); }
11205
  if ( !defined( "NIMBLE_AFTER_CONTENT_FILTER_PRIORITY" ) ) { define( "NIMBLE_AFTER_CONTENT_FILTER_PRIORITY", PHP_INT_MAX ); }
11206
  if ( !defined( "NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY" ) ) { define( "NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY", - PHP_INT_MAX ); }
 
 
11207
  add_action( 'template_redirect', array( $this, 'sek_schedule_rendering_hooks') );
 
 
11208
  add_filter( 'the_content', array( $this, 'sek_wrap_wp_content' ), NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY );
 
 
11209
  add_action( 'wp_enqueue_scripts', array( $this, 'sek_enqueue_the_printed_module_assets') );
 
 
11210
  add_filter( 'nimble_parse_for_smart_load', array( $this, 'sek_maybe_process_img_for_js_smart_load') );
 
 
11211
  $this -> sek_setup_tiny_mce_content_filters();
 
 
11212
  add_action( 'nimble_front_classes_ready', array( $this, 'sek_register_nimble_global_locations') );
 
 
11213
  add_filter( 'template_include', array( $this, 'sek_maybe_set_local_nimble_template' ) );
 
 
11214
  if ( sek_is_header_footer_enabled() ) {
11215
  add_action( 'template_redirect', array( $this, 'sek_maybe_set_nimble_header_footer' ) );
 
11216
  add_filter( 'get_header', array( $this, 'sek_maybe_set_local_nimble_header') );
 
11217
  add_filter( 'get_footer', array( $this, 'sek_maybe_set_local_nimble_footer') );
11218
  }
 
 
11219
  add_action( 'wp_head', array( $this, 'sek_maybe_include_nimble_content_in_search_results' ) );
11220
  }//_schedule_front_rendering()
 
 
 
 
 
11221
  function sek_wrap_wp_content( $html ) {
11222
  if ( ! skp_is_customizing() || ( defined('DOING_AJAX') && DOING_AJAX ) )
11223
  return $html;
11224
  if ( is_singular() && in_the_loop() && is_main_query() ) {
11225
  global $post;
 
11226
  $html = sprintf( '<div class="sek-wp-content-wrapper" data-sek-wp-post-id="%1$s" data-sek-wp-edit-link="%2$s" title="%3$s">%4$s</div>',
11227
  $post->ID,
 
11228
  $this->get_unfiltered_edit_post_link( $post->ID ),
11229
  __( 'WordPress content', 'nimble-builder'),
11230
  wpautop( $html )
@@ -11232,24 +13864,53 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11232
  }
11233
  return $html;
11234
  }
 
 
 
11235
  function sek_register_nimble_global_locations() {
11236
  register_location('nimble_local_header', array( 'is_header_location' => true ) );
11237
  register_location('nimble_local_footer', array( 'is_footer_location' => true ) );
11238
  register_location('nimble_global_header', array( 'is_global_location' => true, 'is_header_location' => true ) );
11239
  register_location('nimble_global_footer', array( 'is_global_location' => true, 'is_footer_location' => true ) );
11240
  }
 
 
 
 
11241
  function sek_schedule_rendering_hooks() {
11242
  $locale_template = sek_get_locale_template();
 
11243
  $all_locations = sek_get_locations();
 
 
 
 
 
 
 
 
11244
  foreach( $all_locations as $location_id => $params ) {
11245
  $params = is_array( $params ) ? $params : array();
11246
  $params = wp_parse_args( $params, array( 'priority' => 10 ) );
 
 
 
 
 
 
 
11247
  if ( !empty( $locale_template ) && !array_key_exists( $location_id, Nimble_Manager()->default_locations ) ) {
11248
  add_action( $location_id, array( $this, 'sek_schedule_sektions_rendering' ), $params['priority'] );
11249
  } else {
11250
  switch ( $location_id ) {
11251
  case 'loop_start' :
11252
  case 'loop_end' :
 
 
 
 
 
 
11253
  if ( ! ( apply_filters( 'infinite_scroll_got_infinity', isset( $_GET[ 'infinity' ] ) ) ) ) {
11254
  add_action( $location_id, array( $this, 'sek_schedule_sektions_rendering' ), $params['priority'] );
11255
  }
@@ -11260,6 +13921,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11260
  case 'after_content' :
11261
  add_filter('the_content', array( $this, 'sek_schedule_sektion_rendering_after_content' ), NIMBLE_AFTER_CONTENT_FILTER_PRIORITY );
11262
  break;
 
11263
  default :
11264
  add_action( $location_id, array( $this, 'sek_schedule_sektions_rendering' ), $params['priority'] );
11265
  break;
@@ -11268,12 +13930,28 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11268
 
11269
  }
11270
  }
 
 
 
 
 
11271
  function sek_schedule_sektions_rendering( $query = null ) {
 
 
 
 
 
 
11272
  if ( is_object( $query ) && is_a( $query, 'WP_Query' ) && ! $query->is_main_query() ) {
11273
  return;
11274
  }
11275
 
11276
  $location_id = current_filter();
 
 
 
 
 
11277
  if ( did_action( "sek_before_location_{$location_id}" ) )
11278
  return;
11279
 
@@ -11281,12 +13959,26 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11281
  $this->_render_seks_for_location( $location_id );
11282
  do_action( "sek_after_location_{$location_id}" );
11283
  }
 
 
11284
  function sek_schedule_sektion_rendering_before_content( $html ) {
 
 
 
 
 
11285
 
11286
  do_action( 'sek_before_location_before_content' );
11287
  return $this -> _filter_the_content( $html, 'before_content' );
11288
  }
 
 
11289
  function sek_schedule_sektion_rendering_after_content( $html ) {
 
 
 
 
 
11290
 
11291
  do_action( 'sek_before_location_after_content' );
11292
  return $this -> _filter_the_content( $html, 'after_content' );
@@ -11297,6 +13989,9 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11297
  ob_start();
11298
  $this->_render_seks_for_location( $where );
11299
  $html = 'before_content' == $where ? ob_get_clean() . $html : $html . ob_get_clean();
 
 
 
11300
  if ( strpos( $html, '<div' ) !== false ) {
11301
  $html = preg_replace( '|\s*<div|', '<div', $html );
11302
  $html = preg_replace( '|</div>\s*|', '</div>', $html );
@@ -11305,6 +14000,8 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11305
 
11306
  return $html;
11307
  }
 
 
11308
  public function _render_seks_for_location( $location_id = '', $location_data = array() ) {
11309
  $all_locations = sek_get_locations();
11310
 
@@ -11322,6 +14019,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11322
  if ( is_array( $locationSettingValue ) ) {
11323
 
11324
  remove_filter('the_content', array( $this, 'sek_wrap_wp_content' ), NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY );
 
11325
  remove_filter('the_content', array( $this, 'sek_schedule_sektion_rendering_before_content' ), NIMBLE_BEFORE_CONTENT_FILTER_PRIORITY );
11326
  remove_filter('the_content', array( $this, 'sek_schedule_sektion_rendering_after_content' ), NIMBLE_AFTER_CONTENT_FILTER_PRIORITY );
11327
 
@@ -11346,6 +14044,11 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11346
  /* ------------------------------------------------------------------------- *
11347
  * RENDERING UTILITIES USED IN NIMBLE TEMPLATES
11348
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
11349
  function render_nimble_locations( $locations, $options = array() ) {
11350
  if ( is_string( $locations ) && ! empty( $locations ) ) {
11351
  $locations = array( $locations );
@@ -11354,23 +14057,48 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11354
  sek_error_log( __FUNCTION__ . ' error => missing or invalid locations provided');
11355
  return;
11356
  }
 
 
11357
  $options = ! is_array( $options ) ? array() : $options;
11358
  $options = wp_parse_args( $options, array(
 
 
 
11359
  'fallback_location' => null, // Typically set as 'loop_start' in the nimble templates
11360
  ));
11361
 
 
 
 
 
 
 
 
 
 
 
11362
  foreach( $locations as $location_id ) {
11363
  if ( ! is_string( $location_id ) || empty( $location_id ) ) {
11364
  sek_error_log( __FUNCTION__ . ' => error => a location_id is not valid in the provided locations', $locations );
11365
  continue;
11366
  }
 
 
 
 
 
 
11367
  if ( did_action( "sek_before_location_{$location_id}" ) )
11368
  continue;
11369
 
11370
  $is_global = sek_is_global_location( $location_id );
11371
  $skope_id = $is_global ? NIMBLE_GLOBAL_SKOPE_ID : skp_get_skope_id();
11372
  $locationSettingValue = sek_get_skoped_seks( $skope_id, $location_id );
 
11373
  if ( ! is_null( $options[ 'fallback_location' ]) ) {
 
 
 
11374
  if ( $options[ 'fallback_location' ] === $location_id || ( is_array( $locationSettingValue ) && ! empty( $locationSettingValue['collection'] ) ) ) {
11375
  do_action( "sek_before_location_{$location_id}" );
11376
  Nimble_Manager()->_render_seks_for_location( $location_id, $locationSettingValue );
@@ -11394,7 +14122,12 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11394
  /* ------------------------------------------------------------------------- *
11395
  * MAIN RENDERING METHOD
11396
  /* ------------------------------------------------------------------------- */
 
11397
  function render( $model = array(), $location = 'loop_start' ) {
 
 
 
 
11398
  if ( ! is_array( $model ) ) {
11399
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => a model must be an array', $model );
11400
  return;
@@ -11403,25 +14136,36 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11403
  error_log( '::render() => a level model is missing the level or the id property' );
11404
  return;
11405
  }
 
11406
  $id = $model['id'];
11407
  if ( ! is_string( $id ) || empty( $id ) ) {
11408
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => a level id must be a string not empty', $model );
11409
  return;
11410
  }
 
 
11411
  $level_type = $model['level'];
11412
  if ( ! is_string( $level_type ) || empty( $level_type ) ) {
11413
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => a level type must be a string not empty', $model );
11414
  return;
11415
  }
 
 
11416
  if ( in_array( $id, Nimble_Manager()->rendered_levels ) ) {
11417
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => a ' . $level_type . ' level id has already been rendered : ' . $id );
11418
  return;
11419
  }
 
11420
  Nimble_Manager()->rendered_levels[] = $id;
 
 
 
11421
  $parent_model = $this -> parent_model;
11422
  $this -> model = $model;
11423
 
11424
  $collection = array_key_exists( 'collection', $model ) ? $model['collection'] : array();
 
 
11425
  $custom_anchor = null;
11426
  if ( !empty( $model[ 'options' ] ) && !empty( $model[ 'options' ][ 'anchor' ] ) && !empty( $model[ 'options' ][ 'anchor' ]['custom_anchor'] ) ) {
11427
  if ( is_string( $model[ 'options' ][ 'anchor' ]['custom_anchor'] ) ) {
@@ -11432,11 +14176,14 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11432
  if ( !empty( $model[ 'options' ] ) && !empty( $model[ 'options' ][ 'anchor' ] ) && !empty( $model[ 'options' ][ 'anchor' ]['custom_css_classes'] ) ) {
11433
  if ( is_string( $model[ 'options' ][ 'anchor' ]['custom_css_classes'] ) ) {
11434
  $custom_css_classes = esc_attr( $model[ 'options' ][ 'anchor' ]['custom_css_classes'] );
 
11435
  }
11436
  }
11437
 
11438
  switch ( $level_type ) {
11439
  case 'location' :
 
 
11440
  ?>
11441
  <?php if ( skp_is_customizing() || ( ! skp_is_customizing() && ! empty( $collection ) ) ) : ?>
11442
  <?php
@@ -11454,6 +14201,8 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11454
  foreach ( $collection as $_key => $sec_model ) { $this -> render( $sec_model ); }
11455
  ?>
11456
  <?php
 
 
11457
  ?>
11458
  <?php if ( empty( $collection ) && !sek_is_customize_previewing_a_changeset_post() ) : ?>
11459
  <div class="sek-empty-location-placeholder">
@@ -11478,6 +14227,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11478
  $is_nested = array_key_exists( 'is_nested', $model ) && true == $model['is_nested'];
11479
  $has_at_least_one_module = sek_section_has_modules( $collection );
11480
  $column_container_class = 'sek-container-fluid';
 
11481
  if ( !empty( $model[ 'options' ][ 'layout' ][ 'boxed-wide' ] ) && 'boxed' == $model[ 'options' ][ 'layout' ][ 'boxed-wide' ] ) {
11482
  $column_container_class = 'sek-container';
11483
  }
@@ -11489,12 +14239,14 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11489
  $has_at_least_one_module ? 'sek-has-modules' : '',
11490
  $this->get_level_visibility_css_class( $model ),
11491
  is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"',
 
11492
  $this -> sek_maybe_add_bg_attributes( $model ),
11493
  is_null( $custom_css_classes ) ? '' : $custom_css_classes
11494
  ); ?>
11495
  <div class="<?php echo $column_container_class; ?>">
11496
  <div class="sek-row sek-sektion-inner">
11497
  <?php
 
11498
  $this -> parent_model = $model;
11499
  foreach ( $collection as $col_model ) {$this -> render( $col_model ); }
11500
  ?>
@@ -11505,12 +14257,27 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11505
  break;
11506
 
11507
  case 'column' :
 
 
 
 
 
 
 
11508
  $col_number = ( array_key_exists( 'collection', $parent_model ) && is_array( $parent_model['collection'] ) ) ? count( $parent_model['collection'] ) : 1;
11509
  $col_number = 12 < $col_number ? 12 : $col_number;
11510
  $col_width_in_percent = 100/$col_number;
 
 
 
 
11511
  $col_suffix = floor( $col_width_in_percent );
 
 
11512
  $global_custom_breakpoint = intval( sek_get_global_custom_breakpoint() );
11513
  $has_global_custom_breakpoint = $global_custom_breakpoint >= 1;
 
 
11514
  $section_custom_breakpoint = intval( sek_get_section_custom_breakpoint( $parent_model ) );
11515
  $has_section_custom_breakpoint = $section_custom_breakpoint >= 1;
11516
 
@@ -11527,16 +14294,22 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11527
  $grid_column_class,
11528
  $this->get_level_visibility_css_class( $model ),
11529
  empty( $collection ) ? 'data-sek-no-modules="true"' : '',
 
11530
  $this -> sek_maybe_add_bg_attributes( $model ),
11531
  is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"',
11532
  is_null( $custom_css_classes ) ? '' : $custom_css_classes
11533
  );
11534
  ?>
11535
  <?php
 
 
11536
  ?>
11537
  <div class="sek-column-inner <?php echo empty( $collection ) ? 'sek-empty-col' : ''; ?>">
11538
  <?php
 
 
11539
  if ( skp_is_customizing() && !sek_is_customize_previewing_a_changeset_post() && empty( $collection ) ) {
 
11540
  $content_type = 'module';
11541
  $title = 'section' === $content_type ? __('Drag and drop a section or a module here', 'nimble-builder' ) : __('Drag and drop a block of content here', 'nimble-builder' );
11542
  ?>
@@ -11548,6 +14321,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11548
  </div>
11549
  <?php
11550
  } else {
 
11551
  $this -> parent_model = $model;
11552
  foreach ( $collection as $module_or_nested_section_model ) {
11553
  ?>
@@ -11570,6 +14344,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11570
  }
11571
  $module_type = $model['module_type'];
11572
  $model = sek_normalize_module_value_with_defaults( $model );
 
11573
  $this -> model = $model;
11574
  $title_attribute = '';
11575
  if ( skp_is_customizing() ) {
@@ -11582,6 +14357,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11582
  $module_type,
11583
  $this->get_level_visibility_css_class( $model ),
11584
  $title_attribute,
 
11585
  $this -> sek_maybe_add_bg_attributes( $model ),
11586
  is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"',
11587
  is_null( $custom_css_classes ) ? '' : $custom_css_classes
@@ -11613,12 +14389,14 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11613
  * VARIOUS HELPERS
11614
  /* ------------------------------------------------------------------------- */
11615
  /* HELPER TO PRINT THE VISIBILITY CSS CLASS IN THE LEVEL CONTAINER */
 
11616
  private function get_level_visibility_css_class( $model ) {
11617
  if ( ! is_array( $model ) ) {
11618
  error_log( __FUNCTION__ . ' => $model param should be an array' );
11619
  return;
11620
  }
11621
  $visibility_class = '';
 
11622
  if ( !empty( $model[ 'options' ] ) && !empty( $model[ 'options' ][ 'visibility' ] ) ) {
11623
  if ( is_array( $model[ 'options' ][ 'visibility' ] ) ) {
11624
  foreach ( $model[ 'options' ][ 'visibility' ] as $device_type => $device_visibility_bool ) {
@@ -11639,6 +14417,8 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11639
 
11640
 
11641
  /* MODULE AND PLACEHOLDER */
 
 
11642
  private function sek_print_module_tmpl( $model ) {
11643
  if ( ! is_array( $model ) ) {
11644
  error_log( __FUNCTION__ . ' => $model param should be an array' );
@@ -11656,6 +14436,15 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11656
  error_log( __FUNCTION__ . ' => no template found for module type ' . $module_type );
11657
  }
11658
 
 
 
 
 
 
 
 
 
 
11659
  }
11660
 
11661
 
@@ -11714,6 +14503,10 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11714
  }
11715
  return $link;
11716
  }
 
 
 
 
11717
  function sek_enqueue_the_printed_module_assets() {
11718
  $skope_id = skp_get_skope_id();
11719
  $skoped_seks = sek_get_skoped_seks( $skope_id );
@@ -11750,6 +14543,8 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11750
  }
11751
  }
11752
  }//sek_enqueue_the_printed_module_assets()
 
 
11753
  function sek_sniff_assets_to_enqueue( $collection, $enqueuing_candidates = array() ) {
11754
  foreach ( $collection as $level_data ) {
11755
  if ( array_key_exists( 'level', $level_data ) && 'module' === $level_data['level'] && ! empty( $level_data['module_type'] ) ) {
@@ -11773,6 +14568,12 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11773
  /* ------------------------------------------------------------------------- *
11774
  * SMART LOAD.
11775
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
11776
  function sek_maybe_add_bg_attributes( $model ) {
11777
  $attributes = '';
11778
  $bg_url_for_lazy_load = '';
@@ -11788,6 +14589,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11788
  if ( sek_is_img_smartload_enabled() ) {
11789
  $bg_url_for_lazy_load = wp_get_attachment_url( $bg_options[ 'bg-image'] );
11790
  }
 
11791
  $fixed_bg_enabled = !empty( $bg_options['bg-attachment'] ) && sek_booleanize_checkbox_val( $bg_options['bg-attachment'] );
11792
  $parallax_enabled = !$fixed_bg_enabled && !empty( $bg_options['bg-parallax'] ) && sek_booleanize_checkbox_val( $bg_options['bg-parallax'] );
11793
  if ( $parallax_enabled ) {
@@ -11802,6 +14604,10 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11802
  if ( ! empty( $bg_url_for_lazy_load ) ) {
11803
  $attributes .= sprintf('%1$s data-sek-lazy-bg="true" data-sek-src="%2$s"', $attributes, $bg_url_for_lazy_load );
11804
  }
 
 
 
 
11805
  if ( $fixed_bg_enabled ) {
11806
  $attributes .= sprintf('%1$s data-sek-bg-fixed="true"',
11807
  $attributes
@@ -11812,10 +14618,18 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11812
  $width,
11813
  $height,
11814
  array_key_exists('bg-parallax-force', $bg_options) ? $bg_options['bg-parallax-force'] : '40'
 
11815
  );
11816
  }
11817
  return $attributes;
11818
  }
 
 
 
 
 
 
 
11819
  function sek_maybe_process_img_for_js_smart_load( $html ) {
11820
  if ( !sek_is_img_smartload_enabled() )
11821
  return $html;
@@ -11849,7 +14663,14 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11849
 
11850
  return preg_replace_callback( $pattern, '\Nimble\nimble_regex_callback', $html);
11851
  }
 
 
 
 
 
11852
  private function sek_setup_tiny_mce_content_filters() {
 
 
11853
  if ( function_exists( 'do_blocks' ) ) {
11854
  add_filter( 'the_nimble_tinymce_module_content', 'do_blocks', 9 );
11855
  }
@@ -11862,15 +14683,26 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11862
  add_filter( 'the_nimble_tinymce_module_content', 'do_shortcode', 11 ); // AFTER wpautop()
11863
  add_filter( 'the_nimble_tinymce_module_content', 'capital_P_dangit', 9 );
11864
  add_filter( 'the_nimble_tinymce_module_content', '\Nimble\sek_parse_template_tags', 21 );
 
 
 
 
 
11865
  add_filter( 'the_nimble_tinymce_module_content', array( $this, 'sek_run_shortcode' ), 8 );
 
 
11866
  add_filter( 'the_nimble_tinymce_module_content', array( $this, 'sek_parse_content_for_video_embed') , 8 );
11867
  }
 
 
11868
  function sek_run_shortcode( $content ) {
11869
  if ( array_key_exists( 'wp_embed', $GLOBALS ) && $GLOBALS['wp_embed'] instanceof \WP_Embed ) {
11870
  $content = $GLOBALS['wp_embed']->run_shortcode( $content );
11871
  }
11872
  return $content;
11873
  }
 
 
11874
  function sek_parse_content_for_video_embed( $content ) {
11875
  if ( array_key_exists( 'wp_embed', $GLOBALS ) && $GLOBALS['wp_embed'] instanceof \WP_Embed ) {
11876
  $content = $GLOBALS['wp_embed']->autoembed( $content );
@@ -11885,19 +14717,33 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11885
  /* ------------------------------------------------------------------------- *
11886
  * CONTENT, HEADER, FOOTER
11887
  /* ------------------------------------------------------------------------- */
 
 
11888
  function sek_maybe_set_local_nimble_template( $template ) {
 
11889
  $locale_template = sek_get_locale_template();
11890
  if ( !empty( $locale_template ) ) {
11891
  $template = $locale_template;
11892
  }
 
11893
  return $template;
11894
  }
 
 
 
 
 
 
 
 
 
11895
  function sek_maybe_set_nimble_header_footer() {
11896
  if ( !did_action('nimble_front_classes_ready') || !did_action('wp') ) {
11897
  sek_error_log( __FUNCTION__ . ' has been invoked too early at hook ' . current_filter() );
11898
  return;
11899
  }
11900
  if ( '_not_cached_yet_' === $this->has_local_header_footer || '_not_cached_yet_' === $this->has_global_header_footer ) {
 
11901
  $local_header_footer_data = sek_get_local_option_value('local_header_footer');
11902
  $global_header_footer_data = sek_get_global_option_value('global_header_footer');
11903
 
@@ -11911,9 +14757,17 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11911
  }
11912
  }
11913
  }
 
 
 
 
11914
  function sek_maybe_set_local_nimble_header( $header_name ) {
 
11915
  if ( sek_page_uses_nimble_header_footer() ) {
 
11916
  load_template( NIMBLE_BASE_PATH . '/tmpl/header/nimble_header_tmpl.php', false );
 
 
11917
  $templates = array();
11918
  $header_name = (string) $header_name;
11919
  if ( '' !== $header_name ) {
@@ -11921,15 +14775,27 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11921
  }
11922
 
11923
  $templates[] = 'header.php';
 
 
11924
  remove_all_actions( 'wp_head' );
 
11925
  ob_start();
 
 
 
11926
  locate_template( $templates, true );
11927
  ob_get_clean();
11928
  }
11929
  }
 
 
11930
  function sek_maybe_set_local_nimble_footer( $footer_name ) {
 
11931
  if ( sek_page_uses_nimble_header_footer() ) {
 
11932
  load_template( NIMBLE_BASE_PATH . '/tmpl/footer/nimble_footer_tmpl.php', false );
 
 
11933
  $templates = array();
11934
  $name = (string) $footer_name;
11935
  if ( '' !== $footer_name ) {
@@ -11937,12 +14803,35 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11937
  }
11938
 
11939
  $templates[] = 'footer.php';
 
 
11940
  remove_all_actions( 'wp_footer' );
 
11941
  ob_start();
 
 
 
11942
  locate_template( $templates, true );
11943
  ob_get_clean();
11944
  }
11945
  }//sek_maybe_set_local_nimble_footer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11946
  function sek_maybe_include_nimble_content_in_search_results(){
11947
  if ( !is_search() )
11948
  return;
@@ -11951,6 +14840,8 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11951
  $query_vars = $wp_query->query_vars;
11952
  if ( ! is_array( $query_vars ) || empty( $query_vars['s'] ) )
11953
  return;
 
 
11954
  $sek_post_query_vars = array(
11955
  'post_type' => NIMBLE_CPT,
11956
  'post_status' => get_post_stati(),
@@ -11963,8 +14854,12 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11963
  's' => $query_vars['s']
11964
  );
11965
  $query = new \WP_Query( $sek_post_query_vars );
 
 
11966
  if ( is_array( $query->posts ) ) {
11967
  foreach ( $query->posts as $post_object ) {
 
 
11968
  if ( preg_match('(post_page|post_post)', $post_object->post_title ) ) {
11969
  $post_number = preg_replace('/[^0-9]/', '', $post_object->post_title );
11970
  $post_number = intval($post_number);
@@ -11972,11 +14867,14 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11972
  $post_candidate = get_post( $post_number );
11973
 
11974
  if ( is_object( $post_candidate ) ) {
 
11975
  array_push( $wp_query->posts, $post_candidate );
11976
  }
11977
  }
11978
  }
11979
  }
 
 
11980
  $maybe_includes_duplicated = $wp_query->posts;
11981
  $without_duplicated = array();
11982
  $post_ids = array();
@@ -11988,6 +14886,8 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
11988
  $without_duplicated[] = $post_obj;
11989
  }
11990
  $wp_query->posts = $without_duplicated;
 
 
11991
  $wp_query->post_count = count($wp_query->posts);
11992
  $wp_query->found_posts = $wp_query->post_count > 0;
11993
  }// sek_maybe_include_nimble_content_in_search_results
@@ -11997,15 +14897,36 @@ endif;
11997
  ?><?php
11998
  if ( ! class_exists( 'SEK_Front_Render_Css' ) ) :
11999
  class SEK_Front_Render_Css extends SEK_Front_Render {
 
12000
  function _setup_hook_for_front_css_printing_or_enqueuing() {
12001
  add_action( 'wp_enqueue_scripts', array( $this, 'print_or_enqueue_seks_style') );
12002
  }
 
 
 
 
12003
  function print_or_enqueue_seks_style( $skope_id = null ) {
 
 
 
 
 
 
 
 
 
 
 
 
12004
  if ( ( ! is_null( $skope_id ) && ! empty( $skope_id ) ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
12005
  $this->_instantiate_css_handler( array( 'skope_id' => $skope_id, 'is_global_stylesheet' => NIMBLE_GLOBAL_SKOPE_ID === $skope_id ) );
12006
  } else {
12007
  $skope_id = skp_build_skope_id();
 
12008
  $this->_instantiate_css_handler( array( 'skope_id' => skp_build_skope_id() ) );
 
 
 
12009
  if ( sek_has_global_sections() ) {
12010
  $this->_instantiate_css_handler( array( 'skope_id' => NIMBLE_GLOBAL_SKOPE_ID, 'is_global_stylesheet' => true ) );
12011
  }
@@ -12014,13 +14935,18 @@ if ( ! class_exists( 'SEK_Front_Render_Css' ) ) :
12014
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' =>the skope_id should not be empty' );
12015
  }
12016
  }//print_or_enqueue_seks_style
 
 
 
12017
  private function _instantiate_css_handler( $params = array() ) {
12018
  $params = wp_parse_args( $params, array( 'skope_id' => '', 'is_global_stylesheet' => false ) );
12019
  new Sek_Dyn_CSS_Handler( array(
12020
  'id' => $params['skope_id'],
12021
  'skope_id' => $params['skope_id'],
 
12022
  'is_global_stylesheet' => $params['is_global_stylesheet'],
12023
  'mode' => is_customize_preview() ? Sek_Dyn_CSS_Handler::MODE_INLINE : Sek_Dyn_CSS_Handler::MODE_FILE,
 
12024
  'force_write' => true, //<- write if the file doesn't exist
12025
  'force_rewrite' => is_user_logged_in() && current_user_can( 'customize' ), //<- write even if the file exists
12026
  'hook' => ( ! defined( 'DOING_AJAX' ) && is_customize_preview() ) ? 'wp_head' : ''
@@ -12041,9 +14967,13 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12041
  private $form_composition;
12042
 
12043
  function _setup_simple_forms() {
 
12044
  add_action( 'parse_request', array( $this, 'simple_form_parse_request' ), 20 );
12045
  add_action( 'wp_enqueue_scripts', array( $this, 'maybe_enqueue_recaptcha_scripts' ), 0 );
12046
  add_action( 'body_class', array( $this, 'set_the_recaptcha_badge_visibility_class') );
 
 
 
12047
  $this->form_composition = array(
12048
  'nimble_simple_cf' => array(
12049
  'type' => 'hidden',
@@ -12094,9 +15024,15 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12094
  )
12095
  );
12096
  }//_setup_simple_forms
 
 
 
12097
  function simple_form_parse_request() {
12098
  if ( ! isset( $_POST['nimble_simple_cf'] ) )
12099
  return;
 
 
 
12100
  $module_model = array();
12101
  if ( isset( $_POST['nimble_skope_id'] ) && '_skope_not_set_' !== $_POST['nimble_skope_id'] ) {
12102
  $local_sektions = sek_get_skoped_seks( $_POST['nimble_skope_id'] );
@@ -12116,22 +15052,41 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12116
  sek_error_log( __FUNCTION__ . ' => invalid module model');
12117
  return;
12118
  }
 
 
12119
  foreach ( $this->form_composition as $name => $field ) {
12120
  $form_composition[ $name ] = $field;
12121
  if ( isset( $_POST[ $name ] ) ) {
12122
  $form_composition[ $name ][ 'value' ] = $_POST[ $name ];
12123
  }
12124
  }
 
12125
  $form_composition = $this->_set_form_composition( $form_composition, $module_model );
 
12126
  $this->fields = $this->simple_form_generate_fields( $form_composition );
 
12127
  $this->form = $this->simple_form_generate_form( $this->fields );
 
 
12128
  $this->mailer = new Sek_Mailer( $this->form );
12129
  $this->mailer->maybe_send( $form_composition, $module_model );
12130
  }
 
 
 
12131
  function maybe_enqueue_recaptcha_scripts() {
 
 
 
 
 
 
 
12132
  if ( skp_is_customizing() || !sek_is_recaptcha_globally_enabled() || !sek_front_sections_include_a_form() )
12133
  return;
12134
 
 
 
12135
  $global_recaptcha_opts = sek_get_global_option_value('recaptcha');
12136
  $global_recaptcha_opts = is_array( $global_recaptcha_opts ) ? $global_recaptcha_opts : array();
12137
 
@@ -12143,6 +15098,11 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12143
  wp_enqueue_script( 'google-recaptcha', $url, array(), '3.0', true );
12144
  add_action('wp_footer', array( $this, 'print_recaptcha_inline_js'), 100 );
12145
  }
 
 
 
 
 
12146
  function print_recaptcha_inline_js() {
12147
  ?>
12148
  <script type="text/javascript" id="nimble-inline-recaptcha">
@@ -12151,6 +15111,7 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12151
  execute: function() {
12152
  grecaptcha.execute(
12153
  sitekey,
 
12154
  { action: ( window.sekFrontLocalized && sekFrontLocalized.skope_id ) ? sekFrontLocalized.skope_id.replace( 'skp__' , 'nimble_form__' ) : 'nimble_builder_form' }
12155
  ).then( function( token ) {
12156
  var forms = document.getElementsByTagName( 'form' );
@@ -12172,16 +15133,30 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12172
  </script>
12173
  <?php
12174
  }
 
 
12175
  public function set_the_recaptcha_badge_visibility_class( $classes ) {
 
 
 
12176
  if ( ! sek_is_recaptcha_badge_globally_displayed() ) {
12177
  $classes[] = 'sek-hide-rc-badge';
12178
  }
12179
  return $classes;
12180
  }
 
 
 
 
 
 
12181
  function get_simple_form_html( $module_model ) {
12182
  $html = '';
 
12183
  $form_composition = $this->_set_form_composition( $this->form_composition, $module_model );
 
12184
  $fields = isset( $this->fields ) ? $this->fields : $this->simple_form_generate_fields( $form_composition );
 
12185
  $form = isset( $this->form ) ? $this->form : $this->simple_form_generate_form( $fields );
12186
 
12187
  $module_id = is_array( $module_model ) && array_key_exists('id', $module_model ) ? $module_model['id'] : '';
@@ -12190,6 +15165,7 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12190
  <div id="sek-form-respond">
12191
  <?php
12192
  $echo_form = true;
 
12193
  if ( ! is_null( $this->mailer ) ) {
12194
  if ( 'sent' == $status_code = $this->mailer->get_status() ) {
12195
  $echo_form = false;
@@ -12235,6 +15211,8 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12235
  <?php
12236
  return ob_get_clean();
12237
  }
 
 
12238
  private function _set_form_composition( $form_composition, $module_model = array() ) {
12239
 
12240
  $user_form_composition = array();
@@ -12243,11 +15221,13 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12243
  return $user_form_composition;
12244
  }
12245
  $module_user_values = array_key_exists( 'value', $module_model ) ? $module_model['value'] : array();
 
12246
  $form_fields_options = empty( $module_user_values['form_fields'] ) ? array() : $module_user_values['form_fields'];
12247
  $form_button_options = empty( $module_user_values['form_button'] ) ? array() : $module_user_values['form_button'];
12248
  $form_submission_options = empty( $module_user_values['form_submission'] ) ? array() : $module_user_values['form_submission'];
12249
 
12250
  foreach ( $form_composition as $field_id => $field_data ) {
 
12251
  switch ( $field_id ) {
12252
  case 'nimble_name':
12253
  if ( ! empty( $form_fields_options['show_name_field'] ) && sek_is_checked( $form_fields_options['show_name_field'] ) ) {
@@ -12274,9 +15254,11 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12274
  $user_form_composition[$field_id] = $field_data;
12275
  $user_form_composition[$field_id]['label'] = esc_attr( $form_fields_options['email_field_label'] );
12276
  break;
 
12277
  case 'nimble_submit':
12278
  $user_form_composition[$field_id] = $field_data;
12279
  $visual_effect_class = '';
 
12280
  if ( array_key_exists( 'use_box_shadow', $form_button_options ) && true === sek_booleanize_checkbox_val( $form_button_options['use_box_shadow'] ) ) {
12281
  $visual_effect_class = ' box-shadow';
12282
  if ( array_key_exists( 'push_effect', $form_button_options ) && true === sek_booleanize_checkbox_val( $form_button_options['push_effect'] ) ) {
@@ -12288,16 +15270,24 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12288
  break;
12289
  case 'nimble_skope_id':
12290
  $user_form_composition[$field_id] = $field_data;
 
 
12291
  $skope_id = '';
12292
  if ( ! skp_is_customizing() ) {
12293
  $skope_id = isset( $_POST['nimble_skope_id'] ) ? $_POST['nimble_skope_id'] : sek_get_level_skope_id( $module_model['id'] );
12294
  }
 
 
 
12295
  $user_form_composition[$field_id]['value'] = $skope_id;
12296
  break;
12297
  case 'nimble_level_id':
12298
  $user_form_composition[$field_id] = $field_data;
12299
  $user_form_composition[$field_id]['value'] = $module_model['id'];
12300
  break;
 
 
 
12301
  case 'nimble_recaptcha_resp' :
12302
  if ( ! skp_is_customizing() && sek_is_recaptcha_globally_enabled() && 'disabled' !== $form_submission_options['recaptcha_enabled'] ) {
12303
  $user_form_composition[$field_id] = $field_data;
@@ -12311,6 +15301,9 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12311
  }
12312
  return $user_form_composition;
12313
  }
 
 
 
12314
  function simple_form_generate_fields( $form_composition = array() ) {
12315
  $form_composition = empty( $form_composition ) ? $this->form_composition : $form_composition;
12316
  $fields_ = array();
@@ -12328,6 +15321,9 @@ class Sek_Simple_Form extends SEK_Front_Render_Css {
12328
 
12329
  return $fields_;
12330
  }
 
 
 
12331
  function simple_form_generate_form( $fields ) {
12332
  $form = new Sek_Form();
12333
  $form->add_fields( $fields );
@@ -12353,6 +15349,7 @@ class Sek_Form {
12353
  $this->attributes = wp_parse_args( $args, array(
12354
  'action' => '',
12355
  'method' => 'post'
 
12356
  ) );
12357
  }
12358
 
@@ -12376,6 +15373,8 @@ class Sek_Form {
12376
  }
12377
  return null;
12378
  }
 
 
12379
  public function has_invalid_field() {
12380
  $has_invalid_field = false;
12381
 
@@ -12454,6 +15453,7 @@ class Sek_Field {
12454
  'wrapper_tag' => '',
12455
  'wrapper_class' => array( 'sek-form-field' ),
12456
  'label' => '',
 
12457
  'before_label' => '',
12458
  'after_label' => '',
12459
  'before_input' => '',
@@ -12471,9 +15471,12 @@ class Sek_Field {
12471
 
12472
  public function html() {
12473
  $label = $this->data[ 'label' ];
 
 
12474
  if ( $label ) {
12475
  if ( true == $this->input->get_data( 'required' ) ) {
12476
  $label .= ' *';
 
12477
  }
12478
  $label = sprintf( '%1$s<label for="%2$s">%3$s</label>%4$s',
12479
  $this->data[ 'before_label' ],
@@ -12482,12 +15485,16 @@ class Sek_Field {
12482
  $this->data[ 'after_label' ]
12483
  );
12484
  }
 
 
12485
  $html = sprintf( '%s%s%s%s',
12486
  $label,
12487
  $this->data[ 'before_input' ],
12488
  $this->input,
12489
  $this->data[ 'after_input' ]
12490
  );
 
 
12491
  if ( $this->data[ 'wrapper_tag' ] ) {
12492
  $wrapper_tag = tag_escape( $this->data[ 'wrapper_tag' ] );
12493
  $wrapper_class = $this->data[ 'wrapper_class' ] ? ' class="'. implode( ' ', array_map('sanitize_html_class', $this->data[ 'wrapper_class' ] ) ) .'"' : '';
@@ -12524,6 +15531,8 @@ abstract class Sek_Input_Abstract implements Sek_Input_Interface {
12524
  protected $attributes = array( 'id', 'name', 'required' );
12525
 
12526
  public function __construct( $args ) {
 
 
12527
  if ( ! isset( $args['name'] ) ) {
12528
  error_log( __FUNCTION__ . ' => contact form input name not set' );
12529
  return;
@@ -12581,6 +15590,9 @@ abstract class Sek_Input_Abstract implements Sek_Input_Interface {
12581
  case 'nimble_subject' :
12582
  $value = __('An email subject', 'nimble-builder');
12583
  break;
 
 
 
12584
  }
12585
  }
12586
  return $value;
@@ -12788,9 +15800,17 @@ class Sek_Mailer {
12788
  $this-> form = $form;
12789
 
12790
  $this->messages = array(
 
 
 
12791
  'aborted' => __( 'Please supply correct information.', 'nimble-builder') //<-todo too much generic
12792
  );
12793
  $this->status = 'init';
 
 
 
 
 
12794
  if ( isset( $_POST['nimble_recaptcha_resp'] ) ) {
12795
  if ( !$this->validate_recaptcha( $_POST['nimble_recaptcha_resp'] ) ) {
12796
  $this->status = 'recaptcha_fail';
@@ -12800,19 +15820,28 @@ class Sek_Mailer {
12800
  }
12801
  }
12802
  }
 
 
 
12803
  private function validate_recaptcha( $recaptcha_token ) {
12804
  $is_valid = false;
12805
  $endpoint = 'https://www.google.com/recaptcha/api/siteverify';
12806
  $global_recaptcha_opts = sek_get_global_option_value('recaptcha');
12807
  $global_recaptcha_opts = is_array( $global_recaptcha_opts ) ? $global_recaptcha_opts : array();
 
 
12808
  if ( empty($global_recaptcha_opts['private_key']) )
12809
  return true;
 
 
12810
  $request = array(
12811
  'body' => array(
12812
  'secret' => $global_recaptcha_opts['private_key'],
12813
  'response' => $recaptcha_token
12814
  ),
12815
  );
 
 
12816
  $response = wp_remote_post( esc_url_raw( $endpoint ), $request );
12817
  if ( is_array( $response ) ) {
12818
  $maybe_recaptcha_errors = wp_remote_retrieve_body( $response );
@@ -12823,14 +15852,24 @@ class Sek_Mailer {
12823
  }
12824
 
12825
  }
 
 
 
12826
  if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
12827
  $this->recaptcha_errors = sprintf( __('There was a problem when performing the reCAPTCHA http request.', 'nimble-builder') );
12828
  return $is_valid;
12829
  }
 
 
12830
  if ( '_no_error_' === $this->recaptcha_errors ) {
12831
  $response_body = wp_remote_retrieve_body( $response );
12832
  $response_body = json_decode( $response_body, true );
 
 
12833
  $score = isset( $response_body['score'] ) ? $response_body['score'] : 0;
 
 
 
12834
  $user_score_threshold = array_key_exists('score', $global_recaptcha_opts) ? $global_recaptcha_opts['score'] : 0.5;
12835
  $user_score_threshold = !is_numeric( $user_score_threshold ) ? 0.5 : $user_score_threshold;
12836
  $user_score_threshold = $user_score_threshold > 1 ? 1 : $user_score_threshold;
@@ -12845,11 +15884,20 @@ class Sek_Mailer {
12845
 
12846
  return $is_valid;
12847
  }
 
 
 
 
12848
  public function maybe_send( $form_composition, $module_model ) {
 
12849
  if ( 'recaptcha_fail' === $this->status ) {
12850
  return;
12851
  }
12852
 
 
 
 
 
12853
  $invalid_field = $this->form->has_invalid_field();
12854
  if ( false !== $invalid_field ) {
12855
  $this->status = 'aborted';
@@ -12858,7 +15906,10 @@ class Sek_Mailer {
12858
  }
12859
 
12860
  $module_user_values = array_key_exists( 'value', $module_model ) ? $module_model['value'] : array();
 
12861
  $submission_options = empty( $module_user_values['form_submission'] ) ? array() : $module_user_values['form_submission'];
 
 
12862
  $allow_html = true;
12863
 
12864
  $sender_email = $this->form->get_field('nimble_email')->get_input()->get_value();
@@ -12876,6 +15927,16 @@ class Sek_Mailer {
12876
  } else {
12877
  $subject = sprintf( __( 'Someone sent a message from %1$s', 'nimble-builder' ), get_bloginfo( 'name' ) );
12878
  }
 
 
 
 
 
 
 
 
 
 
12879
  $before_message = sprintf( '%1$s: %2$s &lt;%3$s&gt;', __('From', 'nimble-builder'), $sender_name, $sender_email );//$sender_website;
12880
  $before_message .= sprintf( '<br>%1$s: %2$s', __('Subject', 'nimble-builder'), $subject );
12881
  $after_message = '';
@@ -12892,6 +15953,7 @@ class Sek_Mailer {
12892
  if ( !empty( $sender_body_message ) ) {
12893
  $sender_body_message = sprintf( '<br><br>%1$s: <br>%2$s',
12894
  __('Message body', 'nimble-builder'),
 
12895
  $sender_body_message
12896
  );
12897
  }
@@ -12923,9 +15985,13 @@ class Sek_Mailer {
12923
 
12924
  public function get_message( $status, $module_model ) {
12925
  $module_user_values = array_key_exists( 'value', $module_model ) ? $module_model['value'] : array();
 
12926
  $submission_options = empty( $module_user_values['form_submission'] ) ? array() : $module_user_values['form_submission'];
12927
 
12928
  $submission_message = isset( $this->messages[ $status ] ) ? $this->messages[ $status ] : '';
 
 
 
12929
  switch( $status ) {
12930
  case 'not_sent' :
12931
  if ( array_key_exists( 'failure_message', $submission_options ) && !empty( $submission_options['failure_message'] ) && 0 < strlen( preg_replace('/\s+/', '', $submission_options['failure_message'] ) ) ) {
@@ -12959,6 +16025,11 @@ class Sek_Mailer {
12959
  }
12960
  return $submission_message;
12961
  }
 
 
 
 
 
12962
  private function get_from_email() {
12963
  $admin_email = get_option( 'admin_email' );
12964
  $sitename = strtolower( $_SERVER['SERVER_NAME'] );
@@ -12979,6 +16050,19 @@ class Sek_Mailer {
12979
  }
12980
  }//Sek_Mailer
12981
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
12982
  function sek_simple_form_mail_template() {
12983
  $template = array(
12984
  'subject' =>
6
  function sek_is_debug_mode() {
7
  return isset( $_GET['nimble_debug'] );
8
  }
9
+ // @return array
10
  function sek_is_dev_mode() {
11
  return ( defined( 'NIMBLE_DEV' ) && NIMBLE_DEV ) || ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || sek_is_debug_mode();
12
  }
24
  if ( !defined( 'NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID') ) { define( 'NIMBLE_DETACHED_TINYMCE_TEXTAREA_ID' , 'czr-customize-content_editor' ); }
25
 
26
  if ( !defined( 'NIMBLE_WELCOME_NOTICE_ID' ) ) { define ( 'NIMBLE_WELCOME_NOTICE_ID', 'nimble-welcome-notice-12-2018' ); }
27
+ //mt_rand(0, 65535) . 'test-nimble-feedback-notice-04-2019'
28
  if ( !defined( 'NIMBLE_FEEDBACK_NOTICE_ID' ) ) { define ( 'NIMBLE_FEEDBACK_NOTICE_ID', 'nimble-feedback-notice-04-2019' ); }
29
 
30
 
31
  /* ------------------------------------------------------------------------- *
32
  * LOCATIONS UTILITIES
33
  /* ------------------------------------------------------------------------- */
34
+ // @return array
35
  function sek_get_locations() {
36
  if ( ! is_array( Nimble_Manager()->registered_locations ) ) {
37
  sek_error_log( __FUNCTION__ . ' error => the registered locations must be an array');
38
  return Nimble_Manager()->default_locations;
39
  }
40
+ //sek_error_log( __FUNCTION__ .' => locations ?', array_merge( Nimble_Manager()->default_locations, Nimble_Manager()->registered_locations ) );
41
  return apply_filters( 'sek_get_locations', Nimble_Manager()->registered_locations );
42
  }
43
+
44
+ // @return array of "local" content locations => locations with the following characterictics :
45
+ // - sections in this location are specific to a given skope id
46
+ // - header and footer locations are excluded
47
  function sek_get_local_content_locations() {
48
  $locations = array();
49
  $all_locations = sek_get_locations();
50
  if ( is_array( $all_locations ) ) {
51
  foreach ( $all_locations as $loc_id => $loc_data) {
52
+ // Normalizes with the default model used to register a location
53
+ // public $default_registered_location_model = [
54
+ // 'priority' => 10,
55
+ // 'is_global_location' => false,
56
+ // 'is_header_location' => false,
57
+ // 'is_footer_location' => false
58
+ // ];
59
  $loc_data = wp_parse_args( $loc_data, Nimble_Manager()->default_registered_location_model );
60
  if ( true === $loc_data['is_header_location'] || true === $loc_data['is_footer_location'] )
61
  continue;
67
  }
68
  return $locations;
69
  }
70
+
71
+ // DEPRECATED IN V1.4.0.
72
+ // Kept for retro compatibility
73
  function sek_get_local_locations() {
74
  return sek_get_local_content_locations();
75
  }
76
+
77
+ // @return an array of "global" locations => in which the sections are displayed site wide
78
  function sek_get_global_locations() {
79
  $locations = array();
80
  $all_locations = sek_get_locations();
87
  }
88
  return $locations;
89
  }
90
+
91
+
92
+ // @param location_id (string)
93
  function sek_get_registered_location_property( $location_id, $property_name = '' ) {
94
  $all_locations = sek_get_locations();
95
  $default_property_val = 'not_set';
96
+ //sek_error_log( __FUNCTION__ .' => locations ?', $all_locations );
97
  if ( ! isset( $all_locations[$location_id] ) || ! is_array( $all_locations[$location_id] ) ) {
98
  sek_error_log( __FUNCTION__ . ' error => the location ' . $location_id . ' is invalid or not registered.');
99
  return $default_property_val;
107
  $location_params = wp_parse_args( $all_locations[$location_id], Nimble_Manager()->default_registered_location_model );
108
  return ! empty( $location_params[$property_name] ) ? $location_params[$property_name] : $default_property_val;
109
  }
110
+
111
+ // @return bool
112
  function sek_is_global_location( $location_id ) {
113
  if ( ! is_string( $location_id ) || empty( $location_id ) ) {
114
  sek_error_log( __FUNCTION__ . ' error => missing or invalid location_id param' );
117
  $is_global_location = sek_get_registered_location_property( $location_id, 'is_global_location' );
118
  return 'not_set' === $is_global_location ? false : true === $is_global_location;
119
  }
120
+
121
+ // @param $location_id ( string ). Example '__after_header'
122
  function register_location( $location_id, $params = array() ) {
123
  $params = is_array( $params ) ? $params : array();
124
  $params = wp_parse_args( $params, Nimble_Manager()->default_registered_location_model );
127
  $registered_locations[$location_id] = $params;
128
  }
129
  Nimble_Manager()->registered_locations = $registered_locations;
130
+ //sek_error_log( __FUNCTION__ .' => Nimble_Manager()->registered_locations', Nimble_Manager()->registered_locations );
131
  }
132
+
133
+
134
+ // @return array
135
+ // @used when populating the customizer localized params
136
+ // @param $skope_id optional. Specified when we need to differentiate the local and global locations
137
  function sek_get_default_location_model( $skope_id = null ) {
138
  $is_global_skope = NIMBLE_GLOBAL_SKOPE_ID === $skope_id;
139
  if ( $is_global_skope ) {
157
  }
158
  return $defaut_sektions_value;
159
  }
160
+
161
+
162
+ //@return string
163
  function sek_get_seks_setting_id( $skope_id = '' ) {
164
  if ( empty( $skope_id ) ) {
165
  sek_error_log( 'sek_get_seks_setting_id => empty skope id or location => collection setting id impossible to build' );
166
  }
167
  return NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . "[{$skope_id}]";
168
  }
169
+
170
+
171
+ // return bool
172
  function sek_has_global_sections() {
173
  if ( skp_is_customizing() )
174
  return true;
175
  $maybe_global_sek_post = sek_get_seks_post( NIMBLE_GLOBAL_SKOPE_ID );
176
  return ! is_null($maybe_global_sek_post) || !!$maybe_global_sek_post;
177
  }
178
+
179
+
180
+
181
+
182
+
183
+ // @return void()
184
  /*function sek_get_module_placeholder( $placeholder_icon = 'short_text' ) {
185
  $placeholder_icon = empty( $placeholder_icon ) ? 'not_interested' : $placeholder_icon;
186
  ?>
189
  </div>
190
  <?php
191
  }*/
192
+
193
+
194
+
195
+
196
+ // Recursively walk the level tree until a match is found
197
+ // @param id = the id of the level for which the model shall be returned
198
+ // @param $collection = sek_get_skoped_seks( $skope_id )['collection']; <= the root collection must always be provided, so we are sure it's
199
  function sek_get_level_model( $id, $collection = array() ) {
200
  $_data = 'no_match';
201
  if ( ! is_array( $collection ) ) {
203
  return $_data;
204
  }
205
  foreach ( $collection as $level_data ) {
206
+ // stop here and return if a match was recursively found
207
  if ( 'no_match' != $_data )
208
  break;
209
  if ( array_key_exists( 'id', $level_data ) && $id === $level_data['id'] ) {
216
  }
217
  return $_data;
218
  }
219
+
220
+ // Recursive helper
221
+ // Typically used when ajaxing
222
+ // Is also used when building the dyn_css or when firing sek_add_css_rules_for_spacing()
223
+ // @param id : mandatory
224
+ // @param collection : optional <= that's why if missing we must walk all collections : local and global
225
  function sek_get_parent_level_model( $child_level_id = '', $collection = array(), $skope_id = '' ) {
226
  $_parent_level_data = 'no_match';
227
  if ( ! is_string( $child_level_id ) || empty( $child_level_id ) ) {
228
  sek_error_log( __FUNCTION__ . ' => missing or invalid child_level_id param.');
229
  return $_parent_level_data;
230
  }
231
+
232
+ // When no collection is provided, we must walk all collections, local and global.
233
  if ( empty( $collection ) ) {
234
  if ( empty( $skope_id ) ) {
235
  if ( is_array( $_POST ) && ! empty( $_POST['location_skope_id'] ) ) {
236
  $skope_id = $_POST['location_skope_id'];
237
  } else {
238
+ // When fired during an ajax 'customize_save' action, the skp_get_skope_id() is determined with $_POST['local_skope_id']
239
+ // @see add_filter( 'skp_get_skope_id', '\Nimble\sek_filter_skp_get_skope_id', 10, 2 );
240
  $skope_id = skp_get_skope_id();
241
  }
242
  }
252
  }
253
 
254
  foreach ( $collection as $level_data ) {
255
+ // stop here and return if a match was recursively found
256
  if ( 'no_match' !== $_parent_level_data )
257
  break;
258
  if ( array_key_exists( 'collection', $level_data ) && is_array( $level_data['collection'] ) ) {
259
  foreach ( $level_data['collection'] as $child_level_data ) {
260
  if ( array_key_exists( 'id', $child_level_data ) && $child_level_id == $child_level_data['id'] ) {
261
  $_parent_level_data = $level_data;
262
+ //match found, break this loop
263
  break;
264
  } else {
265
  $_parent_level_data = sek_get_parent_level_model( $child_level_id, $level_data['collection'], $skope_id );
269
  }
270
  return $_parent_level_data;
271
  }
272
+
273
+ // @return boolean
274
+ // Indicates if a section level contains at least on module
275
+ // Used in SEK_Front_Render::render() to maybe print a css class on the section level
276
  function sek_section_has_modules( $model, $has_module = null ) {
277
  $has_module = is_null( $has_module ) ? false : (bool)$has_module;
278
  foreach ( $model as $level_data ) {
279
+ // stop here and return if a match was recursively found
280
  if ( true === $has_module )
281
  break;
282
  if ( is_array( $level_data ) && array_key_exists( 'collection', $level_data ) && is_array( $level_data['collection'] ) ) {
283
  foreach ( $level_data['collection'] as $child_level_data ) {
284
  if ( 'module'== $child_level_data['level'] ) {
285
  $has_module = true;
286
+ //match found, break this loop
287
  break;
288
  } else {
289
  $has_module = sek_section_has_modules( $child_level_data, $has_module );
293
  }
294
  return $has_module;
295
  }
296
+
297
+
298
+ // Return the skope id in which a level will be rendered
299
+ // For that, walk the collections local and global to see if there's a match
300
+ // Fallback skope is local.
301
+ // used for example in the simple form module to print the hidden skope id, needed on submission.
302
+ // Recursive helper
303
+ // @param id : mandatory
304
+ // @param collection : optional <= that's why if missing we must walk all collections : local and global
305
  function sek_get_level_skope_id( $level_id = '' ) {
306
  $level_skope_id = skp_get_skope_id();
307
  if ( ! is_string( $level_id ) || empty( $level_id ) ) {
311
 
312
  $local_skope_settings = sek_get_skoped_seks( skp_get_skope_id() );
313
  $local_collection = ( is_array( $local_skope_settings ) && !empty( $local_skope_settings['collection'] ) ) ? $local_skope_settings['collection'] : array();
314
+ // if the level id has not been found in the local sections, we know it's a global level.
315
+ // In dev mode, always make sure that the level id is found in the global locations.
316
  if ( 'no_match' === sek_get_level_model( $level_id, $local_collection ) ) {
317
  $level_skope_id = NIMBLE_GLOBAL_SKOPE_ID;
318
  if ( sek_is_dev_mode() ) {
331
  /* ------------------------------------------------------------------------- *
332
  * HEADER FOOTER
333
  /* ------------------------------------------------------------------------- */
334
+ // fired by sek_maybe_set_local_nimble_footer() @get_footer()
335
+ // fired by sek_maybe_set_local_nimble_header() @get_header()
336
  function sek_page_uses_nimble_header_footer() {
337
+ // cache the properties if not done yet
338
  Nimble_Manager()->sek_maybe_set_nimble_header_footer();
339
  return true === Nimble_Manager()->has_local_header_footer || true === Nimble_Manager()->has_global_header_footer;
340
  }
344
  /* ------------------------------------------------------------------------- *
345
  * REGISTERED MODULES => GET PROPERTY
346
  /* ------------------------------------------------------------------------- */
347
+ // Helper
348
  function sek_get_registered_module_type_property( $module_type, $property = '' ) {
349
+ // check introduced since https://github.com/presscustomizr/nimble-builder/issues/432
350
+ // may not be mandatory
351
  if ( !class_exists('\Nimble\CZR_Fmk_Base') ) {
352
  sek_error_log( __FUNCTION__ . ' => error => CZR_Fmk_Base not loaded' );
353
  return;
354
  }
355
+ // registered modules
356
  $registered_modules = CZR_Fmk_Base()->registered_modules;
357
  if ( ! array_key_exists( $module_type, $registered_modules ) ) {
358
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' not registered.' );
370
  /* ------------------------------------------------------------------------- *
371
  * GET THE INPUT VALUE OF A GIVEN MODULE MODEL
372
  /* ------------------------------------------------------------------------- */
373
+ // Recursive helper
374
+ // Handles simple model and multidimensional module model ( father - children ), like
375
+ // Array
376
+ // (
377
+ // [quote_content] => Array
378
+ // (
379
+ // [quote_text] => Hey, careful, man, there's a beverage here!
380
+ // [quote_font_size_css] => Array
381
+ // (
382
+ // [desktop] => 29px
383
+ // [mobile] => 12px
384
+ // )
385
+
386
+ // [quote_letter_spacing_css] => 7
387
+ // [quote___flag_important] => 1
388
+ // )
389
+
390
+ // [cite_content] => Array
391
+ // (
392
+ // [cite_text] => The Dude in <a href="https://www.imdb.com/title/tt0118715/quotes/qt0464770" rel="nofollow noopener noreferrer" target="_blank">The Big Lebowski</a>
393
+ // [cite_font_style_css] => italic
394
+ // )
395
+
396
+ // [design] => Array
397
+ // (
398
+ // [quote_design] => border-before
399
+ // )
400
+ // )
401
+ // Helper
402
+ // @param $input_id ( string )
403
+ // @param $module_model ( array )
404
  function sek_get_input_value_in_module_model( $input_id, $module_model ) {
405
  if ( ! is_string( $input_id ) ) {
406
  sek_error_log( __FUNCTION__ . ' => error => the $input_id param should be a string', $module_model);
433
  /* ------------------------------------------------------------------------- *
434
  * REGISTERED MODULES => DEFAULT MODULE MODEL
435
  /* ------------------------------------------------------------------------- */
436
+ // @param (string) module_type
437
+ // Walk the registered modules tree and generates the module default if not already cached
438
+ // used :
439
+ // - in sek_normalize_module_value_with_defaults(), when preprocessing the module model before printing the module template. @see SEK_Front::render()
440
+ // - when setting the css of a level option. @see for example : sek_add_css_rules_for_bg_border_background()
441
+ // @return array()
442
  function sek_get_default_module_model( $module_type = '' ) {
443
  $default = array();
444
  if ( empty( $module_type ) || is_null( $module_type ) )
445
  return $default;
446
+
447
+ // check introduced since https://github.com/presscustomizr/nimble-builder/issues/432
448
+ // may not be mandatory
449
  if ( !class_exists('\Nimble\CZR_Fmk_Base') ) {
450
  sek_error_log( __FUNCTION__ . ' => error => CZR_Fmk_Base not loaded' );
451
  return $default;
452
  }
453
+
454
+ // Did we already cache it ?
455
  $default_models = Nimble_Manager()->default_models;
456
  if ( ! empty( $default_models[ $module_type ] ) ) {
457
  $default = $default_models[ $module_type ];
461
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' is not registered in the $CZR_Fmk_Base_fn()->registered_modules;' );
462
  return $default;
463
  }
464
+
465
+ // Is this module a father ?
466
  if ( !empty( $registered_modules[ $module_type ]['is_father'] ) && true === $registered_modules[ $module_type ]['is_father'] ) {
467
  if ( empty( $registered_modules[ $module_type ][ 'children' ] ) ) {
468
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' missing children modules' );
484
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' => missing "tmpl" property => impossible to build the default model.' );
485
  return $default;
486
  }
487
+ // Build
488
  $default = _sek_build_default_model( $registered_modules[ $module_type ][ 'tmpl' ] );
489
  }
490
+
491
+ // Cache
492
  $default_models[ $module_type ] = $default;
493
  Nimble_Manager()->default_models = $default_models;
494
+ //sek_error_log( __FUNCTION__ . ' => $default_models', $default_models );
495
  }
496
  return $default;
497
  }
498
+
499
+ // @return array() default model
500
+ // Walk recursively the 'tmpl' property of the module
501
+ // 'tmpl' => array(
502
+ // 'pre-item' => array(
503
+ // 'social-icon' => array(
504
+ // 'input_type' => 'select',
505
+ // 'title' => __('Select an icon', 'text_doma')
506
+ // ),
507
+ // ),
508
+ // 'mod-opt' => array(
509
+ // 'social-size' => array(
510
+ // 'input_type' => 'number',
511
+ // 'title' => __('Size in px', 'text_doma'),
512
+ // 'step' => 1,
513
+ // 'min' => 5,
514
+ // 'transport' => 'postMessage'
515
+ // )
516
+ // ),
517
+ // 'item-inputs' => array(
518
+ // 'item-inputs' => array(
519
+ // 'tabs' => array(
520
+ // array(
521
+ // 'title' => __('Content', 'text_doma'),
522
+ // //'attributes' => 'data-sek-device="desktop"',
523
+ // 'inputs' => array(
524
+ // 'content' => array(
525
+ // 'input_type' => 'detached_tinymce_editor',
526
+ // 'title' => __('Content', 'text_doma')
527
+ // ),
528
+ // 'h_alignment_css' => array(
529
+ // 'input_type' => 'h_text_alignment',
530
+ // 'title' => __('Alignment', 'text_doma'),
531
+ // 'default' => is_rtl() ? 'right' : 'left',
532
+ // 'refresh_markup' => false,
533
+ // 'refresh_stylesheet' => true
534
+ // )
535
+ // )
536
+ // )
537
+ // )
538
+ // )
539
  function _sek_build_default_model( $module_tmpl_data, $default_model = null ) {
540
  $default_model = is_array( $default_model ) ? $default_model : array();
541
+ //error_log( print_r( $module_tmpl_data , true ) );
542
  foreach( $module_tmpl_data as $key => $data ) {
543
  if ( 'pre-item' === $key )
544
  continue;
566
  /* ------------------------------------------------------------------------- *
567
  * REGISTERED MODULES => INPUT LIST
568
  /* ------------------------------------------------------------------------- */
569
+ // @param (string) module_type
570
+ // Walk the registered modules tree and generates the module input list if not already cached
571
+ // used :
572
+ // - when filtering 'sek_add_css_rules_for_input_id' @see Sek_Dyn_CSS_Builder::sek_css_rules_sniffer_walker()
573
+ // @return array()
574
  function sek_get_registered_module_input_list( $module_type = '' ) {
575
  $input_list = array();
576
  if ( empty( $module_type ) || is_null( $module_type ) )
577
  return $input_list;
578
+
579
+ // check introduced since https://github.com/presscustomizr/nimble-builder/issues/432
580
+ // may not be mandatory
581
  if ( !class_exists('\Nimble\CZR_Fmk_Base') ) {
582
  sek_error_log( __FUNCTION__ . ' => error => CZR_Fmk_Base not loaded' );
583
  return $input_list;
584
  }
585
+
586
+ // Did we already cache it ?
587
  $cached_input_lists = Nimble_Manager()->cached_input_lists;
588
  if ( ! empty( $cached_input_lists[ $module_type ] ) ) {
589
  $input_list = $cached_input_lists[ $module_type ];
590
  } else {
591
  $registered_modules = CZR_Fmk_Base()->registered_modules;
592
+ // sek_error_log( __FUNCTION__ . ' => registered_modules', $registered_modules );
593
  if ( ! array( $registered_modules ) || ! array_key_exists( $module_type, $registered_modules ) ) {
594
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' is not registered in the $CZR_Fmk_Base_fn()->registered_modules;' );
595
  return $input_list;
596
  }
597
+
598
+
599
+ // Is this module a father ?
600
  if ( !empty( $registered_modules[ $module_type ]['is_father'] ) && true === $registered_modules[ $module_type ]['is_father'] ) {
601
  if ( empty( $registered_modules[ $module_type ][ 'children' ] ) ) {
602
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' missing children modules' );
612
  sek_error_log( __FUNCTION__ . ' => ' . $mod_type . ' => missing "tmpl" property => impossible to build the master input_list.' );
613
  continue;
614
  }
615
+ // $temp[$opt_group] = _sek_build_input_list( $registered_modules[ $mod_type ][ 'tmpl' ] );
616
+ // $input_list = array_merge( $input_list, $temp[$opt_group] );
617
 
618
  $input_list[$opt_group] = _sek_build_input_list( $registered_modules[ $mod_type ][ 'tmpl' ] );
619
  }
622
  sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' => missing "tmpl" property => impossible to build the input_list.' );
623
  return $input_list;
624
  }
625
+ // Build
626
  $input_list = _sek_build_input_list( $registered_modules[ $module_type ][ 'tmpl' ] );
627
  }
628
+
629
+
630
+
631
+
632
+ // if ( empty( $registered_modules[ $module_type ][ 'tmpl' ] ) ) {
633
+ // sek_error_log( __FUNCTION__ . ' => ' . $module_type . ' => missing "tmpl" property => impossible to build the input_list.' );
634
+ // return $input_list;
635
+ // }
636
+
637
+ // // Build
638
+ // $input_list = _sek_build_input_list( $registered_modules[ $module_type ][ 'tmpl' ] );
639
+
640
+ // Cache
641
  $cached_input_lists[ $module_type ] = $input_list;
642
  Nimble_Manager()->cached_input_lists = $cached_input_lists;
643
+ // sek_error_log( __FUNCTION__ . ' => $cached_input_lists', $cached_input_lists );
644
  }
645
  return $input_list;
646
  }
647
+
648
+ // @return array() default model
649
+ // Walk recursively the 'tmpl' property of the module
650
+ // 'tmpl' => array(
651
+ // 'pre-item' => array(
652
+ // 'social-icon' => array(
653
+ // 'input_type' => 'select',
654
+ // 'title' => __('Select an icon', 'text_doma')
655
+ // ),
656
+ // ),
657
+ // 'mod-opt' => array(
658
+ // 'social-size' => array(
659
+ // 'input_type' => 'number',
660
+ // 'title' => __('Size in px', 'text_doma'),
661
+ // 'step' => 1,
662
+ // 'min' => 5,
663
+ // 'transport' => 'postMessage'
664
+ // )
665
+ // ),
666
+ // 'item-inputs' => array(
667
+ // 'item-inputs' => array(
668
+ // 'tabs' => array(
669
+ // array(
670
+ // 'title' => __('Content', 'text_doma'),
671
+ // //'attributes' => 'data-sek-device="desktop"',
672
+ // 'inputs' => array(
673
+ // 'content' => array(
674
+ // 'input_type' => 'detached_tinymce_editor',
675
+ // 'title' => __('Content', 'text_doma')
676
+ // ),
677
+ // 'h_alignment_css' => array(
678
+ // 'input_type' => 'h_text_alignment',
679
+ // 'title' => __('Alignment', 'text_doma'),
680
+ // 'default' => is_rtl() ? 'right' : 'left',
681
+ // 'refresh_markup' => false,
682
+ // 'refresh_stylesheet' => true
683
+ // )
684
+ // )
685
+ // )
686
+ // )
687
+ // )
688
+ // Build the input list from item-inputs and modop-inputs
689
  function _sek_build_input_list( $module_tmpl_data, $input_list = null ) {
690
  $input_list = is_array( $input_list ) ? $input_list : array();
691
+ //sek_error_log( '_sek_build_input_list', print_r( $module_tmpl_data , true ) );
692
  foreach( $module_tmpl_data as $key => $data ) {
693
  if ( 'pre-item' === $key )
694
  continue;
695
  if ( is_array( $data ) && array_key_exists( 'input_type', $data ) ) {
696
+ // each input_id of a module should be unique
697
  if ( array_key_exists( $key, $input_list ) ) {
698
  sek_error_log( __FUNCTION__ . ' => error => duplicated input_id found => ' . $key );
699
  } else {
719
  * preprocessing the module model before printing the module template.
720
  * used before rendering or generating css
721
  /* ------------------------------------------------------------------------- */
722
+ // @return array() $normalized_model
723
  function sek_normalize_module_value_with_defaults( $raw_module_model ) {
724
  $normalized_model = $raw_module_model;
725
  if ( empty( $normalized_model['module_type'] ) ) {
729
  $is_father = sek_get_registered_module_type_property( $module_type, 'is_father' );
730
 
731
  $raw_module_value = ( ! empty( $raw_module_model['value'] ) && is_array( $raw_module_model['value'] ) ) ? $raw_module_model['value'] : array();
732
+
733
+ // reset the model value and rewrite it normalized with the defaults
734
  $normalized_model['value'] = array();
735
  if ( $is_father ) {
736
  $children = sek_get_registered_module_type_property( $module_type, 'children' );
749
  } else {
750
  $normalized_model['value'] = _sek_normalize_single_module_values( $raw_module_value, $module_type );
751
  }
752
+ //sek_error_log('sek_normalize_single_module_values for module type ' . $module_type , $normalized_model );
753
  return $normalized_model;
754
  }
755
+
756
+ // @return array()
757
  function _sek_normalize_single_module_values( $raw_module_value, $module_type ) {
758
  $default_value_model = sek_get_default_module_model( $module_type );//<= walk the registered modules tree and generates the module default if not already cached
759
+
760
+ // reset the model value and rewrite it normalized with the defaults
761
  $module_values = array();
762
  if ( czr_is_multi_item_module( $module_type ) ) {
763
  foreach ( $raw_module_value as $item ) {
777
  * HELPER FOR CHECKBOX OPTIONS
778
  /* ------------------------------------------------------------------------- */
779
  function sek_is_checked( $val ) {
780
+ //cast to string if array
781
  $val = is_array($val) ? $val[0] : $val;
782
  return sek_booleanize_checkbox_val( $val );
783
  }
808
  /* ------------------------------------------------------------------------- *
809
  * LOCAL OPTIONS HELPERS
810
  /* ------------------------------------------------------------------------- */
811
+ // @return mixed null || string
812
  function sek_get_locale_template(){
813
  $path = null;
814
  $local_template_data = sek_get_local_option_value( 'template' );
824
  }
825
  return $path;
826
  }
827
+
828
+
829
+ // @param $option_name = string
830
+ // 'nimble_front_classes_ready' is fired when Nimble_Manager() is instanciated
831
  function sek_get_local_option_value( $option_name = '', $skope_id = null ) {
832
  if ( empty($option_name) ) {
833
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
836
  if ( !skp_is_customizing() && did_action('nimble_front_classes_ready') && '_not_cached_yet_' !== Nimble_Manager()->local_options ) {
837
  $local_options = Nimble_Manager()->local_options;
838
  } else {
839
+ // use the provided skope_id if in the signature
840
  $skope_id = ( !empty( $skope_id ) && is_string( $skope_id ))? $skope_id : skp_get_skope_id();
841
  $localSkopeNimble = sek_get_skoped_seks( skp_get_skope_id() );
842
  $local_options = ( is_array( $localSkopeNimble ) && !empty( $localSkopeNimble['local_options'] ) && is_array( $localSkopeNimble['local_options'] ) ) ? $localSkopeNimble['local_options'] : array();
843
+ // Cache only after 'wp' && 'nimble_front_classes_ready'
844
+ // never cache when doing ajax
845
  if ( did_action('nimble_front_classes_ready') && did_action('wp') && !defined('DOING_AJAX') ) {
846
  Nimble_Manager()->local_options = $local_options;
847
  }
848
  }
849
+ // maybe normalizes with default values
850
  $values = ( ! empty( $local_options ) && ! empty( $local_options[ $option_name ] ) ) ? $local_options[ $option_name ] : null;
851
  if ( did_action('nimble_front_classes_ready') ) {
852
  $values = sek_normalize_local_options_with_defaults( $option_name, $values );
853
  }
854
  return $values;
855
  }
856
+
857
+
858
+ // @return array() $normalized_values
859
+ // @see _1_6_4_sektions_generate_UI_local_skope_options.js
860
  function sek_normalize_local_options_with_defaults( $option_name, $raw_module_values ) {
861
  if ( empty($option_name) ) {
862
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
863
  return array();
864
  }
865
  $normalized_values = ( !empty($raw_module_values) && is_array( $raw_module_values ) ) ? $raw_module_values : array();
866
+ // map the option key as saved in db ( @see _1_6_4_sektions_generate_UI_local_skope_options.js ) and the module type
867
  $local_option_map = SEK_Front_Construct::$local_options_map;
868
 
869
  if ( !array_key_exists($option_name, $local_option_map) ) {
872
  } else {
873
  $module_type = $local_option_map[$option_name];
874
  }
875
+
876
+ // normalize with the defaults
877
+ // class_exists check introduced since https://github.com/presscustomizr/nimble-builder/issues/432
878
+ // may not be mandatory
879
  if ( class_exists('\Nimble\CZR_Fmk_Base') ) {
880
  if( CZR_Fmk_Base()->czr_is_module_registered($module_type) ) {
881
  $normalized_values = _sek_normalize_single_module_values( $normalized_values, $module_type );
888
  /* ------------------------------------------------------------------------- *
889
  * GLOBAL OPTIONS HELPERS
890
  /* ------------------------------------------------------------------------- */
891
+ // @param $option_name = string
892
+ // 'nimble_front_classes_ready' is fired when Nimble_Manager() is instanciated
893
  function sek_get_global_option_value( $option_name = '' ) {
894
  if ( empty($option_name) ) {
895
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
899
  $global_nimble_options = Nimble_Manager()->global_nimble_options;
900
  } else {
901
  $global_nimble_options = get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
902
+ //sek_error_log(' SOOO OPTIONS ?', $global_nimble_options );
903
+ // cache when nimble is ready
904
+ // this hook is fired when Nimble_Manager() is instanciated
905
+ // never cache when doing ajax
906
  if ( did_action('nimble_front_classes_ready') && !defined('DOING_AJAX') ) {
907
  Nimble_Manager()->global_nimble_options = $global_nimble_options;
908
  }
909
  }
910
+ // maybe normalizes with default values
911
  $values = ( is_array( $global_nimble_options ) && !empty( $global_nimble_options[ $option_name ] ) ) ? $global_nimble_options[ $option_name ] : null;
912
  if ( did_action('nimble_front_classes_ready') ) {
913
  $values = sek_normalize_global_options_with_defaults( $option_name, $values );
914
  }
915
  return $values;
916
  }
917
+
918
+
919
+
920
+ // @see _1_6_5_sektions_generate_UI_global_options.js
921
+ // @return array() $normalized_values
922
  function sek_normalize_global_options_with_defaults( $option_name, $raw_module_values ) {
923
  if ( empty($option_name) ) {
924
  sek_error_log( __FUNCTION__ . ' => invalid option name' );
925
  return array();
926
  }
927
  $normalized_values = ( !empty($raw_module_values) && is_array( $raw_module_values ) ) ? $raw_module_values : array();
928
+ // map the option key as saved in db ( @see _1_6_5_sektions_generate_UI_global_options.js ) and the module type
929
  $global_option_map = SEK_Front_Construct::$global_options_map;
930
 
931
+ //sek_error_log('SEK_Front_Construct::$global_options_map', SEK_Front_Construct::$global_options_map );
932
+
933
  if ( !array_key_exists($option_name, $global_option_map) ) {
934
  sek_error_log( __FUNCTION__ . ' => invalid option name', $option_name );
935
  return $raw_module_values;
936
  } else {
937
  $module_type = $global_option_map[$option_name];
938
  }
939
+
940
+ // normalize with the defaults
941
+ // class_exists check introduced since https://github.com/presscustomizr/nimble-builder/issues/432
942
+ // may not be mandatory
943
  if ( class_exists('\Nimble\CZR_Fmk_Base') ) {
944
  if( CZR_Fmk_Base()->czr_is_module_registered($module_type) ) {
945
  $normalized_values = _sek_normalize_single_module_values( $normalized_values, $module_type );
965
 
966
  return intval( $global_breakpoint_data['global-custom-breakpoint'] );
967
  }
968
+
969
+ // invoked when filtering 'sek_add_css_rules_for__section__options'
970
  function sek_get_section_custom_breakpoint( $section ) {
971
  if ( ! is_array( $section ) )
972
  return;
997
  /* ------------------------------------------------------------------------- *
998
  * FRONT ASSET SNIFFERS
999
  /* ------------------------------------------------------------------------- */
1000
+ // @return bool
1001
+ // some modules uses font awesome :
1002
+ // Fired in 'wp_enqueue_scripts' to check if font awesome is needed
1003
  function sek_front_needs_font_awesome( $bool = false, $recursive_data = null ) {
1004
  if ( !$bool ) {
1005
  if ( is_null( $recursive_data ) ) {
1024
  }
1025
  return $bool;
1026
  }
1027
+
1028
+ // @return bool
1029
+ // used to print reCaptcha js for the form module
1030
  function sek_front_sections_include_a_form( $bool = false, $recursive_data = null ) {
1031
  if ( !$bool ) {
1032
  if ( is_null( $recursive_data ) ) {
1049
  }
1050
  return $bool;
1051
  }
1052
+
1053
+ // @return bool
1054
+ // Fired in 'wp_enqueue_scripts'
1055
+ // Recursively sniff the local and global sections to find a 'img-lightbox' string
1056
+ // @see sek_get_module_params_for_czr_image_main_settings_child
1057
  function sek_front_needs_magnific_popup( $bool = false, $recursive_data = null ) {
1058
  if ( !$bool ) {
1059
  if ( is_null( $recursive_data ) ) {
1066
  }
1067
 
1068
  foreach ($recursive_data as $key => $value) {
1069
+ // @see sek_get_module_params_for_czr_image_main_settings_child
1070
  if ( is_string( $value ) && 'img-lightbox' === $value ) {
1071
  $bool = true;
1072
  break;
1085
  /* ------------------------------------------------------------------------- *
1086
  * IMAGE HELPER
1087
  /* ------------------------------------------------------------------------- */
1088
+ // @see https://codex.wordpress.org/Function_Reference/get_intermediate_image_sizes
1089
+ // used in sek_get_select_options_for_input_id()
1090
  function sek_get_img_sizes() {
1091
  global $_wp_additional_image_sizes;
1092
 
1104
  $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
1105
  $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
1106
  $sizes[ $_size ]['title'] = $first_to_upper_size;
1107
+ //$sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
1108
  } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1109
  $sizes[ $_size ] = array(
1110
  'width' => $_wp_additional_image_sizes[ $_size ]['width'],
1111
  'height' => $_wp_additional_image_sizes[ $_size ]['height'],
1112
  'title' => $first_to_upper_size
1113
+ //'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
1114
  );
1115
  }
1116
  }
1154
  );
1155
  }
1156
  }
1157
+
1158
+
1159
+ // @return boolean
1160
+ // img smartload can be set globally with 'global-img-smart-load' and locally with 'local-img-smart-load'
1161
+ // the local option wins
1162
+ // if local is set to inherit, return the global option
1163
+ // This option is cached
1164
+ // deactivated when customizing
1165
  function sek_is_img_smartload_enabled() {
1166
  if ( skp_is_customizing() )
1167
  return false;
1169
  return Nimble_Manager()->img_smartload_enabled;
1170
  }
1171
  $is_img_smartload_enabled = false;
1172
+ // LOCAL OPTION
1173
+ // we use the ajaxily posted skope_id when available <= typically in a customizing ajax action 'sek-refresh-stylesheet'
1174
+ // otherwise we fallback on the normal utility skp_build_skope_id()
1175
  $local_performances_data = sek_get_local_option_value( 'local_performances' );
1176
  $local_smartload = 'inherit';
1177
  if ( !is_null( $local_performances_data ) && is_array( $local_performances_data ) ) {
1183
  if ( 'inherit' !== $local_smartload ) {
1184
  $is_img_smartload_enabled = $local_smartload;
1185
  } else {
1186
+ // GLOBAL OPTION
1187
  $glob_performances_data = sek_get_global_option_value( 'performances' );
1188
  if ( !is_null( $glob_performances_data ) && is_array( $glob_performances_data ) && !empty( $glob_performances_data['global-img-smart-load'] ) ) {
1189
  $is_img_smartload_enabled = sek_booleanize_checkbox_val( $glob_performances_data['global-img-smart-load'] );
1190
  }
1191
  }
1192
+
1193
+ // CACHE THE OPTION
1194
  Nimble_Manager()->img_smartload_enabled = $is_img_smartload_enabled;
1195
 
1196
  return Nimble_Manager()->img_smartload_enabled;
1200
  /* ------------------------------------------------------------------------- *
1201
  * reCAPTCHA HELPER
1202
  /* ------------------------------------------------------------------------- */
1203
+ // @return boolean
1204
+ // reCaptcha is enabled globally
1205
+ // deactivated when customizing
1206
  function sek_is_recaptcha_globally_enabled() {
1207
  if ( did_action('nimble_front_classes_ready') && '_not_cached_yet_' !== Nimble_Manager()->recaptcha_enabled ) {
1208
  return Nimble_Manager()->recaptcha_enabled;
1214
  if ( !is_null( $glob_recaptcha_opts ) && is_array( $glob_recaptcha_opts ) && !empty( $glob_recaptcha_opts['enable'] ) ) {
1215
  $recaptcha_enabled = sek_booleanize_checkbox_val( $glob_recaptcha_opts['enable'] ) && !empty( $glob_recaptcha_opts['public_key'] ) && !empty($glob_recaptcha_opts['private_key'] );
1216
  }
1217
+
1218
+ // CACHE when not doing ajax
1219
  if ( !defined( 'DOING_AJAX') || true !== DOING_AJAX ) {
1220
  Nimble_Manager()->recaptcha_enabled = $recaptcha_enabled;
1221
  }
1222
 
1223
  return $recaptcha_enabled;
1224
  }
1225
+
1226
+ // @return boolean
1227
+ // reCaptcha is enabled globally
1228
+ // deactivated when customizing
1229
  function sek_is_recaptcha_badge_globally_displayed() {
1230
  if ( did_action('nimble_front_classes_ready') && '_not_cached_yet_' !== Nimble_Manager()->recaptcha_badge_displayed ) {
1231
  return Nimble_Manager()->recaptcha_badge_displayed;
1237
  if ( !is_null( $glob_recaptcha_opts ) && is_array( $glob_recaptcha_opts ) && !empty( $glob_recaptcha_opts['badge'] ) ) {
1238
  $display_badge = sek_booleanize_checkbox_val( $glob_recaptcha_opts['badge'] ) && sek_is_recaptcha_globally_enabled();
1239
  }
1240
+
1241
+ // CACHE when not doing ajax
1242
  if ( !defined( 'DOING_AJAX') || true !== DOING_AJAX ) {
1243
  Nimble_Manager()->recaptcha_badge_displayed = $display_badge;
1244
  }
1257
  */
1258
  function sek_user_started_before_version( $requested_version ) {
1259
  $started_with = get_option( 'nimble_started_with_version' );
1260
+ //the transient is set in HU_utils::hu_init_properties()
1261
  if ( ! $started_with )
1262
  return false;
1263
 
1266
 
1267
  return version_compare( $started_with , $requested_version, '<' );
1268
  }
1269
+
1270
+
1271
+ // Filter the local skope id when invoking skp_get_skope_id in a customize_save ajax action
1272
  add_filter( 'skp_get_skope_id', '\Nimble\sek_filter_skp_get_skope_id', 10, 2 );
1273
  function sek_filter_skp_get_skope_id( $skope_id, $level ) {
1274
+ // When ajaxing, @see the js callback on 'save-request-params', core hooks for the save query
1275
+ // api.bind('save-request-params', function( query ) {
1276
+ // $.extend( query, { local_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ) } );
1277
+ // });
1278
+ // implemented to fix : https://github.com/presscustomizr/nimble-builder/issues/242
1279
  if ( 'local' === $level && is_array( $_POST ) && ! empty( $_POST['local_skope_id'] ) && 'customize_save' === $_POST['action'] ) {
1280
  $skope_id = $_POST['local_skope_id'];
1281
  }
1286
  /* ------------------------------------------------------------------------- *
1287
  * HAS USER STARTED CREATING SECTIONS ?
1288
  /* ------------------------------------------------------------------------- */
1289
+ // @return a boolean
1290
+ // Used to check if we should render the welcome notice in sek_render_welcome_notice()
1291
  function sek_site_has_nimble_sections_created() {
1292
  $sek_post_query_vars = array(
1293
  'post_type' => NIMBLE_CPT,
1294
  'post_status' => get_post_stati(),
1295
+ //'name' => sanitize_title( NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id ),
1296
  'posts_per_page' => -1,
1297
  'no_found_rows' => true,
1298
  'cache_results' => true,
1301
  'lazy_load_term_meta' => false,
1302
  );
1303
  $query = new \WP_Query( $sek_post_query_vars );
1304
+ //sek_error_log('DO WE HAVE SECTIONS ?', $query );
1305
  return is_array( $query->posts ) && ! empty( $query->posts );
1306
  }
1307
 
1348
  error_log( '</' . $title . '>' );
1349
  }
1350
  }
1351
+
1352
+
1353
+ // DEPRECATED SINCE Nimble v1.3.0, november 2018
1354
+ // was used in the Hueman theme before version 3.4.9
1355
  function render_content_sections_for_nimble_template() {
1356
  Nimble_Manager()->render_nimble_locations(
1357
  array_keys( Nimble_Manager()->default_locations ),//array( 'loop_start', 'before_content', 'after_content', 'loop_end'),
1375
  $args = apply_filters( 'wp_page_menu_args', $args );
1376
  $menu = '';
1377
  $list_args = $args;
1378
+
1379
+ // Show Home in the menu
1380
  if ( ! empty($args['show_home']) ) {
1381
  if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) {
1382
  $text = __('Home' , 'nimble-builder');
1388
  $class = 'class="current_page_item"';
1389
  }
1390
  $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
1391
+ // If the front page is a page, add it to the exclude list
1392
  if (get_option('show_on_front') == 'page') {
1393
  if ( !empty( $list_args['exclude'] ) ) {
1394
  $list_args['exclude'] .= ',';
1401
 
1402
  $list_args['echo'] = false;
1403
  $list_args['title_li'] = '';
1404
+
1405
+ // limit the number of pages displayed, home excluded from the count if included
1406
  $list_args['number'] = 4;
1407
 
1408
  $menu .= str_replace( array( "\r", "\n", "\t" ), '', sek_list_pages( $list_args ) );
1409
+ // if ( $menu )
1410
+ // $menu = '<ul>' . $menu . '</ul>';
1411
+ //$menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n";
1412
  if ( $menu ) {
1413
  $menu = '<ul class="' . esc_attr( $args['menu_class'] ) . '">' . $menu . '</ul>';
1414
  }
1415
+
1416
+ //$menu = apply_filters( 'wp_page_menu', $menu, $args );
1417
  if ( $args['echo'] )
1418
  echo $menu;
1419
  else
1442
  $r = wp_parse_args( $args, $defaults );
1443
  $output = '';
1444
  $current_page = 0;
1445
+ // sanitize, mostly to keep spaces out
1446
  $r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] );
1447
+ // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)
1448
  $exclude_array = ( $r['exclude'] ) ? explode( ',', $r['exclude'] ) : array();
1449
  $r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
1450
+ // Query pages.
1451
  $r['hierarchical'] = 0;
1452
  $pages = get_pages( $r );
1453
  if ( ! empty( $pages ) ) {
1485
  * @see Walker_Page::walk() for parameters and return description.
1486
  */
1487
  function sek_walk_page_tree( $pages, $depth, $current_page, $r ) {
1488
+ // if ( empty($r['walker']) )
1489
+ // $walker = new Walker_Page;
1490
+ // else
1491
+ // $walker = $r['walker'];
1492
  $walker = new \Walker_Page;
1493
  foreach ( (array) $pages as $page ) {
1494
  if ( $page->post_parent ) {
1500
  }
1501
 
1502
  function sek_get_user_created_menus() {
1503
+ // if ( ! skp_is_customizing() )
1504
+ // return array();
1505
  $all_menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
1506
  $user_menus = array();
1507
  foreach ( $all_menus as $menu_obj ) {
1509
  $user_menus[ $menu_obj->slug ] = $menu_obj->name;
1510
  }
1511
  }
1512
+ // sek_error_log( 'sek_get_user_created_menus', array_merge(
1513
+ // array( 'nimble_page_menu' => __('Default page menu', 'text_domain_to_replace') )
1514
+ // , $user_menus ) );
1515
  return array_merge(
1516
  array( 'nimble_page_menu' => __('Default page menu', 'nimble-builder') )
1517
  , $user_menus );
1521
  /* ------------------------------------------------------------------------- *
1522
  * Nimble Widgets Areas
1523
  /* ------------------------------------------------------------------------- */
1524
+ // @return the list of Nimble registered widget areas
1525
  function sek_get_registered_widget_areas() {
1526
  global $wp_registered_sidebars;
1527
  $widget_areas = array();
1535
  }
1536
  return $widget_areas;
1537
  }
1538
+ // @return bool
1539
+ // @ param $id string
1540
  function sek_is_nimble_widget_id( $id ) {
1541
+ // NIMBLE_WIDGET_PREFIX = nimble-widget-area-
1542
  return NIMBLE_WIDGET_PREFIX === substr( $id, 0, strlen( NIMBLE_WIDGET_PREFIX ) );
1543
  }
1544
 
1564
  }
1565
  return null;
1566
  }
1567
+ // fired @filter 'nimble_parse_template_tags'
1568
  function sek_parse_template_tags( $val ) {
1569
+ //the pattern could also be '!\{\{(\w+)\}\}!', but adding \s? allows us to allow spaces around the term inside curly braces
1570
+ //see https://stackoverflow.com/questions/959017/php-regex-templating-find-all-occurrences-of-var#comment71815465_959026
1571
  return is_string( $val ) ? preg_replace_callback( '!\{\{\s?(\w+)\s?\}\}!', '\Nimble\sek_find_pattern_match', $val) : $val;
1572
  }
1573
  add_filter( 'nimble_parse_template_tags', '\Nimble\sek_parse_template_tags' );
1576
  /* ------------------------------------------------------------------------- *
1577
  * Beta Features
1578
  /* ------------------------------------------------------------------------- */
1579
+ // December 2018 => preparation of the header / footer feature
1580
+ // The beta features can be control by a constant
1581
+ // and by a global option
1582
  function sek_is_header_footer_enabled() {
1583
  $global_beta_feature = sek_get_global_option_value( 'beta_features');
1584
  if ( is_array( $global_beta_feature ) && array_key_exists('beta-enabled', $global_beta_feature ) ) {
1597
  /* ------------------------------------------------------------------------- *
1598
  * OTHER HELPERS
1599
  /* ------------------------------------------------------------------------- */
1600
+ // @return a bool
1601
+ // typically when
1602
+ // previewing a changeset on front with a link generated in the publish menu of the customizer
1603
+ // looking like : mysite.com/?customize_changeset_uuid=67862e7f-427c-4183-b3f7-62eb86f79899
1604
+ // in this case the $_REQUEST super global, doesn't include a customize_messenger_channel paral
1605
+ // added when fixing https://github.com/presscustomizr/nimble-builder/issues/351
1606
  function sek_is_customize_previewing_a_changeset_post() {
1607
  return !( defined('DOING_AJAX') && DOING_AJAX ) && is_customize_preview() && !isset( $_REQUEST['customize_messenger_channel']);
1608
  }
1612
  /* ------------------------------------------------------------------------- *
1613
  * MODULES
1614
  /* ------------------------------------------------------------------------- */
1615
+ // introduced when implementing the level tree #359
1616
  function sek_get_module_collection() {
1617
  return array(
1618
  array(
1722
  'active' => sek_is_header_footer_enabled()
1723
  ),
1724
 
1725
+ // array(
1726
+ // 'content-type' => 'module',
1727
+ // 'content-id' => 'czr_special_img_module',
1728
+ // 'title' => __( 'Nimble Image', 'text_doma' ),
1729
+ // 'font_icon' => '<i class="material-icons">all_out</i>',
1730
+ // 'active' => sek_is_pro()
1731
+ // )
1732
+ // array(
1733
+ // 'content-type' => 'module',
1734
+ // 'content-id' => 'czr_featured_pages_module',
1735
+ // 'title' => __( 'Featured pages', 'text_doma' ),
1736
+ // 'icon' => 'Nimble__featured_icon.svg'
1737
+ // ),
1738
+
1739
 
1740
  );
1741
  }
1742
+
1743
+ // @return string theme name
1744
+ // always return the parent theme name
1745
  function sek_get_parent_theme_slug() {
1746
  $theme_slug = get_option( 'stylesheet' );
1747
+ // $_REQUEST['theme'] is set both in live preview and when we're customizing a non active theme
1748
  $theme_slug = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : $theme_slug; //old wp versions
1749
  $theme_slug = isset($_REQUEST['customize_theme']) ? $_REQUEST['customize_theme'] : $theme_slug;
1750
+
1751
+ //gets the theme name (or parent if child)
1752
  $theme_data = wp_get_theme( $theme_slug );
1753
  if ( $theme_data -> parent() ) {
1754
  $theme_slug = $theme_data -> parent() -> Name;
1756
 
1757
  return sanitize_file_name( strtolower( $theme_slug ) );
1758
  }
1759
+
1760
+
1761
+
1762
+
1763
+
1764
+
1765
+ // /* ------------------------------------------------------------------------- *
1766
+ // * FEEDBACK NOTIF
1767
+ // /* ------------------------------------------------------------------------- */
1768
+ // Invoked when generating the customizer localized js params 'sektionsLocalizedData'
1769
  function sek_get_feedback_notif_status() {
1770
  if ( sek_feedback_notice_is_dismissed() )
1771
  return;
1772
  if ( sek_feedback_notice_is_postponed() )
1773
  return;
1774
  $start_version = get_option( 'nimble_started_with_version', NIMBLE_VERSION );
1775
+ //sek_error_log('START VERSION ?' . $start_version, version_compare( $start_version, '1.6.0', '<=' ) );
1776
+
1777
+ // Bail if user did not start before 1.6.0
1778
  if ( ! version_compare( $start_version, '1.6.0', '<=' ) )
1779
  return;
1780
 
1781
  $sek_post_query_vars = array(
1782
  'post_type' => NIMBLE_CPT,
1783
  'post_status' => get_post_stati(),
1784
+ //'name' => sanitize_title( NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id ),
1785
  'posts_per_page' => -1,
1786
  'no_found_rows' => true,
1787
  'cache_results' => true,
1795
 
1796
  $customized_pages = 0;
1797
  $nb_section_created = 0;
1798
+ // the global var is easier to handle for array when populated recursively
1799
  global $modules_used;
1800
  $module_used = array();
1801
 
1811
  return;
1812
 
1813
  $modules_used = array_unique($modules_used);
1814
+
1815
+ // sek_error_log('$section_created ??', $nb_section_created );
1816
+ // sek_error_log('$modules_used ?? ' . count($modules_used), $modules_used );
1817
+ // sek_error_log('$customized_pages ??', $customized_pages );
1818
+ //version_compare( $this->wp_version, '4.1', '>=' )
1819
  return $customized_pages > 0 && $nb_section_created > 3 && count($modules_used) > 3;
1820
  }
1821
+
1822
+ // recursive helper to count the number of sections in a given set of sections data
1823
  function sek_count_not_empty_sections_in_page( $seks_data, $count = 0 ) {
1824
  if ( ! is_array( $seks_data ) ) {
1825
  sek_error_log( __FUNCTION__ . ' => invalid seks_data param');
1838
  }
1839
  return $count;
1840
  }
1841
+
1842
+ // recursive helper to generate a list of module used in a given set of sections data
1843
  function sek_populate_list_of_modules_used( $seks_data ) {
1844
  global $modules_used;
1845
  if ( ! is_array( $seks_data ) ) {
1851
  if ( !empty( $data['level'] ) && 'module' === $data['level'] && !empty( $data['module_type'] ) ) {
1852
  $modules_used[] = $data['module_type'];
1853
  } else {
1854
+ //$modules_used = array_merge( $modules_used, sek_populate_list_of_modules_used( $data, $modules_used ) );
1855
  sek_populate_list_of_modules_used( $data, $modules_used );
1856
  }
1857
  }
1863
  $dismissed_array = array_filter( explode( ',', (string) $dismissed ) );
1864
  return in_array( NIMBLE_FEEDBACK_NOTICE_ID, $dismissed_array );
1865
  }
1866
+
1867
+ // @uses get_user_meta( get_current_user_id(), 'nimble_user_transients', true );
1868
+ // populated in ajax class
1869
  function sek_feedback_notice_is_postponed() {
1870
  return 'maybe_later' === get_transient( NIMBLE_FEEDBACK_NOTICE_ID );
1871
  }
1872
+
1873
+
1874
+
1875
+ // /* ------------------------------------------------------------------------- *
1876
+ // * HELPERS FOR ADMIN AND API TO DETERMINE / CHECK CURRENT THEME NAME
1877
+ // /* ------------------------------------------------------------------------- */
1878
+ // @return bool
1879
  function sek_is_presscustomizr_theme( $theme_name ) {
1880
  $bool = false;
1881
  if ( is_string( $theme_name ) ) {
1882
  foreach ( ['customizr', 'hueman'] as $pc_theme ) {
1883
+ // handle the case when the theme name looks like customizr-4.1.29
1884
  if ( !$bool && $pc_theme === substr( $theme_name, 0, strlen($pc_theme) ) ) {
1885
  $bool = true;
1886
  }
1888
  }
1889
  return $bool;
1890
  }
1891
+
1892
+ // @return the theme name string, exact if customizr or hueman
1893
  function sek_maybe_get_presscustomizr_theme_name( $theme_name ) {
1894
  if ( is_string( $theme_name ) ) {
1895
  foreach ( ['customizr', 'hueman'] as $pc_theme ) {
1896
+ // handle the case when the theme name looks like customizr-4.1.29
1897
  if ( $pc_theme === substr( $theme_name, 0, strlen($pc_theme) ) ) {
1898
  $theme_name = $pc_theme;
1899
  }
1901
  }
1902
  return $theme_name;
1903
  }
1904
+
1905
+
1906
+
1907
+
1908
+
1909
+ // /* ------------------------------------------------------------------------- *
1910
+ // * IMPORT IMAGE IF NOT ALREADY IN MEDIA LIB
1911
+ // /* ------------------------------------------------------------------------- */
1912
+ // @return attachment id or WP_Error
1913
+ // this method uses download_url()
1914
+ // it first checks if the media already exists in the media library
1915
  function sek_sideload_img_and_return_attachment_id( $img_url ) {
1916
+ // Set variables for storage, fix file filename for query strings.
1917
  preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $img_url, $matches );
1918
  $filename = basename( $matches[0] );
1919
+ // prefix with nimble_asset_ if not done yet
1920
+ // for example, when importing a file, the img might already have the nimble_asset_ prefix if it's been uploaded by Nimble
1921
  if ( 'nimble_asset_' !== substr($filename, 0, strlen('nimble_asset_') ) ) {
1922
  $filename = 'nimble_asset_' . $filename;
1923
  }
1924
+
1925
+ // remove the extension
1926
  $img_title = preg_replace( '/\.[^.]+$/', '', trim( $filename ) );
1927
+
1928
+ //sek_error_log( __FUNCTION__ . ' ALORS img_title?', preg_replace( '/\.[^.]+$/', '', trim( $img_title ) ) );
1929
+
1930
+ // Make sure this img has not already been uploaded
1931
+ // Meta query on the alt property, better than the title
1932
+ // because of https://github.com/presscustomizr/nimble-builder/issues/435
1933
  $args = array(
1934
  'posts_per_page' => 1,
1935
  'post_type' => 'attachment',
1936
  'post_status' => 'inherit',
1937
+ //'name' => $img_title,
1938
  'meta_query' => array(
1939
  array(
1940
  'key' => '_wp_attachment_image_alt',
1944
  ),
1945
  );
1946
  $get_attachment = new \WP_Query( $args );
1947
+
1948
+ //error_log( print_r( $get_attachment->posts, true ) );
1949
  if ( is_array( $get_attachment->posts ) && array_key_exists(0, $get_attachment->posts) ) {
1950
+ //wp_send_json_error( __CLASS__ . '::' . __CLASS__ . '::' . __FUNCTION__ . ' => file already uploaded : ' . $relative_path );
1951
  $img_id_already_uploaded = $get_attachment->posts[0] -> ID;
1952
  }
1953
+ // stop now and return the id if the attachment was already uploaded
1954
  if ( isset($img_id_already_uploaded) ) {
1955
+ //sek_error_log( __FUNCTION__ . ' ALREADY UPLOADED ?', $img_id_already_uploaded );
1956
  return $img_id_already_uploaded;
1957
  }
1958
+
1959
+ // Insert the media
1960
+ // Prepare the file_array that we will pass to media_handle_sideload()
1961
  $file_array = array();
1962
  $file_array['name'] = $filename;
1963
+
1964
+ // Download file to temp location.
1965
  $file_array['tmp_name'] = download_url( $img_url );
1966
+
1967
+ // If error storing temporarily, return the error.
1968
  if ( is_wp_error( $file_array['tmp_name'] ) ) {
1969
  return $file_array['tmp_name'];
1970
  }
1971
+
1972
+ // Do the validation and storage stuff.
1973
  $id = media_handle_sideload( $file_array, 0 );
1974
+
1975
+ // If error storing permanently, unlink.
1976
  if ( is_wp_error( $id ) ) {
1977
  @unlink( $file_array['tmp_name'] );
1978
  } else {
1979
+ // Store the title as image alt property
1980
+ // so we can identify it uniquely next time when checking if already uploaded
1981
+ // of course, if the alt property has been manually modified meanwhile, the image will be loaded again
1982
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/435
1983
  add_post_meta( $id, '_wp_attachment_image_alt', $img_title, true );
1984
  }
1985
 
1987
  }
1988
  ?><?php
1989
  namespace Nimble;
1990
+ // /* ------------------------------------------------------------------------- *
1991
+ // * NIMBLE API
1992
+ // /* ------------------------------------------------------------------------- */
1993
  if ( !defined( "NIMBLE_SECTIONS_LIBRARY_OPT_NAME" ) ) { define( "NIMBLE_SECTIONS_LIBRARY_OPT_NAME", 'nimble_api_prebuilt_sections_data' ); }
1994
  if ( !defined( "NIMBLE_NEWS_OPT_NAME" ) ) { define( "NIMBLE_NEWS_OPT_NAME", 'nimble_api_news_data' ); }
1995
+ // NIMBLE_DATA_API_URL_V2 SINCE MAY 21ST 2019
1996
+ // after problem was reported when fetching data remotely : https://github.com/presscustomizr/nimble-builder/issues/445
1997
+ // DOES NOT RETURN THE DATA FOR PRESET SECTIONS
1998
+ // if ( !defined( "NIMBLE_DATA_API_URL" ) ) { define( "NIMBLE_DATA_API_URL", 'https://api.nimblebuilder.com/wp-json/nimble/v1/cravan' ); }
1999
+ if ( !defined( "NIMBLE_DATA_API_URL_V2" ) ) { define( "NIMBLE_DATA_API_URL_V2", 'https://api.nimblebuilder.com/wp-json/nimble/v2/cravan' ); }
2000
+
2001
+ // Nimble api returns a set of value structured as follow
2002
+ // return array(
2003
+ // 'timestamp' => time(),
2004
+ // 'upgrade_notice' => array(),
2005
+ // 'library' => array(
2006
+ // 'sections' => array(
2007
+ // 'registration_params' => sek_get_sections_registration_params(),
2008
+ // 'json_collection' => sek_get_json_collection()
2009
+ // ),
2010
+ // 'templates' => array()
2011
+ // ),
2012
+ // 'latest_posts' => $post_data,
2013
+ // 'cta' => array( 'started_before' => $go_pro_if_started_before, 'html' => $go_pro_html )
2014
+ // // 'testtest' => $_GET,
2015
+ // // 'testreferer' => $_SERVER => to get the
2016
+ // );
2017
+ // @return array|false Info data, or false.
2018
  function sek_get_nimble_api_data( $force_update = false ) {
2019
  $api_data_transient_name = 'nimble_api_data_' . NIMBLE_VERSION;
2020
  $info_data = get_transient( $api_data_transient_name );
2021
+ // set this constant in wp_config.php
2022
  $force_update = ( defined( 'NIMBLE_FORCE_UPDATE_API_DATA') && NIMBLE_FORCE_UPDATE_API_DATA ) ? true : $force_update;
2023
+
2024
+ // Refresh every 12 hours, unless force_update set to true
2025
  if ( $force_update || false === $info_data ) {
2026
  $timeout = ( $force_update ) ? 25 : 8;
2027
+ $response = wp_remote_get( NIMBLE_DATA_API_URL_V2, array(
2028
  'timeout' => $timeout,
2029
  'body' => [
2030
  'api_version' => NIMBLE_VERSION,
2034
  ) );
2035
 
2036
  if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) {
2037
+ // HOUR_IN_SECONDS is a default WP constant
2038
  set_transient( $api_data_transient_name, [], 2 * HOUR_IN_SECONDS );
2039
  return false;
2040
  }
2046
  return false;
2047
  }
2048
 
2049
+ // on May 21st 2019 => back to the local data for preset sections
2050
+ // after problem was reported when fetching data remotely : https://github.com/presscustomizr/nimble-builder/issues/445
2051
+ // if ( !empty( $info_data['library'] ) ) {
2052
+ // if ( !empty( $info_data['library']['sections'] ) ) {
2053
+ // update_option( NIMBLE_SECTIONS_LIBRARY_OPT_NAME, $info_data['library']['sections'], 'no' );
2054
+ // }
2055
+ // unset( $info_data['library'] );
2056
+ // }
2057
 
2058
  if ( isset( $info_data['latest_posts'] ) ) {
2059
  update_option( NIMBLE_NEWS_OPT_NAME, $info_data['latest_posts'], 'no' );
2065
 
2066
  return $info_data;
2067
  }
2068
+
2069
+
2070
+ //////////////////////////////////////////////////
2071
+ /// SECTIONS DATA
2072
  function sek_get_sections_registration_params_api_data( $force_update = false ) {
2073
+ // To avoid a possible refresh, hence a reconnection to the api when opening the customizer
2074
+ // Let's use the data saved as options
2075
+ // Those data are updated on plugin install, plugin update, theme switch
2076
+ // @see https://github.com/presscustomizr/nimble-builder/issues/441
2077
  $sections_data = get_option( NIMBLE_SECTIONS_LIBRARY_OPT_NAME );
2078
  if ( empty( $sections_data ) || !is_array( $sections_data ) || empty( $sections_data['registration_params'] ) ) {
2079
  sek_get_nimble_api_data( true );//<= true for "force_update"
2088
  }
2089
 
2090
  function sek_get_preset_sections_api_data( $force_update = false ) {
2091
+ // To avoid a possible refresh, hence a reconnection to the api when opening the customizer
2092
+ // Let's use the data saved as options
2093
+ // Those data are updated on plugin install, plugin update( upgrader_process_complete ), theme switch
2094
+ // @see https://github.com/presscustomizr/nimble-builder/issues/441
2095
  $sections_data = get_option( NIMBLE_SECTIONS_LIBRARY_OPT_NAME );
2096
  if ( empty( $sections_data ) || !is_array( $sections_data ) || empty( $sections_data['json_collection'] ) ) {
2097
  sek_get_nimble_api_data( true );//<= true for "force_update"
2104
  }
2105
  return $sections_data['json_collection'];
2106
  }
2107
+
2108
+
2109
+ //////////////////////////////////////////////////
2110
+ /// LATESTS POSTS
2111
+ // @return array of posts
2112
  function sek_get_latest_posts_api_data( $force_update = false ) {
2113
  sek_get_nimble_api_data( $force_update );
2114
  $latest_posts = get_option( NIMBLE_NEWS_OPT_NAME );
2118
  }
2119
  return $latest_posts;
2120
  }
2121
+
2122
+ // @return html string
2123
  function sek_get_cta_message_from_api( $theme_name, $force_update = false ) {
2124
  $info_data = sek_get_nimble_api_data( $force_update );
2125
  if ( !sek_is_presscustomizr_theme( $theme_name ) || ! is_array( $info_data ) ) {
2134
  }
2135
  return $message;
2136
  }
2137
+
2138
+ // Refresh the api data on plugin update and theme switch
2139
  add_action( 'after_switch_theme', '\Nimble\sek_refresh_nimble_api_data');
2140
  add_action( 'upgrader_process_complete', '\Nimble\sek_refresh_nimble_api_data');
2141
  function sek_refresh_nimble_api_data() {
2142
+ // Refresh data on theme switch
2143
+ // => so the posts and message are up to date
2144
  sek_get_nimble_api_data(true);
2145
  }
2146
 
2147
+ ?><?php
2148
+ namespace Nimble;
2149
+ // This file has been introduced on May 21st 2019 => back to the local data
2150
+ // after problem was reported when fetching data remotely : https://github.com/presscustomizr/nimble-builder/issues/445
2151
+
2152
+ /////////////////////////////////////////////////////////////
2153
+ // REGISTRATION PARAMS FOR PRESET SECTIONS
2154
+ // Store the params in transient, refreshed every hour
2155
+ // @return array()
2156
+ function sek_get_sections_registration_params( $force_update = false ) {
2157
+ $section_params_transient_name = 'section_params_transient_' . NIMBLE_VERSION;
2158
+ $registration_params = get_transient( $section_params_transient_name );
2159
+ // Refresh every 30 days, unless force_update set to true
2160
+ if ( $force_update || false === $registration_params ) {
2161
+ $registration_params = sek_get_raw_registration_params();
2162
+ set_transient( $section_params_transient_name, $registration_params, 30 * DAY_IN_SECONDS );
2163
+ }
2164
+ return $registration_params;
2165
+ }
2166
+
2167
+ function sek_get_raw_registration_params() {
2168
+ return [
2169
+ 'sek_intro_sec_picker_module' => [
2170
+ 'module_title' => __('Sections for an introduction', 'nimble-builder'),
2171
+ 'section_collection' => array(
2172
+ array(
2173
+ 'content-id' => 'intro_three',
2174
+ 'title' => __('1 columns, call to action, full-width background', 'nimble-builder' ),
2175
+ 'thumb' => 'intro_three.jpg'
2176
+ ),
2177
+ array(
2178
+ 'content-id' => 'intro_one',
2179
+ 'title' => __('1 column, full-width background', 'nimble-builder' ),
2180
+ 'thumb' => 'intro_one.jpg'
2181
+ ),
2182
+ array(
2183
+ 'content-id' => 'intro_two',
2184
+ 'title' => __('2 columns, call to action, full-width background', 'nimble-builder' ),
2185
+ 'thumb' => 'intro_two.jpg'
2186
+ )
2187
+ )
2188
+ ],
2189
+ 'sek_features_sec_picker_module' => [
2190
+ 'module_title' => __('Sections for services and features', 'nimble-builder'),
2191
+ 'section_collection' => array(
2192
+ array(
2193
+ 'content-id' => 'features_one',
2194
+ 'title' => __('3 columns with icon and call to action', 'nimble-builder' ),
2195
+ 'thumb' => 'features_one.jpg',
2196
+ //'height' => '188px'
2197
+ ),
2198
+ array(
2199
+ 'content-id' => 'features_two',
2200
+ 'title' => __('3 columns with icon', 'nimble-builder' ),
2201
+ 'thumb' => 'features_two.jpg',
2202
+ //'height' => '188px'
2203
+ )
2204
+ )
2205
+ ],
2206
+ 'sek_contact_sec_picker_module' => [
2207
+ 'module_title' => __('Contact-us sections', 'nimble-builder'),
2208
+ 'section_collection' => array(
2209
+ array(
2210
+ 'content-id' => 'contact_one',
2211
+ 'title' => __('A contact form and a Google map', 'nimble-builder' ),
2212
+ 'thumb' => 'contact_one.jpg',
2213
+ //'height' => '188px'
2214
+ ),
2215
+ array(
2216
+ 'content-id' => 'contact_two',
2217
+ 'title' => __('A contact form with an image background', 'nimble-builder' ),
2218
+ 'thumb' => 'contact_two.jpg',
2219
+ //'height' => '188px'
2220
+ )
2221
+ )
2222
+ ],
2223
+ 'sek_column_layouts_sec_picker_module' => [
2224
+ 'module_title' => __('Empty sections with columns layout', 'nimble-builder'),
2225
+ 'section_collection' => array(
2226
+ array(
2227
+ 'content-id' => 'two_columns',
2228
+ 'title' => __('two columns layout', 'nimble-builder' ),
2229
+ 'thumb' => 'two_columns.jpg'
2230
+ ),
2231
+ array(
2232
+ 'content-id' => 'three_columns',
2233
+ 'title' => __('three columns layout', 'nimble-builder' ),
2234
+ 'thumb' => 'three_columns.jpg'
2235
+ ),
2236
+ array(
2237
+ 'content-id' => 'four_columns',
2238
+ 'title' => __('four columns layout', 'nimble-builder' ),
2239
+ 'thumb' => 'four_columns.jpg'
2240
+ ),
2241
+ )
2242
+ ],
2243
+ // pre-built sections for header and footer
2244
+ 'sek_header_sec_picker_module' => [
2245
+ 'module_title' => __('Header sections', 'nimble-builder'),
2246
+ 'section_collection' => array(
2247
+ array(
2248
+ 'content-id' => 'header_one',
2249
+ 'title' => __('simple header with a logo on the right, menu on the left', 'nimble-builder' ),
2250
+ 'thumb' => 'header_one.jpg',
2251
+ 'height' => '33px'
2252
+ )
2253
+ )
2254
+ ],
2255
+ 'sek_footer_sec_picker_module' => [
2256
+ 'module_title' => __('Footer sections', 'nimble-builder'),
2257
+ 'section_collection' => array(
2258
+ array(
2259
+ 'content-id' => 'footer_one',
2260
+ 'title' => __('simple footer with 3 columns and large bottom zone', 'nimble-builder' ),
2261
+ 'thumb' => 'footer_one.jpg'
2262
+ )
2263
+ )
2264
+ ]
2265
+ ];
2266
+ }
2267
+
2268
+ /////////////////////////////////////////////////////////////
2269
+ // JSON FOR PRESET SECTIONS
2270
+ function sek_get_preset_section_collection_from_json( $force_update = false ) {
2271
+ $section_json_transient_name = 'section_json_transient_' . NIMBLE_VERSION;
2272
+ $json_collection = get_transient( $section_json_transient_name );
2273
+ // Refresh every 30 days, unless force_update set to true
2274
+ if ( $force_update || false === $json_collection ) {
2275
+ $json_raw = @file_get_contents( NIMBLE_BASE_PATH ."/assets/preset_sections.json" );
2276
+ if ( $json_raw === false ) {
2277
+ $json_raw = wp_remote_fopen( NIMBLE_BASE_PATH ."/assets/preset_sections.json" );
2278
+ }
2279
+
2280
+ $json_collection = json_decode( $json_raw, true );
2281
+ set_transient( $section_json_transient_name, $json_collection, 30 * DAY_IN_SECONDS );
2282
+ }
2283
+ return $json_collection;
2284
+ }
2285
+
2286
+
2287
+ // Maybe refresh data on
2288
+ // - theme switch
2289
+ // - nimble upgrade
2290
+ // - nimble is loaded ( only when is_admin() ) <= This makes the loading of the customizer faster on the first load, because the transient is ready.
2291
+ add_action( 'nimble_front_classes_ready', '\Nimble\sek_refresh_preset_sections_data');
2292
+ add_action( 'after_switch_theme', '\Nimble\sek_refresh_preset_sections_data');
2293
+ add_action( 'upgrader_process_complete', '\Nimble\sek_refresh_preset_sections_data');
2294
+ function sek_refresh_preset_sections_data() {
2295
+ if ( 'nimble_front_classes_ready' === current_filter() && !is_admin() )
2296
+ return;
2297
+ if ( 'nimble_front_classes_ready' === current_filter() && defined( 'DOING_AJAX') && DOING_AJAX )
2298
+ return;
2299
+
2300
+ // => so the posts and message are up to date
2301
+ sek_get_preset_section_collection_from_json(true);
2302
+ sek_get_sections_registration_params(true);
2303
+ }
2304
+
2305
  ?><?php
2306
  add_action( 'admin_bar_menu', '\Nimble\sek_add_customize_link', 1000 );
2307
  function sek_add_customize_link() {
2308
  global $wp_admin_bar;
2309
+ // Don't show for users who can't access the customizer
2310
  if ( ! current_user_can( 'customize' ) )
2311
  return;
2312
 
2320
  $customize_url = sek_get_customize_url_when_is_admin( $return_customize_url );
2321
  } else {
2322
  global $wp_customize;
2323
+ // Don't show if the user cannot edit a given customize_changeset post currently being previewed.
2324
  if ( is_customize_preview() && $wp_customize->changeset_post_id() && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) {
2325
  return;
2326
  }
2357
  ),
2358
  ) );
2359
  }//sek_add_customize_link
2360
+
2361
+ // returns a customize link when is_admin() for posts and terms
2362
+ // inspired from wp-includes/admin-bar.php#wp_admin_bar_edit_menu()
2363
  function sek_get_customize_url_when_is_admin( $return_customize_url ) {
2364
  global $tag, $user_id;
2365
 
2409
  return $customize_url;
2410
  }
2411
  ?><?php
2412
+ // fired @wp_loaded
2413
+ // Note : if fired @plugins_loaded, invoking wp_update_post() generates php notices
2414
  function sek_maybe_do_version_mapping() {
2415
  if ( ! is_user_logged_in() || ! current_user_can( 'edit_theme_options' ) )
2416
  return;
2417
+ //delete_option(NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS);
2418
  $global_options = get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
2419
  $global_options = is_array( $global_options ) ? $global_options : array();
2420
  $global_options['retro_compat_mappings'] = isset( $global_options['retro_compat_mappings'] ) ? $global_options['retro_compat_mappings'] : array();
2421
+
2422
+ // To 1_0_4 was introduced in december 2018
2423
+ // It's related to a modification of the skope_id when home is a static page
2424
  if ( ! array_key_exists( 'to_1_4_0', $global_options['retro_compat_mappings'] ) || 'done' != $global_options['retro_compat_mappings']['to_1_4_0'] ) {
2425
  $status_to_1_4_0 = sek_do_compat_to_1_4_0();
2426
+ //sek_error_log('$status_1_0_4_to_1_1_0 ' . $status_1_0_4_to_1_1_0, $global_options );
2427
  $global_options['retro_compat_mappings']['to_1_4_0'] = 'done';
2428
  }
2429
+
2430
+ // 1_0_4_to_1_1_0 introduced in October 2018
2431
  if ( ! array_key_exists( '1_0_4_to_1_1_0', $global_options['retro_compat_mappings'] ) || 'done' != $global_options['retro_compat_mappings']['1_0_4_to_1_1_0'] ) {
2432
  $status_1_0_4_to_1_1_0 = sek_do_compat_1_0_4_to_1_1_0();
2433
+ //sek_error_log('$status_1_0_4_to_1_1_0 ' . $status_1_0_4_to_1_1_0, $global_options );
2434
  $global_options['retro_compat_mappings']['1_0_4_to_1_1_0'] = 'done';
2435
  }
2436
  update_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS, $global_options );
2437
  }
2438
+
2439
+ ////////////////////////////////////////////////////////////////
2440
+ // RETRO COMPAT => to 1.4.0
2441
+ // It's related to a modification of the skope_id when home is a static page
2442
+ // Was skp__post_page_home
2443
+ // Now is skp__post_page_{$static_home_page_id}
2444
+ // This was introduced to facilitate the compatibility of the Nimble Builder with multilanguage plugins like polylang
2445
+ // => Allows user to create a different home page for each languages
2446
+ //
2447
+ // If the current home page is not a static page, we don't have to do anything
2448
+ // If not, the sections currently saved for skope skp__post_page_home, must be moved to skope skp__post_page_{$static_home_page_id}
2449
+ // => this means that we need to update the post_id saved for option NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . 'skp__post_page_{$static_home_page_id}';
2450
+ // to the value of the one saved for option NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . 'skp__post_page_home';
2451
  function sek_do_compat_to_1_4_0() {
2452
  if ( 'page' === get_option( 'show_on_front' ) ) {
2453
  $home_page_id = (int)get_option( 'page_on_front' );
2454
  if ( 0 < $home_page_id ) {
2455
+ // get the post id storing the current sections on home
2456
+ // @see sek_get_seks_post()
2457
  $current_option_name = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . 'skp__post_page_home';
2458
  $post_id_storing_home_page_sections = (int)get_option( $current_option_name );
2459
  if ( $post_id_storing_home_page_sections > 0 ) {
2463
  }
2464
  }
2465
  }
2466
+
2467
+
2468
+ ////////////////////////////////////////////////////////////////
2469
+ // RETRO COMPAT 1.0.4 to 1.1.0
2470
+ // Introduced when upgrading from version 1.0.4 to version 1.1 +. October 2018.
2471
+ // 1) Retro compat for image and tinymce module, turned multidimensional ( father - child logic ) since 1.1+
2472
+ // 2) Ensure each level has a "ver_ini" property set to 1.0.4
2473
  function sek_do_compat_1_0_4_to_1_1_0() {
2474
  $sek_post_query_vars = array(
2475
  'post_type' => NIMBLE_CPT,
2476
  'post_status' => get_post_stati(),
2477
+ //'name' => sanitize_title( NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id ),
2478
  'posts_per_page' => -1,
2479
  'no_found_rows' => true,
2480
  'cache_results' => true,
2504
  'post_status' => 'publish',
2505
  'post_content' => maybe_serialize( $seks_data )
2506
  );
2507
+ //sek_error_log('$new_post_data ??', $seks_data );
2508
  $r = wp_update_post( wp_slash( $new_post_data ), true );
2509
  if ( is_wp_error( $r ) ) {
2510
  $status = 'error';
2513
  }//foreach
2514
  return $status;
2515
  }
2516
+
2517
+
2518
+
2519
+ // Recursive helper
2520
+ // Sniff the modules that need a compatibility mapping
2521
+ // do the mapping
2522
+ // @return an updated sektions collection
2523
  function sek_walk_levels_and_do_map_compat_1_0_4_to_1_1_0( $seks_data ) {
2524
  $new_seks_data = array();
2525
  foreach ( $seks_data as $key => $value ) {
2526
+ // Set level ver_ini
2527
+ // If the ver_ini property is not set, it means the level has been created with the previous version of Nimble ( v1.0.4 )
2528
+ // Let's add it
2529
  if ( is_array($value) && array_key_exists('level', $value) && ! array_key_exists('ver_ini', $value) ) {
2530
  $value['ver_ini'] = '1.0.4';
2531
  }
2532
  $new_seks_data[$key] = $value;
2533
+ // LEVEL OPTIONS mapping
2534
+ // remove spacing
2535
+ // remove layout
2536
+ // copy all background related options ( bg-* ) from "bg_border" to "bg"
2537
+ // options => array(
2538
+ // spacing => array(),
2539
+ // height => array(),
2540
+ // bg_border => array()
2541
+ // )
2542
  if ( ! empty( $value ) && is_array( $value ) && 'options' === $key ) {
2543
+ // bail if the mapping has already been done
2544
  if ( array_key_exists( 'bg', $value ) )
2545
  continue;
2546
  $new_seks_data[$key] = array();
2559
  }
2560
  }
2561
  } // end of Level mapping
2562
+ // MODULE mapping
2563
  else if ( is_array( $value ) && array_key_exists('module_type', $value ) ) {
2564
  $new_seks_data[$key] = $value;
2565
+ // Assign a default value to the new_value in case we have no matching case
2566
  $new_value = $value['value'];
2567
 
2568
  switch ( $value['module_type'] ) {
2569
  case 'czr_image_module':
2570
  if ( is_array( $value['value'] ) ) {
2571
+ // make sure we don't map twice
2572
  if ( array_key_exists( 'main_settings', $value['value'] ) || array_key_exists( 'borders_corners', $value['value'] ) )
2573
  break;
2574
  $new_value = array( 'main_settings' => array(), 'borders_corners' => array() );
2575
  foreach ( $value['value'] as $input_id => $input_data ) {
2576
+ // make sure we don't map twice
2577
  if ( in_array( $input_id, array( 'main_settings', 'borders_corners' ) ) )
2578
  break;
2579
  switch ($input_id) {
2593
 
2594
  case 'czr_tiny_mce_editor_module':
2595
  if ( is_array( $value['value'] ) ) {
2596
+ // make sure we don't map twice
2597
  if ( array_key_exists( 'main_settings', $value['value'] ) || array_key_exists( 'font_settings', $value['value'] ) )
2598
  break;
2599
  $new_value = array( 'main_settings' => array(), 'font_settings' => array() );
2600
  foreach ( $value['value'] as $input_id => $input_data ) {
2601
+ // make sure we don't map twice
2602
  if ( in_array( $input_id, array( 'main_settings', 'font_settings' ) ) )
2603
  break;
2604
  switch ($input_id) {
2620
  }
2621
  $new_seks_data[$key]['value'] = $new_value;
2622
  } // End of module mapping
2623
+ // go recursive if possible
2624
  else if ( is_array($value) ) {
2625
  $new_seks_data[$key] = sek_walk_levels_and_do_map_compat_1_0_4_to_1_1_0( $value );
2626
  }
2627
  }
2628
  return $new_seks_data;
2629
  }
2630
+
2631
+ // mapping from
2632
+ // [spacing] => Array
2633
+ // (
2634
+ // [desktop_pad_marg] => Array
2635
+ // (
2636
+ // [padding-top] => 20
2637
+ // [padding-bottom] => 20
2638
+ // )
2639
+
2640
+ // [desktop_unit] => em
2641
+ // [tablet_pad_marg] => Array
2642
+ // (
2643
+ // [padding-left] => 30
2644
+ // [padding-right] => 30
2645
+ // )
2646
+
2647
+ // [tablet_unit] => percent
2648
+ // )
2649
+ // to
2650
+ // [spacing] => Array
2651
+ // (
2652
+ // [pad_marg] => Array
2653
+ // (
2654
+ // [desktop] => Array
2655
+ // (
2656
+ // [padding-top] => 20
2657
+ // [padding-bottom] => 20
2658
+ // [unit] => em
2659
+ // )
2660
+
2661
+ // [tablet] => Array
2662
+ // (
2663
+ // [padding-right] => 30
2664
+ // [padding-left] => 30
2665
+ // [unit] => %
2666
+ // )
2667
+
2668
+ // )
2669
+
2670
+ // )
2671
  function sek_map_compat_1_0_4_to_1_1_0_do_level_spacing_mapping( $old_user_data ) {
2672
  $old_data_structure = array(
2673
  'desktop_pad_marg',
2677
  'mobile_pad_marg',
2678
  'mobile_unit'
2679
  );
2680
+ //sek_error_log('$old_user_data', $old_user_data);
2681
  $mapped_data = array();
2682
  foreach ( $old_data_structure as $old_key ) {
2683
  if ( false !== strpos( $old_key , 'pad_marg' ) ) {
2697
  return $mapped_data;
2698
  }
2699
  ?><?php
2700
+ // SEKTION POST
2701
  register_post_type( NIMBLE_CPT , array(
2702
  'labels' => array(
2703
  'name' => __( 'Nimble sections', 'nimble-builder' ),
2740
  * @return WP_Post|null The skope post or null if none exists.
2741
  */
2742
  function sek_get_seks_post( $skope_id = '', $skope_level = 'local' ) {
2743
+ //sek_error_log('skope_id in sek_get_seks_post => ' . $skope_id );
2744
  if ( empty( $skope_id ) ) {
2745
  $skope_id = skp_get_skope_id( $skope_level );
2746
  }
2762
  $option_name = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id;
2763
 
2764
  $post_id = (int)get_option( $option_name );
2765
+ // if the options has not been set yet, it will return (int) 0
2766
+ // id #1 is already taken by the 'Hello World' post.
2767
  if ( 1 > $post_id ) {
2768
+ //error_log( 'sek_get_seks_post => post_id is not valid for options => ' . $option_name );
2769
  return;
2770
  }
2771
 
2776
  if ( is_int( $post_id ) && $post_id > 0 && get_post( $post_id ) ) {
2777
  $post = get_post( $post_id );
2778
  }
2779
+
2780
+ // `-1` indicates no post exists; no query necessary.
2781
  if ( ! $post && -1 !== $post_id ) {
2782
  $query = new \WP_Query( $sek_post_query_vars );
2783
  $post = $query->post;
2807
  }
2808
  $is_global_skope = NIMBLE_GLOBAL_SKOPE_ID === $skope_id;
2809
  $is_cached = false;
2810
+
2811
+ // use the cached value when available ( after did_action('wp') )
2812
  if ( did_action('wp') ) {
2813
  if ( !$is_global_skope && 'not_cached' != Nimble_Manager()->local_seks ) {
2814
  $is_cached = true;
2827
  $seks_data = maybe_unserialize( $post->post_content );
2828
  }
2829
  $seks_data = is_array( $seks_data ) ? $seks_data : array();
2830
+
2831
+ // normalizes
2832
+ // [ 'collection' => [], 'local_options' => [] ];
2833
  $default_collection = sek_get_default_location_model( $skope_id );
2834
  $seks_data = wp_parse_args( $seks_data, $default_collection );
2835
+
2836
+ // Maybe add missing registered locations
2837
  $maybe_incomplete_locations = [];
2838
  foreach( $seks_data['collection'] as $location_data ) {
2839
  if ( !empty( $location_data['id'] ) ) {
2848
  }
2849
  }
2850
  }
2851
+ // cache now
2852
  if ( $is_global_skope ) {
2853
  Nimble_Manager()->global_seks = $seks_data;
2854
  } else {
2856
  }
2857
 
2858
  }//end if
2859
+
2860
+ // when customizing, let us filter the value with the 'customized' ones
2861
  $seks_data = apply_filters(
2862
  'sek_get_skoped_seks',
2863
  $seks_data,
2864
  $skope_id,
2865
  $location_id
2866
  );
2867
+
2868
+ // sek_error_log( '<sek_get_skoped_seks() location => ' . $location . array_key_exists( 'collection', $seks_data ), $seks_data );
2869
+ // if a location is specified, return specifically the sections of this location
2870
  if ( array_key_exists( 'collection', $seks_data ) && ! empty( $location_id ) ) {
2871
  if ( ! array_key_exists( $location_id, sek_get_locations() ) ) {
2872
  error_log( __FUNCTION__ . ' Error => location ' . $location_id . ' is not registered in the available locations' );
2914
  'post_status' => 'publish',
2915
  'post_content' => maybe_serialize( $seks_data )
2916
  );
2917
+
2918
+ // Update post if it already exists, otherwise create a new one.
2919
  $post = sek_get_seks_post( $skope_id );
2920
 
2921
  if ( $post ) {
2928
  $post_id = $r;//$r is the post ID
2929
 
2930
  update_option( $option_name, (int)$post_id );
2931
+
2932
+ // Trigger creation of a revision. This should be removed once #30854 is resolved.
2933
  if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
2934
  wp_save_post_revision( $r );
2935
  }
2946
  /* ------------------------------------------------------------------------- *
2947
  * SAVED SEKTIONS
2948
  /* ------------------------------------------------------------------------- */
2949
+ // SAVED SEKTIONS POST TYPE
2950
  register_post_type( 'nimble_saved_seks' , array(
2951
  'labels' => array(
2952
  'name' => __( 'Nimble saved sections', 'nimble-builder' ),
2975
  'publish_posts' => 'edit_theme_options',
2976
  )
2977
  ));
2978
+
2979
+ // @return the saved sektion data collection : columns, options as an array
2980
  function sek_get_saved_sektion_data( $saved_section_id ) {
2981
  $sek_post = sek_get_saved_seks_post( $saved_section_id );
2982
  $section_data = array();
2983
  if ( $sek_post ) {
2984
  $section_data_decoded = maybe_unserialize( $sek_post -> post_content );
2985
+ // The section data are described as an array
2986
+ // array(
2987
+ // 'title' => '',
2988
+ // 'description' => '',
2989
+ // 'id' => '',
2990
+ // 'type' => 'content',//in the future will be used to differentiate header, content and footer sections
2991
+ // 'creation_date' => date("Y-m-d H:i:s"),
2992
+ // 'update_date' => '',
2993
+ // 'data' => array(),<= this is where we describe the columns and options
2994
+ // 'nimble_version' => NIMBLE_VERSION
2995
+ // )
2996
  if ( is_array( $section_data_decoded ) && ! empty( $section_data_decoded['data'] ) && is_string( $section_data_decoded['data'] ) ) {
2997
  $section_data = json_decode( wp_unslash( $section_data_decoded['data'], true ) );
2998
  }
3009
  * @return WP_Post|null The skope post or null if none exists.
3010
  */
3011
  function sek_get_saved_seks_post( $saved_section_id ) {
3012
+ // $sek_post_query_vars = array(
3013
+ // 'post_type' => NIMBLE_CPT,
3014
+ // 'post_status' => get_post_stati(),
3015
+ // 'name' => sanitize_title( $saved_section_id ),
3016
+ // 'posts_per_page' => 1,
3017
+ // 'no_found_rows' => true,
3018
+ // 'cache_results' => true,
3019
+ // 'update_post_meta_cache' => false,
3020
+ // 'update_post_term_cache' => false,
3021
+ // 'lazy_load_term_meta' => false,
3022
+ // );
3023
 
3024
  $post = null;
3025
  $all_saved_seks = get_option( NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS );
3026
  $section_data = array_key_exists( $saved_section_id, $all_saved_seks ) ? $all_saved_seks[$saved_section_id] : array();
3027
  $post_id = array_key_exists( 'post_id', $section_data ) ? $section_data['post_id'] : -1;
3028
+
3029
+ // if the options has not been set yet, it will return (int) 0
3030
  if ( 0 > $post_id ) {
3031
+ //error_log( 'sek_get_seks_post => post_id is not valid for options => ' . $saved_section_id );
3032
  return;
3033
  }
3034
 
3040
  $post = get_post( $post_id );
3041
  }
3042
 
3043
+ // // `-1` indicates no post exists; no query necessary.
3044
+ // if ( ! $post && -1 !== $post_id ) {
3045
+ // $query = new WP_Query( $sek_post_query_vars );
3046
+ // $post = $query->post;
3047
+ // $post_id = $post ? $post->ID : -1;
3048
+ // /*
3049
+ // * Cache the lookup. See sek_update_sek_post().
3050
+ // * @todo This should get cleared if a skope post is added/removed.
3051
+ // */
3052
+ // update_option( $option_name, (int)$post_id );
3053
+ // }
3054
+
3055
  return $post;
3056
  }
3057
+
3058
+
3059
+
3060
+
3061
+ // Update the `nimble_saved_seks` post for a given "{$skope_id}"
3062
+ // Inserts a `nimble_saved_seks` post when one doesn't yet exist.
3063
+ // $seks_data = array(
3064
+ // 'title' => $_POST['sek_title'],
3065
+ // 'description' => $_POST['sek_description'],
3066
+ // 'id' => $_POST['sek_id'],
3067
+ // 'type' => 'content',//in the future will be used to differentiate header, content and footer sections
3068
+ // 'creation_date' => date("Y-m-d H:i:s"),
3069
+ // 'update_date' => '',
3070
+ // 'data' => $_POST['sek_data']
3071
+ // )
3072
+ // @return WP_Post|WP_Error Post on success, error on failure.
3073
  function sek_update_saved_seks_post( $seks_data ) {
3074
  if ( ! is_array( $seks_data ) ) {
3075
  error_log( 'sek_update_saved_seks_post => $seks_data is not an array' );
3096
  'post_status' => 'publish',
3097
  'post_content' => maybe_serialize( $seks_data )
3098
  );
3099
+
3100
+ // Update post if it already exists, otherwise create a new one.
3101
  $post = sek_get_saved_seks_post( $saved_section_id );
3102
 
3103
  if ( $post ) {
3121
  );
3122
 
3123
  update_option( NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS, $all_saved_seks );
3124
+
3125
+ // Trigger creation of a revision. This should be removed once #30854 is resolved.
3126
  if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
3127
  wp_save_post_revision( $r );
3128
  }
3144
  * @return string $skope_level optional
3145
  */
3146
  function sek_get_revision_history_from_posts( $skope_id = '', $skope_level = 'local' ) {
3147
+ //sek_error_log('skope_id in sek_get_seks_post => ' . $skope_id );
3148
  if ( empty( $skope_id ) ) {
3149
  $skope_id = skp_get_skope_id( $skope_level );
3150
  }
3151
+ // We need a valid skope_id
3152
  if ( defined('DOING_AJAX') && DOING_AJAX && '_skope_not_set_' === $skope_id ) {
3153
  wp_send_json_error( __FUNCTION__ . ' => invalid skope id' );
3154
  }
3179
  * @return string $skope_level optional
3180
  */
3181
  function sek_get_single_post_revision( $post_id = null ) {
3182
+
3183
+ // We need a valid post_id
3184
  if ( defined('DOING_AJAX') && DOING_AJAX && ( is_null( $post_id ) || !is_numeric( (int)$post_id ) ) ) {
3185
  wp_send_json_error( __FUNCTION__ . ' => invalid post id' );
3186
  }
3193
  }
3194
 
3195
  ?><?php
3196
+ // @return array() for css rules
3197
+ // $rules[] = array(
3198
+ // 'selector' => '[data-sek-id="'.$level['id'].'"]',
3199
+ // 'css_rules' => 'border-radius:'.$numeric . $unit.';',
3200
+ // 'mq' =>null
3201
+ // );
3202
+ //
3203
+ // @param $border_options is an array looking like :
3204
+ // [borders] => Array
3205
+ // (
3206
+ // [_all_] => Array
3207
+ // (
3208
+ // [wght] => 55px
3209
+ // [col] => #359615
3210
+ // )
3211
+
3212
+ // [top] => Array
3213
+ // (
3214
+ // [wght] => 6em
3215
+ // [col] => #dd3333
3216
+ // )
3217
+
3218
+ // [bottom] => Array
3219
+ // (
3220
+ // [wght] => 76%
3221
+ // [col] => #eeee22
3222
+ // )
3223
+ // @param $border_type is a string. solid, dashed, ...
3224
  function sek_generate_css_rules_for_multidimensional_border_options( $rules, $border_settings, $border_type, $css_selectors = '' ) {
3225
  if ( ! is_array( $rules ) )
3226
  return array();
3238
  $data = wp_parse_args( $data, $default_data );
3239
 
3240
  $border_properties = array();
3241
+ // border width
3242
  $numeric = sek_extract_numeric_value( $data['wght'] );
3243
  if ( is_numeric( $numeric ) ) {
3244
  $unit = sek_extract_unit( $data['wght'] );
3245
+ // $unit = '%' === $unit ? 'vw' : $unit;
3246
  $border_properties[] = $numeric . $unit;
3247
+ //border type
3248
  $border_properties[] = $border_type;
3249
+ //border color
3250
+ //(needs validation: we need a sanitize hex or rgba color)
3251
  if ( ! empty( $data[ 'col' ] ) ) {
3252
  $border_properties[] = $data[ 'col' ];
3253
  }
3258
  }
3259
 
3260
  $css_rules[] = "{$css_property}:" . implode( ' ', array_filter( $border_properties ) );
3261
+ //sek_error_log('CSS RULES FOR BORDERS', implode( ';', array_filter( $css_rules ) ));
3262
  }//if ( !empty( $numeric ) )
3263
  }//foreach
3264
+
3265
+ //append border rules
3266
  $rules[] = array(
3267
  'selector' => $css_selectors,
3268
  'css_rules' => implode( ';', array_filter( $css_rules ) ),//"border:" . implode( ' ', array_filter( $border_properties ) ),
3270
  );
3271
  return $rules;
3272
  }
3273
+
3274
+
3275
+
3276
+ // @return array() for css rules
3277
+ // $rules[] = array(
3278
+ // 'selector' => '[data-sek-id="'.$level['id'].'"]',
3279
+ // 'css_rules' => 'border-radius:'.$numeric . $unit.';',
3280
+ // 'mq' =>null
3281
+ // );
3282
+ //
3283
+ // @param border_radius_settings is an array looking like :
3284
+ // border-radius] => Array
3285
+ // (
3286
+ // [_all_] => 207px
3287
+ // [bottom_right] => 360px
3288
+ // [top_left] => 448px
3289
+ // [bottom_left] => 413px
3290
+ // )
3291
  function sek_generate_css_rules_for_border_radius_options( $rules, $border_radius_settings, $css_selectors = '' ) {
3292
  if ( ! is_array( $rules ) )
3293
  return array();
3303
  $default_radius = $default_val . $unit;
3304
  }
3305
  }
3306
+
3307
+ // Make sure that the $border_radius_setting is normalize so we can generate a proper border-radius value
3308
+ // For example a user value of ( '_all_' => '3px', 'top_right' => '6px', 'bottom_left' => '3px' )
3309
+ // should be normalized to ( '_all_' => '3px', 'top_left' => '3px', 'top_right' => '6px', 'bottom_right' => '3px', 'bottom_left' => '3px' )
3310
  $radius_dimensions_default = array(
3311
  'top_left' => $default_radius,
3312
  'top_right' => $default_radius,
3318
  if ( array_key_exists( '_all_', $border_radius_settings ) && 1 === count( $border_radius_settings ) ) {
3319
  $css_rules = "border-radius:" . $default_radius.';';
3320
  } else {
3321
+ // Build the normalized array for multidimensional css properties
3322
  $normalized_border_radius_values = array();
3323
  foreach ( $radius_dimensions_default as $dim => $default_radius) {
3324
  if ( array_key_exists( $dim, $border_radius_settings ) ) {
3337
  }
3338
 
3339
  if ( ! empty( $css_rules ) ) {
3340
+ //append border radius rules
3341
  $rules[] = array(
3342
  'selector' => $css_selectors,
3343
  'css_rules' => $css_rules,
3347
 
3348
  return $rules;
3349
  }
3350
+
3351
+
3352
+
3353
+
3354
+ // @return array() for css rules
3355
+ // $rules[] = array(
3356
+ // 'selector' => '[data-sek-id="'.$level['id'].'"]',
3357
+ // 'css_rules' => '',
3358
+ // 'mq' =>null
3359
+ // );
3360
+ //
3361
+ // @param $spacing_settings is an array looking like :
3362
+ // Array
3363
+ // (
3364
+ // [desktop] => Array
3365
+ // (
3366
+ // [padding-top] => 2
3367
+ // )
3368
+
3369
+ // )
3370
  function sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $spacing_settings, $css_selectors = '' ) {
3371
+ //spacing
3372
  if ( empty( $spacing_settings ) || ! is_array( $spacing_settings ) )
3373
  return $rules;
3374
 
3375
 
3376
  $default_unit = 'px';
3377
+
3378
+ //not mobile first
3379
  $_desktop_rules = $_mobile_rules = $_tablet_rules = null;
3380
 
3381
  if ( !empty( $spacing_settings['desktop'] ) ) {
3382
  $_desktop_rules = array( 'rules' => $spacing_settings['desktop'] );
3383
  }
3384
+
3385
+ // POPULATES AN ARRAY FROM THE RAW SAVED OPTIONS
3386
  $_pad_marg = array(
3387
  'desktop' => array(),
3388
  'tablet' => array(),
3392
  foreach( array_keys( $_pad_marg ) as $device ) {
3393
  if ( !empty( $spacing_settings[ $device ] ) ) {
3394
  $rules_candidates = $spacing_settings[ $device ];
3395
+ //add unit and sanitize padding (cannot have negative padding)
3396
  $unit = !empty( $rules_candidates['unit'] ) ? $rules_candidates['unit'] : $default_unit;
3397
  $unit = 'percent' == $unit ? '%' : $unit;
3398
 
3407
 
3408
  array_walk( $_pad_marg[ $device ][ 'rules' ],
3409
  function( &$val, $key, $unit ) {
3410
+ //make sure paddings are positive values
3411
  if ( FALSE !== strpos( 'padding', $key ) ) {
3412
  $val = abs( $val );
3413
  }
3421
  /*
3422
  * TABLETS AND MOBILES WILL INHERIT UPPER MQ LEVELS IF NOT OTHERWISE SPECIFIED
3423
  */
3424
+ // Sek_Dyn_CSS_Builder::$breakpoints = [
3425
+ // 'xs' => 0,
3426
+ // 'sm' => 576,
3427
+ // 'md' => 768,
3428
+ // 'lg' => 992,
3429
+ // 'xl' => 1200
3430
+ // ];
3431
  if ( ! empty( $_pad_marg[ 'desktop' ] ) ) {
3432
  $_pad_marg[ 'desktop' ][ 'mq' ] = null;
3433
  }
3455
  }
3456
  return $rules;
3457
  }
3458
+
3459
+
3460
+
3461
+ // This function is invoked when sniffing the input rules.
3462
+ // It's a generic helper to generate media query css rule
3463
+ // @return an array of css rules looking like
3464
+ // $rules[] = array(
3465
+ // 'selector' => $selector,
3466
+ // 'css_rules' => $css_rules,
3467
+ // 'mq' => $mq
3468
+ // );
3469
+ // @params params(array). Example
3470
+ // array(
3471
+ // 'value' => $ready_value,(array)
3472
+ // 'css_property' => 'height',(string or array of properties)
3473
+ // 'selector' => $selector,(string)
3474
+ // 'is_important' => $important,(bool)
3475
+ // )
3476
+ // params['value'] = Array
3477
+ // (
3478
+ // [desktop] => 5em
3479
+ // [tablet] => 4em
3480
+ // [mobile] => 25px
3481
+ // )
3482
  function sek_set_mq_css_rules( $params, $rules ) {
3483
+ // TABLETS AND MOBILES WILL INHERIT UPPER MQ LEVELS IF NOT OTHERWISE SPECIFIED
3484
+ // Sek_Dyn_CSS_Builder::$breakpoints = [
3485
+ // 'xs' => 0,
3486
+ // 'sm' => 576,
3487
+ // 'md' => 768,
3488
+ // 'lg' => 992,
3489
+ // 'xl' => 1200
3490
+ // ];
3491
  $params = wp_parse_args( $params, array(
3492
  'value' => array(),
3493
  'css_property' => '',
3505
  if ( ! empty( $params['value'][ 'mobile' ] ) ) {
3506
  $_font_size_mq[ 'mobile' ] = '(max-width:'. ( Sek_Dyn_CSS_Builder::$breakpoints['sm'] - 1 ) . 'px)'; //max-width: 575
3507
  }
3508
+ // $params['value'] looks like
3509
+ // array(
3510
+ // 'desktop' => '30px',
3511
+ // 'tablet' => '',
3512
+ // 'mobile' => ''
3513
+ // );
3514
  foreach ( $params['value'] as $device => $val ) {
3515
  if ( ! in_array( $device, array( 'desktop', 'tablet', 'mobile' ) ) ) {
3516
  sek_error_log( __FUNCTION__ . ' => error => unknown device : ' . $device );
3517
  continue;
3518
  }
3519
  if ( ! empty( $val ) ) {
3520
+ // the css_property can be an array
3521
+ // this is needed for example to write properties supporting several vendor prefixes
3522
  $css_property = $params['css_property'];
3523
  if ( is_array( $css_property ) ) {
3524
  $css_rules_array = array();
3538
  }
3539
  return $rules;
3540
  }
3541
+
3542
+
3543
+
3544
+
3545
+
3546
+
3547
+
3548
+
3549
+ //HELPERS
3550
  /**
3551
  * SASS COLOR DARKEN/LIGHTEN UTILS
3552
  */
3710
  $rgb = is_array( $rgb ) ? $rgb : explode( ',', $rgb );
3711
  $rgb = is_array( $rgb) ? $rgb : array( $rgb );
3712
  $rgb = count( $rgb ) < 3 ? array_pad( $rgb, 3, 255 ) : $rgb;
3713
+
3714
+ // Convert RGB to HEX
3715
  $hex[0] = str_pad( dechex( $rgb[0] ), 2, '0', STR_PAD_LEFT );
3716
  $hex[1] = str_pad( dechex( $rgb[1] ), 2, '0', STR_PAD_LEFT );
3717
  $hex[2] = str_pad( dechex( $rgb[2] ), 2, '0', STR_PAD_LEFT );
3730
  $rgba = is_array( $rgba) ? $rgba : array( $rgba );
3731
  return array(
3732
  array_slice( $rgba, 0, 3 ),
3733
+ // https://github.com/presscustomizr/nimble-builder/issues/303
3734
  isset( $rgba[3] ) ? $rgba[3] : 1
3735
  );
3736
  }
3747
  $rgb = count( $rgb ) < 3 ? array_pad( $rgb, 3, 255 ) : $rgb;
3748
 
3749
  $deltas = array();
3750
+
3751
+ // check if numeric following https://github.com/presscustomizr/nimble-builder/issues/303
3752
  $RGB = array(
3753
  'R' => is_numeric($rgb[0]) ? ( $rgb[0] / 255 ) : 1,
3754
  'G' => is_numeric($rgb[1]) ? ( $rgb[1] / 255 ) : 1,
3886
  * Returns the complementary hsl color
3887
  */
3888
  function sek_rgb_invert( $rgb ) {
3889
+ // Adjust Hue 180 degrees
3890
+ // $hsl[0] += ($hsl[0]>180) ? -180:180;
3891
  $rgb_inverted = array(
3892
  255 - $rgb[0],
3893
  255 - $rgb[1],
3907
 
3908
  return sek_rgb2hex( $rgb_inverted, $make_prop_value );
3909
  }
3910
+
3911
+ // 1.5em => em
3912
+ // -2px => px
3913
  function sek_extract_unit( $value ) {
3914
+ // remove numbers, dot, comma
3915
  $unit = preg_replace('/[0-9]|\.|,/', '', $value );
3916
+ // remove hyphens
3917
  $unit = str_replace('-', '', $unit );
3918
  return 0 === preg_match( "/(px|em|%)/i", $unit ) ? 'px' : $unit;
3919
  }
3920
+
3921
+ // 1.5em => 1.5
3922
+ // note : using preg_replace('/[^0-9]/', '', $data); would remove the dots or comma.
3923
  function sek_extract_numeric_value( $value ) {
3924
  if ( ! is_scalar( $value ) )
3925
  return null;
3929
 
3930
 
3931
  ?><?php
3932
+ // The base fmk is loaded @after_setup_theme:10
3933
  add_action( 'after_setup_theme', '\Nimble\sek_schedule_module_registration', 50 );
3934
+
3935
+ // When not customizing, we don't need to register all modules
3936
  function sek_schedule_module_registration() {
3937
+ // we load all modules when :
3938
+ // 1) customizing
3939
+ // 2) doing ajax <=> customizing
3940
+ // 3) isset( $_POST['nimble_simple_cf'] ) <= when a contact form is submitted.
3941
+ // Note about 3) => We should in fact load the necessary modules that we can determined with the posted skope_id. To be improved.
3942
+ // 3 fixes https://github.com/presscustomizr/nimble-builder/issues/433
3943
  if ( isset( $_POST['nimble_simple_cf'] ) ) {
3944
  sek_register_modules_when_customizing_or_ajaxing();
3945
  } else if ( skp_is_customizing() || ( defined('DOING_AJAX') && DOING_AJAX ) ) {
3946
  sek_register_modules_when_customizing_or_ajaxing();
3947
+ // prebuilt sections are registered from a JSON since https://github.com/presscustomizr/nimble-builder/issues/431
3948
  sek_register_prebuilt_section_modules();
3949
  } else {
3950
  add_action( 'wp', '\Nimble\sek_register_modules_when_not_customizing_and_not_ajaxing', PHP_INT_MAX );
3951
  }
3952
  }
3953
+
3954
+ // @return void();
3955
+ // @hook 'after_setup_theme'
3956
  function sek_register_modules_when_customizing_or_ajaxing() {
3957
  $modules = array_merge(
3958
  SEK_Front_Construct::$ui_picker_modules,
3960
  SEK_Front_Construct::$ui_local_global_options_modules,
3961
  SEK_Front_Construct::$ui_front_modules
3962
  );
3963
+
3964
+ // Header and footer have been introduced in v1.4.0 but not enabled by default
3965
+ // The module menu and the widget area module are on hold until "header and footer" feature is released.
3966
  if ( sek_is_header_footer_enabled() ) {
3967
  $modules = array_merge( $modules, SEK_Front_Construct::$ui_front_beta_modules );
3968
  }
3969
  sek_do_register_module_collection( $modules );
3970
  }
3971
+
3972
+
3973
+
3974
+ // @return void();
3975
+ // @hook 'wp'
3976
  function sek_register_modules_when_not_customizing_and_not_ajaxing() {
3977
+ //sniff the list of active modules in local and global location
3978
  sek_populate_contextually_active_module_list();
3979
 
3980
  $contextually_actives = array();
3981
  $front_modules = array_merge( SEK_Front_Construct::$ui_front_modules, SEK_Front_Construct::$ui_front_beta_modules );
3982
+
3983
+ // we need to get all children when the module is a father.
3984
+ // This will be flatenized afterwards
3985
  foreach ( Nimble_Manager()->contextually_active_modules as $module_name ) {
3986
+
3987
+ // Parent module with children
3988
  if ( array_key_exists( $module_name, $front_modules ) ) {
3989
+ // get the list of childrent, includes the parent too.
3990
+ // @see ::$ui_front_modules
3991
  $contextually_actives[] = $front_modules[ $module_name ];
3992
  }
3993
+ // Simple module with no children
3994
  if ( in_array( $module_name, $front_modules ) ) {
3995
  $contextually_actives[] = $module_name;
3996
  }
4003
  );
4004
  sek_do_register_module_collection( $modules );
4005
  }
4006
+
4007
+
4008
+ // @return void();
4009
  function sek_do_register_module_collection( $modules ) {
4010
  $module_candidates = array();
4011
+ // flatten the array
4012
+ // because can be formed this way after filter when including child
4013
+ // [0] => Array
4014
+ // (
4015
+ // [0] => czr_post_grid_module
4016
+ // [1] => czr_post_grid_main_child
4017
+ // [2] => czr_post_grid_thumb_child
4018
+ // [3] => czr_post_grid_metas_child
4019
+ // [4] => czr_post_grid_fonts_child
4020
+ // )
4021
+
4022
+ // [1] => sek_level_bg_module
4023
+ // [2] => sek_level_border_module
4024
  foreach ($modules as $key => $value) {
4025
  if ( is_array( $value ) ) {
4026
  $module_candidates = array_merge( $module_candidates, $value );
4028
  $module_candidates[] = $value;
4029
  }
4030
  }
4031
+
4032
+ // remove duplicated modules, typically 'czr_font_child'
4033
  $module_candidates = array_unique( $module_candidates );
4034
  foreach ( $module_candidates as $module_name ) {
4035
+ // Was previously written "\Nimble\sek_get_module_params_for_{$module_name}";
4036
+ // But this syntax can lead to function_exists() return false even if the function exists
4037
+ // Probably due to a php version issue. Bug detected with php version 5.6.38
4038
+ // bug report detailed here https://github.com/presscustomizr/nimble-builder/issues/234
4039
  $fn = "Nimble\sek_get_module_params_for_{$module_name}";
4040
  if ( function_exists( $fn ) ) {
4041
  $params = $fn();
4049
  }
4050
  }
4051
  }
4052
+
4053
+ // @return void()
4054
+ // recursive helper => populates Nimble_Manager()->contextually_active_modules
4055
  function sek_populate_contextually_active_module_list( $recursive_data = null ) {
4056
  if ( is_null( $recursive_data ) ) {
4057
  $local_skope_settings = sek_get_skoped_seks( skp_get_skope_id() );
4064
  if ( is_array( $value ) ) {
4065
  sek_populate_contextually_active_module_list( $value );
4066
  }
4067
+ // @see sek_get_module_params_for_czr_image_main_settings_child
4068
  if ( is_string( $key ) && 'module_type' === $key ) {
4069
  $module_collection = Nimble_Manager()->contextually_active_modules;
4070
  $module_collection[] = $value;
4072
  }
4073
  }
4074
  }
4075
+
4076
+
4077
+
4078
+
4079
+
4080
+
4081
+ // SINGLE MODULE PARAMS STUCTURE
4082
+ // 'dynamic_registration' => true,
4083
+ // 'module_type' => 'sek_column_layouts_sec_picker_module',
4084
+ // 'name' => __('Empty sections with columns layout', 'text_doma'),
4085
+ // 'tmpl' => array(
4086
+ // 'item-inputs' => array(
4087
+ // 'sections' => array(
4088
+ // 'input_type' => 'section_picker',
4089
+ // 'title' => __('Drag-and-drop or double-click a section to insert it into a drop zone of the preview page.', 'text_doma'),
4090
+ // 'width-100' => true,
4091
+ // 'title_width' => 'width-100',
4092
+ // 'section_collection' => array(
4093
+ // array(
4094
+ // 'content-id' => 'two_columns',
4095
+ // 'title' => __('two columns layout', 'text-domain' ),
4096
+ // 'thumb' => 'two_columns.jpg'
4097
+ // ),
4098
+ // array(
4099
+ // 'content-id' => 'three_columns',
4100
+ // 'title' => __('three columns layout', 'text-domain' ),
4101
+ // 'thumb' => 'three_columns.jpg'
4102
+ // ),
4103
+ // array(
4104
+ // 'content-id' => 'four_columns',
4105
+ // 'title' => __('four columns layout', 'text-domain' ),
4106
+ // 'thumb' => 'four_columns.jpg'
4107
+ // ),
4108
+ // )
4109
+ // )
4110
+ // )
4111
+ // )
4112
+ // @return void();
4113
+ // @hook 'after_setup_theme'
4114
  function sek_register_prebuilt_section_modules() {
4115
+ $registration_params = sek_get_sections_registration_params();
4116
  $default_module_params = array(
4117
  'dynamic_registration' => true,
4118
  'module_type' => '',
4135
  'module_title' => '',
4136
  'section_collection' => array()
4137
  ));
4138
+
4139
+ // normalize the module params
4140
  $normalized_params = $default_module_params;
4141
  $normalized_params['module_type'] = $module_type;
4142
  $normalized_params['name'] = $module_params['module_title'];
4145
  }
4146
 
4147
  }
4148
+
4149
+
4150
+
4151
+
4152
+
4153
+
4154
+ // HELPERS
4155
+ // Used when registering a select input in a module
4156
+ // @return an array of options that will be used to populate the select input in js
4157
  function sek_get_select_options_for_input_id( $input_id ) {
4158
  $options = array();
4159
  switch( $input_id ) {
4173
  case 'img-size' :
4174
  $options = sek_get_img_sizes();
4175
  break;
4176
+
4177
+ // ALL MODULES
4178
  case 'link-to' :
4179
  $options = array(
4180
  'no-link' => __('No link', 'nimble-builder' ),
4181
  'url' => __('Site content or custom url', 'nimble-builder' ),
4182
  );
4183
  break;
4184
+
4185
+ // FEATURED PAGE MODULE
4186
  case 'img-type' :
4187
  $options = array(
4188
  'none' => __( 'No image', 'nimble-builder' ),
4197
  'custom' => __( 'Use a custom text', 'nimble-builder' ),
4198
  );
4199
  break;
4200
+
4201
+ // HEADING MODULE
4202
  case 'heading_tag':
4203
  $options = array(
4204
  /* Not totally sure these should be localized as they strictly refer to html tags */
4210
  'h6' => __('H6', 'nimble-builder' ),
4211
  );
4212
  break;
4213
+
4214
+ // CSS MODIFIERS INPUT ID
4215
  case 'font_weight_css' :
4216
  $options = array(
4217
  'normal' => __( 'normal', 'nimble-builder' ),
4255
  'lowercase' => __( 'lowercase', 'nimble-builder' )
4256
  );
4257
  break;
4258
+
4259
+ // SPACING MODULE
4260
  case 'css_unit' :
4261
  $options = array(
4262
  'px' => __('Pixels', 'nimble-builder' ),
4264
  'percent' => __('Percents', 'nimble-builder' )
4265
  );
4266
  break;
4267
+
4268
+ //QUOTE MODULE
4269
  case 'quote_design' :
4270
  $options = array(
4271
  'none' => __( 'Text only', 'nimble-builder' ),
4273
  'quote-icon-before' => __( 'Quote Icon', 'nimble-builder' ),
4274
  );
4275
  break;
4276
+
4277
+ // LEVELS UI : LAYOUT BACKGROUND BORDER HEIGHT WIDTH
4278
  case 'boxed-wide' :
4279
  $options = array(
4280
  'boxed' => __('Boxed', 'nimble-builder'),
4327
  /* ------------------------------------------------------------------------- *
4328
  * CONTENT TYPE SWITCHER
4329
  /* ------------------------------------------------------------------------- */
4330
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
4331
  function sek_get_module_params_for_sek_content_type_switcher_module() {
4332
  return array(
4333
  'dynamic_registration' => true,
4334
  'module_type' => 'sek_content_type_switcher_module',
4335
  'name' => __('Content type', 'nimble-builder'),
4336
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
4337
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
4338
  'tmpl' => array(
4339
  'item-inputs' => array(
4340
  'content_type' => array(
4348
  __('use the Nimble page template', 'nimble-builder'),
4349
  "javascript:wp.customize.section('__localOptionsSection', function( _s_ ){_s_.container.find('.accordion-section-title').first().trigger('click');})"
4350
  ),
4351
+ // Header and footer have been introduced in v1.4.0 but not enabled by default
4352
  sek_is_header_footer_enabled() ? sprintf('<a href="#" onclick="%2$s" title="%1$s">%1$s</a>',
4353
  __('header and footer', 'nimble-builder'),
4354
  "javascript:wp.customize.section('__globalOptionsSectionId', function( _s_ ){ _s_.focus(); })"
4364
  /* ------------------------------------------------------------------------- *
4365
  * MODULE PICKER MODULE
4366
  /* ------------------------------------------------------------------------- */
4367
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
4368
  function sek_get_module_params_for_sek_module_picker_module() {
4369
  return array(
4370
  'dynamic_registration' => true,
4371
  'module_type' => 'sek_module_picker_module',
4372
  'name' => __('Content Picker', 'nimble-builder'),
4373
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
4374
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
4375
  'tmpl' => array(
4376
  'item-inputs' => array(
4377
  'module_id' => array(
4389
  /* ------------------------------------------------------------------------- *
4390
  * SEKTION PICKER MODULES
4391
  /* ------------------------------------------------------------------------- */
4392
+ // registered from a remote JSON since https://github.com/presscustomizr/nimble-builder/issues/431
4393
+
4394
+ // FOR SAVED SECTIONS
4395
+ // function sek_get_module_params_for_sek_my_sections_sec_picker_module() {
4396
+ // return array(
4397
+ // 'dynamic_registration' => true,
4398
+ // 'module_type' => 'sek_my_sections_sec_picker_module',
4399
+ // 'name' => __('My sections', 'text_doma'),
4400
+ // 'tmpl' => array(
4401
+ // 'item-inputs' => array(
4402
+ // 'my_sections' => array(
4403
+ // 'input_type' => 'section_picker',
4404
+ // 'title' => __('Drag-and-drop or double-click a section to insert it into a drop zone of the preview page.', 'text_doma'),
4405
+ // 'width-100' => true,
4406
+ // 'title_width' => 'width-100'
4407
+ // )
4408
+ // )
4409
+ // )
4410
+ // );
4411
+ // }
4412
  ?><?php
4413
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
4414
  function sek_get_module_params_for_sek_level_bg_module() {
4415
  return array(
4416
  'dynamic_registration' => true,
4417
  'module_type' => 'sek_level_bg_module',
4418
  'name' => __('Background', 'nimble-builder'),
4419
+ // 'starting_value' => array(
4420
+ // 'bg-color-overlay' => '#000000',
4421
+ // 'bg-opacity-overlay' => '40'
4422
+ // ),
4423
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
4424
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
4425
  'tmpl' => array(
4426
  'item-inputs' => array(
4427
  'bg-color' => array(
4448
  'default' => array( 'desktop' => 'center' ),
4449
  'title_width' => 'width-100',
4450
  ),
4451
+ // 'bg-parallax' => array(
4452
+ // 'input_type' => 'nimblecheck',
4453
+ // 'title' => __('Parallax scrolling', 'text_doma')
4454
+ // ),
4455
  'bg-attachment' => array(
4456
  'input_type' => 'nimblecheck',
4457
  'title' => __('Fixed background', 'nimble-builder'),
4475
  'orientation' => 'horizontal',
4476
  'min' => 0,
4477
  'max' => 100,
4478
+ // 'unit' => '%',
4479
  'default' => '60',
4480
  'width-100' => true,
4481
  'title_width' => 'width-100',
4502
  'space' => __('Space', 'nimble-builder'),
4503
  )
4504
  ),
4505
+ // 'bg-video' => array(
4506
+ // 'input_type' => 'text',
4507
+ // 'title' => __('Video', 'text_doma'),
4508
+ // 'default' => ''
4509
+ // ),
4510
  'bg-apply-overlay' => array(
4511
  'input_type' => 'nimblecheck',
4512
  'title' => __('Apply a background overlay', 'nimble-builder'),
4526
  'orientation' => 'horizontal',
4527
  'min' => 0,
4528
  'max' => 100,
4529
+ // 'unit' => '%',
4530
  'default' => '40',
4531
  'width-100' => true,
4532
  'title_width' => 'width-100'
4545
 
4546
  function sek_add_css_rules_for_level_background( $rules, $level ) {
4547
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
4548
+
4549
+ // $default_value_model = Array
4550
+ // (
4551
+ // [bg-color] =>
4552
+ // [bg-image] =>
4553
+ // [bg-position] => center
4554
+ // [bg-attachment] => 0
4555
+ // [bg-scale] => default
4556
+ // [bg-apply-overlay] => 0
4557
+ // [bg-color-overlay] =>
4558
+ // [bg-opacity-overlay] => 50
4559
+ // [border-width] => 1
4560
+ // [border-type] => none
4561
+ // [border-color] =>
4562
+ // [shadow] => 0
4563
+ // )
4564
  $default_value_model = sek_get_default_module_model( 'sek_level_bg_module' );
4565
  $bg_options = ( ! empty( $options[ 'bg' ] ) && is_array( $options[ 'bg' ] ) ) ? $options[ 'bg' ] : array();
4566
  $bg_options = wp_parse_args( $bg_options , is_array( $default_value_model ) ? $default_value_model : array() );
4575
  * https://www.webpagefx.com/blog/web-design/background-css-shorthand/
4576
  * background: [background-image] [background-position] / [background-size] [background-repeat] [background-attachment] [background-origin] [background-clip] [background-color];
4577
  */
4578
+ // Img background
4579
  if ( ! empty( $bg_options[ 'bg-image'] ) && is_numeric( $bg_options[ 'bg-image'] ) ) {
4580
+ // deactivated when customizing @see function sek_is_img_smartload_enabled()
4581
  if ( ! sek_is_img_smartload_enabled() ) {
4582
+ //no repeat by default?
4583
  $background_properties[ 'background-image' ] = 'url("'. wp_get_attachment_url( $bg_options[ 'bg-image'] ) .'")';
4584
  }
4585
+
4586
+ // Img Bg Position
4587
+ // 'center' is the default value. the CSS rule is declared in assets/front/scss/sek-base.scss
4588
  if ( ! empty( $bg_options[ 'bg-position'] ) && 'center' != $bg_options[ 'bg-position'] ) {
4589
  $pos_map = array(
4590
  'top_left' => '0% 0%',
4597
  'bottom' => '50% 100%',
4598
  'bottom_right'=> '100% 100%'
4599
  );
4600
+ // Retro-compat for old bg-position option without device switcher
4601
  if ( is_string( $bg_options[ 'bg-position'] ) ) {
4602
  $raw_pos = $bg_options[ 'bg-position'];
4603
  $background_properties[ 'background-position' ] = array_key_exists($raw_pos, $pos_map) ? $pos_map[ $raw_pos ] : $pos_map[ 'center' ];
4604
  } else if ( is_array( $bg_options[ 'bg-position'] ) ) {
4605
  $mapped_bg_options = array();
4606
+ // map option with css value
4607
  foreach ($bg_options[ 'bg-position'] as $device => $user_val ) {
4608
  if ( ! in_array( $device, array( 'desktop', 'tablet', 'mobile' ) ) ) {
4609
  sek_error_log( __FUNCTION__ . ' => error => unknown device : ' . $device );
4619
  ), $rules );
4620
  }
4621
  }
4622
+
4623
+ // background size
4624
+ // 'cover' is the default value. the CSS rule is declared in assets/front/scss/sek-base.scss
4625
  if ( ! empty( $bg_options['bg-scale'] ) && 'default' != $bg_options['bg-scale'] && 'cover' != $bg_options['bg-scale'] ) {
4626
+ //When specifying a background-size value, it must immediately follow the background-position value.
4627
  $background_properties['background-size'] = $bg_options['bg-scale'];
4628
  }
4629
+
4630
+ // add no-repeat by default?
4631
+ // 'no-repeat' is the default value. the CSS rule is declared in assets/front/scss/sek-base.scss
4632
  if ( ! empty( $bg_options['bg-repeat'] ) && 'default' != $bg_options['bg-repeat'] ) {
4633
  $background_properties['background-repeat'] = $bg_options['bg-repeat'];
4634
  }
4635
+
4636
+ // write the bg-attachment rule only if true <=> set to "fixed"
4637
  if ( ! empty( $bg_options['bg-attachment'] ) && sek_is_checked( $bg_options['bg-attachment'] ) ) {
4638
  $background_properties['background-attachment'] = 'fixed';
4639
  }
4640
 
4641
  }
4642
+
4643
+ //background color (needs validation: we need a sanitize hex or rgba color)
4644
  if ( ! empty( $bg_options['bg-color'] ) ) {
4645
  $background_properties['background-color'] = $bg_options[ 'bg-color' ];
4646
  }
4647
+
4648
+
4649
+ //build background rule
4650
  if ( ! empty( $background_properties ) ) {
4651
  $background_css_rules = '';
4652
  foreach ($background_properties as $bg_prop => $bg_css_val ) {
4658
  'mq' =>null
4659
  );
4660
  }
4661
+
4662
+ //Background overlay?
4663
+ // 1) a background image should be set
4664
+ // 2) the option should be checked
4665
  if ( !empty( $bg_options['bg-image']) && ! empty( $bg_options[ 'bg-apply-overlay'] ) && sek_is_checked( $bg_options[ 'bg-apply-overlay'] ) ) {
4666
+ //(needs validation: we need a sanitize hex or rgba color)
4667
  $bg_color_overlay = isset( $bg_options[ 'bg-color-overlay' ] ) ? $bg_options[ 'bg-color-overlay' ] : null;
4668
  if ( $bg_color_overlay ) {
4669
+ //overlay pseudo element
4670
  $bg_overlay_css_rules = 'content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:'.$bg_color_overlay;
4671
+
4672
+ //opacity
4673
+ //validate/sanitize
4674
  $bg_overlay_opacity = isset( $bg_options[ 'bg-opacity-overlay' ] ) ? filter_var( $bg_options[ 'bg-opacity-overlay' ], FILTER_VALIDATE_INT, array( 'options' =>
4675
  array( "min_range"=>0, "max_range"=>100 ) )
4676
  ) : FALSE;
4683
  'css_rules' => $bg_overlay_css_rules,
4684
  'mq' =>null
4685
  );
4686
+ //we have to also:
4687
+ // 1) make '[data-sek-id="'.$level['id'].'"] to be relative positioned (to make the overlay absolute element referring to it)
4688
+ // 2) make any '[data-sek-id="'.$level['id'].'"] first child to be relative (not to the resizable handle div)
4689
  $rules[] = array(
4690
  'selector' => '[data-sek-id="'.$level['id'].'"]',
4691
  'css_rules' => 'position:relative',
4693
  );
4694
 
4695
  $first_child_selector = '[data-sek-id="'.$level['id'].'"]>*';
4696
+ //in the preview we still want some elements to be absoluted positioned
4697
+ //1) the .ui-resizable-handle (jquery-ui)
4698
+ //2) the block overlay
4699
+ //3) the add content button
4700
  if ( is_customize_preview() ) {
4701
  $first_child_selector .= ':not(.ui-resizable-handle):not(.sek-dyn-ui-wrapper):not(.sek-add-content-button)';
4702
  }
4712
  }
4713
 
4714
  ?><?php
4715
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
4716
  function sek_get_module_params_for_sek_level_border_module() {
4717
  return array(
4718
  'dynamic_registration' => true,
4723
  '_all_' => array( 'wght' => '1px', 'col' => '#000000' )
4724
  )
4725
  ),
4726
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
4727
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
4728
  'tmpl' => array(
4729
  'item-inputs' => array(
4730
  'border-type' => array(
4752
  'title_width' => 'width-100',
4753
  'min' => 0,
4754
  'max' => 500,
4755
+ //'refresh_markup' => false,
4756
+ //'refresh_stylesheet' => true,
4757
+ //'css_identifier' => 'border_radius',
4758
+ //'css_selectors'=> $css_selectors
4759
  ),
4760
  'shadow' => array(
4761
  'input_type' => 'nimblecheck',
4780
 
4781
  function sek_add_css_rules_for_border( $rules, $level ) {
4782
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
4783
+ // $default_value_model = Array
4784
+ // (
4785
+ // [bg-color] =>
4786
+ // [bg-image] =>
4787
+ // [bg-position] => center
4788
+ // [bg-attachment] => 0
4789
+ // [bg-scale] => default
4790
+ // [bg-apply-overlay] => 0
4791
+ // [bg-color-overlay] =>
4792
+ // [bg-opacity-overlay] => 50
4793
+ // [border-type] => 'solid'
4794
+ // [borders] => Array
4795
+ // (
4796
+ // [_all_] => Array
4797
+ // (
4798
+ // [wght] => 55px
4799
+ // [col] => #359615
4800
+ // )
4801
+
4802
+ // [top] => Array
4803
+ // (
4804
+ // [wght] => 6em
4805
+ // [col] => #dd3333
4806
+ // )
4807
+
4808
+ // [bottom] => Array
4809
+ // (
4810
+ // [wght] => 76%
4811
+ // [col] => #eeee22
4812
+ // )
4813
+ // [shadow] => 0
4814
+ // )
4815
  $default_value_model = sek_get_default_module_model( 'sek_level_border_module' );
4816
  $normalized_border_options = ( ! empty( $options[ 'border' ] ) && is_array( $options[ 'border' ] ) ) ? $options[ 'border' ] : array();
4817
  $normalized_border_options = wp_parse_args( $normalized_border_options , is_array( $default_value_model ) ? $default_value_model : array() );
4822
  $border_settings = ! empty( $normalized_border_options[ 'borders' ] ) ? $normalized_border_options[ 'borders' ] : FALSE;
4823
  $border_type = $normalized_border_options[ 'border-type' ];
4824
  $has_border_settings = FALSE !== $border_settings && is_array( $border_settings ) && ! empty( $border_type ) && 'none' != $border_type;
4825
+
4826
+ //border width + type + color
4827
  if ( $has_border_settings ) {
4828
  $rules = sek_generate_css_rules_for_multidimensional_border_options( $rules, $border_settings, $border_type, '[data-sek-id="'.$level['id'].'"]' );
4829
  }
4841
 
4842
  function sek_add_css_rules_for_boxshadow( $rules, $level ) {
4843
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
4844
+ // $default_value_model = Array
4845
+ // (
4846
+ // [bg-color] =>
4847
+ // [bg-image] =>
4848
+ // [bg-position] => center
4849
+ // [bg-attachment] => 0
4850
+ // [bg-scale] => default
4851
+ // [bg-apply-overlay] => 0
4852
+ // [bg-color-overlay] =>
4853
+ // [bg-opacity-overlay] => 50
4854
+ // [border-width] => 1
4855
+ // [border-type] => none
4856
+ // [border-color] =>
4857
+ // [shadow] => 0
4858
+ // )
4859
  $default_value_model = sek_get_default_module_model( 'sek_level_border_module' );
4860
  $normalized_border_options = ( ! empty( $options[ 'border' ] ) && is_array( $options[ 'border' ] ) ) ? $options[ 'border' ] : array();
4861
  $normalized_border_options = wp_parse_args( $normalized_border_options , is_array( $default_value_model ) ? $default_value_model : array() );
4864
  return $rules;
4865
 
4866
  if ( !empty( $normalized_border_options[ 'shadow' ] ) && sek_is_checked( $normalized_border_options[ 'shadow'] ) ) {
4867
+ //$css_rules = 'box-shadow: 1px 1px 2px 0 rgba(75, 75, 85, 0.2); -webkit-box-shadow: 1px 1px 2px 0 rgba(75, 75, 85, 0.2);';
4868
  $css_rules = '-webkit-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px;-moz-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px;box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px;';
4869
+ // Set to !important when customizing, to override the sek-highlight-active-ui effect
4870
  if ( skp_is_customizing() ) {
4871
  $css_rules = '-webkit-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px!important;-moz-box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px!important;box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 11px 0px!important;';
4872
  }
4879
  return $rules;
4880
  }
4881
  ?><?php
4882
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
4883
  function sek_get_module_params_for_sek_level_height_module() {
4884
  return array(
4885
  'dynamic_registration' => true,
4888
  'starting_value' => array(
4889
  'custom-height' => array( 'desktop' => '50%' ),
4890
  ),
4891
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
4892
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
4893
  'tmpl' => array(
4894
  'item-inputs' => array(
4895
  'height-type' => array(
4908
  'title_width' => 'width-100',
4909
  'notice_before' => 'Note that when using a custom height, the inner content can be larger than the parent container, in particular on mobile devices. To prevent this problem, preview your page with the device switcher icons. You can also activate the overflow hidden option below.'
4910
  ),
4911
+ // implemented to fix https://github.com/presscustomizr/nimble-builder/issues/365
4912
  'overflow_hidden' => array(
4913
  'input_type' => 'nimblecheck',
4914
  'title' => __('Overflow hidden', 'nimble-builder'),
4925
  'default' => array( 'desktop' => 'center' ),
4926
  'refresh_markup' => false,
4927
  'refresh_stylesheet' => true,
4928
+ //'css_identifier' => 'v_alignment',
4929
  'title_width' => 'width-100',
4930
  'width-100' => true,
4931
  )
4946
  return $rules;
4947
 
4948
  $height_options = is_array( $options[ 'height' ] ) ? $options[ 'height' ] : array();
4949
+
4950
+ // VERTICAL ALIGNMENT
4951
  if ( ! empty( $height_options[ 'v_alignment' ] ) ) {
4952
  if ( ! is_array( $height_options[ 'v_alignment' ] ) ) {
4953
  sek_error_log( __FUNCTION__ . ' => error => the v_alignment option should be an array( {device} => {alignment} )');
4978
  'selector' => '[data-sek-id="'.$level['id'].'"]'
4979
  ), $rules );
4980
  }
4981
+
4982
+ // CUSTOM HEIGHT BY DEVICE
4983
  if ( ! empty( $height_options[ 'height-type' ] ) ) {
4984
  if ( 'custom' === $height_options[ 'height-type' ] ) {
4985
  $custom_user_height = array_key_exists( 'custom-height', $height_options ) ? $height_options[ 'custom-height' ] : array();
5010
  ), $rules );
5011
  }
5012
  }
5013
+
5014
+ // OVERFLOW HIDDEN
5015
+ // implemented to fix https://github.com/presscustomizr/nimble-builder/issues/365
5016
  if ( ! empty( $height_options[ 'overflow_hidden' ] ) && sek_booleanize_checkbox_val( $height_options[ 'overflow_hidden' ] ) ) {
5017
  $rules[] = array(
5018
  'selector' => '[data-sek-id="'.$level['id'].'"]',
5020
  'mq' =>null
5021
  );
5022
  }
5023
+ //error_log( print_r($rules, true) );
5024
  return $rules;
5025
  }
5026
 
5028
  /* ------------------------------------------------------------------------- *
5029
  * SPACING MODULE
5030
  /* ------------------------------------------------------------------------- */
5031
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5032
  function sek_get_module_params_for_sek_level_spacing_module() {
5033
  return array(
5034
  'dynamic_registration' => true,
5035
  'module_type' => 'sek_level_spacing_module',
5036
  'name' => __('Spacing options', 'nimble-builder'),
5037
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5038
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5039
 
5040
  'tmpl' => array(
5041
  'item-inputs' => array(
5060
  * SCHEDULE CSS RULES FILTERING
5061
  /* ------------------------------------------------------------------------- */
5062
  add_filter( 'sek_add_css_rules_for_level_options', '\Nimble\sek_add_css_rules_for_spacing', 10, 2 );
5063
+ // hook : sek_dyn_css_builder_rules
5064
+ // @return array() of css rules
5065
  function sek_add_css_rules_for_spacing( $rules, $level ) {
5066
  $options = empty( $level[ 'options' ] ) ? array() : $level['options'];
5067
+ //spacing
5068
  if ( empty( $options[ 'spacing' ] ) || empty( $options[ 'spacing' ][ 'pad_marg' ] ) )
5069
  return $rules;
5070
  $pad_marg_options = $options[ 'spacing' ][ 'pad_marg' ];
5071
+ // array( desktop => array( margin-right => 10, padding-top => 5, unit => 'px' ) )
5072
  if ( ! is_array( $pad_marg_options ) )
5073
  return $rules;
5074
 
5075
  $rules = sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $pad_marg_options, '[data-sek-id="'.$level['id'].'"]' );
5076
+
5077
+ // if the column has a positive ( > 0 ) margin-right and / or a margin-left set , let's adapt the column widths so we fit the 100%
5078
  if ( 'column' === $level['level'] && ! empty( $pad_marg_options['desktop'] ) ) {
5079
  $margin_left = array_key_exists('margin-left', $pad_marg_options['desktop'] ) ? $pad_marg_options['desktop']['margin-left'] : 0;
5080
  $margin_right = array_key_exists('margin-right', $pad_marg_options['desktop'] ) ? $pad_marg_options['desktop']['margin-right'] : 0;
5096
 
5097
  $col_width_in_percent = 100/$col_number;
5098
  $col_suffix = floor( $col_width_in_percent );
5099
+ //sek_error_log('$parent_section', $parent_section );
5100
+
5101
+ // Do we have a custom width for the column ?
5102
+ // if not, let's get the col suffix from the parent section
5103
  $custom_width = ( ! empty( $level[ 'width' ] ) && is_numeric( $level[ 'width' ] ) ) ? $level['width'] : null;
5104
  if ( ! is_null( $custom_width ) ) {
5105
  $col_width_in_percent = $custom_width;
5106
  }
5107
+
5108
+ // bail here if we messed up the column width
5109
  if ( $col_suffix < 1 )
5110
  return $rules;
5111
+
5112
+ // define a default breakpoint : 768
5113
  $breakpoint = Sek_Dyn_CSS_Builder::$breakpoints[ Sek_Dyn_CSS_Builder::COLS_MOBILE_BREAKPOINT ];//COLS_MOBILE_BREAKPOINT = 'md' <=> 768px
5114
+
5115
+ // define a default selector
5116
  $selector = sprintf('[data-sek-level="location"] [data-sek-id="%1$s"] .sek-sektion-inner > .sek-col-%2$s[data-sek-id="%3$s"]', $parent_section['id'], $col_suffix, $level['id'] );
5117
+
5118
+ // Is there a global custom breakpoint set ?
5119
  $global_custom_breakpoint = intval( sek_get_global_custom_breakpoint() );
5120
  $has_global_custom_breakpoint = $global_custom_breakpoint >= 1;
5121
+
5122
+ // Does the parent section have a custom breakpoint set ?
5123
  $section_custom_breakpoint = intval( sek_get_section_custom_breakpoint( $parent_section ) );
5124
  $has_section_custom_breakpoint = $section_custom_breakpoint >= 1;
5125
 
5126
  if ( $has_section_custom_breakpoint ) {
5127
  $breakpoint = $section_custom_breakpoint;
5128
+ // In this case, we need to use ".sek-section-custom-breakpoint-col-{}"
5129
+ // @see sek_add_css_rules_for_sections_breakpoint
5130
  $selector = sprintf('[data-sek-level="location"] [data-sek-id="%1$s"] .sek-sektion-inner > .sek-section-custom-breakpoint-col-%2$s[data-sek-id="%3$s"]', $parent_section['id'], $col_suffix, $level['id'] );
5131
  } else if ( $has_global_custom_breakpoint ) {
5132
  $breakpoint = $global_custom_breakpoint;
5133
  }
5134
 
5135
  $responsive_css_rules = sprintf( '-ms-flex: 0 0 calc(%1$s%% - %2$s) ;flex: 0 0 calc(%1$s%% - %2$s);max-width: calc(%1$s%% - %2$s)', $col_width_in_percent, $total_horizontal_margin_with_unit );
5136
+
5137
+ // we need to override the rule defined in : Sek_Dyn_CSS_Builder::sek_add_rules_for_column_width
5138
+ // that's why we use a long specific selector here
5139
  $rules[] = array(
5140
  'selector' => $selector,
5141
  'css_rules' => $responsive_css_rules,
5142
  'mq' => "(min-width: {$breakpoint}px)"
5143
  );
5144
+
5145
+ // the horizontal margin should be subtracted also to the column width of 100%, below the mobile breakpoint: basically the margin should be always subtracted to the column width for each viewport it is set
5146
+ // @see https://github.com/presscustomizr/nimble-builder/issues/217
5147
  $responsive_css_rules_for_100_percent_width = sprintf( '-ms-flex: 0 0 calc(%1$s%% - %2$s) ;flex: 0 0 calc(%1$s%% - %2$s);max-width: calc(%1$s%% - %2$s)', 100, $total_horizontal_margin_with_unit );
5148
  $rules[] = array(
5149
  'selector' => sprintf('.sek-sektion-inner > [data-sek-id="%1$s"]', $level['id'] ),
5150
  'css_rules' => $responsive_css_rules_for_100_percent_width,
5151
+ //$breakpoint_for_100_percent_width = $breakpoint-1;
5152
  'mq' => null,// "(max-width: {$breakpoint_for_100_percent_width}px)"
5153
  );
5154
+ //sek_error_log('padding margin', $rules );
5155
  }//if ( $total_horizontal_margin > 0 && !empty( $parent_section ) ) {
5156
  }// if column
5157
 
5159
  }
5160
 
5161
  ?><?php
5162
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5163
  function sek_get_module_params_for_sek_level_width_module() {
5164
  return array(
5165
  'dynamic_registration' => true,
5166
  'module_type' => 'sek_level_width_module',
5167
  'name' => __('Width options', 'nimble-builder'),
5168
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5169
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5170
  'tmpl' => array(
5171
  'item-inputs' => array(
5172
  'width-type' => array(
5211
  return $rules;
5212
 
5213
  $width_options = is_array( $options[ 'width' ] ) ? $options[ 'width' ] : array();
5214
+
5215
+ // ALIGNMENT BY DEVICE
5216
  if ( ! empty( $width_options[ 'h_alignment' ] ) ) {
5217
  if ( ! is_array( $width_options[ 'h_alignment' ] ) ) {
5218
  sek_error_log( __FUNCTION__ . ' => error => the h_alignment option should be an array( {device} => {alignment} )');
5244
  'selector' => '[data-sek-id="'.$module['id'].'"]'
5245
  ), $rules );
5246
  }
5247
+
5248
+
5249
+ // CUSTOM WIDTH BY DEVICE
5250
  if ( ! empty( $width_options[ 'width-type' ] ) ) {
5251
  if ( 'custom' == $width_options[ 'width-type' ] && array_key_exists( 'custom-width', $width_options ) ) {
5252
  $user_custom_width_value = $width_options[ 'custom-width' ];
5277
  ), $rules );
5278
  }
5279
  }
5280
+ //error_log( print_r($rules, true) );
5281
  return $rules;
5282
  }
5283
 
5284
  ?><?php
5285
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5286
  function sek_get_module_params_for_sek_level_width_section() {
5287
  return array(
5288
  'dynamic_registration' => true,
5289
  'module_type' => 'sek_level_width_section',
5290
  'name' => __('Width options', 'nimble-builder'),
5291
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5292
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5293
+ // 'starting_value' => array(
5294
+ // 'outer-section-width' => '100%',
5295
+ // 'inner-section-width' => '100%'
5296
+ // ),
5297
  'tmpl' => array(
5298
  'item-inputs' => array(
5299
  'use-custom-outer-width' => array(
5342
  /* ------------------------------------------------------------------------- *
5343
  * SCHEDULE CSS RULES FILTERING
5344
  /* ------------------------------------------------------------------------- */
5345
+ // Data structure since v1.1.0. Oct 2018
5346
+ // [width] => Array
5347
+ // (
5348
+ // [use-custom-outer-width] => 1
5349
+ // [outer-section-width] => Array
5350
+ // (
5351
+ // [desktop] => 99%
5352
+ // [mobile] => 66%
5353
+ // [tablet] => 93%
5354
+ // )
5355
+
5356
+ // [use-custom-inner-width] => 1
5357
+ // [inner-section-width] => Array
5358
+ // (
5359
+ // [desktop] => 98em
5360
+ // [tablet] => 11em
5361
+ // [mobile] => 8em
5362
+ // )
5363
+ // )
5364
+ // The inner and outer widths can be set at 3 levels :
5365
+ // 1) global
5366
+ // 2) skope ( local )
5367
+ // 3) section
5368
+ // And for 3 different types of devices : desktop, tablet, mobiles.
5369
+ //
5370
+ // Nimble implements an inheritance for both logic, determined by the css selectors, and the media query rules.
5371
+ // For example, an inner width of 85% applied for skope will win against the global one, but can be overriden by a specific inner width set at a section level.
5372
  add_filter( 'sek_add_css_rules_for__section__options', '\Nimble\sek_add_css_rules_for_section_width', 10, 3 );
5373
  function sek_add_css_rules_for_section_width( $rules, $section ) {
5374
  $options = empty( $section[ 'options' ] ) ? array() : $section['options'];
5387
 
5388
  if ( empty( $user_defined_widths ) )
5389
  return $rules;
5390
+
5391
+ // Note that the option 'outer-section-width' and 'inner-section-width' can be empty when set to a value === default
5392
+ // @see js czr_setions::normalizeAndSanitizeSingleItemInputValues()
5393
  foreach ( $user_defined_widths as $width_opt_name => $selector ) {
5394
  if ( ! empty( $width_options[ $width_opt_name ] ) && ! is_array( $width_options[ $width_opt_name ] ) ) {
5395
  sek_error_log( __FUNCTION__ . ' => error => the width option should be an array( {device} => {number}{unit} )');
5396
  }
5397
+ // $width_options[ $width_opt_name ] should be an array( {device} => {number}{unit} )
5398
+ // If not set in the width options , it means that it is equal to default
5399
  $user_custom_width_value = ( empty( $width_options[ $width_opt_name ] ) || ! is_array( $width_options[ $width_opt_name ] ) ) ? array('desktop' => '100%') : $width_options[ $width_opt_name ];
5400
  $user_custom_width_value = wp_parse_args( $user_custom_width_value, array(
5401
  'desktop' => '100%',
5420
  'css_property' => 'max-width',
5421
  'selector' => $selector
5422
  ), $rules );
5423
+
5424
+ // when customizing the inner section width, we need to reset the default padding rules for .sek-container-fluid {padding-right:10px; padding-left:10px}
5425
+ // @see assets/front/scss/_grid.scss
5426
  if ( 'inner-section-width' === $width_opt_name ) {
5427
  $rules = sek_set_mq_css_rules(array(
5428
  'value' => $padding_of_the_parent_container,
5449
  }
5450
 
5451
  ?><?php
5452
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5453
  function sek_get_module_params_for_sek_level_anchor_module() {
5454
  return array(
5455
  'dynamic_registration' => true,
5456
  'module_type' => 'sek_level_anchor_module',
5457
  'name' => __('Set a custom anchor', 'nimble-builder'),
5458
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5459
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5460
  'tmpl' => array(
5461
  'item-inputs' => array(
5462
  'custom_anchor' => array(
5479
  }
5480
 
5481
  ?><?php
5482
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5483
  function sek_get_module_params_for_sek_level_visibility_module() {
5484
  return array(
5485
  'dynamic_registration' => true,
5486
  'module_type' => 'sek_level_visibility_module',
5487
  'name' => __('Set visibility on devices', 'nimble-builder'),
5488
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5489
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5490
  'tmpl' => array(
5491
  'item-inputs' => array(
5492
  'desktops' => array(
5523
  }
5524
 
5525
  ?><?php
5526
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5527
  function sek_get_module_params_for_sek_level_breakpoint_module() {
5528
  $global_custom_breakpoint = sek_get_global_custom_breakpoint();
5529
  return array(
5530
  'dynamic_registration' => true,
5531
  'module_type' => 'sek_level_breakpoint_module',
5532
  'name' => __('Set a custom breakpoint', 'nimble-builder'),
5533
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5534
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5535
  'tmpl' => array(
5536
  'item-inputs' => array(
5537
  'use-custom-breakpoint' => array(
5552
  'step' => 1,
5553
  'refresh_markup' => true,
5554
  'refresh_stylesheet' => true,
5555
+ //'css_identifier' => 'letter_spacing',
5556
  'width-100' => true,
5557
  'title_width' => 'width-100',
5558
  'notice_after' => __( 'This is the breakpoint under which columns are reorganized vertically. The default breakpoint is 768px.', 'nimble-builder')
5590
  'mq' => "(min-width: {$custom_breakpoint}px)"
5591
  );
5592
  }
5593
+
5594
+ // maybe set the reverse column order on mobile devices ( smaller than the breakpoint )
5595
  if ( isset( $section[ 'options' ] ) && isset( $section[ 'options' ]['breakpoint'] ) && array_key_exists( 'reverse-col-at-breakpoint', $section[ 'options' ]['breakpoint'] ) ) {
5596
  $default_md_breakpoint = '768';
5597
  if ( class_exists('\Nimble\Sek_Dyn_CSS_Builder') ) {
5611
  }
5612
 
5613
  ?><?php
5614
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5615
  function sek_get_module_params_for_sek_local_template() {
5616
  return array(
5617
  'dynamic_registration' => true,
5618
  'module_type' => 'sek_local_template',
5619
  'name' => __('Template for the current page', 'nimble-builder'),
5620
  'starting_value' => array(),
5621
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5622
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5623
  'tmpl' => array(
5624
  'item-inputs' => array(
5625
  'local_template' => array(
5633
  ),
5634
  'refresh_preview' => true,
5635
  'notice_before_title' => __('Use the Nimble Builder template to display content created only with the Nimble Builder on this page. Your theme\'s default template will be overriden','nimble-builder')
5636
+ //'notice_after' => __('When you select the Nimble Builder template, only the Nimble sections are displayed.')
5637
  )
5638
  )
5639
  )//tmpl
5640
  );
5641
  }
5642
  ?><?php
5643
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5644
  function sek_get_module_params_for_sek_local_widths() {
5645
  return array(
5646
  'dynamic_registration' => true,
5647
  'module_type' => 'sek_local_widths',
5648
  'name' => __('Width settings of the sections in the current page', 'nimble-builder'),
5649
+ // 'starting_value' => array(
5650
+ // 'outer-section-width' => '100%',
5651
+ // 'inner-section-width' => '100%'
5652
+ // ),
5653
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5654
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5655
  'tmpl' => array(
5656
  'item-inputs' => array(
5657
  'use-custom-outer-width' => array(
5707
  )//tmpl
5708
  );
5709
  }
5710
+
5711
+
5712
+ // Add user local custom inner and outer widths for the sections
5713
+ // Data structure since v1.1.0. Oct 2018
5714
+ // [width] => Array
5715
+ // (
5716
+ // [use-custom-outer-width] => 1
5717
+ // [outer-section-width] => Array
5718
+ // (
5719
+ // [desktop] => 99%
5720
+ // [mobile] => 66%
5721
+ // [tablet] => 93%
5722
+ // )
5723
+
5724
+ // [use-custom-inner-width] => 1
5725
+ // [inner-section-width] => Array
5726
+ // (
5727
+ // [desktop] => 98em
5728
+ // [tablet] => 11em
5729
+ // [mobile] => 8em
5730
+ // )
5731
+ // )
5732
+ // The inner and outer widths can be set at 3 levels :
5733
+ // 1) global
5734
+ // 2) skope ( local )
5735
+ // 3) section
5736
+ // And for 3 different types of devices : desktop, tablet, mobiles.
5737
+ //
5738
+ // Nimble implements an inheritance for both logic, determined by the css selectors, and the media query rules.
5739
+ // For example, an inner width of 85% applied for skope will win against the global one, but can be overriden by a specific inner width set at a section level.
5740
  add_filter( 'nimble_get_dynamic_stylesheet', '\Nimble\sek_add_raw_local_widths_css', 10, 2 );
5741
+ // @filter 'nimble_get_dynamic_stylesheet'
5742
+ // this filter is declared in Sek_Dyn_CSS_Builder::get_stylesheet() with 2 parameters
5743
+ // apply_filters( 'nimble_get_dynamic_stylesheet', $css, $this->is_global_stylesheet );
5744
  function sek_add_raw_local_widths_css( $css, $is_global_stylesheet ) {
5745
+ // the local width rules must be restricted to the local stylesheet
5746
  if ( $is_global_stylesheet )
5747
  return $css;
5748
 
5749
  $css = is_string( $css ) ? $css : '';
5750
+ // we use the ajaxily posted skope_id when available <= typically in a customizing ajax action 'sek-refresh-stylesheet'
5751
+ // otherwise we fallback on the normal utility skp_build_skope_id()
5752
  $local_options = sek_get_skoped_seks( !empty( $_POST['local_skope_id'] ) ? $_POST['local_skope_id'] : skp_build_skope_id() );
5753
 
5754
  if ( ! is_array( $local_options ) || empty( $local_options['local_options']) || empty( $local_options['local_options']['widths'] ) )
5765
  }
5766
 
5767
  $rules = array();
5768
+
5769
+ // Note that the option 'outer-section-width' and 'inner-section-width' can be empty when set to a value === default
5770
+ // @see js czr_setions::normalizeAndSanitizeSingleItemInputValues()
5771
  foreach ( $user_defined_widths as $width_opt_name => $selector ) {
5772
  if ( ! empty( $width_options[ $width_opt_name ] ) && ! is_array( $width_options[ $width_opt_name ] ) ) {
5773
  sek_error_log( __FUNCTION__ . ' => error => the width option should be an array( {device} => {number}{unit} )');
5774
  }
5775
+ // $width_options[ $width_opt_name ] should be an array( {device} => {number}{unit} )
5776
+ // If not set in the width options , it means that it is equal to default
5777
  $user_custom_width_value = ( empty( $width_options[ $width_opt_name ] ) || ! is_array( $width_options[ $width_opt_name ] ) ) ? array('desktop' => '100%') : $width_options[ $width_opt_name ];
5778
  $user_custom_width_value = wp_parse_args( $user_custom_width_value, array(
5779
  'desktop' => '100%',
5798
  'css_property' => 'max-width',
5799
  'selector' => $selector
5800
  ), $rules );
5801
+
5802
+ // when customizing the inner section width, we need to reset the default padding rules for .sek-container-fluid {padding-right:10px; padding-left:10px}
5803
+ // @see assets/front/scss/_grid.scss
5804
  if ( 'inner-section-width' === $width_opt_name ) {
5805
  $rules = sek_set_mq_css_rules(array(
5806
  'value' => $padding_of_the_parent_container,
5828
  return is_string( $width_options_css ) ? $css . $width_options_css : $css;
5829
  }
5830
  ?><?php
5831
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5832
  function sek_get_module_params_for_sek_local_custom_css() {
5833
  return array(
5834
  'dynamic_registration' => true,
5835
  'module_type' => 'sek_local_custom_css',
5836
  'name' => __('Custom CSS for the sections of the current page', 'nimble-builder'),
5837
+ // 'starting_value' => array(
5838
+ // 'local_custom_css' => sprintf( '/* %1$s */', __('Add your own CSS code here', 'text_doma' ) )
5839
+ // ),
5840
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5841
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5842
  'tmpl' => array(
5843
  'item-inputs' => array(
5844
  'local_custom_css' => array(
5854
  )//tmpl
5855
  );
5856
  }
5857
+
5858
+
5859
+ // add user local custom css
5860
+ // this filter is declared in Sek_Dyn_CSS_Builder::get_stylesheet() with 2 parameters
5861
+ // apply_filters( 'nimble_get_dynamic_stylesheet', $css, $this->is_global_stylesheet );
5862
  add_filter( 'nimble_get_dynamic_stylesheet', '\Nimble\sek_add_raw_local_custom_css', 10, 2 );
5863
+ //@filter 'nimble_get_dynamic_stylesheet'
5864
  function sek_add_raw_local_custom_css( $css, $is_global_stylesheet ) {
5865
+ // the local custom css must be restricted to the local stylesheet
5866
  if ( $is_global_stylesheet )
5867
  return $css;
5868
+ // we use the ajaxily posted skope_id when available <= typically in a customizing ajax action 'sek-refresh-stylesheet'
5869
+ // otherwise we fallback on the normal utility skp_build_skope_id()
5870
  $local_options = sek_get_skoped_seks( !empty( $_POST['local_skope_id'] ) ? $_POST['local_skope_id'] : skp_build_skope_id() );
5871
  if ( is_array( $local_options ) && !empty( $local_options['local_options']) && ! empty( $local_options['local_options']['custom_css'] ) ) {
5872
  $options = $local_options['local_options']['custom_css'];
5877
  return $css;
5878
  }
5879
  ?><?php
5880
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5881
  function sek_get_module_params_for_sek_local_reset() {
5882
  return array(
5883
  'dynamic_registration' => true,
5898
  );
5899
  }
5900
  ?><?php
5901
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5902
  function sek_get_module_params_for_sek_local_performances() {
5903
  return array(
5904
  'dynamic_registration' => true,
5905
  'module_type' => 'sek_local_performances',
5906
  'name' => __('Performance optimizations', 'nimble-builder'),
5907
+ // 'starting_value' => array(
5908
+ // 'local_custom_css' => sprintf( '/* %1$s */', __('Add your own CSS code here', 'text_doma' ) )
5909
+ // ),
5910
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5911
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5912
  'tmpl' => array(
5913
  'item-inputs' => array(
5914
  'local-img-smart-load' => array(
5920
  'yes' => __('Load images on scroll ( optimized )', 'nimble-builder' ),
5921
  'no' => __('Load all images on page load ( not optimized )', 'nimble-builder' )
5922
  ),
5923
+ //'refresh_preview' => true,
5924
  'notice_after' => sprintf('%1$s <br/><strong>%2$s</strong>',
5925
  __( 'When you select "Load images on scroll", images below the window are loaded dynamically when scrolling. This can improve performance by reducing the weight of long web pages including multiple images.', 'nimble-builder'),
5926
  __( 'If you use a cache plugin, make sure that this option does not conflict with your caching options.', 'nimble-builder')
5933
  );
5934
  }
5935
  ?><?php
5936
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5937
  function sek_get_module_params_for_sek_local_header_footer() {
5938
  return array(
5939
  'dynamic_registration' => true,
5940
  'module_type' => 'sek_local_header_footer',
5941
  'name' => __('Page header', 'nimble-builder'),
5942
+ // 'starting_value' => array(
5943
+ // 'local_custom_css' => sprintf( '/* %1$s */', __('Add your own CSS code here', 'text_doma' ) )
5944
+ // ),
5945
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5946
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5947
  'tmpl' => array(
5948
  'item-inputs' => array(
5949
  'header-footer' => array(
5971
  );
5972
  }
5973
  ?><?php
5974
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
5975
  function sek_get_module_params_for_sek_local_revisions() {
5976
  return array(
5977
  'dynamic_registration' => true,
5978
  'module_type' => 'sek_local_revisions',
5979
  'name' => __('Revision history', 'nimble-builder'),
5980
+ // 'starting_value' => array(
5981
+ // 'local_custom_css' => sprintf( '/* %1$s */', __('Add your own CSS code here', 'text_doma' ) )
5982
+ // ),
5983
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
5984
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
5985
  'tmpl' => array(
5986
  'item-inputs' => array(
5987
  'local_revisions' => array(
5999
  );
6000
  }
6001
  ?><?php
6002
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6003
  function sek_get_module_params_for_sek_local_imp_exp() {
6004
  return array(
6005
  'dynamic_registration' => true,
6006
  'module_type' => 'sek_local_imp_exp',
6007
  'name' => __('Export / Import', 'nimble-builder'),
6008
+ // 'starting_value' => array(
6009
+ // 'local_custom_css' => sprintf( '/* %1$s */', __('Add your own CSS code here', 'text_doma' ) )
6010
+ // ),
6011
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6012
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6013
  'tmpl' => array(
6014
  'item-inputs' => array(
6015
  'import_export' => array(
6020
  'refresh_stylesheet' => false,
6021
  'width-100' => true,
6022
  'title_width' => 'width-100',
6023
+ //'notice_before' => __('Make sure you import a file generated with Nimble Builder export system.', 'text_doma'),
6024
+ // 'notice_after' => __('Select a revision from the drop-down list to preview it. You can then restore it by clicking the Publish button at the top of the page.', 'text_doma')
6025
  ),
6026
  'keep_existing_sections' => array(
6027
  'input_type' => 'nimblecheck',
6039
  );
6040
  }
6041
  ?><?php
6042
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6043
  function sek_get_module_params_for_sek_global_breakpoint() {
6044
  return array(
6045
  'dynamic_registration' => true,
6046
  'module_type' => 'sek_global_breakpoint',
6047
  'name' => __('Site wide breakpoint options', 'nimble-builder'),
6048
+ // 'starting_value' => array(
6049
+
6050
+ // ),
6051
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6052
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6053
  'tmpl' => array(
6054
  'item-inputs' => array(
6055
  'use-custom-breakpoint' => array(
6069
  'step' => 1,
6070
  'refresh_markup' => true,
6071
  'refresh_stylesheet' => true,
6072
+ //'css_identifier' => 'letter_spacing',
6073
  'width-100' => true,
6074
  'title_width' => 'width-100'
6075
  )//0,
6082
  add_action('wp_head', '\Nimble\sek_write_global_custom_breakpoint', 1000 );
6083
  function sek_write_global_custom_breakpoint() {
6084
  $css = '';
6085
+ // delete_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
6086
  $custom_breakpoint = sek_get_global_custom_breakpoint();
6087
  if ( $custom_breakpoint >= 1 ) {
6088
  $css .= '@media (min-width:' . $custom_breakpoint . 'px) {.sek-global-custom-breakpoint-col-8 {-ms-flex: 0 0 8.333%;flex: 0 0 8.333%;max-width: 8.333%;}.sek-global-custom-breakpoint-col-9 {-ms-flex: 0 0 9.090909%;flex: 0 0 9.090909%;max-width: 9.090909%;}.sek-global-custom-breakpoint-col-10 {-ms-flex: 0 0 10%;flex: 0 0 10%;max-width: 10%;}.sek-global-custom-breakpoint-col-11 {-ms-flex: 0 0 11.111%;flex: 0 0 11.111%;max-width: 11.111%;}.sek-global-custom-breakpoint-col-12 {-ms-flex: 0 0 12.5%;flex: 0 0 12.5%;max-width: 12.5%;}.sek-global-custom-breakpoint-col-14 {-ms-flex: 0 0 14.285%;flex: 0 0 14.285%;max-width: 14.285%;}.sek-global-custom-breakpoint-col-16 {-ms-flex: 0 0 16.666%;flex: 0 0 16.666%;max-width: 16.666%;}.sek-global-custom-breakpoint-col-20 {-ms-flex: 0 0 20%;flex: 0 0 20%;max-width: 20%;}.sek-global-custom-breakpoint-col-25 {-ms-flex: 0 0 25%;flex: 0 0 25%;max-width: 25%;}.sek-global-custom-breakpoint-col-30 {-ms-flex: 0 0 30%;flex: 0 0 30%;max-width: 30%;}.sek-global-custom-breakpoint-col-33 {-ms-flex: 0 0 33.333%;flex: 0 0 33.333%;max-width: 33.333%;}.sek-global-custom-breakpoint-col-40 {-ms-flex: 0 0 40%;flex: 0 0 40%;max-width: 40%;}.sek-global-custom-breakpoint-col-50 {-ms-flex: 0 0 50%;flex: 0 0 50%;max-width: 50%;}.sek-global-custom-breakpoint-col-60 {-ms-flex: 0 0 60%;flex: 0 0 60%;max-width: 60%;}.sek-global-custom-breakpoint-col-66 {-ms-flex: 0 0 66.666%;flex: 0 0 66.666%;max-width: 66.666%;}.sek-global-custom-breakpoint-col-70 {-ms-flex: 0 0 70%;flex: 0 0 70%;max-width: 70%;}.sek-global-custom-breakpoint-col-75 {-ms-flex: 0 0 75%;flex: 0 0 75%;max-width: 75%;}.sek-global-custom-breakpoint-col-80 {-ms-flex: 0 0 80%;flex: 0 0 80%;max-width: 80%;}.sek-global-custom-breakpoint-col-83 {-ms-flex: 0 0 83.333%;flex: 0 0 83.333%;max-width: 83.333%;}.sek-global-custom-breakpoint-col-90 {-ms-flex: 0 0 90%;flex: 0 0 90%;max-width: 90%;}.sek-global-custom-breakpoint-col-100 {-ms-flex: 0 0 100%;flex: 0 0 100%;max-width: 100%;}}';
6091
  printf('<style type="text/css" id="nimble-global-breakpoint-options">%1$s</style>', $css );
6092
  }
6093
  ?><?php
6094
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6095
  function sek_get_module_params_for_sek_global_widths() {
6096
  return array(
6097
  'dynamic_registration' => true,
6098
  'module_type' => 'sek_global_widths',
6099
  'name' => __('Site wide width options', 'nimble-builder'),
6100
+ // 'starting_value' => array(
6101
+
6102
+ // ),
6103
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6104
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6105
  'tmpl' => array(
6106
  'item-inputs' => array(
6107
  'use-custom-outer-width' => array(
6153
  )//tmpl
6154
  );
6155
  }
6156
+
6157
+
6158
+ // Add user site wide custom inner and outer widths for the sections
6159
+ // Data structure since v1.1.0. Oct 2018
6160
+ // [width] => Array
6161
+ // (
6162
+ // [use-custom-outer-width] => 1
6163
+ // [outer-section-width] => Array
6164
+ // (
6165
+ // [desktop] => 99%
6166
+ // [mobile] => 66%
6167
+ // [tablet] => 93%
6168
+ // )
6169
+
6170
+ // [use-custom-inner-width] => 1
6171
+ // [inner-section-width] => Array
6172
+ // (
6173
+ // [desktop] => 98em
6174
+ // [tablet] => 11em
6175
+ // [mobile] => 8em
6176
+ // )
6177
+ // )
6178
+ // The inner and outer widths can be set at 3 levels :
6179
+ // 1) global
6180
+ // 2) skope ( local )
6181
+ // 3) section
6182
+ // And for 3 different types of devices : desktop, tablet, mobiles.
6183
+ //
6184
+ // Nimble implements an inheritance for both logic, determined by the css selectors, and the media query rules.
6185
+ // For example, an inner width of 85% applied for skope will win against the global one, but can be overriden by a specific inner width set at a section level.
6186
  add_action('wp_head', '\Nimble\sek_write_global_custom_section_widths', 1000 );
6187
  function sek_write_global_custom_section_widths() {
6188
  $global_options = get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
6201
  }
6202
 
6203
  $rules = array();
6204
+
6205
+ // Note that the option 'outer-section-width' and 'inner-section-width' can be empty when set to a value === default
6206
+ // @see js czr_setions::normalizeAndSanitizeSingleItemInputValues()
6207
  foreach ( $user_defined_widths as $width_opt_name => $selector ) {
6208
  if ( ! empty( $width_options[ $width_opt_name ] ) && ! is_array( $width_options[ $width_opt_name ] ) ) {
6209
  sek_error_log( __FUNCTION__ . ' => error => the width option should be an array( {device} => {number}{unit} )');
6210
  }
6211
+ // $width_options[ $width_opt_name ] should be an array( {device} => {number}{unit} )
6212
+ // If not set in the width options , it means that it is equal to default
6213
  $user_custom_width_value = ( empty( $width_options[ $width_opt_name ] ) || ! is_array( $width_options[ $width_opt_name ] ) ) ? array('desktop' => '100%') : $width_options[ $width_opt_name ];
6214
  $user_custom_width_value = wp_parse_args( $user_custom_width_value, array(
6215
  'desktop' => '100%',
6234
  'css_property' => 'max-width',
6235
  'selector' => $selector
6236
  ), $rules );
6237
+
6238
+ // when customizing the inner section width, we need to reset the default padding rules for .sek-container-fluid {padding-right:10px; padding-left:10px}
6239
+ // @see assets/front/scss/_grid.scss
6240
  if ( 'inner-section-width' === $width_opt_name ) {
6241
  $rules = sek_set_mq_css_rules(array(
6242
  'value' => $padding_of_the_parent_container,
6266
  }
6267
  }
6268
  ?><?php
6269
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6270
  function sek_get_module_params_for_sek_global_reset() {
6271
  return array(
6272
  'dynamic_registration' => true,
6288
  }
6289
 
6290
  ?><?php
6291
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6292
  function sek_get_module_params_for_sek_global_performances() {
6293
  return array(
6294
  'dynamic_registration' => true,
6295
  'module_type' => 'sek_global_performances',
6296
  'name' => __('Site wide performance options', 'nimble-builder'),
6297
+ // 'starting_value' => array(
6298
+
6299
+ // ),
6300
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6301
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6302
  'tmpl' => array(
6303
  'item-inputs' => array(
6304
  'global-img-smart-load' => array(
6318
  }
6319
 
6320
  ?><?php
6321
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6322
  function sek_get_module_params_for_sek_global_header_footer() {
6323
  return array(
6324
  'dynamic_registration' => true,
6325
  'module_type' => 'sek_global_header_footer',
6326
  'name' => __('Site wide header', 'nimble-builder'),
6327
+ // 'starting_value' => array(
6328
+
6329
+ // ),
6330
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6331
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6332
  'tmpl' => array(
6333
  'item-inputs' => array(
6334
  'header-footer' => array(
6339
  'theme' => __('Use the active theme\'s header and footer', 'nimble-builder' ),
6340
  'nimble_global' => __('Nimble site wide header and footer ( beta )', 'nimble-builder' )
6341
  ),
6342
+ //'refresh_preview' => true,
6343
  'notice_before_title' => sprintf( __( 'The Nimble Builder allows you to build your own header and footer, or to use your theme\'s ones. This option can be overriden in the %1$s.', 'nimble-builder'),
6344
  sprintf( '<a href="#" onclick="%1$s">%2$s</a>',
6345
  "javascript:wp.customize.section('__localOptionsSection', function( _s_ ){_s_.container.find('.accordion-section-title').first().trigger('click');})",
6355
  }
6356
 
6357
  ?><?php
6358
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6359
  function sek_get_module_params_for_sek_global_recaptcha() {
6360
  return array(
6361
  'dynamic_registration' => true,
6362
  'module_type' => 'sek_global_recaptcha',
6363
  'name' => __('Protect your contact forms with Google reCAPTCHA', 'nimble-builder'),
6364
+ // 'starting_value' => array(
6365
+
6366
+ // ),
6367
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6368
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6369
  'tmpl' => array(
6370
  'item-inputs' => array(
6371
  'enable' => array(
6437
  }
6438
 
6439
  ?><?php
6440
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6441
  function sek_get_module_params_for_sek_global_revisions() {
6442
  return array(
6443
  'dynamic_registration' => true,
6444
  'module_type' => 'sek_global_revisions',
6445
  'name' => __('Revision history', 'nimble-builder'),
6446
+ // 'starting_value' => array(
6447
+ // 'global_custom_css' => sprintf( '/* %1$s */', __('Add your own CSS code here', 'text_doma' ) )
6448
+ // ),
6449
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6450
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6451
  'tmpl' => array(
6452
  'item-inputs' => array(
6453
  'global_revisions' => array(
6466
  }
6467
 
6468
  ?><?php
6469
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6470
  function sek_get_module_params_for_sek_global_beta_features() {
6471
  return array(
6472
  'dynamic_registration' => true,
6473
  'module_type' => 'sek_global_beta_features',
6474
  'name' => __('Beta features', 'nimble-builder'),
6475
+ // 'starting_value' => array(
6476
+
6477
+ // ),
6478
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6479
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6480
  'tmpl' => array(
6481
  'item-inputs' => array(
6482
  'beta-enabled' => array(
6497
  /* ------------------------------------------------------------------------- *
6498
  * LOAD AND REGISTER SIMPLE HTML MODULE
6499
  /* ------------------------------------------------------------------------- */
6500
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6501
 
6502
  function sek_get_module_params_for_czr_simple_html_module() {
6503
  return array(
6510
  'html_content' => array(
6511
  'input_type' => 'code_editor',
6512
  'title' => __( 'HTML Content' , 'nimble-builder' )
6513
+ //'code_type' => 'text/html' //<= use 'text/css' to instantiate the code mirror as CSS editor, which by default will be an HTML editor
6514
  )
6515
  )
6516
  ),
6532
  /* ------------------------------------------------------------------------- *
6533
  * TEXT EDITOR FATHER MODULE
6534
  /* ------------------------------------------------------------------------- */
6535
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6536
  function sek_get_module_params_for_czr_tiny_mce_editor_module() {
6537
  return array(
6538
  'dynamic_registration' => true,
6548
  'content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.'
6549
  )
6550
  ),
6551
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6552
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6553
  'css_selectors' => array(
6554
+ // this list is limited to the most commonly used tags in the editor.
6555
+ // note that Hx headings have a default style set in _heading.scss
6556
  '.sek-module-inner',
6557
  'p',
6558
  'a',
6568
  /* ------------------------------------------------------------------------- *
6569
  * TEXT EDITOR CONTENT CHILD
6570
  /* ------------------------------------------------------------------------- */
6571
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6572
  function sek_get_module_params_for_czr_tinymce_child() {
6573
  return array(
6574
  'dynamic_registration' => true,
6575
  'module_type' => 'czr_tinymce_child',
6576
  'name' => __('Content', 'nimble-builder'),
6577
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6578
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6579
  'tmpl' => array(
6580
  'item-inputs' => array(
6581
  'content' => array(
6613
  /* ------------------------------------------------------------------------- *
6614
  * LOAD AND REGISTER IMAGE MODULE
6615
  /* ------------------------------------------------------------------------- */
6616
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6617
  function sek_get_module_params_for_czr_image_module() {
6618
  $css_selectors = '.sek-module-inner img';
6619
  return array(
6631
  'custom_width' => ''
6632
  )
6633
  ),
6634
+ // 'sanitize_callback' => '\Nimble\czr_image_module_sanitize_validate',
6635
+ // 'validate_callback' => '\Nimble\czr_image_module_sanitize_validate',
6636
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/image_module_tmpl.php",
6637
  'placeholder_icon' => 'short_text'
6638
  );
6649
  'dynamic_registration' => true,
6650
  'module_type' => 'czr_image_main_settings_child',
6651
  'name' => __( 'Image main settings', 'nimble-builder' ),
6652
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
6653
+ // 'starting_value' => array(
6654
+ // 'button_text' => __('Click me','text_doma'),
6655
+ // 'color_css' => '#ffffff',
6656
+ // 'bg_color_css' => '#020202',
6657
+ // 'bg_color_hover' => '#151515', //lighten 15%,
6658
+ // 'use_custom_bg_color_on_hover' => 0,
6659
+ // 'border_radius_css' => '2',
6660
+ // 'h_alignment_css' => 'center',
6661
+ // 'use_box_shadow' => 1,
6662
+ // 'push_effect' => 1
6663
+ // ),
6664
+ //'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
6665
  'tmpl' => array(
6666
  'item-inputs' => array(
6667
  'img' => array(
6744
  'title' => __('Width', 'nimble-builder'),
6745
  'min' => 1,
6746
  'max' => 100,
6747
+ //'unit' => '%',
6748
  'default' => array( 'desktop' => '100%' ),
6749
  'max' => 500,
6750
  'width-100' => true,
6783
  'dynamic_registration' => true,
6784
  'module_type' => 'czr_image_borders_corners_child',
6785
  'name' => __( 'Borders and corners', 'nimble-builder' ),
6786
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
6787
+ // 'starting_value' => array(
6788
+ // 'button_text' => __('Click me','text_doma'),
6789
+ // 'color_css' => '#ffffff',
6790
+ // 'bg_color_css' => '#020202',
6791
+ // 'bg_color_hover' => '#151515', //lighten 15%,
6792
+ // 'use_custom_bg_color_on_hover' => 0,
6793
+ // 'border_radius_css' => '2',
6794
+ // 'h_alignment_css' => 'center',
6795
+ // 'use_box_shadow' => 1,
6796
+ // 'push_effect' => 1
6797
+ // ),
6798
+ //'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
6799
  'tmpl' => array(
6800
  'item-inputs' => array(
6801
  'border-type' => array(
6850
  * SCHEDULE CSS RULES FILTERING
6851
  /* ------------------------------------------------------------------------- */
6852
  add_filter( 'sek_add_css_rules_for_module_type___czr_image_module', '\Nimble\sek_add_css_rules_for_czr_image_module', 10, 2 );
6853
+ // filter documented in Sek_Dyn_CSS_Builder::sek_css_rules_sniffer_walker
6854
+ // Note : $complete_modul_model has been normalized
6855
+ // @return populated $rules
6856
  function sek_add_css_rules_for_czr_image_module( $rules, $complete_modul_model ) {
6857
  if ( empty( $complete_modul_model['value'] ) )
6858
  return $rules;
6860
  $value = $complete_modul_model['value'];
6861
  $main_settings = $complete_modul_model['value']['main_settings'];
6862
  $borders_corners_settings = $complete_modul_model['value']['borders_corners'];
6863
+
6864
+ // WIDTH
6865
  if ( sek_booleanize_checkbox_val( $main_settings['use_custom_width'] ) ) {
6866
  $width = $main_settings[ 'custom_width' ];
6867
  $css_rules = '';
6871
  $unit = sek_extract_unit( $width );
6872
  $css_rules .= 'width:' . $numeric . $unit . ';';
6873
  }
6874
+ // same treatment as in sek_add_css_rules_for_css_sniffed_input_id() => 'width'
6875
  if ( is_string( $width ) ) {
6876
  $numeric = sek_extract_numeric_value($width);
6877
  if ( ! empty( $numeric ) ) {
6884
  'tablet' => '',
6885
  'mobile' => ''
6886
  ));
6887
+ // replace % by vh when needed
6888
  $ready_value = $width;
6889
  foreach ($width as $device => $num_unit ) {
6890
  $numeric = sek_extract_numeric_value( $num_unit );
6912
  );
6913
  }
6914
  }
6915
+
6916
+ // BORDERS
6917
  $border_settings = $borders_corners_settings[ 'borders' ];
6918
  $border_type = $borders_corners_settings[ 'border-type' ];
6919
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
6920
+
6921
+ //border width + type + color
6922
  if ( $has_border_settings ) {
6923
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
6924
  $rules,
6934
  /* ------------------------------------------------------------------------- *
6935
  * LOAD AND REGISTER FEATURED PAGES MODULE
6936
  /* ------------------------------------------------------------------------- */
6937
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
6938
  function sek_get_module_params_for_czr_featured_pages_module() {
6939
  return array(
6940
  'dynamic_registration' => true,
6941
  'module_type' => 'czr_featured_pages_module',
6942
  'is_crud' => true,
6943
  'name' => __('Featured Pages', 'nimble-builder'),
6944
+ // 'starting_value' => array(
6945
+ // 'img' => NIMBLE_BASE_URL . '/assets/img/default-img.png'
6946
+ // ),
6947
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
6948
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
6949
  'tmpl' => array(
6950
  'pre-item' => array(
6951
+ // 'page-id' => array(
6952
+ // 'input_type' => 'content_picker',
6953
+ // 'title' => __('Pick a page', 'text_doma')
6954
+ // ),
6955
  'img-type' => array(
6956
  'input_type' => 'simpleselect',
6957
  'title' => __('Display an image', 'nimble-builder'),
6959
  'choices' => sek_get_select_options_for_input_id( 'img-type' )
6960
  ),
6961
  ),
6962
+ // 'mod-opt' => array(
6963
+ // // 'page-id' => array(
6964
+ // // 'input_type' => 'content_picker',
6965
+ // // 'title' => __('Pick a page', 'text_doma')
6966
+ // // ),
6967
+ // 'mod_opt_test' => array(
6968
+ // 'input_type' => 'simpleselect',
6969
+ // 'title' => __('Display an image', 'text_doma'),
6970
+ // 'default' => 'featured'
6971
+ // ),
6972
+ // ),
6973
  'item-inputs' => array(
6974
  'page-id' => array(
6975
  'input_type' => 'content_picker',
7027
  /* ------------------------------------------------------------------------- *
7028
  * TEXT EDITOR FATHER MODULE
7029
  /* ------------------------------------------------------------------------- */
7030
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7031
  function sek_get_module_params_for_czr_heading_module() {
7032
  return array(
7033
  'dynamic_registration' => true,
7045
  )
7046
  ),
7047
  'css_selectors' => array( '.sek-module-inner > .sek-heading' ),
7048
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
7049
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
7050
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/heading_module_tmpl.php",
7051
  'placeholder_icon' => 'short_text'
7052
  );
7057
  /* ------------------------------------------------------------------------- *
7058
  * TEXT EDITOR CONTENT CHILD
7059
  /* ------------------------------------------------------------------------- */
7060
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7061
  function sek_get_module_params_for_czr_heading_child() {
7062
  return array(
7063
  'dynamic_registration' => true,
7064
  'module_type' => 'czr_heading_child',
7065
  'name' => __('Content', 'nimble-builder'),
7066
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
7067
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
7068
  'tmpl' => array(
7069
  'item-inputs' => array(
7070
  'heading_text' => array(
7078
  'default' => '',
7079
  'width-100' => true,
7080
  'refresh_markup' => '.sek-heading [data-sek-input-type="textarea"]'
7081
+ //'notice_before' => __( 'You may use some html tags like a, br, span with attributes like style, id, class ...', 'text_doma'),
7082
 
7083
  ),
7084
  'heading_tag' => array(
7139
  /* ------------------------------------------------------------------------- *
7140
  * HEADING SPACING CHILD
7141
  /* ------------------------------------------------------------------------- */
7142
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7143
  function sek_get_module_params_for_czr_heading_spacing_child() {
7144
  return array(
7145
  'dynamic_registration' => true,
7146
  'module_type' => 'czr_heading_spacing_child',
7147
  'name' => __('Spacing', 'nimble-builder'),
7148
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
7149
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
7150
  'tmpl' => array(
7151
  'item-inputs' => array(
7152
  'spacing_css' => array(
7158
  'refresh_markup' => false,
7159
  'refresh_stylesheet' => true,
7160
  'css_identifier' => 'spacing_with_device_switcher',
7161
+ //'css_selectors'=> ''
7162
  )
7163
  )
7164
  ),
7171
 
7172
  function sanitize_callback__czr_heading_module( $value ) {
7173
  if ( !current_user_can( 'unfiltered_html' ) && array_key_exists('main_settings', $value ) && is_array( $value['main_settings'] ) && array_key_exists('heading_text', $value['main_settings'] ) ) {
7174
+ //sanitize heading_text
7175
  if ( function_exists( 'czr_heading_module_kses_text' ) ) {
7176
  $value['main_settings'][ 'heading_text' ] = czr_heading_module_kses_text( $value['main_settings'][ 'heading_text' ] );
7177
  }
7178
  }
7179
  return $value;
7180
+ //return new \WP_Error('required' ,'heading did not pass sanitization');
7181
  }
7182
+
7183
+ // @see SEK_CZR_Dyn_Register::set_dyn_setting_args
7184
+ // Only the boolean true or a WP_error object will be valid returned value considered when validating
7185
  function validate_callback__czr_heading_module( $value ) {
7186
+ //return new \WP_Error('required' ,'heading did not pass ');
7187
  return true;
7188
  }
7189
 
7193
  /* ------------------------------------------------------------------------- *
7194
  * LOAD AND REGISTER SPACER MODULE
7195
  /* ------------------------------------------------------------------------- */
7196
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7197
 
7198
 
7199
  function sek_get_module_params_for_czr_spacer_module() {
7202
  'module_type' => 'czr_spacer_module',
7203
  'name' => __('Spacer', 'nimble-builder'),
7204
  'css_selectors' => array( '.sek-module-inner > *' ),
7205
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
7206
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
7207
  'tmpl' => array(
7208
  'item-inputs' => array(
7209
  'height_css' => array(
7229
  /* ------------------------------------------------------------------------- *
7230
  * LOAD AND REGISTER DIVIDER MODULE
7231
  /* ------------------------------------------------------------------------- */
7232
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7233
 
7234
  function sek_get_module_params_for_czr_divider_module() {
7235
  return array(
7244
  'title' => __('Weight', 'nimble-builder'),
7245
  'min' => 1,
7246
  'max' => 50,
7247
+ //'unit' => 'px',
7248
  'default' => '1px',
7249
  'width-100' => true,
7250
  'refresh_markup' => false,
7274
  'title' => __('Width', 'nimble-builder'),
7275
  'min' => 1,
7276
  'max' => 100,
7277
+ //'unit' => '%',
7278
  'default' => '100%',
7279
  'width-100' => true,
7280
  'refresh_markup' => false,
7292
  'refresh_markup' => false,
7293
  'refresh_stylesheet' => true,
7294
  'css_identifier' => 'border_radius'
7295
+ //'css_selectors'=> ''
7296
  ),
7297
  'h_alignment_css' => array(
7298
  'input_type' => 'horizAlignmentWithDeviceSwitcher',
7326
  /* ------------------------------------------------------------------------- *
7327
  * LOAD AND REGISTER ICON MODULE
7328
  /* ------------------------------------------------------------------------- */
7329
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7330
 
7331
  function sek_get_module_params_for_czr_icon_module() {
7332
  return array(
7346
  'color_hover' => '#969696'
7347
  )
7348
  ),
7349
+ // 'sanitize_callback' => '\Nimble\sanitize_callback__czr_icon_module',
7350
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
7351
  'css_selectors' => array( '.sek-icon-wrapper' ),//array( '.sek-icon i' ),
7352
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/icon_module_tmpl.php",
7353
  'front_assets' => array(
7354
  'czr-font-awesome' => array(
7355
  'type' => 'css',
7356
+ //'handle' => 'czr-font-awesome',
7357
  'src' => NIMBLE_BASE_URL . '/assets/front/fonts/css/fontawesome-all.min.css'
7358
+ //'deps' => array()
7359
  )
7360
  )
7361
  );
7373
  'dynamic_registration' => true,
7374
  'module_type' => 'czr_icon_settings_child',
7375
  'name' => __( 'Icon settings', 'nimble-builder' ),
7376
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
7377
+ // 'starting_value' => array(
7378
+ // 'button_text' => __('Click me','text_doma'),
7379
+ // 'color_css' => '#ffffff',
7380
+ // 'bg_color_css' => '#020202',
7381
+ // 'bg_color_hover' => '#151515', //lighten 15%,
7382
+ // 'use_custom_bg_color_on_hover' => 0,
7383
+ // 'border_radius_css' => '2',
7384
+ // 'h_alignment_css' => 'center',
7385
+ // 'use_box_shadow' => 1,
7386
+ // 'push_effect' => 1
7387
+ // ),
7388
  'css_selectors' => array( '.sek-icon-wrapper' ),//array( '.sek-icon i' ),
7389
  'tmpl' => array(
7390
  'item-inputs' => array(
7391
  'icon' => array(
7392
  'input_type' => 'fa_icon_picker',
7393
  'title' => __('Select an Icon', 'nimble-builder'),
7394
+ //'default' => 'no-link'
7395
  ),
7396
  'link-to' => array(
7397
  'input_type' => 'simpleselect',
7464
  'default' => '#969696',
7465
  'refresh_markup' => false,
7466
  'refresh_stylesheet' => true,
7467
+ //'css_identifier' => 'color_hover'
7468
  )
7469
  )
7470
  ),
7487
  'dynamic_registration' => true,
7488
  'module_type' => 'czr_icon_spacing_border_child',
7489
  'name' => __( 'Icon options for background, spacing, border, shadow', 'nimble-builder' ),
7490
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
7491
+ // 'starting_value' => array(
7492
+ // 'button_text' => __('Click me','text_doma'),
7493
+ // 'color_css' => '#ffffff',
7494
+ // 'bg_color_css' => '#020202',
7495
+ // 'bg_color_hover' => '#151515', //lighten 15%,
7496
+ // 'use_custom_bg_color_on_hover' => 0,
7497
+ // 'border_radius_css' => '2',
7498
+ // 'h_alignment_css' => 'center',
7499
+ // 'use_box_shadow' => 1,
7500
+ // 'push_effect' => 1
7501
+ // ),
7502
  'css_selectors' => array( '.sek-icon-wrapper' ),//array( '.sek-icon i' ),
7503
  'tmpl' => array(
7504
  'item-inputs' => array(
7510
  'refresh_markup' => false,
7511
  'refresh_stylesheet' => true,
7512
  'css_identifier' => 'spacing_with_device_switcher',
7513
+ // 'css_selectors'=> '.sek-icon i'
7514
  ),
7515
  'bg_color_css' => array(
7516
  'input_type' => 'wp_color_alpha',
7521
  'refresh_markup' => false,
7522
  'refresh_stylesheet' => true,
7523
  'css_identifier' => 'background_color',
7524
+ // 'css_selectors'=> '.sek-icon i'
7525
  ),
7526
  'border-type' => array(
7527
  'input_type' => 'simpleselect',
7543
  'refresh_stylesheet' => true,
7544
  'width-100' => true,
7545
  'title_width' => 'width-100',
7546
+ // 'css_selectors'=> '.sek-icon i'
7547
  ),
7548
  'border_radius_css' => array(
7549
  'input_type' => 'border_radius',
7556
  'refresh_markup' => false,
7557
  'refresh_stylesheet' => true,
7558
  'css_identifier' => 'border_radius',
7559
+ // 'css_selectors'=> '.sek-icon i'
7560
  ),
7561
  'use_box_shadow' => array(
7562
  'input_type' => 'nimblecheck',
7583
  * SCHEDULE CSS RULES FILTERING
7584
  /* ------------------------------------------------------------------------- */
7585
  add_filter( 'sek_add_css_rules_for_module_type___czr_icon_module', '\Nimble\sek_add_css_rules_for_icon_front_module', 10, 2 );
7586
+ // filter documented in Sek_Dyn_CSS_Builder::sek_css_rules_sniffer_walker
7587
+ // Note : $complete_modul_model has been normalized
7588
+ // @return populated $rules
7589
  function sek_add_css_rules_for_icon_front_module( $rules, $complete_modul_model ) {
7590
  if ( empty( $complete_modul_model['value'] ) )
7591
  return $rules;
7593
  $value = $complete_modul_model['value'];
7594
 
7595
  $icon_settings = $value['icon_settings'];
7596
+
7597
+ // COLOR ON HOVER
7598
  $icon_color = $icon_settings['color_css'];
7599
  if ( sek_booleanize_checkbox_val( $icon_settings['use_custom_color_on_hover'] ) ) {
7600
  $color_hover = $icon_settings['color_hover'];
7601
  } else {
7602
+ // Build the lighter rgb from the user picked bg color
7603
  if ( 0 === strpos( $icon_color, 'rgba' ) ) {
7604
  list( $rgb, $alpha ) = sek_rgba2rgb_a( $icon_color );
7605
  $color_hover_rgb = sek_lighten_rgb( $rgb, $percent=15, $array = true );
7615
  'css_rules' => 'color:' . $color_hover . ';',
7616
  'mq' =>null
7617
  );
7618
+
7619
+ // BORDERS
7620
  $border_settings = $value[ 'spacing_border' ][ 'borders' ];
7621
  $border_type = $value[ 'spacing_border' ][ 'border-type' ];
7622
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
7623
+
7624
+ //border width + type + color
7625
  if ( $has_border_settings ) {
7626
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
7627
  $rules,
7637
  /* ------------------------------------------------------------------------- *
7638
  * LOAD AND REGISTER MAP MODULE
7639
  /* ------------------------------------------------------------------------- */
7640
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7641
 
7642
  function sek_get_module_params_for_czr_map_module() {
7643
  return array(
7644
  'dynamic_registration' => true,
7645
  'module_type' => 'czr_map_module',
7646
  'name' => __('Map', 'nimble-builder'),
7647
+ // 'sanitize_callback' => '\Nimble\sanitize_callback__czr_gmap_module',
7648
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
7649
+ //'css_selectors' => array( '.sek-module-inner' ),
7650
  'starting_value' => array(
7651
  'address' => 'Nice, France',
7652
  'zoom' => 10,
7702
  /* ------------------------------------------------------------------------- *
7703
  * LOAD AND REGISTER QUOTE MODULE
7704
  /* ------------------------------------------------------------------------- */
7705
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
7706
 
7707
  function sek_get_module_params_for_czr_quote_module() {
7708
  return array(
7716
  ),
7717
  'name' => __('Quote', 'nimble-builder' ),
7718
  'sanitize_callback' => __NAMESPACE__ . '\sanitize_callback__czr_quote_module',
7719
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
7720
  'starting_value' => array(
7721
  'quote_content' => array(
7722
  'quote_text' => __('Hey, careful, man, there\'s a beverage here!','nimble-builder'),
7756
  'dynamic_registration' => true,
7757
  'module_type' => 'czr_quote_quote_child',
7758
  'name' => __( 'Quote content', 'nimble-builder' ),
7759
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
7760
+ //'css_selectors' =>'',
7761
  'tmpl' => array(
7762
  'item-inputs' => array(
7763
  'quote_text' => array(
7769
  'title' => __( 'Main quote content', 'nimble-builder' ),
7770
  'default' => '',
7771
  'width-100' => true,
7772
+ //'notice_before' => __( 'You may use some html tags like a, br,p, div, span with attributes like style, id, class ...', 'text_doma'),
7773
  'refresh_markup' => '.sek-quote-content'
7774
  ),
7775
  'quote_font_family_css' => array(
7881
  'css_selectors' => $quote_font_selectors,
7882
  'width-100' => true,
7883
  ),//0,
7884
+ // Note : always use the suffix '_flag_important' to name an input controling the !important css flag @see Nimble\sek_add_css_rules_for_css_sniffed_input_id
7885
  'quote___flag_important' => array(
7886
  'input_type' => 'nimblecheck',
7887
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
7890
  'refresh_stylesheet' => true,
7891
  'title_width' => 'width-80',
7892
  'input_width' => 'width-20',
7893
+ // declare the list of input_id that will be flagged with !important when the option is checked
7894
+ // @see sek_add_css_rules_for_css_sniffed_input_id
7895
+ // @see sek_is_flagged_important
7896
  'important_input_list' => array(
7897
  'quote_font_family_css',
7898
  'quote_font_size_css',
7925
  'dynamic_registration' => true,
7926
  'module_type' => 'czr_quote_cite_child',
7927
  'name' => __( 'Cite content', 'nimble-builder' ),
7928
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
7929
+ //'css_selectors' =>'',
7930
  'tmpl' => array(
7931
  'item-inputs' => array(
7932
  'cite_text' => array(
7940
  'title' => __( 'Cite text', 'nimble-builder' ),
7941
  'default' => '',
7942
  'width-100' => true,
7943
+ //'notice_before' => __( 'You may use some html tags like a, br, span with attributes like style, id, class ...', 'text_doma'),
7944
  ),
7945
  'cite_font_family_css' => array(
7946
  'input_type' => 'font_picker',
8051
  'css_selectors' => $cite_font_selectors,
8052
  'width-100' => true,
8053
  ),//0,
8054
+ // Note : always use the suffix '_flag_important' to name an input controling the !important css flag @see Nimble\sek_add_css_rules_for_css_sniffed_input_id
8055
  'cite___flag_important' => array(
8056
  'input_type' => 'nimblecheck',
8057
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
8060
  'refresh_stylesheet' => true,
8061
  'title_width' => 'width-80',
8062
  'input_width' => 'width-20',
8063
+ // declare the list of input_id that will be flagged with !important when the option is checked
8064
+ // @see sek_add_css_rules_for_css_sniffed_input_id
8065
+ // @see Nsek_is_flagged_important
8066
  'important_input_list' => array(
8067
  'cite_font_family_css',
8068
  'cite_font_size_css',
8100
  'dynamic_registration' => true,
8101
  'module_type' => 'czr_quote_design_child',
8102
  'name' => __( 'Design', 'nimble-builder' ),
8103
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8104
+ //'css_selectors' =>'',
8105
  'tmpl' => array(
8106
  'item-inputs' => array(
8107
  'quote_design' => array(
8172
  function sanitize_callback__czr_quote_module( $value ) {
8173
  if ( !current_user_can( 'unfiltered_html' ) ) {
8174
  if ( array_key_exists( 'quote_text', $value ) ) {
8175
+ //sanitize quote_text
8176
  $value[ 'quote_text' ] = wp_kses_post( $value[ 'quote_text' ] );
8177
  }
8178
  if ( array_key_exists( 'cite_text', $value ) ) {
8179
+ //sanitize cite_text
8180
  $value[ 'cite_text' ] = wp_kses_post( $value[ 'cite_text' ] );
8181
  }
8182
  }
8188
  /* ------------------------------------------------------------------------- *
8189
  * LOAD AND REGISTER BUTTON MODULE
8190
  /* ------------------------------------------------------------------------- */
8191
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
8192
 
8193
  function sek_get_module_params_for_czr_button_module() {
8194
  $css_selectors = '.sek-btn';
8236
  'dynamic_registration' => true,
8237
  'module_type' => 'czr_btn_content_child',
8238
  'name' => __( 'Button content', 'nimble-builder' ),
8239
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8240
+ //'css_selectors' =>'',
8241
  'tmpl' => array(
8242
  'item-inputs' => array(
8243
  'button_text' => array(
8286
  'icon' => array(
8287
  'input_type' => 'fa_icon_picker',
8288
  'title' => __( 'Icon next to the button text', 'nimble-builder' ),
8289
+ //'default' => 'no-link'
8290
  ),
8291
  'icon-side' => array(
8292
  'input_type' => 'buttons_choice',
8311
  'dynamic_registration' => true,
8312
  'module_type' => 'czr_btn_design_child',
8313
  'name' => __( 'Button design', 'nimble-builder' ),
8314
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8315
+ //'css_selectors' =>'',
8316
  'tmpl' => array(
8317
  'item-inputs' => array(
8318
  'bg_color_css' => array(
8323
  'refresh_markup' => false,
8324
  'refresh_stylesheet' => true,
8325
  'css_identifier' => 'background_color',
8326
+ //'css_selectors'=> $css_selectors
8327
  ),
8328
  'use_custom_bg_color_on_hover' => array(
8329
  'input_type' => 'nimblecheck',
8342
  'refresh_markup' => false,
8343
  'refresh_stylesheet' => true,
8344
  'notice_after' => __( 'You can also customize the text color on mouseover in the group of text settings below.', 'nimble-builder')
8345
+ //'css_identifier' => 'background_color_hover',
8346
+ //'css_selectors'=> $css_selectors
8347
  ),
8348
  'border-type' => array(
8349
  'input_type' => 'simpleselect',
8378
  'refresh_markup' => false,
8379
  'refresh_stylesheet' => true,
8380
  'css_identifier' => 'border_radius',
8381
+ //'css_selectors'=> $css_selectors
8382
  ),
8383
  'h_alignment_css' => array(
8384
  'input_type' => 'horizAlignmentWithDeviceSwitcher',
8453
  * SCHEDULE CSS RULES FILTERING
8454
  /* ------------------------------------------------------------------------- */
8455
  add_filter( 'sek_add_css_rules_for_module_type___czr_button_module', '\Nimble\sek_add_css_rules_for_button_front_module', 10, 2 );
8456
+ // filter documented in Sek_Dyn_CSS_Builder::sek_css_rules_sniffer_walker
8457
+ // Note : $complete_modul_model has been normalized
8458
+ // @return populated $rules
8459
  function sek_add_css_rules_for_button_front_module( $rules, $complete_modul_model ) {
8460
  if ( empty( $complete_modul_model['value'] ) )
8461
  return $rules;
8462
+
8463
+ // BACKGROUND
8464
  $value = $complete_modul_model['value'];
8465
  $design_settings = $value['design'];
8466
  $bg_color = $design_settings['bg_color_css'];
8467
  if ( sek_booleanize_checkbox_val( $design_settings['use_custom_bg_color_on_hover'] ) ) {
8468
  $bg_color_hover = $design_settings['bg_color_hover'];
8469
  } else {
8470
+ // Build the lighter rgb from the user picked bg color
8471
  if ( 0 === strpos( $bg_color, 'rgba' ) ) {
8472
  list( $rgb, $alpha ) = sek_rgba2rgb_a( $bg_color );
8473
  $bg_color_hover_rgb = sek_lighten_rgb( $rgb, $percent=15, $array = true );
8483
  'css_rules' => 'background-color:' . $bg_color_hover . ';',
8484
  'mq' =>null
8485
  );
8486
+
8487
+ // BORDERS
8488
  $border_settings = $design_settings[ 'borders' ];
8489
  $border_type = $design_settings[ 'border-type' ];
8490
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
8491
+
8492
+ //border width + type + color
8493
  if ( $has_border_settings ) {
8494
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
8495
  $rules,
8506
  /* ------------------------------------------------------------------------- *
8507
  * LOAD AND REGISTER SIMPLE FORM MODULES
8508
  /* ------------------------------------------------------------------------- */
8509
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
8510
 
8511
  function sek_get_module_params_for_czr_simple_form_module() {
8512
  $css_selectors = '.sek-btn';
8523
  'form_submission' => 'czr_simple_form_submission_child'
8524
  ),
8525
  'name' => __( 'Simple Form', 'nimble-builder' ),
8526
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8527
  'starting_value' => array(
8528
  'fields_design' => array(
8529
  'border' => array(
8575
  'dynamic_registration' => true,
8576
  'module_type' => 'czr_simple_form_fields_child',
8577
  'name' => __( 'Form fields and button labels', 'nimble-builder' ),
8578
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8579
+ // 'starting_value' => array(
8580
+ // 'button_text' => __('Click me','text_doma'),
8581
+ // 'color_css' => '#ffffff',
8582
+ // 'bg_color_css' => '#020202',
8583
+ // 'bg_color_hover' => '#151515', //lighten 15%,
8584
+ // 'use_custom_bg_color_on_hover' => 0,
8585
+ // 'border_radius_css' => '2',
8586
+ // 'h_alignment_css' => 'center',
8587
+ // 'use_box_shadow' => 1,
8588
+ // 'push_effect' => 1
8589
+ // ),
8590
  'css_selectors' => array( '.sek-module-inner' ),
8591
  'tmpl' => array(
8592
  'item-inputs' => array(
8687
  'dynamic_registration' => true,
8688
  'module_type' => 'czr_simple_form_design_child',
8689
  'name' => __( 'Form fields design', 'nimble-builder' ),
8690
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8691
+ // 'starting_value' => array(
8692
+ // 'button_text' => __('Click me','text_doma'),
8693
+ // 'color_css' => '#ffffff',
8694
+ // 'bg_color_css' => '#020202',
8695
+ // 'bg_color_hover' => '#151515', //lighten 15%,
8696
+ // 'use_custom_bg_color_on_hover' => 0,
8697
+ // 'border_radius_css' => '2',
8698
+ // 'h_alignment_css' => 'center',
8699
+ // 'use_box_shadow' => 1,
8700
+ // 'push_effect' => 1
8701
+ // ),
8702
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
8703
  'tmpl' => array(
8704
  'item-inputs' => array(
8775
  'dynamic_registration' => true,
8776
  'module_type' => 'czr_simple_form_button_child',
8777
  'name' => __( 'Form button design', 'nimble-builder' ),
8778
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8779
+ // 'starting_value' => array(
8780
+ // 'button_text' => __('Click me','text_doma'),
8781
+ // 'color_css' => '#ffffff',
8782
+ // 'bg_color_css' => '#020202',
8783
+ // 'bg_color_hover' => '#151515', //lighten 15%,
8784
+ // 'use_custom_bg_color_on_hover' => 0,
8785
+ // 'border_radius_css' => '2',
8786
+ // 'h_alignment_css' => 'center',
8787
+ // 'use_box_shadow' => 1,
8788
+ // 'push_effect' => 1
8789
+ // ),
8790
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
8791
  'tmpl' => array(
8792
  'item-inputs' => array(
8816
  'default' => '',
8817
  'refresh_markup' => false,
8818
  'refresh_stylesheet' => true,
8819
+ //'css_identifier' => 'background_color_hover',
8820
  'css_selectors'=> $css_selectors
8821
  ),
8822
  'border-type' => array(
8923
  'dynamic_registration' => true,
8924
  'module_type' => 'czr_simple_form_fonts_child',
8925
  'name' => __( 'Form texts options : fonts, colors, ...', 'nimble-builder' ),
8926
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
8927
+ // 'starting_value' => array(
8928
+ // ),
8929
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
8930
  'tmpl' => array(
8931
  'item-inputs' => array(
9042
  'css_selectors' => $fl_font_selectors,
9043
  'width-100' => true,
9044
  ),//0,
9045
+ // Note : always use the suffix '_flag_important' to name an input controling the !important css flag @see Nimble\sek_add_css_rules_for_css_sniffed_input_id
9046
  'fl___flag_important' => array(
9047
  'input_type' => 'nimblecheck',
9048
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
9051
  'refresh_stylesheet' => true,
9052
  'title_width' => 'width-80',
9053
  'input_width' => 'width-20',
9054
+ // declare the list of input_id that will be flagged with !important when the option is checked
9055
+ // @see sek_add_css_rules_for_css_sniffed_input_id
9056
+ // @see Nsek_is_flagged_important
9057
  'important_input_list' => array(
9058
  'fl_font_family_css',
9059
  'fl_font_size_css',
9181
  'css_selectors' => $ft_font_selectors,
9182
  'width-100' => true,
9183
  ),//0,
9184
+ // Note : always use the suffix '_flag_important' to name an input controling the !important css flag @see Nimble\sek_add_css_rules_for_css_sniffed_input_id
9185
  'ft___flag_important' => array(
9186
  'input_type' => 'nimblecheck',
9187
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
9190
  'refresh_stylesheet' => true,
9191
  'title_width' => 'width-80',
9192
  'input_width' => 'width-20',
9193
+ // declare the list of input_id that will be flagged with !important when the option is checked
9194
+ // @see sek_add_css_rules_for_css_sniffed_input_id
9195
+ // @see Nsek_is_flagged_important
9196
  'important_input_list' => array(
9197
  'ft_font_family_css',
9198
  'ft_font_size_css',
9320
  'css_selectors' => $btn_font_selectors,
9321
  'width-100' => true,
9322
  ),//0,
9323
+ // Note : always use the suffix '_flag_important' to name an input controling the !important css flag @see Nimble\sek_add_css_rules_for_css_sniffed_input_id
9324
  'btn___flag_important' => array(
9325
  'input_type' => 'nimblecheck',
9326
  'title' => __( 'Make those style options win if other rules are applied.', 'nimble-builder' ),
9329
  'refresh_stylesheet' => true,
9330
  'title_width' => 'width-80',
9331
  'input_width' => 'width-20',
9332
+ // declare the list of input_id that will be flagged with !important when the option is checked
9333
+ // @see sek_add_css_rules_for_css_sniffed_input_id
9334
+ // @see Nsek_is_flagged_important
9335
  'important_input_list' => array(
9336
  'btn_font_family_css',
9337
  'btn_font_size_css',
9354
  );
9355
  }
9356
 
9357
+ // function sanitize_callback__czr_simple_form_module( $value ) {
9358
+ // $value[ 'button_text' ] = sanitize_text_field( $value[ 'button_text' ] );
9359
+ // return $value;
9360
+ // }
9361
+
9362
 
9363
 
9364
  /* ------------------------------------------------------------------------- *
9370
  'dynamic_registration' => true,
9371
  'module_type' => 'czr_simple_form_submission_child',
9372
  'name' => __( 'Form submission options', 'nimble-builder' ),
9373
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
9374
+ // 'starting_value' => array(
9375
+ // 'button_text' => __('Click me','text_doma'),
9376
+ // 'color_css' => '#ffffff',
9377
+ // 'bg_color_css' => '#020202',
9378
+ // 'bg_color_hover' => '#151515', //lighten 15%,
9379
+ // 'use_custom_bg_color_on_hover' => 0,
9380
+ // 'border_radius_css' => '2',
9381
+ // 'h_alignment_css' => 'center',
9382
+ // 'use_box_shadow' => 1,
9383
+ // 'push_effect' => 1
9384
+ // ),
9385
  'css_selectors' => array( '.sek-module-inner .sek-simple-form-wrapper' ),
9386
  'tmpl' => array(
9387
  'item-inputs' => array(
9470
  /* ------------------------------------------------------------------------- *
9471
  * SCHEDULE CSS RULES FILTERING FOR THE FORM MODULE
9472
  /* ------------------------------------------------------------------------- */
9473
+ // FORM MODULE CHILDREN
9474
+ // 'children' => array(
9475
+ // 'form_fields' => 'czr_simple_form_fields_child',
9476
+ // 'fields_design' => 'czr_simple_form_design_child',
9477
+ // 'form_button' => 'czr_simple_form_button_child',
9478
+ // 'form_fonts' => 'czr_simple_form_fonts_child'
9479
+ // ),
9480
  add_filter( 'sek_add_css_rules_for_module_type___czr_simple_form_module', '\Nimble\sek_add_css_rules_for_czr_simple_form_module', 10, 2 );
9481
+ // filter documented in Sek_Dyn_CSS_Builder::sek_css_rules_sniffer_walker
9482
+ // Note : $complete_modul_model has been normalized
9483
+ // @return populated $rules
9484
  function sek_add_css_rules_for_czr_simple_form_module( $rules, $complete_modul_model ) {
9485
  if ( empty( $complete_modul_model['value'] ) )
9486
  return $rules;
9487
 
9488
  $value = $complete_modul_model['value'];
9489
+
9490
+ // BUTTON
9491
  if ( ! empty( $value['form_button'] ) && is_array( $value['form_button'] ) ) {
9492
  $form_button_options = $value['form_button'];
9493
  $bg_color = $form_button_options['bg_color_css'];
9494
  if ( sek_booleanize_checkbox_val( $form_button_options['use_custom_bg_color_on_hover'] ) ) {
9495
  $bg_color_hover = $form_button_options['bg_color_hover'];
9496
  } else {
9497
+ // Build the lighter rgb from the user picked bg color
9498
  if ( 0 === strpos( $bg_color, 'rgba' ) ) {
9499
  list( $rgb, $alpha ) = sek_rgba2rgb_a( $bg_color );
9500
  $bg_color_hover_rgb = sek_lighten_rgb( $rgb, $percent=15, $array = true );
9511
  'css_rules' => 'background-color:' . $bg_color_hover . ';',
9512
  'mq' =>null
9513
  );
9514
+
9515
+ // BUTTON BORDERS
9516
  $border_settings = $form_button_options[ 'borders' ];
9517
  $border_type = $form_button_options[ 'border-type' ];
9518
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
9519
+
9520
+ //border width + type + color
9521
  if ( $has_border_settings ) {
9522
  $rules = sek_generate_css_rules_for_multidimensional_border_options(
9523
  $rules,
9527
  );
9528
  }
9529
  }
9530
+
9531
+
9532
+ // FIELDS BORDERS
9533
  $border_settings = $value[ 'fields_design' ][ 'borders' ];
9534
  $border_type = $value[ 'fields_design' ][ 'border-type' ];
9535
  $has_border_settings = 'none' != $border_type && !empty( $border_type );
9536
+
9537
+ //border width + type + color
9538
  if ( $has_border_settings ) {
9539
  $selector_list = array( 'form input[type="text"]', 'input[type="text"]:focus', 'form textarea', 'form textarea:focus' );
9540
  $css_selectors = array();
9583
  'dynamic_registration' => true,
9584
  'module_type' => 'czr_post_grid_main_child',
9585
  'name' => __( 'Main grid settings : layout, number of posts, columns,...', 'nimble-builder' ),
9586
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
9587
+ // 'starting_value' => array(
9588
+ // 'button_text' => __('Click me','text_doma'),
9589
+ // 'color_css' => '#ffffff',
9590
+ // 'bg_color_css' => '#020202',
9591
+ // 'bg_color_hover' => '#151515', //lighten 15%,
9592
+ // 'use_custom_bg_color_on_hover' => 0,
9593
+ // 'border_radius_css' => '2',
9594
+ // 'h_alignment_css' => 'center',
9595
+ // 'use_box_shadow' => 1,
9596
+ // 'push_effect' => 1
9597
+ // ),
9598
  'css_selectors' => array( '.sek-module-inner' ),
9599
  'tmpl' => array(
9600
  'item-inputs' => array(
9622
  'default' => false,
9623
  'title_width' => 'width-80',
9624
  'input_width' => 'width-20'
9625
+ //'html_before' => '<hr>'
9626
  ),
9627
  'order_by' => array(
9628
  'input_type' => 'simpleselect',
9672
  'default' => false,
9673
  'title_width' => 'width-80',
9674
  'input_width' => 'width-20'
9675
+ //'html_before' => '<hr>'
9676
  ),
9677
  'has_mobile_breakpoint' => array(
9678
  'input_type' => 'nimblecheck',
9712
  'title' => __('Space between text blocks', 'nimble-builder'),
9713
  'min' => 1,
9714
  'max' => 100,
9715
+ //'unit' => 'px',
9716
  'default' => array( 'desktop' => '15px' ),
9717
  'width-100' => true,
9718
  'refresh_markup' => false,
9745
  'title' => __('Content blocks padding', 'nimble-builder'),
9746
  'min' => 1,
9747
  'max' => 100,
9748
+ //'unit' => 'px',
9749
  'default' => array( 'desktop' => '0px' ),
9750
  'width-100' => true,
9751
  'refresh_markup' => false,
9799
  'dynamic_registration' => true,
9800
  'module_type' => 'czr_post_grid_thumb_child',
9801
  'name' => __( 'Post thumbnail settings : size, design...', 'nimble-builder' ),
9802
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
9803
+ // 'starting_value' => array(
9804
+ // 'button_text' => __('Click me','text_doma'),
9805
+ // 'color_css' => '#ffffff',
9806
+ // 'bg_color_css' => '#020202',
9807
+ // 'bg_color_hover' => '#151515', //lighten 15%,
9808
+ // 'use_custom_bg_color_on_hover' => 0,
9809
+ // 'border_radius_css' => '2',
9810
+ // 'h_alignment_css' => 'center',
9811
+ // 'use_box_shadow' => 1,
9812
+ // 'push_effect' => 1
9813
+ // ),
9814
  'css_selectors' => array( '.sek-module-inner' ),
9815
  'tmpl' => array(
9816
  'item-inputs' => array(
9817
+ // IMAGE
9818
  'show_thumb' => array(
9819
  'input_type' => 'nimblecheck',
9820
  'title' => __('Display post thumbnail', 'nimble-builder'),
9890
  'dynamic_registration' => true,
9891
  'module_type' => 'czr_post_grid_metas_child',
9892
  'name' => __( 'Post metas : author, date, category, tags,...', 'nimble-builder' ),
9893
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
9894
+ // 'starting_value' => array(
9895
+ // 'button_text' => __('Click me','text_doma'),
9896
+ // 'color_css' => '#ffffff',
9897
+ // 'bg_color_css' => '#020202',
9898
+ // 'bg_color_hover' => '#151515', //lighten 15%,
9899
+ // 'use_custom_bg_color_on_hover' => 0,
9900
+ // 'border_radius_css' => '2',
9901
+ // 'h_alignment_css' => 'center',
9902
+ // 'use_box_shadow' => 1,
9903
+ // 'push_effect' => 1
9904
+ // ),
9905
  'css_selectors' => array( '.sek-module-inner' ),
9906
  'tmpl' => array(
9907
  'item-inputs' => array(
9958
  'dynamic_registration' => true,
9959
  'module_type' => 'czr_post_grid_fonts_child',
9960
  'name' => __( 'Grid text settings : fonts, colors, ...', 'nimble-builder' ),
9961
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
9962
+ // 'starting_value' => array(
9963
+ // ),
9964
  'css_selectors' => array( '.sek-module-inner .sek-post-grid-wrapper' ),
9965
  'tmpl' => array(
9966
  'item-inputs' => array(
10346
  * SCHEDULE CSS RULES FILTERING
10347
  /* ------------------------------------------------------------------------- */
10348
  add_filter( 'sek_add_css_rules_for_module_type___czr_post_grid_module', '\Nimble\sek_add_css_rules_for_czr_post_grid_module', 10, 2 );
10349
+ // filter documented in Sek_Dyn_CSS_Builder::sek_css_rules_sniffer_walker
10350
+ // Note : $complete_modul_model has been normalized
10351
+ // @return populated $rules
10352
  function sek_add_css_rules_for_czr_post_grid_module( $rules, $complete_modul_model ) {
10353
  if ( empty( $complete_modul_model['value'] ) )
10354
  return $rules;
10356
  $value = $complete_modul_model['value'];
10357
  $main_settings = $value['grid_main'];
10358
  $thumb_settings = $value['grid_thumb'];
10359
+
10360
+
10361
+ // SPACE BETWEEN CONTENT ELEMENTS
10362
  $margin_bottom = $main_settings['space_between_el'];
10363
  $margin_bottom = is_array( $margin_bottom ) ? $margin_bottom : array();
10364
  $defaults = array(
10371
  foreach ($margin_bottom as $device => $num_unit ) {
10372
  $num_val = sek_extract_numeric_value( $num_unit );
10373
  $margin_bottom_ready_val[$device] = '';
10374
+ // Leave the device value empty if === to default
10375
+ // Otherwise it will print a duplicated dynamic css rules, already hardcoded in the static stylesheet
10376
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/419
10377
  if ( ! empty( $num_unit ) && $num_val.'px' !== $defaults[$device].'' ) {
10378
  $unit = sek_extract_unit( $num_unit );
10379
  $num_val = $num_val < 0 ? 0 : $num_val;
10390
  )),
10391
  'is_important' => false
10392
  ), $rules );
10393
+
10394
+
10395
+
10396
+ // CONTENT BLOCKS PADDING
10397
  $content_padding = $main_settings['content_padding'];
10398
  $content_padding = is_array( $content_padding ) ? $content_padding : array();
10399
  $defaults = array(
10406
  foreach ($content_padding as $device => $num_unit ) {
10407
  $num_val = sek_extract_numeric_value( $num_unit );
10408
  $content_padding_ready_val[$device] = '';
10409
+ // Leave the device value empty if === to default
10410
+ // Otherwise it will print a duplicated dynamic css rules, already hardcoded in the static stylesheet
10411
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/419
10412
  if ( ! empty( $num_unit ) && $num_val.'px' !== $defaults[$device].'' ) {
10413
  $unit = sek_extract_unit( $num_unit );
10414
  $num_val = $num_val < 0 ? 0 : $num_val;
10421
  'selector' => '[data-sek-id="'.$complete_modul_model['id'].'"] .sek-post-grid-wrapper .sek-grid-items article .sek-pg-content',
10422
  'is_important' => false
10423
  ), $rules );
10424
+
10425
+
10426
+
10427
+ // IMG COLUMN WIDTH IN LIST
10428
+ // - only relevant when the thumbnail is displayed
10429
+ // - default value is array( 'desktop' => '30' )
10430
+ // - default css is .sek-list-layout article.sek-has-thumb { grid-template-columns: 30% minmax(0,1fr); }
10431
  if ( 'list' === $main_settings['layout'] && true === sek_booleanize_checkbox_val( $thumb_settings['show_thumb'] ) ) {
10432
  $img_column_width = $main_settings['img_column_width'];
10433
  $img_column_width = is_array( $img_column_width ) ? $img_column_width : array();
10441
  foreach ($img_column_width as $device => $num_val ) {
10442
  $num_val = sek_extract_numeric_value( $num_val );
10443
  $img_column_width_ready_value[$device] = '';
10444
+ // Leave the device value empty if === to default
10445
+ // Otherwise it will print a duplicated dynamic css rules, already hardcoded in the static stylesheet
10446
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/419
10447
  if ( ! empty( $num_val ) && $num_val.'%' !== $defaults[$device].'' ) {
10448
  $num_val = $num_val > 100 ? 100 : $num_val;
10449
  $num_val = $num_val < 1 ? 1 : $num_val;
10458
  'is_important' => false
10459
  ), $rules );
10460
  }
10461
+
10462
+ // IMG HEIGHT
10463
+ // we set the height of the image container ( <a> tag ), with the padding property
10464
+ // because padding and margin are relative to the width in CSS
10465
+ // @see https://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#padding-properties
10466
  if ( true === sek_booleanize_checkbox_val( $thumb_settings['img_has_custom_height'] ) ) {
10467
  $img_height = $thumb_settings['img_height'];
10468
  $img_height = is_array( $img_height ) ? $img_height : array();
10477
  foreach ( $img_height as $device => $num_val ) {
10478
  $num_val = sek_extract_numeric_value( $num_val );
10479
  $img_height_ready_value[$device] = '';
10480
+ // Leave the device value empty if === to default
10481
+ // Otherwise it will print a duplicated dynamic css rules, already hardcoded in the static stylesheet
10482
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/419
10483
  if ( ! empty( $num_val ) && $num_val.'%' !== $defaults[$device].'' ) {
10484
  $num_val = $num_val < 1 ? 1 : $num_val;
10485
  $img_height_ready_value[$device] = sprintf('%s;', $num_val .'%');
10492
  'is_important' => false
10493
  ), $rules );
10494
  }
10495
+
10496
+
10497
+ // COLUMN AND ROW GAP
10498
  if ( true === sek_booleanize_checkbox_val( $main_settings['custom_grid_spaces'] ) ) {
10499
+ // Horizontal Gap
10500
  $gap = $main_settings['column_gap'];
10501
  $gap = is_array( $gap ) ? $gap : array();
10502
  $defaults = array(
10505
  'mobile' => ''
10506
  );
10507
  $gap = wp_parse_args( $gap, $defaults );
10508
+ // replace % by vh when needed
10509
  $gap_ready_value = $gap;
10510
  foreach ($gap as $device => $num_unit ) {
10511
  $numeric = sek_extract_numeric_value( $num_unit );
10512
  $numeric = $numeric < 0 ? '0' : $numeric;
10513
  $gap_ready_value[$device] = '';
10514
+ // Leave the device value empty if === to default
10515
+ // Otherwise it will print a duplicated dynamic css rules, already hardcoded in the static stylesheet
10516
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/419
10517
  if ( ! empty( $num_unit ) && $numeric.'px' !== $defaults[$device].'' ) {
10518
  $unit = sek_extract_unit( $num_unit );
10519
  $gap_ready_value[$device] = $numeric . $unit;
10520
  }
10521
  }
10522
+
10523
+ // for grid layout => gap between columns
10524
+ // for list layout => gap between image and content
10525
  $rules = sek_set_mq_css_rules(array(
10526
  'value' => $gap_ready_value,
10527
  'css_property' => 'grid-column-gap',
10531
  ] ),
10532
  'is_important' => false
10533
  ), $rules );
10534
+
10535
+ // Vertical Gap => common to list and grid layout
10536
  $v_gap = $main_settings['row_gap'];
10537
  $v_gap = is_array( $v_gap ) ? $v_gap : array();
10538
  $defaults = array(
10541
  'mobile' => ''
10542
  );
10543
  $v_gap = wp_parse_args( $v_gap, $defaults );
10544
+ // replace % by vh when needed
10545
  $v_gap_ready_value = $v_gap;
10546
  foreach ($v_gap as $device => $num_unit ) {
10547
  $numeric = sek_extract_numeric_value( $num_unit );
10548
  $numeric = $numeric < 0 ? 0 : $numeric;
10549
  $v_gap_ready_value[$device] = '';
10550
+ // Leave the device value empty if === to default
10551
+ // Otherwise it will print a duplicated dynamic css rules, already hardcoded in the static stylesheet
10552
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/419
10553
  if ( ! empty( $num_unit ) && $numeric.'px' !== $defaults[$device].'' ) {
10554
  $unit = sek_extract_unit( $num_unit );
10555
  $v_gap_ready_value[$device] = $numeric . $unit;
10569
  /* ------------------------------------------------------------------------- *
10570
  * LOAD AND REGISTER BUTTON MODULE
10571
  /* ------------------------------------------------------------------------- */
10572
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
10573
 
10574
  function sek_get_module_params_for_czr_menu_module() {
10575
  $css_selectors = '.sek-btn';
10580
  'is_father' => true,
10581
  'children' => array(
10582
  'content' => 'czr_menu_content_child',
10583
+ //'design' => 'czr_menu_design_child',
10584
  'font' => 'czr_font_child',
10585
  'mobile_options' => 'czr_menu_mobile_options'
10586
 
10588
  'name' => __( 'Menu', 'nimble-builder' ),
10589
  'sanitize_callback' => '\Nimble\sanitize_callback__czr_button_module',
10590
  'starting_value' => array(
10591
+ // 'content' => array(
10592
+ // 'button_text' => __('Click me','text_doma'),
10593
+ // ),
10594
+ // 'design' => array(
10595
+ // 'bg_color_css' => '#020202',
10596
+ // 'bg_color_hover' => '#151515', //lighten 15%,
10597
+ // 'use_custom_bg_color_on_hover' => 0,
10598
+ // 'border_radius_css' => '2',
10599
+ // 'h_alignment_css' => 'center',
10600
+ // 'use_box_shadow' => 1,
10601
+ // 'push_effect' => 1,
10602
+ // ),
10603
+ // 'font' => array(
10604
+ // 'color_css' => '#ffffff',
10605
+ // )
10606
  ),
10607
  'css_selectors' => array( '.sek-menu-module > li' ),//<=@see tmpl/modules/menu_module_tmpl.php
10608
  'render_tmpl_path' => NIMBLE_BASE_PATH . "/tmpl/modules/menu_module_tmpl.php"
10617
  'dynamic_registration' => true,
10618
  'module_type' => 'czr_menu_content_child',
10619
  'name' => __( 'Menu content', 'nimble-builder' ),
10620
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
10621
+ //'css_selectors' =>'',
10622
  'tmpl' => array(
10623
  'item-inputs' => array(
10624
  'menu-id' => array(
10658
  'dynamic_registration' => true,
10659
  'module_type' => 'czr_menu_mobile_options',
10660
  'name' => __( 'Settings for mobile devices', 'nimble-builder' ),
10661
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
10662
+ //'css_selectors' =>'',
10663
  'tmpl' => array(
10664
  'item-inputs' => array(
10665
  'expand_below' => array(
10683
  'dynamic_registration' => true,
10684
  'module_type' => 'czr_font_child',
10685
  'name' => __( 'Text settings : font, color, size, ...', 'nimble-builder' ),
10686
+ //'sanitize_callback' => '\Nimble\sanitize_callback__czr_simple_form_module',
10687
+ // 'starting_value' => array(
10688
+ // 'button_text' => __('Click me','text_doma'),
10689
+ // 'color_css' => '#ffffff',
10690
+ // 'bg_color_css' => '#020202',
10691
+ // 'bg_color_hover' => '#151515', //lighten 15%,
10692
+ // 'use_custom_bg_color_on_hover' => 0,
10693
+ // 'border_radius_css' => '2',
10694
+ // 'h_alignment_css' => 'center',
10695
+ // 'use_box_shadow' => 1,
10696
+ // 'push_effect' => 1
10697
+ // ),
10698
+ //'css_selectors' => '',
10699
  'tmpl' => array(
10700
  'item-inputs' => array(
10701
  'font_family_css' => array(
10710
  'font_size_css' => array(
10711
  'input_type' => 'range_with_unit_picker_device_switcher',
10712
  'title' => __( 'Font size', 'nimble-builder' ),
10713
+ // the default value is commented to fix https://github.com/presscustomizr/nimble-builder/issues/313
10714
+ // => as a consequence, when a module uses the font child module, the default font-size rule must be defined in the module SCSS file.
10715
+ //'default' => array( 'desktop' => '16px' ),
10716
  'min' => 0,
10717
  'max' => 100,
10718
  'title_width' => 'width-100',
10800
  'css_identifier' => 'letter_spacing',
10801
  'width-100' => true,
10802
  ),//0,
10803
+ // Note : always use the suffix '_flag_important' to name an input controling the !important css flag @see Nimble\sek_add_css_rules_for_css_sniffed_input_id
10804
  'fonts___flag_important' => array(
10805
  'input_type' => 'nimblecheck',
10806
  'title' => __('Apply the style options in priority (uses !important).', 'nimble-builder'),
10809
  'refresh_stylesheet' => true,
10810
  'title_width' => 'width-80',
10811
  'input_width' => 'width-20',
10812
+ // declare the list of input_id that will be flagged with !important when the option is checked
10813
+ // @see sek_add_css_rules_for_css_sniffed_input_id
10814
+ // @see Nsek_is_flagged_important
10815
  'important_input_list' => array(
10816
  'font_family_css',
10817
  'font_size_css',
10834
  /* ------------------------------------------------------------------------- *
10835
  * LOAD AND REGISTER WIDGET ZONE MODULE
10836
  /* ------------------------------------------------------------------------- */
10837
+ //Fired in add_action( 'after_setup_theme', 'sek_register_modules', 50 );
10838
 
10839
  function sek_get_module_params_for_czr_widget_area_module() {
10840
  return array(
10841
  'dynamic_registration' => true,
10842
  'module_type' => 'czr_widget_area_module',
10843
  'name' => __('Widget Zone', 'nimble-builder'),
10844
+ //'css_selectors' => array( '.sek-module-inner > *' ),
10845
+ // 'sanitize_callback' => 'function_prefix_to_be_replaced_sanitize_callback__czr_social_module',
10846
+ // 'validate_callback' => 'function_prefix_to_be_replaced_validate_callback__czr_social_module',
10847
  'tmpl' => array(
10848
  'item-inputs' => array(
10849
  'widget-area-id' => array(
10899
 
10900
  private $collection;//the collection of css rules
10901
  private $sek_model;
10902
+ // property "is_global_stylesheet" has been added when fixing https://github.com/presscustomizr/nimble-builder/issues/273
10903
  private $is_global_stylesheet;
10904
  private $parent_level_model = array();
10905
 
10906
  public function __construct( $sek_model = array(), $is_global_stylesheet = false ) {
10907
  $this->sek_model = $sek_model;
10908
  $this->is_global_stylesheet = $is_global_stylesheet;
10909
+ // set the css rules for columns
10910
  /* ------------------------------------------------------------------------- *
10911
  * SCHEDULE CSS RULES FILTERING
10912
  /* ------------------------------------------------------------------------- */
10913
+ // filter fired in sek_css_rules_sniffer_walker()
10914
  add_filter( 'sek_add_css_rules_for_level_options', array( $this, 'sek_add_rules_for_column_width' ), 10, 2 );
10915
 
10916
+ //sek_error_log('FIRING THE CSS BUILDER');
10917
+
10918
  $this->sek_css_rules_sniffer_walker();
10919
  }
10920
+
10921
+
10922
+ // Fired in the constructor
10923
+ // Walk the level tree and build rules when needed
10924
+ // The rules are filtered when some conditions are met.
10925
+ // This allows us to schedule the css rules addition remotely :
10926
+ // - from the module registration php file
10927
+ // - from the generic input types ( @see sek_add_css_rules_for_generic_css_input_types() )
10928
  public function sek_css_rules_sniffer_walker( $level = null, $parent_level = array() ) {
10929
  $level = is_null( $level ) ? $this->sek_model : $level;
10930
  $level = is_array( $level ) ? $level : array();
10931
+
10932
+ // The parent level is set when the function is invoked recursively, from a level where we actually have a 'level' property
10933
  if ( ! empty( $parent_level ) ) {
10934
  $this -> parent_level_model = $parent_level;
10935
  }
10936
 
10937
  foreach ( $level as $key => $entry ) {
10938
  $rules = array();
10939
+
10940
+ // INPUT CSS RULES <= used in front modules only
10941
+ // When we are inside the associative arrays of
10942
+ // - the module 'value'
10943
+ // - or the level 'options' entries <= NOT ANYMORE
10944
+ // the keys are not integer.
10945
+ // We want to filter each input
10946
+ // which makes it possible to target for example the font-family. Either in module values or in level options
10947
  if ( is_string( $key ) && 1 < strlen( $key ) ) {
10948
+ // we need to have a level model set
10949
  if ( !empty( $parent_level ) && is_array( $parent_level ) && !empty( $parent_level['module_type'] ) ) {
10950
+ // If the current level is a module, check if the module has generic css ( *_css suffixed ) selectors specified on registration
10951
+ // $module_level_css_selectors = null;
10952
+ // $registered_input_list = null;
10953
  $module_level_css_selectors = sek_get_registered_module_type_property( $parent_level['module_type'], 'css_selectors' );
10954
 
10955
  $registered_input_list = sek_get_registered_module_input_list( $parent_level['module_type'] );
10956
  if ( 'value' === $key && is_array( $entry ) ) {
10957
  $is_father = sek_get_registered_module_type_property( $parent_level['module_type'], 'is_father' );
10958
  $father_mod_type = $parent_level['module_type'];
10959
+ // If the module has children ( the module is_father ), let's loop on each option group
10960
  if ( $is_father ) {
10961
  $children = sek_get_registered_module_type_property( $father_mod_type, 'children' );
10962
+ // Loop on the children
10963
  foreach ( $entry as $opt_group_type => $input_candidates ) {
10964
  if ( ! is_array( $children ) ) {
10965
  sek_error_log( 'Father module ' . $father_mod_type . ' has invalid children');
10970
  continue;
10971
  }
10972
  $child_mod_type = $children[ $opt_group_type ];
10973
+
10974
+ // If the child module has no css_selectors set, we fallback on the father css_selector
10975
  $child_css_selector = sek_get_registered_module_type_property( $child_mod_type, 'css_selectors' );
10976
  $child_css_selector = empty( $child_css_selector ) ? $module_level_css_selectors : $child_css_selector;
10977
 
10978
  foreach ( $input_candidates as $input_id_candidate => $_input_val ) {
10979
+ // let's skip the $key that are reserved for the structure of the sektion tree
10980
+ // ! in_array( $key, [ 'level', 'collection', 'id', 'module_type', 'options', 'value' ] )
10981
+ // The generic rules must be suffixed with '_css'
10982
  if ( false !== strpos( $input_id_candidate, '_css') ) {
10983
  if ( is_array( $registered_input_list ) && is_array( $registered_input_list[ $opt_group_type ] )&& ! empty( $registered_input_list[ $opt_group_type ][ $input_id_candidate ] ) && ! empty( $registered_input_list[ $opt_group_type ][ $input_id_candidate ]['css_identifier'] ) ) {
10984
  $rules = apply_filters(
10999
  }//foreach
11000
  } else {
11001
  foreach ( $entry as $input_id_candidate => $_input_val ) {
11002
+ // let's skip the $key that are reserved for the structure of the sektion tree
11003
+ // ! in_array( $key, [ 'level', 'collection', 'id', 'module_type', 'options', 'value' ] )
11004
+ // The generic rules must be suffixed with '_css'
11005
  if ( false !== strpos( $input_id_candidate, '_css') ) {
11006
  if ( is_array( $registered_input_list ) && ! empty( $registered_input_list[ $input_id_candidate ] ) && ! empty( $registered_input_list[ $input_id_candidate ]['css_identifier'] ) ) {
11007
  $rules = apply_filters(
11023
  }//if
11024
  }//if
11025
  }//if
11026
+
11027
+
11028
+ // LEVEL CSS RULES
11029
  if ( is_array( $entry ) ) {
11030
+ // Populate rules for sections / columns / modules
11031
+ // Location level are excluded
11032
  if ( !empty( $entry[ 'level' ] ) && 'location' != $entry[ 'level' ] ) {
11033
  $level_type = $entry[ 'level' ];
11034
  $rules = apply_filters( "sek_add_css_rules_for__{$level_type}__options", $rules, $entry );
11035
+ // build rules for level options => section / column / module
11036
  $rules = apply_filters( 'sek_add_css_rules_for_level_options', $rules, $entry );
11037
  }
11038
+
11039
+ // populate rules for modules values
11040
  if ( !empty( $entry[ 'level' ] ) && 'module' === $entry['level'] ) {
11041
  if ( ! empty( $entry['module_type'] ) ) {
11042
  $module_type = $entry['module_type'];
11043
+ // build rules for modules
11044
+ // applying sek_normalize_module_value_with_defaults() allows us to access all the value properties of the module without needing to check their existence
11045
  $rules = apply_filters( "sek_add_css_rules_for_module_type___{$module_type}", $rules, sek_normalize_module_value_with_defaults( $entry ) );
11046
  }
11047
  }
11048
  } // if ( is_array( $entry ) ) {
11049
+
11050
+
11051
+ // POPULATE THE CSS RULES COLLECTION
11052
  if ( !empty( $rules ) ) {
11053
+ //@TODO: MAKE SURE RULE ARE NORMALIZED
11054
  foreach( $rules as $rule ) {
11055
  if ( ! is_array( $rule ) ) {
11056
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => a css rule should be represented by an array', $rule );
11067
  );
11068
  }//foreach
11069
  }
11070
+
11071
+ // keep walking if the current $entry is an array
11072
+ // make sure that the parent_level_model is set right before jumping down to the next level
11073
  if ( is_array( $entry ) ) {
11074
+ // Can we set a parent level ?
11075
  if ( !empty( $entry['level'] ) && in_array( $entry['level'], array( 'location', 'section', 'column', 'module' ) ) ) {
11076
  $parent_level = $entry;
11077
  }
11078
+ // Let's go recursive
11079
  $this->sek_css_rules_sniffer_walker( $entry, $parent_level );
11080
  }
11081
+
11082
+ // Reset the parent level model because it might have been modified after walking the sublevels
11083
  if ( ! empty( $parent_level ) ) {
11084
  $this -> parent_level_model = $parent_level;
11085
  }
11086
 
11087
  }//foreach
11088
  }//sek_css_rules_sniffer_walker()
11089
+
11090
+
11091
+
11092
+ // @return void()
11093
+ // populates the css rules ::collection property, organized by media queries
11094
  public function sek_populate( $selector, $css_rules, $mq = '' ) {
11095
  if ( ! is_string( $selector ) )
11096
  return;
11097
  if ( ! is_string( $css_rules ) )
11098
  return;
11099
+
11100
+ // Assign a default media device
11101
+ //TODO: allowed media query?
11102
  $mq_device = 'all_devices';
11103
+
11104
+ // If a media query is requested, build it
11105
  if ( !empty( $mq ) ) {
11106
  if ( false === strpos($mq, 'max') && false === strpos($mq, 'min')) {
11107
  error_log( __FUNCTION__ . ' ' . __CLASS__ . ' => the media queries only accept max-width and min-width rules');
11109
  $mq_device = $mq;
11110
  }
11111
  }
11112
+
11113
+ // if the media query for this device is not yet added, add it
11114
  if ( !isset( $this->collection[ $mq_device ] ) ) {
11115
  $this->collection[ $mq_device ] = array();
11116
  }
11121
 
11122
  $this->collection[ $mq_device ][ $selector ][] = $css_rules;
11123
  }//sek_populate
11124
+
11125
+
11126
+
11127
+ // @return string
11128
  public static function sek_maybe_wrap_in_media_query( $css, $mq_device = 'all_devices' ) {
11129
  if ( 'all_devices' === $mq_device ) {
11130
  return $css;
11135
  }
11136
  return sprintf( '@media%1$s{%2$s}', $mq_device, $css);
11137
  }
11138
+
11139
+
11140
+ // sorts the media queries from all_devices to the smallest width
11141
+ // This doesn't make the difference between max-width and min-width
11142
+ // @return integer
11143
  public static function user_defined_array_key_sort_fn($a, $b) {
11144
  if ( 'all_devices' === $a ) {
11145
  return -1;
11152
 
11153
  return $b_int - $a_int;
11154
  }
11155
+
11156
+ //@returns a stringified stylesheet, ready to be printed on the page or in a file
11157
  public function get_stylesheet() {
11158
  $css = '';
11159
  $collection = apply_filters( 'nimble_css_rules_collection_before_printing_stylesheet', $this->collection );
11160
  if ( is_array( $collection ) && !empty( $collection ) ) {
11161
+ // Sort the collection by media queries
11162
  uksort( $collection, array( get_called_class(), 'user_defined_array_key_sort_fn' ) );
11163
+
11164
+ // process
11165
  foreach ( $collection as $mq_device => $selectors ) {
11166
  $_css = '';
11167
  foreach ( $selectors as $selector => $css_rules ) {
11175
  }
11176
  return apply_filters( 'nimble_get_dynamic_stylesheet', $css, $this->is_global_stylesheet );
11177
  }
11178
+
11179
+
11180
+
11181
+
11182
+
11183
+
11184
+
11185
+ // Helper
11186
+ // @return css string including media queries
11187
+ // @used for example when generating the rules for used defined section widths locally and globally
11188
  public static function sek_generate_css_stylesheet_for_a_set_of_rules( $rules ) {
11189
  $rules_collection = array();
11190
  $css = '';
11191
 
11192
  if ( empty( $rules ) || ! is_array( $rules ) )
11193
  return $css;
11194
+
11195
+ // POPULATE THE CSS RULES COLLECTION
11196
  foreach( $rules as $rule ) {
11197
  if ( ! is_array( $rule ) ) {
11198
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => a css rule should be represented by an array', $rule );
11209
 
11210
  if ( ! is_string( $css_rules ) )
11211
  continue;
11212
+
11213
+ // Assign a default media device
11214
+ //TODO: allowed media query?
11215
  $mq_device = 'all_devices';
11216
+
11217
+ // If a media query is requested, build it
11218
  if ( !empty( $mq ) ) {
11219
  if ( false === strpos($mq, 'max') && false === strpos($mq, 'min')) {
11220
  error_log( __FUNCTION__ . ' ' . __CLASS__ . ' => the media queries only accept max-width and min-width rules');
11222
  $mq_device = $mq;
11223
  }
11224
  }
11225
+
11226
+ // if the media query for this device is not yet added, add it
11227
  if ( !isset( $rules_collection[ $mq_device ] ) ) {
11228
  $rules_collection[ $mq_device ] = array();
11229
  }
11234
 
11235
  $rules_collection[ $mq_device ][ $selector ][] = $css_rules;
11236
  }//foreach
11237
+
11238
+ // GENERATE CSS
11239
  if ( is_array( $rules_collection ) && !empty( $rules_collection ) ) {
11240
+ // Sort the collection by media queries
11241
+ // get_called_class() is supported by php >= 5.3.0. Nimble needs 5.4
11242
+ // @see https://developer.wordpress.org/reference/functions/add_action/
11243
  uksort( $rules_collection, array( get_called_class(), 'user_defined_array_key_sort_fn' ) );
11244
+
11245
+ // process
11246
  foreach ( $rules_collection as $mq_device => $selectors ) {
11247
  $_css = '';
11248
  foreach ( $selectors as $selector => $css_rules ) {
11255
  }
11256
  }
11257
 
11258
+ return $css;
11259
+ }//sek_generate_css_stylesheet_for_a_set_of_rules()
11260
+
11261
+
11262
+
11263
+
11264
+
11265
+
11266
+
11267
+
11268
+
11269
+ // hook : sek_add_css_rules_for_level_options
11270
  public function sek_add_rules_for_column_width( $rules, $column ) {
11271
  if ( ! is_array( $column ) )
11272
  return $rules;
11275
  return $rules;
11276
 
11277
  $width = empty( $column[ 'width' ] ) || !is_numeric( $column[ 'width' ] ) ? '' : $column['width'];
11278
+
11279
+ // width
11280
  if ( empty( $width ) )
11281
  return $rules;
11282
+
11283
+ // define a default breakpoint : 768
11284
  $breakpoint = self::$breakpoints[ self::COLS_MOBILE_BREAKPOINT ];
11285
+
11286
+ // Is there a global custom breakpoint set ?
11287
  $global_custom_breakpoint = intval( sek_get_global_custom_breakpoint() );
11288
  $has_global_custom_breakpoint = $global_custom_breakpoint >= 1;
11289
+
11290
+ // Does the parent section have a custom breakpoint set ?
11291
  $parent_section = sek_get_parent_level_model( $column['id'] );
11292
  if ( 'no_match' === $parent_section ) {
11293
  sek_error_log( __FUNCTION__ . ' => $parent_section not found for column id : ' . $column['id'] );
11301
  } else if ( $has_global_custom_breakpoint ) {
11302
  $breakpoint = $global_custom_breakpoint;
11303
  }
11304
+
11305
+ // Note : the css selector must be specific enough to override the possible parent section ( or global ) custom breakpoint one.
11306
+ // @see sek_add_css_rules_for_level_breakpoint()
11307
  $rules[] = array(
11308
  'selector' => sprintf( '[data-sek-id="%1$s"] .sek-sektion-inner > .sek-column[data-sek-id="%2$s"]', $parent_section['id'], $column['id'] ),
11309
  'css_rules' => sprintf( '-ms-flex: 0 0 %1$s%%;flex: 0 0 %1$s%%;max-width: %1$s%%', $width ),
11369
  * @var string
11370
  */
11371
  private $skope_id;
11372
+
11373
+ // property "is_global_stylesheet" has been added when fixing https://github.com/presscustomizr/nimble-builder/issues/273
11374
  private $is_global_stylesheet;
11375
 
11376
  /**
11568
  $defaults = array(
11569
  'id' => 'sek-'.rand(),
11570
  'skope_id' => '',
11571
+ // property "is_global_stylesheet" has been added when fixing https://github.com/presscustomizr/nimble-builder/issues/273
11572
  'is_global_stylesheet' => false,
11573
  'mode' => self::MODE_FILE,
11574
  'css_string_to_enqueue_or_print' => $this->css_string_to_enqueue_or_print,
11582
 
11583
 
11584
  $args = wp_parse_args( $args, $defaults );
11585
+
11586
+ //normalize some parameters
11587
  $args[ 'dep' ] = is_array( $args[ 'dep' ] ) ? $args[ 'dep' ] : array();
11588
  $args[ 'priority'] = is_numeric( $args[ 'priority' ] ) ? $args[ 'priority' ] : $this->priority;
11589
+
11590
+ //turn $args into object properties
11591
  foreach ( $args as $key => $value ) {
11592
  if ( property_exists( $this, $key ) && array_key_exists( $key, $defaults) ) {
11593
  $this->$key = $value;
11598
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ .' => __construct => skope_id not provided' );
11599
  return;
11600
  }
11601
+
11602
+ //build no parameterized properties
11603
  $this->_sek_dyn_css_set_properties();
11604
+
11605
+ // Possible scenarios :
11606
+ // 1) customizing :
11607
+ // the css is always printed inline. If there's already an existing css file for this skope_id, it's not enqueued.
11608
+ // 2) saving in the customizer :
11609
+ // the css file is written in a "force_rewrite" mode, meaning that any existing css file gets re-written.
11610
+ // There's no enqueing scheduled, 'customizer_save' mode.
11611
+ // 3) front, user logged in + 'customize' capabilities :
11612
+ // the css file is re-written on each page load + enqueued. If writing a css file is not possible, we fallback on inline printing.
11613
+ // 4) front, user not logged in :
11614
+ // the normal behaviour is that the css file is enqueued.
11615
+ // It should have been written when saving in the customizer. If no file available, we try to write it. If writing a css file is not possible, we fallback on inline printing.
11616
  if ( is_customize_preview() || ! $this->_sek_dyn_css_file_exists() || $this->force_rewrite || $this->customizer_save ) {
11617
  $this->sek_model = sek_get_skoped_seks( $this -> skope_id );
11618
+
11619
+ // on front, when no stylesheet is available, the fallback hook must be set to wp_head, because the hook property might be empty
11620
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/328
11621
  if ( !is_customize_preview() && !$this->_sek_dyn_css_file_exists() ) {
11622
  $this->hook = 'wp_head';
11623
  }
11624
+
11625
+ //build stylesheet
11626
  $this->builder = new Sek_Dyn_CSS_Builder( $this->sek_model, $this->is_global_stylesheet );
11627
+
11628
+ // now that the stylesheet is ready let's cache it
11629
  $this->css_string_to_enqueue_or_print = (string)$this->builder-> get_stylesheet();
11630
  }
11631
+
11632
+ //hook setup for printing or enqueuing
11633
+ //bail if "customizer_save" == true, typically when saving the customizer settings @see Nimble_Customizer_Setting::update()
11634
  if ( ! $this->customizer_save ) {
11635
  $this->_schedule_css_and_fonts_enqueuing_or_printing_maybe_on_custom_hook();
11636
  } else {
11637
+ //sek_error_log( __CLASS__ . '::' . __FUNCTION__ .' ?? => $this->css_string_to_enqueue_or_print => ', $this->css_string_to_enqueue_or_print );
11638
  if ( $this->css_string_to_enqueue_or_print ) {
11639
  $this->sek_dyn_css_maybe_write_css_file();
11640
  } else {
11687
  * @return string
11688
  */
11689
  private function _ssl_maybe_fix_url($url) {
11690
+ // only fix if source URL starts with http://
11691
  if ( is_ssl() && is_string($url) && stripos($url, 'http://') === 0 ) {
11692
  $url = 'https' . substr($url, 4);
11693
  }
11708
  if ( $this->hook ) {
11709
  add_action( $this->hook, array( $this, 'sek_dyn_css_enqueue_or_print_and_google_fonts_print' ), $this->priority );
11710
  } else {
11711
+ //enqueue or print
11712
  $this->sek_dyn_css_enqueue_or_print_and_google_fonts_print();
11713
  }
11714
  }
11728
  * @return void()
11729
  */
11730
  public function sek_dyn_css_enqueue_or_print_and_google_fonts_print() {
11731
+ //sek_error_log( __CLASS__ . ' | ' . __FUNCTION__ . ' => ' . $this->id );
11732
+ // CSS FILE
11733
+ //case enqueue file : front end + user with customize caps not logged in
11734
  if ( self::MODE_FILE == $this->mode ) {
11735
+ //in case we need to write the file before enqueuing
11736
+ //1) $this->css_string_to_enqueue_or_print must exists
11737
+ //2) we might need to force the rewrite even if the file exists or to write it if the file doesn't exist
11738
  if ( $this->css_string_to_enqueue_or_print ) {
11739
  if ( $this->force_rewrite || ( !$this->file_exists && $this->force_write ) ) {
11740
  $this->file_exists = $this->sek_dyn_css_maybe_write_css_file();
11741
  }
11742
  }
11743
+
11744
+ //if the file exists
11745
  if ( $this->file_exists ) {
11746
+ //print the needed html to enqueue a style only if we're in wp_footer or wp_head
11747
  if ( in_array( current_filter(), array( 'wp_footer', 'wp_head' ) ) ) {
11748
  /*
11749
  * TODO: make sure all the deps are enqueued
11750
  */
11751
  printf( '<link rel="stylesheet" id="sek-dyn-%1$s-css" href="%2$s" type="text/css" media="all" />',
11752
  $this->id,
11753
+ //this resource version is built upon the file last modification time
11754
  add_query_arg( array( 'ver' => filemtime($this->uri) ), $this->url )
11755
  );
11756
  } else {
11757
+ //this resource version is built upon the file last modification time
11758
  wp_enqueue_style( "sek-dyn-{$this->id}", $this->url, $this->dep, filemtime($this->uri) );
11759
  }
11760
 
11762
  }
11763
 
11764
  }// if ( self::MODE_FILE )
11765
+
11766
+
11767
+ //if $this->mode != 'file' or the file enqueuing didn't go through (fall back)
11768
+ //print inline style
11769
  if ( $this->css_string_to_enqueue_or_print && ! $this->enqueued_or_printed ) {
11770
  $dep = array_pop( $this->dep );
11771
 
11772
  if ( !$dep || wp_style_is( $dep, 'done' ) || !wp_style_is( $dep, 'done' ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
11773
  printf( '<style id="sek-%1$s" type="text/css" media="all">%2$s</style>', $this->id, $this->css_string_to_enqueue_or_print );
11774
  } else {
11775
+ //not sure
11776
  wp_add_inline_style( $dep , $this->css_string_to_enqueue_or_print );
11777
  }
11778
 
11779
  $this->mode = self::MODE_INLINE;
11780
  $this->enqueued_or_printed = true;
11781
  }
11782
+
11783
+ // GOOGLE FONTS
11784
+ // When customizing
11785
  $print_candidates = $this->sek_get_gfont_print_candidates();
11786
  if ( !empty( $print_candidates ) ) {
11787
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
11801
  }
11802
  }
11803
  }
11804
+
11805
+ // hook : wp_head
11806
+ // or fired directly when ajaxing
11807
+ // When ajaxing, the link#sek-gfonts-{$this->id} gets removed from the dom and replaced by this string
11808
  function sek_gfont_print( $print_candidates ) {
11809
  if ( ! empty( $print_candidates ) ) {
11810
  printf('<link rel="stylesheet" id="sek-gfonts-%1$s" href="%2$s">',
11813
  );
11814
  }
11815
  }
11816
+
11817
+ //@return string
11818
  private function sek_get_gfont_print_candidates() {
11819
+ // in a front end, not logged-in scenario, the sek_model is 'not set', because the stylesheet has not been re-built in the constructor
11820
  $sektions = 'no_set' === $this->sek_model ? sek_get_skoped_seks( $this -> skope_id ) : $this->sek_model;
11821
  $print_candidates = '';
11822
 
11846
  $error = false;
11847
 
11848
  $base_uri = $this->base_uri;
11849
+
11850
+ // Can we create the folder?
11851
  if ( ! $wp_filesystem->is_dir( $base_uri ) ) {
11852
  $error = !wp_mkdir_p( $base_uri );
11853
  }
11857
  }
11858
 
11859
  if ( ! file_exists( $index_path = wp_normalize_path( trailingslashit( $base_uri ) . 'index.php' ) ) ) {
11860
+ // predefined mode settings for WP files
11861
  $wp_filesystem->put_contents( $index_path, "<?php\n// Silence is golden.\n", FS_CHMOD_FILE );
11862
  }
11863
 
11865
  if ( ! wp_is_writable( $base_uri ) ) {
11866
  return false;
11867
  }
11868
+
11869
+ //actual write try and update the file_exists status
11870
  $this->file_exists = $wp_filesystem->put_contents(
11871
  $this->uri,
11872
  $this->css_string_to_enqueue_or_print,
11873
+ // predefined mode settings for WP files
11874
  FS_CHMOD_FILE
11875
  );
11876
+
11877
+ //return whether or not the writing succeeded
11878
  return $this->file_exists;
11879
  }
11880
 
11914
  */
11915
  private function _sek_dyn_css_file_exists() {
11916
  global $wp_filesystem;
11917
+ //sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' SOOO ? => ' . $this->uri . $wp_filesystem->exists( $this->uri ), empty( $file_content ) );
11918
  if ( $wp_filesystem->exists( $this->uri ) ) {
11919
  $file_content = $wp_filesystem->get_contents( $this->uri );
11920
  return $wp_filesystem->is_readable( $this->uri ) && !empty( $file_content );
11971
  * @return string The absolute CSS base directory URI
11972
  */
11973
  private function _sek_dyn_css_build_base_uri() {
11974
+ //since 4.5.0
11975
  $upload_dir = wp_get_upload_dir();
11976
 
11977
  $relative_base_path = isset( $this->relative_base_path ) ? $this->relative_base_path : $this->_sek_dyn_css_build_relative_base_path();
11990
  * @return string The absolute CSS base directory URL
11991
  */
11992
  private function _sek_dyn_css_build_base_url() {
11993
+ //since 4.5.0
11994
  $upload_dir = wp_get_upload_dir();
11995
 
11996
  $relative_base_path = isset( $this->relative_base_path ) ? $this->relative_base_path : $this->_sek_dyn_css_build_relative_base_path();
12032
  *
12033
  * @return bool Whether or not we have filesystem credentials
12034
  */
12035
+ //TODO: try to extend this to other methods e.g. FTP when FTP credentials are already defined
12036
  private function _sek_dyn_css_write_file_is_possible() {
12037
  $upload_dir = wp_get_upload_dir();
12038
+ //Note: if the 'uploads' dir has not been created, this check will not pass, hence no file will never be created
12039
+ //unless something else creates the 'uploads' dir
12040
  if ( 'direct' === get_filesystem_method( array(), $upload_dir['basedir'] ) ) {
12041
  $creds = request_filesystem_credentials( '', '', false, false, array() );
12042
 
12061
  */
12062
  private function _sek_dyn_css_require_wp_filesystem() {
12063
  global $wp_filesystem;
12064
+
12065
+ // Initialize the WordPress filesystem.
12066
  if ( empty( $wp_filesystem ) ) {
12067
  require_once( ABSPATH . '/wp-admin/includes/file.php' );
12068
  WP_Filesystem();
12072
  }
12073
 
12074
  ?><?php
12075
+ // filter declared in Sek_Dyn_CSS_Builder::sek_css_rules_sniffer_walker()
12076
+ // $rules = apply_filters( "sek_add_css_rules_for_input_id", $rules, $key, $entry, $this -> parent_level );
12077
+ // the rules are filtered if ( false !== strpos( $input_id_candidate, '_css') )
12078
+ // Example of input id candidate filtered : 'h_alignment_css'
12079
  add_filter( "sek_add_css_rules_for_input_id", '\Nimble\sek_add_css_rules_for_css_sniffed_input_id', 10, 6 );
12080
  function sek_add_css_rules_for_css_sniffed_input_id( $rules, $value, $input_id, $registered_input_list, $parent_level, $module_level_css_selectors ) {
12081
 
12095
 
12096
  $selector = '[data-sek-id="'.$parent_level['id'].'"]';
12097
  $css_identifier = $input_registration_params['css_identifier'];
12098
+
12099
+ // SPECIFIC CSS SELECTOR AT MODULE LEVEL
12100
+ // are there more specific css selectors specified on module registration ?
12101
  if ( !is_null( $module_level_css_selectors ) && !empty( $module_level_css_selectors ) ) {
12102
  if ( is_array( $module_level_css_selectors ) ) {
12103
  $new_selectors = array();
12110
  $selector .= ' ' . $module_level_css_selectors;
12111
  }
12112
  }
12113
+ // for a module level, increase the default specifity to the .sek-module-inner container by default
12114
+ // @fixes https://github.com/presscustomizr/nimble-builder/issues/85
12115
  else if ( 'module' === $parent_level['level'] ) {
12116
  $selector .= ' .sek-module-inner';
12117
  }
12118
+
12119
+
12120
+ // SPECIFIC CSS SELECTOR AT INPUT LEVEL
12121
+ // => Overrides the module level specific selector, if it was set.
12122
  if ( 'module' === $parent_level['level'] ) {
12123
+ //$start = microtime(true) * 1000;
12124
  if ( ! is_array( $registered_input_list ) || empty( $registered_input_list ) ) {
12125
  sek_error_log( __FUNCTION__ . ' => missing input list' );
12126
  } else if ( is_array( $registered_input_list ) && empty( $registered_input_list[ $input_id ] ) ) {
12127
  sek_error_log( __FUNCTION__ . ' => missing input id ' . $input_id . ' in input list for module type ' . $parent_level['module_type'] );
12128
  }
12129
  if ( is_array( $registered_input_list ) && ! empty( $registered_input_list[ $input_id ] ) && ! empty( $registered_input_list[ $input_id ]['css_selectors'] ) ) {
12130
+ // reset the selector to the level id selector, in case it was previously set spcifically at the module level
12131
  $selector = '[data-sek-id="'.$parent_level['id'].'"]';
12132
  $input_level_css_selectors = $registered_input_list[ $input_id ]['css_selectors'];
12133
  $new_selectors = array();
12141
 
12142
  $new_selectors = implode(',', $new_selectors );
12143
  $selector = $new_selectors;
12144
+ //sek_error_log( '$input_level_css_selectors', $selector );
12145
  }
12146
+ // sek_error_log( 'input_id', $input_id );
12147
+ // sek_error_log( '$registered_input_list', $registered_input_list );
12148
+
12149
+ // $end = microtime(true) * 1000;
12150
+ // $time_elapsed_secs = $end - $start;
12151
+ // sek_error_log('$time_elapsed_secs to get module params', $time_elapsed_secs );
12152
  }
12153
 
12154
 
12156
  $properties_to_render = array();
12157
 
12158
  switch ( $css_identifier ) {
12159
+ // 2 cases for the font_size
12160
+ // 1) we save it as a string : '16px'
12161
+ // 2) we save it as an array of strings by devices : [ 'desktop' => '55px', 'tablet' => '40px', 'mobile' => '36px']
12162
  case 'font_size' :
12163
  if ( is_string( $value ) ) { // <= simple
12164
  $numeric = sek_extract_numeric_value($value);
12205
  $properties_to_render['color'] = $value;
12206
  break;
12207
  case 'color_hover' :
12208
+ //$selector = '[data-sek-id="'.$parent_level['id'].'"]:hover';
12209
+ // Add ':hover to each selectors'
12210
  $new_selectors = array();
12211
  $exploded = explode(',', $selector);
12212
  foreach ( $exploded as $sel ) {
12224
  if ( 'module' === $parent_level['level'] && !empty( $parent_level['value'] ) ) {
12225
  $important = sek_is_flagged_important( $input_id, $parent_level['value'], $registered_input_list );
12226
  }
12227
+ // convert to flex
12228
  $flex_ready_value = array();
12229
  foreach( $value as $device => $val ) {
12230
  switch ( $val ) {
12256
  'is_important' => $important,
12257
  ), $rules );
12258
  break;
12259
+ // handles simple or by device option
12260
  case 'h_alignment' :
12261
  if ( is_string( $value ) ) {// <= simple
12262
  $properties_to_render['text-align'] = $value;
12297
  break;
12298
  case 'font_family' :
12299
  $family = $value;
12300
+ //sek_error_log( __FUNCTION__ . ' font-family', $value );
12301
+ // Preprocess the selected font family
12302
+ // font: [font-stretch] [font-style] [font-variant] [font-weight] [font-size]/[line-height] [font-family];
12303
+ // special treatment for font-family
12304
  if ( false != strstr( $value, '[gfont]') ) {
12305
  $split = explode(":", $family);
12306
  $family = $split[0];
12307
+ //only numbers for font-weight. 400 is default
12308
  $properties_to_render['font-weight'] = $split[1] ? preg_replace('/\D/', '', $split[1]) : '';
12309
  $properties_to_render['font-weight'] = empty($properties_to_render['font-weight']) ? 400 : $properties_to_render['font-weight'];
12310
  $properties_to_render['font-style'] = ( $split[1] && strstr($split[1], 'italic') ) ? 'italic' : 'normal';
12315
  break;
12316
 
12317
  /* Spacer */
12318
+ // The unit should be included in the $value
12319
  case 'height' :
12320
  if ( is_string( $value ) ) { // <= simple
12321
  $numeric = sek_extract_numeric_value($value);
12334
  'tablet' => '',
12335
  'mobile' => ''
12336
  ));
12337
+ // replace % by vh when needed
12338
  $ready_value = $value;
12339
  foreach ($value as $device => $num_unit ) {
12340
  $numeric = sek_extract_numeric_value( $num_unit );
12371
  $unit = sek_extract_unit( $value );
12372
  $unit = '%' === $unit ? 'vh' : $unit;
12373
  $properties_to_render['border-top-width'] = $numeric . $unit;
12374
+ //$properties_to_render['border-top-width'] = $value > 0 ? $value . 'px' : '1px';
12375
  }
12376
  break;
12377
  case 'border_top_style' :
12409
  'tablet' => '',
12410
  'mobile' => ''
12411
  ));
12412
+ // replace % by vh when needed
12413
  $ready_value = $value;
12414
  foreach ($value as $device => $num_unit ) {
12415
  $numeric = sek_extract_numeric_value( $num_unit );
12449
  'tablet' => '',
12450
  'mobile' => ''
12451
  ));
12452
+ // replace % by vh when needed
12453
  $ready_value = $value;
12454
  foreach ($value as $device => $num_unit ) {
12455
  $numeric = sek_extract_numeric_value( $num_unit );
12474
  ), $rules );
12475
  }
12476
  break;
12477
+ //not used at the moment, but it might if we want to display the divider as block (e.g. a div instead of a span)
12478
  case 'h_alignment_block' :
12479
  switch ( $value ) {
12480
  case 'right' :
12497
  case 'padding_margin_spacing' :
12498
  $default_unit = 'px';
12499
  $rules_candidates = $value;
12500
+ //add unit and sanitize padding (cannot have negative padding)
12501
  $unit = !empty( $rules_candidates['unit'] ) ? $rules_candidates['unit'] : $default_unit;
12502
  $unit = 'percent' == $unit ? '%' : $unit;
12503
 
12512
 
12513
  array_walk( $properties_to_render,
12514
  function( &$val, $key, $unit ) {
12515
+ //make sure paddings are positive values
12516
  if ( FALSE !== strpos( 'padding', $key ) ) {
12517
  $val = abs( $val );
12518
  }
12525
  $rules = sek_generate_css_rules_for_spacing_with_device_switcher( $rules, $value, $selector );
12526
  }
12527
  break;
12528
+
12529
+ // The default is simply there to let us know if a css_identifier is missing
12530
  default :
12531
  sek_error_log( __FUNCTION__ . ' => the css_identifier : ' . $css_identifier . ' has no css rules defined for input id ' . $input_id );
12532
  break;
12533
  }//switch
12534
+
12535
+ // when the module has an '*_flag_important' input,
12536
+ // => check if the input_id belongs to the list of "important_input_list"
12537
+ // => and maybe flag the css rules with !important
12538
  if ( ! empty( $properties_to_render ) ) {
12539
  $important = false;
12540
  if ( 'module' === $parent_level['level'] && !empty( $parent_level['value'] ) ) {
12553
  }
12554
  return $rules;
12555
  }
12556
+
12557
+
12558
+ // @return boolean
12559
+ // Recursive
12560
+ // Check if a *_flag_important input id is part of the registered input list of the module
12561
+ // then verify is the provided input_id is part of the list of input that should be set to important => 'important_input_list'
12562
+ // Example of a *_flag_important input:
12563
+ // 'quote___flag_important' => array(
12564
+ // 'input_type' => 'nimblecheck',
12565
+ // 'title' => __( 'Make those style options win if other rules are applied.', 'text_doma' ),
12566
+ // 'default' => 0,
12567
+ // 'refresh_markup' => false,
12568
+ // 'refresh_stylesheet' => true,
12569
+ // 'title_width' => 'width-80',
12570
+ // 'input_width' => 'width-20',
12571
+ // // declare the list of input_id that will be flagged with !important when the option is checked
12572
+ // // @see sek_add_css_rules_for_css_sniffed_input_id
12573
+ // // @see sek_is_flagged_important
12574
+ // 'important_input_list' => array(
12575
+ // 'quote_font_family_css',
12576
+ // 'quote_font_size_css',
12577
+ // 'quote_line_height_css',
12578
+ // 'quote_font_weight_css',
12579
+ // 'quote_font_style_css',
12580
+ // 'quote_text_decoration_css',
12581
+ // 'quote_text_transform_css',
12582
+ // 'quote_letter_spacing_css',
12583
+ // 'quote_color_css',
12584
+ // 'quote_color_hover_css'
12585
+ // )
12586
+ // )
12587
  function sek_is_flagged_important( $input_id, $module_value, $registered_input_list ) {
12588
  $important = false;
12589
 
12591
  sek_error_log( __FUNCTION__ . ' => error => the $registered_input_list param should be an array not empty');
12592
  return $important;
12593
  }
12594
+
12595
+ // loop on the registered input list and try to find a *_flag_important input id
12596
  foreach ( $registered_input_list as $_id => $input_data ) {
12597
  if ( is_string( $_id ) && false !== strpos( $_id, '_flag_important' ) ) {
12598
  if ( empty( $input_data[ 'important_input_list' ] ) ) {
12608
  return $important;
12609
  }
12610
  ?><?php
12611
+ ////////////////////////////////////////////////////////////////
12612
+ // SEK Front Class
12613
  if ( ! class_exists( 'SEK_Front_Construct' ) ) :
12614
  class SEK_Front_Construct {
12615
  static $instance;
12627
  'loop_end' => array( 'priority' => 10 ),
12628
  ];
12629
  public $registered_locations = [];
12630
+ // the model used to register a location
12631
  public $default_registered_location_model = [
12632
  'priority' => 10,
12633
  'is_global_location' => false,
12634
  'is_header_location' => false,
12635
  'is_footer_location' => false
12636
  ];
12637
+ // the model used when saving a location in db
12638
  public $default_location_model = [
12639
  'id' => '',
12640
  'level' => 'location',
12647
  public static function get_instance( $params ) {
12648
  if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Sek_Nimble_Manager ) ) {
12649
  self::$instance = new Sek_Nimble_Manager( $params );
12650
+
12651
+ // this hook is used to add_action( 'nimble_front_classes_ready', array( $this, 'sek_register_nimble_global_locations') );
12652
  do_action( 'nimble_front_classes_ready', self::$instance );
12653
  }
12654
  return self::$instance;
12655
  }
12656
+
12657
+ // store the local and global options
12658
  public $local_options = '_not_cached_yet_';
12659
  public $global_nimble_options = '_not_cached_yet_';
12660
 
12665
 
12666
  public $recaptcha_enabled = '_not_cached_yet_';//enabled in the global options
12667
  public $recaptcha_badge_displayed = '_not_cached_yet_';//enabled in the global options
12668
+
12669
+ // option key as saved in db => module_type
12670
+ // is used in _1_6_5_sektions_generate_UI_global_options.js and when normalizing the global option in sek_normalize_global_options_with_defaults()
12671
  public static $global_options_map = [
12672
  'global_header_footer' => 'sek_global_header_footer',
12673
  'breakpoint' => 'sek_global_breakpoint',
12678
  'global_reset' => 'sek_global_reset',
12679
  'beta_features' => 'sek_global_beta_features'
12680
  ];
12681
+ // option key as saved in db => module_type
12682
+ // is used in _1_6_4_sektions_generate_UI_local_skope_options.js and when normalizing the global option in sek_normalize_global_options_with_defaults()
12683
  public static $local_options_map = [
12684
  'template' => 'sek_local_template',
12685
  'local_header_footer' => 'sek_local_header_footer',
12690
  'import_export' => 'sek_local_imp_exp',
12691
  'local_revisions' => 'sek_local_revisions'
12692
  ];
12693
+ // introduced when implementing import/export feature
12694
+ // @see https://github.com/presscustomizr/nimble-builder/issues/411
12695
  public $img_import_errors = [];
12696
+
12697
+ // stores the active module collection
12698
+ // @see populated in sek_get_contextually_active_module_list()
12699
  public $contextually_active_modules = [];
12700
 
12701
  public static $ui_picker_modules = [
12702
+ // UI CONTENT PICKER
12703
  'sek_content_type_switcher_module',
12704
  'sek_module_picker_module'
12705
  ];
12706
 
12707
  public static $ui_level_modules = [
12708
+ // UI LEVEL MODULES
12709
  'sek_level_bg_module',
12710
  'sek_level_border_module',
12711
+ //'sek_level_section_layout_module',<// deactivated for now. Replaced by sek_level_width_section
12712
  'sek_level_height_module',
12713
  'sek_level_spacing_module',
12714
  'sek_level_width_module',
12719
  ];
12720
 
12721
  public static $ui_local_global_options_modules = [
12722
+ // local skope options modules
12723
  'sek_local_template',
12724
  'sek_local_widths',
12725
  'sek_local_custom_css',
12728
  'sek_local_header_footer',
12729
  'sek_local_revisions',
12730
  'sek_local_imp_exp',
12731
+
12732
+ // global options modules
12733
  'sek_global_breakpoint',
12734
  'sek_global_widths',
12735
  'sek_global_performances',
12741
  ];
12742
 
12743
  public static $ui_front_modules = [
12744
+ // FRONT MODULES
12745
  'czr_simple_html_module',
12746
 
12747
  'czr_tiny_mce_editor_module' => array(
12755
  'czr_image_main_settings_child',
12756
  'czr_image_borders_corners_child'
12757
  ),
12758
+
12759
+ //'czr_featured_pages_module',
12760
  'czr_heading_module' => array(
12761
  'czr_heading_module',
12762
  'czr_heading_child',
12789
  'czr_btn_design_child',
12790
  'czr_font_child'
12791
  ),
12792
+
12793
+ // simple form father + children
12794
  'czr_simple_form_module' => array(
12795
  'czr_simple_form_module',
12796
  'czr_simple_form_fields_child',
12810
  ];
12811
 
12812
  public static $ui_front_beta_modules = [
12813
+ // modules for header and footer
12814
  'czr_menu_module' => array(
12815
  'czr_menu_module',
12816
  'czr_menu_content_child',
12820
 
12821
 
12822
  'czr_widget_area_module'
12823
+ //'czr_menu_design_child',
12824
  ];
12825
+
12826
+
12827
+ /////////////////////////////////////////////////////////////////
12828
+ // <CONSTRUCTOR>
12829
  function __construct( $params = array() ) {
12830
+ // INITIALIZE THE REGISTERED LOCATIONS WITH THE DEFAULT LOCATIONS
12831
  $this->registered_locations = $this->default_locations;
12832
+
12833
+ // AJAX
12834
  $this -> _schedule_front_ajax_actions();
12835
  $this -> _schedule_img_import_ajax_actions();
12836
  if ( defined( 'NIMBLE_SAVED_SECTIONS_ENABLED' ) && NIMBLE_SAVED_SECTIONS_ENABLED ) {
12837
  $this -> _schedule_section_saving_ajax_actions();
12838
  }
12839
+ // ASSETS
12840
  $this -> _schedule_front_and_preview_assets_printing();
12841
+ // RENDERING
12842
  $this -> _schedule_front_rendering();
12843
+ // RENDERING
12844
  $this -> _setup_hook_for_front_css_printing_or_enqueuing();
12845
+ // LOADS SIMPLE FORM
12846
  $this -> _setup_simple_forms();
12847
+ // REGISTER NIMBLE WIDGET ZONES
12848
  add_action( 'widgets_init', array( $this, 'sek_nimble_widgets_init' ) );
12849
  }//__construct
12850
+
12851
+ // @fired @hook 'widgets_init'
12852
  public function sek_nimble_widgets_init() {
12853
+ // Header and footer have been introduced in v1.4.0 but not enabled by default
12854
+ // The Nimble widget areas registration is on hold until "header and footer" feature is released.
12855
  if ( ! sek_is_header_footer_enabled() )
12856
  return;
12857
  $defaults = array(
12877
  ?><?php
12878
  if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
12879
  class SEK_Front_Ajax extends SEK_Front_Construct {
12880
+ // Fired in __construct()
12881
  function _schedule_front_ajax_actions() {
12882
  add_action( 'wp_ajax_sek_get_content', array( $this, 'sek_get_level_content_for_injection' ) );
12883
+ //add_action( 'wp_ajax_sek_get_preview_ui_element', array( $this, 'sek_get_ui_content_for_injection' ) );
12884
+ // Fetches the preset_sections
12885
  add_action( 'wp_ajax_sek_get_preset_sections', array( $this, 'sek_get_preset_sektions' ) );
12886
+ // Fetches the list of revision for a given skope_id
12887
  add_action( 'wp_ajax_sek_get_revision_history', array( $this, 'sek_get_revision_history' ) );
12888
+ // Fetches the revision for a given post id
12889
  add_action( 'wp_ajax_sek_get_single_revision', array( $this, 'sek_get_single_revision' ) );
12890
+ // Fetches the category collection to generate the options for a select input
12891
+ // @see api.czrInputMap.category_picker
12892
  add_action( 'wp_ajax_sek_get_post_categories', array( $this, 'sek_get_post_categories' ) );
12893
 
12894
  add_action( 'wp_ajax_sek_postpone_feedback', array( $this, 'sek_postpone_feedback_notification' ) );
12895
+
12896
+
12897
+ // This is the list of accepted actions
12898
  $this -> ajax_action_map = array(
12899
  'sek-add-section',
12900
  'sek-remove-section',
12901
  'sek-duplicate-section',
12902
+
12903
+ // fired when dropping a module or a preset_section
12904
  'sek-add-content-in-new-nested-sektion',
12905
  'sek-add-content-in-new-sektion',
12906
+
12907
+ // add, duplicate, remove column is a re-rendering of the parent sektion collection
12908
  'sek-add-column',
12909
  'sek-remove-column',
12910
  'sek-duplicate-column',
12921
  'sek-refresh-level'
12922
  );
12923
  }
12924
+
12925
+ ////////////////////////////////////////////////////////////////
12926
+ // GENERIC HELPER FIRED IN ALL AJAX CALLBACKS
12927
+ // @param $params = array('check_nonce' => true )
12928
  function sek_do_ajax_pre_checks( $params = array() ) {
12929
  $params = wp_parse_args( $params, array( 'check_nonce' => true ) );
12930
  if ( $params['check_nonce'] ) {
12951
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => bad_method' );
12952
  }
12953
  }//sek_do_ajax_pre_checks()
12954
+
12955
+
12956
+ ////////////////////////////////////////////////////////////////
12957
+ // IMPORT IMG
12958
+ // Fired in __construct()
12959
  function _schedule_img_import_ajax_actions() {
12960
  add_action( 'wp_ajax_sek_import_attachment', array( $this, 'sek_ajax_import_attachment' ) );
12961
  }
12962
+
12963
+ ////////////////////////////////////////////////////////////////
12964
+ // SECTION SAVING
12965
+ // Fired in __construct()
12966
  function _schedule_section_saving_ajax_actions() {
12967
+ // Writes the saved section in a CPT + update the saved section option
12968
  add_action( 'wp_ajax_sek_save_section', array( $this, 'sek_ajax_save_section' ) );
12969
+ // Fetches the user_saved sections
12970
  add_action( 'wp_ajax_sek_get_user_saved_sections', array( $this, 'sek_sek_get_user_saved_sections' ) );
12971
  }
12972
+
12973
+ ////////////////////////////////////////////////////////////////
12974
+ // PRESET SECTIONS
12975
+ // Fired in __construct()
12976
+ // hook : 'wp_ajax_sek_get_preset_sektions'
12977
  function sek_get_preset_sektions() {
12978
  $this->sek_do_ajax_pre_checks();
12979
+ // May 21st => back to the local data
12980
+ // after problem was reported when fetching data remotely : https://github.com/presscustomizr/nimble-builder/issues/445
12981
+ //$preset_sections = sek_get_preset_sections_api_data();
12982
+ $preset_sections = sek_get_preset_section_collection_from_json();
12983
  if ( empty( $preset_sections ) ) {
12984
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => no preset_sections when running sek_get_preset_sections_api_data()' );
12985
  }
12986
  wp_send_json_success( $preset_sections );
12987
  }
12988
+
12989
+
12990
+
12991
+ // hook : 'wp_ajax_sek_get_html_for_injection'
12992
  function sek_get_level_content_for_injection( $params ) {
12993
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => false ) );
12994
 
13002
  $sek_action = $_POST['sek_action'];
13003
 
13004
  $exported_setting_validities = array();
13005
+
13006
+ // CHECK THE SETTING VALIDITIES BEFORE RENDERING
13007
+ // When a module has been registered with a sanitize_callback, we can collect the possible problems here before sending the response.
13008
+ // Then, on ajax.done(), in SekPreviewPrototype::schedulePanelMsgReactions, we will send the setting validities object to the panel
13009
  if ( is_customize_preview() ) {
13010
  global $wp_customize;
13011
+ // prepare the setting validities so we can pass them when sending the ajax response
13012
  $setting_validities = $wp_customize->validate_setting_values( $wp_customize->unsanitized_post_values() );
13013
  $raw_exported_setting_validities = array_map( array( $wp_customize, 'prepare_setting_validity_for_js' ), $setting_validities );
13014
+
13015
+ // filter the setting validity to only keep the __nimble__ prefixed ui settings
13016
  $exported_setting_validities = array();
13017
  foreach( $raw_exported_setting_validities as $setting_id => $validity ) {
13018
+ // don't consider the not Nimble UI settings, not starting with __nimble__
13019
  if ( false === strpos( $setting_id , NIMBLE_OPT_PREFIX_FOR_LEVEL_UI ) )
13020
  continue;
13021
  $exported_setting_validities[ $setting_id ] = $validity;
13022
  }
13023
  }
13024
+
13025
+ // is this action possible ?
13026
  if ( in_array( $sek_action, $this -> ajax_action_map ) ) {
13027
  $html = $this -> sek_ajax_fetch_content( $sek_action );
13028
+ //sek_error_log(__CLASS__ . '::' . __FUNCTION__ , $html );
13029
  if ( is_wp_error( $html ) ) {
13030
  wp_send_json_error( $html );
13031
  } else {
13041
 
13042
 
13043
  }//sek_get_content_for_injection()
13044
+
13045
+
13046
+ // hook : add_filter( "sek_set_ajax_content___{$action}", array( $this, 'sek_ajax_fetch_content' ) );
13047
+ // $_POST looks like Array
13048
+ // (
13049
+ // [action] => sek_get_content
13050
+ // [withNonce] => false
13051
+ // [id] => __nimble__0b7c85561448ab4eb8adb978
13052
+ // [skope_id] => skp__post_page_home
13053
+ // [sek_action] => sek-add-section
13054
+ // [SEKFrontNonce] => 3713b8ac5c
13055
+ // [customized] => {\"nimble___loop_start[skp__post_page_home]\":{...}}
13056
+ // )
13057
+ // @return string
13058
+ // @param $sek_action is $_POST['sek_action']
13059
  private function sek_ajax_fetch_content( $sek_action = '' ) {
13060
+ //sek_error_log( __CLASS__ . '::' . __FUNCTION__ , $_POST );
13061
+ // the $_POST['customized'] has already been updated
13062
+ // so invoking sek_get_skoped_seks() will ensure that we get the latest data
13063
+ // since wp has not been fired yet, we need to use the posted skope_id param.
13064
  $sektionSettingValue = sek_get_skoped_seks( $_POST['location_skope_id'] );
13065
  if ( ! is_array( $sektionSettingValue ) ) {
13066
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => invalid sektionSettingValue => it should be an array().' );
13084
 
13085
  switch ( $sek_action ) {
13086
  case 'sek-add-section' :
13087
+ // when 'sek-add-content-in-new-sektion' is fired, the section has already been populated with a column and a module
13088
  case 'sek-add-content-in-new-sektion' :
13089
  case 'sek-add-content-in-new-nested-sektion' :
13090
  if ( array_key_exists( 'is_nested', $_POST ) && true === json_decode( $_POST['is_nested'] ) ) {
13091
+ // we need to set the parent_mode here to access it later in the ::render method to calculate the column width.
13092
  $this -> parent_model = sek_get_level_model( $_POST[ 'in_sektion' ], $sektion_collection );
13093
  $level_model = sek_get_level_model( $_POST[ 'in_column' ], $sektion_collection );
13094
  } else {
13095
  $level_model = sek_get_level_model( $_POST[ 'id' ], $sektion_collection );
13096
  }
13097
  break;
13098
+
13099
+ //only used for nested section
13100
  case 'sek-remove-section' :
13101
  if ( ! array_key_exists( 'is_nested', $_POST ) || true !== json_decode( $_POST['is_nested'] ) ) {
13102
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' sek-remove-section => the section must be nested in this ajax action' );
13103
  break;
13104
  } else {
13105
+ // we need to set the parent_model here to access it later in the ::render method to calculate the column width.
13106
  $this -> parent_model = sek_get_parent_level_model( $_POST[ 'in_column' ], $sektion_collection );
13107
  $level_model = sek_get_level_model( $_POST[ 'in_column' ], $sektion_collection );
13108
  }
13110
 
13111
  case 'sek-duplicate-section' :
13112
  if ( array_key_exists( 'is_nested', $_POST ) && true === json_decode( $_POST['is_nested'] ) ) {
13113
+ // we need to set the parent_mode here to access it later in the ::render method to calculate the column width.
13114
  $this -> parent_model = sek_get_parent_level_model( $_POST[ 'in_column' ], $sektion_collection );
13115
  $level_model = sek_get_level_model( $_POST[ 'in_column' ], $sektion_collection );
13116
  } else {
13117
  $level_model = sek_get_level_model( $_POST[ 'id' ], $sektion_collection );
13118
  }
13119
  break;
13120
+
13121
+ // We re-render the entire parent sektion collection in all cases
13122
  case 'sek-add-column' :
13123
  case 'sek-remove-column' :
13124
  case 'sek-duplicate-column' :
13127
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' ' . $sek_action .' => missing in_sektion param' );
13128
  break;
13129
  }
13130
+ // sek_error_log('sektion_collection', $sektion_collection );
13131
  $level_model = sek_get_level_model( $_POST[ 'in_sektion' ], $sektion_collection );
13132
  break;
13133
+
13134
+ // We re-render the entire parent column collection
13135
  case 'sek-add-module' :
13136
  case 'sek-remove-module' :
13137
  case 'sek-refresh-modules-in-column' :
13166
  break;
13167
  }
13168
  if ( !empty( $_POST['level'] ) && 'column' === $_POST['level'] ) {
13169
+ // we need to set the parent_mode here to access it later in the ::render method to calculate the column width.
13170
  $this -> parent_model = sek_get_parent_level_model( $_POST['id'], $sektion_collection );
13171
  }
13172
  $level_model = sek_get_level_model( $_POST[ 'id' ], $sektion_collection );
13173
  break;
13174
  }//Switch sek_action
13175
 
13176
+ // sek_error_log('LEVEL MODEL WHEN AJAXING', $level_model );
13177
+
13178
  ob_start();
13179
 
13180
  if ( $is_stylesheet ) {
13190
  ob_end_clean();
13191
  return;
13192
  }
13193
+ // note that in the case of a sektion nested inside a column, the parent_model has been set in the switch{ case : ... } above ,so we can access it in the ::render method to calculate the column width.
13194
  $r = $this -> render( $level_model );
13195
  }
13196
  $html = ob_get_clean();
13197
  if ( is_wp_error( $r ) ) {
13198
  return $r;
13199
  } else {
13200
+ // the $html content should not be empty when ajaxing a template
13201
+ // it can be empty when ajaxing a stylesheet
13202
  if ( ! $is_stylesheet && empty( $html ) ) {
13203
+ // return a new WP_Error that will be intercepted in sek_get_level_content_for_injection
13204
  $html = new \WP_Error( 'ajax_fetch_content_error', __CLASS__ . '::' . __FUNCTION__ . ' => no content returned for sek_action : ' . $sek_action );
13205
  }
13206
  return apply_filters( "sek_set_ajax_content", $html, $sek_action );// this is sent with wp_send_json_success( apply_filters( 'sek_content_results', $html, $sek_action ) );
13207
  }
13208
  }
13209
+
13210
+
13211
+
13212
+
13213
+
13214
+
13215
+
13216
+
13217
+
13218
+
13219
+
13220
+ /////////////////////////////////////////////////////////////////
13221
+ // hook : wp_ajax_sek_import_attachment
13222
  function sek_ajax_import_attachment() {
13223
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => false ) );
13224
 
13236
  ]);
13237
  }
13238
  }
13239
+
13240
+
13241
+
13242
+
13243
+
13244
+
13245
+
13246
+
13247
+
13248
+
13249
+
13250
+
13251
+
13252
+
13253
+
13254
+
13255
+ /////////////////////////////////////////////////////////////////
13256
+ // hook : wp_ajax_sek_save_section
13257
  function sek_ajax_save_section() {
13258
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
13259
+
13260
+ // We must have a title and a section_id and sektion data
13261
  if ( empty( $_POST['sek_title']) ) {
13262
  wp_send_json_error( __FUNCTION__ . ' => missing title' );
13263
  }
13270
  if ( ! is_string( $_POST['sek_data'] ) ) {
13271
  wp_send_json_error( __FUNCTION__ . ' => the sektion data must be a json stringified' );
13272
  }
13273
+ // sek_error_log('SEKS DATA ?', $_POST['sek_data'] );
13274
+ // sek_error_log('json decode ?', json_decode( wp_unslash( $_POST['sek_data'] ), true ) );
13275
  $sektion_to_save = array(
13276
  'title' => $_POST['sek_title'],
13277
  'description' => $_POST['sek_description'],
13286
  if ( is_wp_error( $saved_section_post ) ) {
13287
  wp_send_json_error( __FUNCTION__ . ' => error when invoking sek_update_saved_seks_post()' );
13288
  } else {
13289
+ // sek_error_log( 'ALORS CE POST?', $saved_section_post );
13290
  wp_send_json_success( [ 'section_post_id' => $saved_section_post -> ID ] );
13291
  }
13292
+
13293
+ //sek_error_log( __FUNCTION__ . '$_POST' , $_POST);
13294
  }
13295
+
13296
+
13297
+ // @hook wp_ajax_sek_sek_get_user_saved_sections
13298
  function sek_sek_get_user_saved_sections() {
13299
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
13300
+
13301
+ // We must have a section_id provided
13302
  if ( empty( $_POST['preset_section_id']) || ! is_string( $_POST['preset_section_id'] ) ) {
13303
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => missing or invalid preset_section_id' );
13304
  }
13312
  if ( ! is_array( $all_saved_seks ) || empty( $all_saved_seks[$section_id]) ) {
13313
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => missing section data in get_option( NIMBLE_OPT_NAME_FOR_SAVED_SEKTIONS )' );
13314
  }
13315
+ // $section_infos is an array
13316
+ // Array
13317
+ // (
13318
+ // [post_id] => 399
13319
+ // [title] => My section one
13320
+ // [description] =>
13321
+ // [creation_date] => 2018-10-29 13:52:54
13322
+ // [type] => content
13323
+ // )
13324
  $section_infos = $all_saved_seks[$section_id];
13325
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => missing post data for section title ' . $section_infos['title'] );
13326
  }
13327
  }
13328
+
13329
+
13330
+
13331
+
13332
+
13333
+
13334
+ ////////////////////////////////////////////////////////////////
13335
+ // REVISIONS
13336
+ // Fired in __construct()
13337
  function sek_get_revision_history() {
13338
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
13339
 
13354
  $revision = sek_get_single_post_revision( $_POST['revision_post_id'] );
13355
  wp_send_json_success( $revision );
13356
  }
13357
+
13358
+
13359
+
13360
+ ////////////////////////////////////////////////////////////////
13361
+ // POST CATEGORIES => to be used in the category picker select input
13362
+ // Fired in __construct()
13363
  function sek_get_post_categories() {
13364
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
13365
  $raw_cats = get_categories();
13374
  }
13375
  wp_send_json_success( $cat_collection );
13376
  }
13377
+
13378
+
13379
+
13380
+
13381
+
13382
+ ////////////////////////////////////////////////////////////////
13383
+ // POSTPONE FEEDBACK NOTIFICATION IN CUSTOMIZER
13384
+ // INSPIRED FROM CORE DISMISS POINTER MECHANISM
13385
+ // @see wp-admin/includes/ajax-actions.php
13386
  function sek_postpone_feedback_notification() {
13387
  $this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
13388
 
13394
  set_transient( NIMBLE_FEEDBACK_NOTICE_ID, 'maybe_later', $transient_duration );
13395
  wp_die( 1 );
13396
  }
13397
+
13398
+
13399
+
13400
+ // hook : 'wp_ajax_sek_get_preview_ui_element'
13401
  /*function sek_get_ui_content_for_injection( $params ) {
13402
+ // error_log( print_r( $_POST, true ) );
13403
+ // error_log( print_r( sek_get_skoped_seks( "skp__post_page_home", 'loop_start' ), true ) );
13404
  if ( ! is_user_logged_in() ) {
13405
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => unauthenticated' );
13406
  return;
13431
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => missing skope_id' );
13432
  return;
13433
  }
13434
+
13435
+
13436
+ // the $_POST['customized'] has already been updated
13437
+ // so invoking sek_get_skoped_seks() will ensure that we get the latest data
13438
+ // since wp has not been fired yet, we need to use the posted skope_id param.
13439
  $sektionSettingValue = sek_get_skoped_seks( $_POST['location_skope_id'] );
13440
  if ( ! is_array( $sektionSettingValue ) || ! array_key_exists( 'collection', $sektionSettingValue ) || ! is_array( $sektionSettingValue['collection'] ) ) {
13441
  wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => invalid sektionSettingValue' );
13442
  return;
13443
  }
13444
+ // we need to set the parent_mode here to access it later in the ::render method to calculate the column width.
13445
  $this -> parent_model = sek_get_parent_level_model( $_POST[ 'id' ], $sektionSettingValue['collection'] );
13446
  $this -> model = sek_get_level_model( $_POST[ 'id' ], $sektionSettingValue['collection'] );
13447
 
13464
  ?><?php
13465
  if ( ! class_exists( 'SEK_Front_Assets' ) ) :
13466
  class SEK_Front_Assets extends SEK_Front_Ajax {
13467
+ // Fired in __construct()
13468
  function _schedule_front_and_preview_assets_printing() {
13469
+ // Load Front Assets
13470
  add_action( 'wp_enqueue_scripts', array( $this, 'sek_enqueue_front_assets' ) );
13471
+ // Load customize preview js
13472
  add_action ( 'customize_preview_init' , array( $this, 'sek_schedule_customize_preview_assets' ) );
13473
  }
13474
+
13475
+ // hook : 'wp_enqueue_scripts'
13476
  function sek_enqueue_front_assets() {
13477
  $rtl_suffix = is_rtl() ? '-rtl' : '';
13478
+
13479
+ //wp_enqueue_style( 'google-material-icons', '//fonts.googleapis.com/icon?family=Material+Icons', array(), null, 'all' );
13480
+ //base custom CSS bootstrap inspired
13481
  wp_enqueue_style(
13482
  'sek-base',
13483
  sprintf(
13489
  NIMBLE_ASSETS_VERSION,
13490
  'all'
13491
  );
13492
+
13493
+
13494
+ // wp_register_script(
13495
+ // 'sek-front-fmk-js',
13496
+ // NIMBLE_BASE_URL . '/assets/front/js/_front_js_fmk.js',
13497
+ // array( 'jquery', 'underscore'),
13498
+ // time(),
13499
+ // true
13500
+ // );
13501
  wp_enqueue_script(
13502
  'sek-main-js',
13503
  sek_is_dev_mode() ? NIMBLE_BASE_URL . '/assets/front/js/ccat-nimble-front.js' : NIMBLE_BASE_URL . '/assets/front/js/ccat-nimble-front.min.js',
13504
+ //array( 'jquery', 'underscore'),
13505
+ // october 2018 => underscore is concatenated in the main front js file.
13506
  array( 'jquery'),
13507
  NIMBLE_ASSETS_VERSION,
13508
  true
13509
  );
13510
+
13511
+ // Font awesome is always loaded when customizing
13512
+ // when not customizing, sek_front_needs_font_awesome() sniffs if the collection include a module using an icon
13513
  if ( ! skp_is_customizing() && sek_front_needs_font_awesome() ) {
13514
  wp_enqueue_style(
13515
  'czr-font-awesome',
13519
  $media = 'all'
13520
  );
13521
  }
13522
+
13523
+ // Magnific Popup is loaded when needed only
13524
  if ( ! skp_is_customizing() && sek_front_needs_magnific_popup() ) {
13525
  wp_enqueue_style(
13526
  'czr-magnific-popup',
13537
  true
13538
  );
13539
  }
13540
+
13541
+ // Google reCAPTCHA
13542
  $global_recaptcha_opts = sek_get_global_option_value('recaptcha');
13543
  $global_recaptcha_opts = is_array( $global_recaptcha_opts ) ? $global_recaptcha_opts : array();
13544
 
13547
  'sekFrontLocalized',
13548
  array(
13549
  'isDevMode' => sek_is_dev_mode(),
13550
+ //'ajaxUrl' => admin_url( 'admin-ajax.php' ),
13551
  'frontNonce' => array( 'id' => 'SEKFrontNonce', 'handle' => wp_create_nonce( 'sek-front-nonce' ) ),
13552
  'localSeks' => sek_is_debug_mode() ? wp_json_encode( sek_get_skoped_seks() ) : '',
13553
  'globalSeks' => sek_is_debug_mode() ? wp_json_encode( sek_get_skoped_seks( NIMBLE_GLOBAL_SKOPE_ID ) ) : '',
13556
  )
13557
  );
13558
  }
13559
+
13560
+
13561
+ // enqueue / print customize preview assets
13562
+ // hook : 'customize_preview_init'
13563
  function sek_schedule_customize_preview_assets() {
13564
+ // we don't need those assets when previewing a customize changeset
13565
+ // added when fixing https://github.com/presscustomizr/nimble-builder/issues/351
13566
  if ( sek_is_customize_previewing_a_changeset_post() )
13567
  return;
13568
+
13569
+ // Load preview ui js tmpl
13570
  add_action( 'wp_footer', array( $this, 'sek_print_ui_tmpl' ) );
13571
 
13572
  wp_enqueue_style(
13587
  NIMBLE_ASSETS_VERSION,
13588
  $media = 'all'
13589
  );
13590
+ // Communication between preview and customizer panel
13591
  wp_enqueue_script(
13592
  'sek-customize-preview',
13593
  sprintf(
13645
  );
13646
  wp_enqueue_script( 'jquery-ui-resizable' );
13647
  }
13648
+
13649
+ //'wp_footer' in the preview frame
13650
  function sek_print_ui_tmpl() {
13651
  ?>
13652
  <script type="text/html" id="sek-tmpl-add-content-button">
13804
  ?><?php
13805
  if ( ! class_exists( 'SEK_Front_Render' ) ) :
13806
  class SEK_Front_Render extends SEK_Front_Assets {
13807
+ // Fired in __construct()
13808
  function _schedule_front_rendering() {
13809
  if ( !defined( "NIMBLE_BEFORE_CONTENT_FILTER_PRIORITY" ) ) { define( "NIMBLE_BEFORE_CONTENT_FILTER_PRIORITY", PHP_INT_MAX ); }
13810
  if ( !defined( "NIMBLE_AFTER_CONTENT_FILTER_PRIORITY" ) ) { define( "NIMBLE_AFTER_CONTENT_FILTER_PRIORITY", PHP_INT_MAX ); }
13811
  if ( !defined( "NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY" ) ) { define( "NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY", - PHP_INT_MAX ); }
13812
+
13813
+ // Fires after 'wp' and before the 'get_header' template file is loaded.
13814
  add_action( 'template_redirect', array( $this, 'sek_schedule_rendering_hooks') );
13815
+
13816
+ // Encapsulate the singular post / page content so we can generate a dynamic ui around it when customizing
13817
  add_filter( 'the_content', array( $this, 'sek_wrap_wp_content' ), NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY );
13818
+
13819
+ // SCHEDULE THE ASSETS ENQUEUING
13820
  add_action( 'wp_enqueue_scripts', array( $this, 'sek_enqueue_the_printed_module_assets') );
13821
+
13822
+ // SMART LOAD
13823
  add_filter( 'nimble_parse_for_smart_load', array( $this, 'sek_maybe_process_img_for_js_smart_load') );
13824
+
13825
+ // SETUP OUR the_content FILTER for the Tiny MCE module
13826
  $this -> sek_setup_tiny_mce_content_filters();
13827
+
13828
+ // REGISTER HEADER AND FOOTER GLOBAL LOCATIONS
13829
  add_action( 'nimble_front_classes_ready', array( $this, 'sek_register_nimble_global_locations') );
13830
+
13831
+ // CONTENT : USE THE DEFAULT WP TEMPLATE OR A CUSTOM NIMBLE ONE
13832
  add_filter( 'template_include', array( $this, 'sek_maybe_set_local_nimble_template' ) );
13833
+
13834
+ // HEADER FOOTER
13835
  if ( sek_is_header_footer_enabled() ) {
13836
  add_action( 'template_redirect', array( $this, 'sek_maybe_set_nimble_header_footer' ) );
13837
+ // HEADER : USE THE DEFAULT WP TEMPLATE OR A CUSTOM NIMBLE ONE
13838
  add_filter( 'get_header', array( $this, 'sek_maybe_set_local_nimble_header') );
13839
+ // FOOTER : USE THE DEFAULT WP TEMPLATE OR A CUSTOM NIMBLE ONE
13840
  add_filter( 'get_footer', array( $this, 'sek_maybe_set_local_nimble_footer') );
13841
  }
13842
+
13843
+ // INCLUDE NIMBLE CONTENT IN SEARCH RESULTS
13844
  add_action( 'wp_head', array( $this, 'sek_maybe_include_nimble_content_in_search_results' ) );
13845
  }//_schedule_front_rendering()
13846
+
13847
+
13848
+
13849
+ // Encapsulate the singular post / page content so we can generate a dynamic ui around it when customizing
13850
+ // @filter the_content::NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY
13851
  function sek_wrap_wp_content( $html ) {
13852
  if ( ! skp_is_customizing() || ( defined('DOING_AJAX') && DOING_AJAX ) )
13853
  return $html;
13854
  if ( is_singular() && in_the_loop() && is_main_query() ) {
13855
  global $post;
13856
+ // note : the edit url is printed as a data attribute to prevent being automatically parsed by wp when customizing and turned into a changeset url
13857
  $html = sprintf( '<div class="sek-wp-content-wrapper" data-sek-wp-post-id="%1$s" data-sek-wp-edit-link="%2$s" title="%3$s">%4$s</div>',
13858
  $post->ID,
13859
+ // we can't rely on the get_edit_post_link() function when customizing because emptied by wp core
13860
  $this->get_unfiltered_edit_post_link( $post->ID ),
13861
  __( 'WordPress content', 'nimble-builder'),
13862
  wpautop( $html )
13864
  }
13865
  return $html;
13866
  }
13867
+
13868
+
13869
+ // Fired in the constructor
13870
  function sek_register_nimble_global_locations() {
13871
  register_location('nimble_local_header', array( 'is_header_location' => true ) );
13872
  register_location('nimble_local_footer', array( 'is_footer_location' => true ) );
13873
  register_location('nimble_global_header', array( 'is_global_location' => true, 'is_header_location' => true ) );
13874
  register_location('nimble_global_footer', array( 'is_global_location' => true, 'is_footer_location' => true ) );
13875
  }
13876
+
13877
+ // @template_redirect
13878
+ // When using the default theme template, let's schedule the default hooks rendering
13879
+ // When using the Nimble template, this is done with render_content_sections_for_nimble_template();
13880
  function sek_schedule_rendering_hooks() {
13881
  $locale_template = sek_get_locale_template();
13882
+ // cache all locations now
13883
  $all_locations = sek_get_locations();
13884
+
13885
+ // $default_locations = [
13886
+ // 'loop_start' => array( 'priority' => 10 ),
13887
+ // 'before_content' => array(),
13888
+ // 'after_content' => array(),
13889
+ // 'loop_end' => array( 'priority' => 10 ),
13890
+ // ]
13891
+ // SCHEDULE THE ACTIONS ON HOOKS AND CONTENT FILTERS
13892
  foreach( $all_locations as $location_id => $params ) {
13893
  $params = is_array( $params ) ? $params : array();
13894
  $params = wp_parse_args( $params, array( 'priority' => 10 ) );
13895
+
13896
+ // When a local template is used, the default locations are rendered with :
13897
+ // render_nimble_locations(
13898
+ // array_keys( Nimble_Manager()->default_locations ),//array( 'loop_start', 'before_content', 'after_content', 'loop_end'),
13899
+ // );
13900
+ // @see nimble tmpl/ template files
13901
+ // That's why we don't need to add the rendering actions for the default locations. We only need to add action for the possible locations registered on the theme hooks
13902
  if ( !empty( $locale_template ) && !array_key_exists( $location_id, Nimble_Manager()->default_locations ) ) {
13903
  add_action( $location_id, array( $this, 'sek_schedule_sektions_rendering' ), $params['priority'] );
13904
  } else {
13905
  switch ( $location_id ) {
13906
  case 'loop_start' :
13907
  case 'loop_end' :
13908
+ // Do not add loop_start, loop_end action hooks when in a jetpack's like "infinite scroll" query
13909
+ // see: https://github.com/presscustomizr/nimble-builder/issues/228
13910
+ // the filter 'infinite_scroll_got_infinity' is documented both in jetpack's infinite module
13911
+ // and in Customizr-Pro/Hueman-Pro infinite scroll code. They both use the same $_GET var too.
13912
+ // Actually this is not needed anymore for our themes, see:
13913
+ // https://github.com/presscustomizr/nimble-builder/issues/228#issuecomment-449362111
13914
  if ( ! ( apply_filters( 'infinite_scroll_got_infinity', isset( $_GET[ 'infinity' ] ) ) ) ) {
13915
  add_action( $location_id, array( $this, 'sek_schedule_sektions_rendering' ), $params['priority'] );
13916
  }
13921
  case 'after_content' :
13922
  add_filter('the_content', array( $this, 'sek_schedule_sektion_rendering_after_content' ), NIMBLE_AFTER_CONTENT_FILTER_PRIORITY );
13923
  break;
13924
+ // Default is typically used for custom locations
13925
  default :
13926
  add_action( $location_id, array( $this, 'sek_schedule_sektions_rendering' ), $params['priority'] );
13927
  break;
13930
 
13931
  }
13932
  }
13933
+
13934
+
13935
+
13936
+ // hook : loop_start, loop_end, and all custom locations like __before_main_wrapper, __after_header or __before_footer in the Customizr theme.
13937
+ // @return void()
13938
  function sek_schedule_sektions_rendering( $query = null ) {
13939
+ // Check if the passed query is the main_query, bail if not
13940
+ // fixes: https://github.com/presscustomizr/nimble-builder/issues/154 2.
13941
+ // Note: a check using $query instanceof WP_Query would return false here, probably because the
13942
+ // query object is passed by reference
13943
+ // accidentally this would also fix the same point 1. of the same issue if the 'sek_schedule_rendering_hooks' method will be fired
13944
+ // with an early hook (earlier than wp_head).
13945
  if ( is_object( $query ) && is_a( $query, 'WP_Query' ) && ! $query->is_main_query() ) {
13946
  return;
13947
  }
13948
 
13949
  $location_id = current_filter();
13950
+ // why check if did_action( ... ) ?
13951
+ // => A location can be rendered only once
13952
+ // => for loop_start and loop_end, checking with is_main_query() is not enough because the main loop might be used 2 times in the same page
13953
+ // => for a custom location, it can be rendered by do_action() somewhere, and be rendered also with render_nimble_locations()
13954
+ // @see issue with Twenty Seventeen here : https://github.com/presscustomizr/nimble-builder/issues/14
13955
  if ( did_action( "sek_before_location_{$location_id}" ) )
13956
  return;
13957
 
13959
  $this->_render_seks_for_location( $location_id );
13960
  do_action( "sek_after_location_{$location_id}" );
13961
  }
13962
+
13963
+ // hook : 'the_content'::-9999
13964
  function sek_schedule_sektion_rendering_before_content( $html ) {
13965
+ // Disable because https://github.com/presscustomizr/nimble-builder/issues/380
13966
+ // No regression ?
13967
+
13968
+ // if ( did_action( 'sek_before_location_before_content' ) )
13969
+ // return $html;
13970
 
13971
  do_action( 'sek_before_location_before_content' );
13972
  return $this -> _filter_the_content( $html, 'before_content' );
13973
  }
13974
+
13975
+ // hook : 'the_content'::9999
13976
  function sek_schedule_sektion_rendering_after_content( $html ) {
13977
+ // Disable because https://github.com/presscustomizr/nimble-builder/issues/380
13978
+ // No regression ?
13979
+
13980
+ // if ( did_action( 'sek_before_location_after_content' ) )
13981
+ // return $html;
13982
 
13983
  do_action( 'sek_before_location_after_content' );
13984
  return $this -> _filter_the_content( $html, 'after_content' );
13989
  ob_start();
13990
  $this->_render_seks_for_location( $where );
13991
  $html = 'before_content' == $where ? ob_get_clean() . $html : $html . ob_get_clean();
13992
+ // Collapse line breaks before and after <div> elements so they don't get autop'd.
13993
+ // @see function wpautop() in wp-includes\formatting.php
13994
+ // @fixes https://github.com/presscustomizr/nimble-builder/issues/32
13995
  if ( strpos( $html, '<div' ) !== false ) {
13996
  $html = preg_replace( '|\s*<div|', '<div', $html );
13997
  $html = preg_replace( '|</div>\s*|', '</div>', $html );
14000
 
14001
  return $html;
14002
  }
14003
+
14004
+ // the $location_data can be provided. Typically when using the function render_content_sections_for_nimble_template in the Nimble page template.
14005
  public function _render_seks_for_location( $location_id = '', $location_data = array() ) {
14006
  $all_locations = sek_get_locations();
14007
 
14019
  if ( is_array( $locationSettingValue ) ) {
14020
 
14021
  remove_filter('the_content', array( $this, 'sek_wrap_wp_content' ), NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY );
14022
+ // sek_error_log( 'LEVEL MODEL IN ::sek_schedule_sektions_rendering()', $locationSettingValue);
14023
  remove_filter('the_content', array( $this, 'sek_schedule_sektion_rendering_before_content' ), NIMBLE_BEFORE_CONTENT_FILTER_PRIORITY );
14024
  remove_filter('the_content', array( $this, 'sek_schedule_sektion_rendering_after_content' ), NIMBLE_AFTER_CONTENT_FILTER_PRIORITY );
14025
 
14044
  /* ------------------------------------------------------------------------- *
14045
  * RENDERING UTILITIES USED IN NIMBLE TEMPLATES
14046
  /* ------------------------------------------------------------------------- */
14047
+ // @return void()
14048
+ // @param $locations. mixed type
14049
+ // @param $options (array)
14050
+ // Note that a location can be rendered only once in a given page.
14051
+ // That's why we need to check if did_action(''), like in ::sek_schedule_sektions_rendering
14052
  function render_nimble_locations( $locations, $options = array() ) {
14053
  if ( is_string( $locations ) && ! empty( $locations ) ) {
14054
  $locations = array( $locations );
14057
  sek_error_log( __FUNCTION__ . ' error => missing or invalid locations provided');
14058
  return;
14059
  }
14060
+
14061
+ // Normalize the $options
14062
  $options = ! is_array( $options ) ? array() : $options;
14063
  $options = wp_parse_args( $options, array(
14064
+ // fallback_location => the location rendered even if empty.
14065
+ // This way, the user starts customizing with only one location for the content instead of four
14066
+ // But if the other locations were already customized, they will be printed.
14067
  'fallback_location' => null, // Typically set as 'loop_start' in the nimble templates
14068
  ));
14069
 
14070
+ //$is_global = sek_is_global_location( $location_id );
14071
+ // $skope_id = skp_get_skope_id();
14072
+ // $skopeLocationCollection = array();
14073
+ // $skopeSettingValue = sek_get_skoped_seks( $skope_id );
14074
+ // if ( is_array( ) && array_key_exists('collection', search) ) {
14075
+ // $skopeLocationCollection = $skopeSettingValue['collection'];
14076
+ // }
14077
+
14078
+ //sek_error_log( __FUNCTION__ . ' sek_get_skoped_seks( ', sek_get_skoped_seks() );
14079
+
14080
  foreach( $locations as $location_id ) {
14081
  if ( ! is_string( $location_id ) || empty( $location_id ) ) {
14082
  sek_error_log( __FUNCTION__ . ' => error => a location_id is not valid in the provided locations', $locations );
14083
  continue;
14084
  }
14085
+
14086
+ // why check if did_action( ... ) ?
14087
+ // => A location can be rendered only once
14088
+ // => for loop_start and loop_end, checking with is_main_query() is not enough because the main loop might be used 2 times in the same page
14089
+ // => for a custom location, it can be rendered by do_action() somewhere, and be rendered also with render_nimble_locations()
14090
+ // @see issue with Twenty Seventeen here : https://github.com/presscustomizr/nimble-builder/issues/14
14091
  if ( did_action( "sek_before_location_{$location_id}" ) )
14092
  continue;
14093
 
14094
  $is_global = sek_is_global_location( $location_id );
14095
  $skope_id = $is_global ? NIMBLE_GLOBAL_SKOPE_ID : skp_get_skope_id();
14096
  $locationSettingValue = sek_get_skoped_seks( $skope_id, $location_id );
14097
+ //sek_error_log('$locationSettingValue ??? => ' . $location_id, $locationSettingValue );
14098
  if ( ! is_null( $options[ 'fallback_location' ]) ) {
14099
+ // We don't need to render the locations with no sections
14100
+ // But we need at least one location : let's always render loop_start.
14101
+ // => so if the user switches from the nimble_template to the default theme one, the loop_start section will always be rendered.
14102
  if ( $options[ 'fallback_location' ] === $location_id || ( is_array( $locationSettingValue ) && ! empty( $locationSettingValue['collection'] ) ) ) {
14103
  do_action( "sek_before_location_{$location_id}" );
14104
  Nimble_Manager()->_render_seks_for_location( $location_id, $locationSettingValue );
14122
  /* ------------------------------------------------------------------------- *
14123
  * MAIN RENDERING METHOD
14124
  /* ------------------------------------------------------------------------- */
14125
+ // Walk a model tree recursively and render each level with a specific template
14126
  function render( $model = array(), $location = 'loop_start' ) {
14127
+ //sek_error_log('LOCATIONS IN ::render()', sek_get_locations() );
14128
+ //sek_error_log('LEVEL MODEL IN ::RENDER()', $model );
14129
+ // Is it the root level ?
14130
+ // The root level has no id and no level entry
14131
  if ( ! is_array( $model ) ) {
14132
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => a model must be an array', $model );
14133
  return;
14136
  error_log( '::render() => a level model is missing the level or the id property' );
14137
  return;
14138
  }
14139
+ // The level "id" is a string not empty
14140
  $id = $model['id'];
14141
  if ( ! is_string( $id ) || empty( $id ) ) {
14142
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => a level id must be a string not empty', $model );
14143
  return;
14144
  }
14145
+
14146
+ // The level "level" can take 4 values : location, section, column, module
14147
  $level_type = $model['level'];
14148
  if ( ! is_string( $level_type ) || empty( $level_type ) ) {
14149
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => a level type must be a string not empty', $model );
14150
  return;
14151
  }
14152
+
14153
+ // A level id can be rendered only once by the recursive ::render method
14154
  if ( in_array( $id, Nimble_Manager()->rendered_levels ) ) {
14155
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => a ' . $level_type . ' level id has already been rendered : ' . $id );
14156
  return;
14157
  }
14158
+ // Record the rendered id now
14159
  Nimble_Manager()->rendered_levels[] = $id;
14160
+
14161
+ // Cache the parent model
14162
+ // => used when calculating the width of the column to be added
14163
  $parent_model = $this -> parent_model;
14164
  $this -> model = $model;
14165
 
14166
  $collection = array_key_exists( 'collection', $model ) ? $model['collection'] : array();
14167
+
14168
+ //sek_error_log( __FUNCTION__ . ' WHAT ARE WE RENDERING? ' . $id, current_filter() . ' | ' . current_action() );
14169
  $custom_anchor = null;
14170
  if ( !empty( $model[ 'options' ] ) && !empty( $model[ 'options' ][ 'anchor' ] ) && !empty( $model[ 'options' ][ 'anchor' ]['custom_anchor'] ) ) {
14171
  if ( is_string( $model[ 'options' ][ 'anchor' ]['custom_anchor'] ) ) {
14176
  if ( !empty( $model[ 'options' ] ) && !empty( $model[ 'options' ][ 'anchor' ] ) && !empty( $model[ 'options' ][ 'anchor' ]['custom_css_classes'] ) ) {
14177
  if ( is_string( $model[ 'options' ][ 'anchor' ]['custom_css_classes'] ) ) {
14178
  $custom_css_classes = esc_attr( $model[ 'options' ][ 'anchor' ]['custom_css_classes'] );
14179
+ //$custom_css_classes = preg_replace("/[^0-9a-zA-Z]/","", $custom_css_classes);
14180
  }
14181
  }
14182
 
14183
  switch ( $level_type ) {
14184
  case 'location' :
14185
+ //sek_error_log( __FUNCTION__ . ' WHAT ARE WE RENDERING? ' . $id , $collection );
14186
+ //empty sektions wrapper are only printed when customizing
14187
  ?>
14188
  <?php if ( skp_is_customizing() || ( ! skp_is_customizing() && ! empty( $collection ) ) ) : ?>
14189
  <?php
14201
  foreach ( $collection as $_key => $sec_model ) { $this -> render( $sec_model ); }
14202
  ?>
14203
  <?php
14204
+ // empty global locations placeholders are only printed when customizing But not previewing a changeset post
14205
+ // since https://github.com/presscustomizr/nimble-builder/issues/351
14206
  ?>
14207
  <?php if ( empty( $collection ) && !sek_is_customize_previewing_a_changeset_post() ) : ?>
14208
  <div class="sek-empty-location-placeholder">
14227
  $is_nested = array_key_exists( 'is_nested', $model ) && true == $model['is_nested'];
14228
  $has_at_least_one_module = sek_section_has_modules( $collection );
14229
  $column_container_class = 'sek-container-fluid';
14230
+ //when boxed use proper container class
14231
  if ( !empty( $model[ 'options' ][ 'layout' ][ 'boxed-wide' ] ) && 'boxed' == $model[ 'options' ][ 'layout' ][ 'boxed-wide' ] ) {
14232
  $column_container_class = 'sek-container';
14233
  }
14239
  $has_at_least_one_module ? 'sek-has-modules' : '',
14240
  $this->get_level_visibility_css_class( $model ),
14241
  is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"',
14242
+ // add smartload + parallax attributes
14243
  $this -> sek_maybe_add_bg_attributes( $model ),
14244
  is_null( $custom_css_classes ) ? '' : $custom_css_classes
14245
  ); ?>
14246
  <div class="<?php echo $column_container_class; ?>">
14247
  <div class="sek-row sek-sektion-inner">
14248
  <?php
14249
+ // Set the parent model now
14250
  $this -> parent_model = $model;
14251
  foreach ( $collection as $col_model ) {$this -> render( $col_model ); }
14252
  ?>
14257
  break;
14258
 
14259
  case 'column' :
14260
+ // if ( defined('DOING_AJAX') && DOING_AJAX ) {
14261
+ // error_log( print_r( $parent_model, true ) );
14262
+ // }
14263
+ // sek_error_log( 'PARENT MODEL WHEN RENDERING', $parent_model );
14264
+
14265
+ // SETUP THE DEFAULT CSS CLASS
14266
+ // Note : the css rules for custom width are generated in Sek_Dyn_CSS_Builder::sek_add_rules_for_column_width
14267
  $col_number = ( array_key_exists( 'collection', $parent_model ) && is_array( $parent_model['collection'] ) ) ? count( $parent_model['collection'] ) : 1;
14268
  $col_number = 12 < $col_number ? 12 : $col_number;
14269
  $col_width_in_percent = 100/$col_number;
14270
+
14271
+ //@note : we use the same logic in the customizer preview js to compute the column css classes when dragging them
14272
+ //@see sek_preview::makeColumnsSortableInSektion
14273
+ //TODO, we might want to be sure the $col_suffix is related to an allowed size
14274
  $col_suffix = floor( $col_width_in_percent );
14275
+
14276
+ // SETUP THE GLOBAL CUSTOM BREAKPOINT CSS CLASS
14277
  $global_custom_breakpoint = intval( sek_get_global_custom_breakpoint() );
14278
  $has_global_custom_breakpoint = $global_custom_breakpoint >= 1;
14279
+
14280
+ // SETUP THE LEVEL CUSTOM BREAKPOINT CSS CLASS
14281
  $section_custom_breakpoint = intval( sek_get_section_custom_breakpoint( $parent_model ) );
14282
  $has_section_custom_breakpoint = $section_custom_breakpoint >= 1;
14283
 
14294
  $grid_column_class,
14295
  $this->get_level_visibility_css_class( $model ),
14296
  empty( $collection ) ? 'data-sek-no-modules="true"' : '',
14297
+ // add smartload + parallax attributes
14298
  $this -> sek_maybe_add_bg_attributes( $model ),
14299
  is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"',
14300
  is_null( $custom_css_classes ) ? '' : $custom_css_classes
14301
  );
14302
  ?>
14303
  <?php
14304
+ // Drop zone : if no modules, the drop zone is wrapped in sek-no-modules-columns
14305
+ // if at least one module, the sek-drop-zone is the .sek-column-inner wrapper
14306
  ?>
14307
  <div class="sek-column-inner <?php echo empty( $collection ) ? 'sek-empty-col' : ''; ?>">
14308
  <?php
14309
+ // the drop zone is inserted when customizing but not when previewing a changeset post
14310
+ // since https://github.com/presscustomizr/nimble-builder/issues/351
14311
  if ( skp_is_customizing() && !sek_is_customize_previewing_a_changeset_post() && empty( $collection ) ) {
14312
+ //$content_type = 1 === $col_number ? 'section' : 'module';
14313
  $content_type = 'module';
14314
  $title = 'section' === $content_type ? __('Drag and drop a section or a module here', 'nimble-builder' ) : __('Drag and drop a block of content here', 'nimble-builder' );
14315
  ?>
14321
  </div>
14322
  <?php
14323
  } else {
14324
+ // Set the parent model now
14325
  $this -> parent_model = $model;
14326
  foreach ( $collection as $module_or_nested_section_model ) {
14327
  ?>
14344
  }
14345
  $module_type = $model['module_type'];
14346
  $model = sek_normalize_module_value_with_defaults( $model );
14347
+ // update the current cached model
14348
  $this -> model = $model;
14349
  $title_attribute = '';
14350
  if ( skp_is_customizing() ) {
14357
  $module_type,
14358
  $this->get_level_visibility_css_class( $model ),
14359
  $title_attribute,
14360
+ // add smartload + parallax attributes
14361
  $this -> sek_maybe_add_bg_attributes( $model ),
14362
  is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"',
14363
  is_null( $custom_css_classes ) ? '' : $custom_css_classes
14389
  * VARIOUS HELPERS
14390
  /* ------------------------------------------------------------------------- */
14391
  /* HELPER TO PRINT THE VISIBILITY CSS CLASS IN THE LEVEL CONTAINER */
14392
+ // @return string
14393
  private function get_level_visibility_css_class( $model ) {
14394
  if ( ! is_array( $model ) ) {
14395
  error_log( __FUNCTION__ . ' => $model param should be an array' );
14396
  return;
14397
  }
14398
  $visibility_class = '';
14399
+ //when boxed use proper container class
14400
  if ( !empty( $model[ 'options' ] ) && !empty( $model[ 'options' ][ 'visibility' ] ) ) {
14401
  if ( is_array( $model[ 'options' ][ 'visibility' ] ) ) {
14402
  foreach ( $model[ 'options' ][ 'visibility' ] as $device_type => $device_visibility_bool ) {
14417
 
14418
 
14419
  /* MODULE AND PLACEHOLDER */
14420
+ // Fires the render callback of the module
14421
+ // The placeholder(s) rendering is delegated to each module template
14422
  private function sek_print_module_tmpl( $model ) {
14423
  if ( ! is_array( $model ) ) {
14424
  error_log( __FUNCTION__ . ' => $model param should be an array' );
14436
  error_log( __FUNCTION__ . ' => no template found for module type ' . $module_type );
14437
  }
14438
 
14439
+ //$placeholder_icon = sek_get_registered_module_type_property( $module_type, 'placeholder_icon' );
14440
+
14441
+ // if ( is_string( $render_callback ) && function_exists( $render_callback ) ) {
14442
+ // call_user_func_array( $render_callback, array( $model ) );
14443
+ // } else {
14444
+ // error_log( __FUNCTION__ . ' => not render_callback defined for ' . $model['module_type'] );
14445
+ // return;
14446
+ // }
14447
+
14448
  }
14449
 
14450
 
14503
  }
14504
  return $link;
14505
  }
14506
+
14507
+
14508
+
14509
+ // @hook wp_enqueue_scripts
14510
  function sek_enqueue_the_printed_module_assets() {
14511
  $skope_id = skp_get_skope_id();
14512
  $skoped_seks = sek_get_skoped_seks( $skope_id );
14543
  }
14544
  }
14545
  }//sek_enqueue_the_printed_module_assets()
14546
+
14547
+ // @hook sek_sniff_assets_to_enqueue
14548
  function sek_sniff_assets_to_enqueue( $collection, $enqueuing_candidates = array() ) {
14549
  foreach ( $collection as $level_data ) {
14550
  if ( array_key_exists( 'level', $level_data ) && 'module' === $level_data['level'] && ! empty( $level_data['module_type'] ) ) {
14568
  /* ------------------------------------------------------------------------- *
14569
  * SMART LOAD.
14570
  /* ------------------------------------------------------------------------- */
14571
+ // @return string
14572
+ // adds the lazy load data attributes when sek_is_img_smartload_enabled()
14573
+ // adds the parallax attributes
14574
+ // img smartload can be set globally with 'global-img-smart-load' and locally with 'local-img-smart-load'
14575
+ // the local option wins
14576
+ // deactivated when customizing @see function sek_is_img_smartload_enabled()
14577
  function sek_maybe_add_bg_attributes( $model ) {
14578
  $attributes = '';
14579
  $bg_url_for_lazy_load = '';
14589
  if ( sek_is_img_smartload_enabled() ) {
14590
  $bg_url_for_lazy_load = wp_get_attachment_url( $bg_options[ 'bg-image'] );
14591
  }
14592
+ // When the fixed background is ckecked, it wins against parallax
14593
  $fixed_bg_enabled = !empty( $bg_options['bg-attachment'] ) && sek_booleanize_checkbox_val( $bg_options['bg-attachment'] );
14594
  $parallax_enabled = !$fixed_bg_enabled && !empty( $bg_options['bg-parallax'] ) && sek_booleanize_checkbox_val( $bg_options['bg-parallax'] );
14595
  if ( $parallax_enabled ) {
14604
  if ( ! empty( $bg_url_for_lazy_load ) ) {
14605
  $attributes .= sprintf('%1$s data-sek-lazy-bg="true" data-sek-src="%2$s"', $attributes, $bg_url_for_lazy_load );
14606
  }
14607
+ // data-sek-bg-fixed attribute has been added for https://github.com/presscustomizr/nimble-builder/issues/414
14608
+ // @see css rules related
14609
+ // we can't have both fixed and parallax option together
14610
+ // when the fixed background is ckecked, it wins against parallax
14611
  if ( $fixed_bg_enabled ) {
14612
  $attributes .= sprintf('%1$s data-sek-bg-fixed="true"',
14613
  $attributes
14618
  $width,
14619
  $height,
14620
  array_key_exists('bg-parallax-force', $bg_options) ? $bg_options['bg-parallax-force'] : '40'
14621
+ //!empty( $bg_options['bg-parallax-force'] ) ? $bg_options['bg-parallax-force'] : '40'
14622
  );
14623
  }
14624
  return $attributes;
14625
  }
14626
+
14627
+
14628
+ // @filter nimble_parse_for_smart_load
14629
+ // this filter is used in several modules : tiny_mce_editor, image module, post grid
14630
+ // img smartload can be set globally with 'global-img-smart-load' and locally with 'local-img-smart-load'
14631
+ // deactivated when customizing @see function sek_is_img_smartload_enabled()
14632
+ // @return html string
14633
  function sek_maybe_process_img_for_js_smart_load( $html ) {
14634
  if ( !sek_is_img_smartload_enabled() )
14635
  return $html;
14663
 
14664
  return preg_replace_callback( $pattern, '\Nimble\nimble_regex_callback', $html);
14665
  }
14666
+
14667
+
14668
+ ////////////////////////////////////////////////////////////////
14669
+ // SETUP CONTENT FILTERS FOR TINYMCE MODULE
14670
+ // Fired in the constructor
14671
  private function sek_setup_tiny_mce_content_filters() {
14672
+ // @see filters in wp-includes/default-filters.php
14673
+ // always check if 'do_blocks' exists for retrocompatibility with WP < 5.0. @see https://github.com/presscustomizr/nimble-builder/issues/237
14674
  if ( function_exists( 'do_blocks' ) ) {
14675
  add_filter( 'the_nimble_tinymce_module_content', 'do_blocks', 9 );
14676
  }
14683
  add_filter( 'the_nimble_tinymce_module_content', 'do_shortcode', 11 ); // AFTER wpautop()
14684
  add_filter( 'the_nimble_tinymce_module_content', 'capital_P_dangit', 9 );
14685
  add_filter( 'the_nimble_tinymce_module_content', '\Nimble\sek_parse_template_tags', 21 );
14686
+
14687
+ // Hack to get the [embed] shortcode to run before wpautop()
14688
+ // fixes Video Embed not showing when using Add Media > Insert from Url
14689
+ // @see https://github.com/presscustomizr/nimble-builder/issues/250
14690
+ // @see wp-includes/class-wp-embed.php
14691
  add_filter( 'the_nimble_tinymce_module_content', array( $this, 'sek_run_shortcode' ), 8 );
14692
+
14693
+ // @see filters in wp-includes/class-wp-embed.php
14694
  add_filter( 'the_nimble_tinymce_module_content', array( $this, 'sek_parse_content_for_video_embed') , 8 );
14695
  }
14696
+
14697
+ // fired @filter the_nimble_tinymce_module_content
14698
  function sek_run_shortcode( $content ) {
14699
  if ( array_key_exists( 'wp_embed', $GLOBALS ) && $GLOBALS['wp_embed'] instanceof \WP_Embed ) {
14700
  $content = $GLOBALS['wp_embed']->run_shortcode( $content );
14701
  }
14702
  return $content;
14703
  }
14704
+
14705
+ // fired @filter the_nimble_tinymce_module_content
14706
  function sek_parse_content_for_video_embed( $content ) {
14707
  if ( array_key_exists( 'wp_embed', $GLOBALS ) && $GLOBALS['wp_embed'] instanceof \WP_Embed ) {
14708
  $content = $GLOBALS['wp_embed']->autoembed( $content );
14717
  /* ------------------------------------------------------------------------- *
14718
  * CONTENT, HEADER, FOOTER
14719
  /* ------------------------------------------------------------------------- */
14720
+ // fired @hook 'template_include'
14721
+ // @return template path
14722
  function sek_maybe_set_local_nimble_template( $template ) {
14723
+ //sek_error_log(' SOO ?? sek_get_skoped_seks( skp_get_skope_id() ) ' . skp_get_skope_id(), sek_get_skoped_seks( skp_get_skope_id() ) );
14724
  $locale_template = sek_get_locale_template();
14725
  if ( !empty( $locale_template ) ) {
14726
  $template = $locale_template;
14727
  }
14728
+ //sek_error_log( 'TEMPLATE ? => ' . did_action('wp'), $template );
14729
  return $template;
14730
  }
14731
+
14732
+
14733
+ // fired @hook 'template_redirect'
14734
+ // fired by sek_maybe_set_local_nimble_footer() @get_footer()
14735
+ // fired by sek_maybe_set_local_nimble_header() @get_header()
14736
+ // @return void()
14737
+ // set the value of the properties
14738
+ // has_local_header_footer
14739
+ // has_global_header_footer
14740
  function sek_maybe_set_nimble_header_footer() {
14741
  if ( !did_action('nimble_front_classes_ready') || !did_action('wp') ) {
14742
  sek_error_log( __FUNCTION__ . ' has been invoked too early at hook ' . current_filter() );
14743
  return;
14744
  }
14745
  if ( '_not_cached_yet_' === $this->has_local_header_footer || '_not_cached_yet_' === $this->has_global_header_footer ) {
14746
+ //sek_error_log(' SOO ?? sek_get_skoped_seks( skp_get_skope_id() ) ' . skp_get_skope_id(), sek_get_skoped_seks( skp_get_skope_id() ) );
14747
  $local_header_footer_data = sek_get_local_option_value('local_header_footer');
14748
  $global_header_footer_data = sek_get_global_option_value('global_header_footer');
14749
 
14757
  }
14758
  }
14759
  }
14760
+
14761
+
14762
+
14763
+ // fired @filter get_header()
14764
  function sek_maybe_set_local_nimble_header( $header_name ) {
14765
+ // if Nimble_Manager()->has_local_header_footer || Nimble_Manager()->has_global_header_footer
14766
  if ( sek_page_uses_nimble_header_footer() ) {
14767
+ // load the Nimble template which includes a call to wp_head()
14768
  load_template( NIMBLE_BASE_PATH . '/tmpl/header/nimble_header_tmpl.php', false );
14769
+
14770
+ // do like in wp core get_header()
14771
  $templates = array();
14772
  $header_name = (string) $header_name;
14773
  if ( '' !== $header_name ) {
14775
  }
14776
 
14777
  $templates[] = 'header.php';
14778
+
14779
+ // don't run wp_head a second time
14780
  remove_all_actions( 'wp_head' );
14781
+ // capture the print and clean it.
14782
  ob_start();
14783
+ // won't be re-loaded by the second call performed by WP
14784
+ // see https://developer.wordpress.org/reference/functions/locate_template/
14785
+ // and https://developer.wordpress.org/reference/functions/load_template/
14786
  locate_template( $templates, true );
14787
  ob_get_clean();
14788
  }
14789
  }
14790
+
14791
+ // fired @filter get_footer()
14792
  function sek_maybe_set_local_nimble_footer( $footer_name ) {
14793
+ // if Nimble_Manager()->has_local_header_footer || Nimble_Manager()->has_global_header_footer
14794
  if ( sek_page_uses_nimble_header_footer() ) {
14795
+ // load the Nimble template which includes a call to wp_footer()
14796
  load_template( NIMBLE_BASE_PATH . '/tmpl/footer/nimble_footer_tmpl.php', false );
14797
+
14798
+ // do like in wp core get_footer()
14799
  $templates = array();
14800
  $name = (string) $footer_name;
14801
  if ( '' !== $footer_name ) {
14803
  }
14804
 
14805
  $templates[] = 'footer.php';
14806
+
14807
+ // don't run wp_footer a second time
14808
  remove_all_actions( 'wp_footer' );
14809
+ // capture the print and clean it.
14810
  ob_start();
14811
+ // won't be re-loaded by the second call performed by WP
14812
+ // see https://developer.wordpress.org/reference/functions/locate_template/
14813
+ // and https://developer.wordpress.org/reference/functions/load_template/
14814
  locate_template( $templates, true );
14815
  ob_get_clean();
14816
  }
14817
  }//sek_maybe_set_local_nimble_footer
14818
+
14819
+
14820
+ // @hook wp_head
14821
+ // Elements of decisions for this implementation :
14822
+ // The problem to solve here is to add the post ( or pages ) where user has created Nimble sections for which the content matches the search term.
14823
+ // 1) we need a way to find the matches
14824
+ // 2) then to "map" the Nimble post to its related post or page
14825
+ // 3) then include the related post / page to the list of search result.
14826
+ // This can't be done by filtering the WP core query params, because Nimble sections are saved as separate posts, not post metas.
14827
+ // That's why the posts are added to the array of posts of the main query.
14828
+ //
14829
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/439
14830
+ //
14831
+ // May 2019 => note that this implementation won't include Nimble sections created in other contexts than page or post.
14832
+ // This could be added in the future.
14833
+ //
14834
+ // partially inspired by https://stackoverflow.com/questions/24195818/add-results-into-wordpress-search-results
14835
  function sek_maybe_include_nimble_content_in_search_results(){
14836
  if ( !is_search() )
14837
  return;
14840
  $query_vars = $wp_query->query_vars;
14841
  if ( ! is_array( $query_vars ) || empty( $query_vars['s'] ) )
14842
  return;
14843
+
14844
+ // Search query on Nimble CPT
14845
  $sek_post_query_vars = array(
14846
  'post_type' => NIMBLE_CPT,
14847
  'post_status' => get_post_stati(),
14854
  's' => $query_vars['s']
14855
  );
14856
  $query = new \WP_Query( $sek_post_query_vars );
14857
+
14858
+ // The search string has been found in a set of Nimble posts
14859
  if ( is_array( $query->posts ) ) {
14860
  foreach ( $query->posts as $post_object ) {
14861
+ // The related WP object ( == skope ) is written in the title of Nimble CPT
14862
+ // ex : nimble___skp__post_post_114
14863
  if ( preg_match('(post_page|post_post)', $post_object->post_title ) ) {
14864
  $post_number = preg_replace('/[^0-9]/', '', $post_object->post_title );
14865
  $post_number = intval($post_number);
14867
  $post_candidate = get_post( $post_number );
14868
 
14869
  if ( is_object( $post_candidate ) ) {
14870
+ // Merge Nimble posts to WP posts
14871
  array_push( $wp_query->posts, $post_candidate );
14872
  }
14873
  }
14874
  }
14875
  }
14876
+
14877
+ // Maybe clean duplicated posts
14878
  $maybe_includes_duplicated = $wp_query->posts;
14879
  $without_duplicated = array();
14880
  $post_ids = array();
14886
  $without_duplicated[] = $post_obj;
14887
  }
14888
  $wp_query->posts = $without_duplicated;
14889
+
14890
+ // Make sure the post_count and found_posts are updated
14891
  $wp_query->post_count = count($wp_query->posts);
14892
  $wp_query->found_posts = $wp_query->post_count > 0;
14893
  }// sek_maybe_include_nimble_content_in_search_results
14897
  ?><?php
14898
  if ( ! class_exists( 'SEK_Front_Render_Css' ) ) :
14899
  class SEK_Front_Render_Css extends SEK_Front_Render {
14900
+ // Fired in __construct()
14901
  function _setup_hook_for_front_css_printing_or_enqueuing() {
14902
  add_action( 'wp_enqueue_scripts', array( $this, 'print_or_enqueue_seks_style') );
14903
  }
14904
+
14905
+ // Can be fired :
14906
+ // 1) on wp_enqueue_scripts or wp_head
14907
+ // 2) when ajaxing, for actions 'sek-resize-columns', 'sek-refresh-stylesheet'
14908
  function print_or_enqueue_seks_style( $skope_id = null ) {
14909
+ // when this method is fired in a customize preview context :
14910
+ // - the skope_id has to be built. Since we are after 'wp', this is not a problem.
14911
+ // - the css rules are printed inline in the <head>
14912
+ // - we set to hook to wp_head
14913
+ //
14914
+ // when the method is fired in an ajax refresh scenario, like 'sek-refresh-stylesheet'
14915
+ // - the skope_id must be passed as param
14916
+ // - the css rules are printed inline in the <head>
14917
+ // - we set the hook to ''
14918
+ //
14919
+ // in a front normal context, the css is enqueued from the already written file.
14920
+ // AJAX REQUESTED STYLESHEET
14921
  if ( ( ! is_null( $skope_id ) && ! empty( $skope_id ) ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
14922
  $this->_instantiate_css_handler( array( 'skope_id' => $skope_id, 'is_global_stylesheet' => NIMBLE_GLOBAL_SKOPE_ID === $skope_id ) );
14923
  } else {
14924
  $skope_id = skp_build_skope_id();
14925
+ // LOCAL SECTIONS STYLESHEET
14926
  $this->_instantiate_css_handler( array( 'skope_id' => skp_build_skope_id() ) );
14927
+ // GLOBAL SECTIONS STYLESHEET
14928
+ // always printed when customizing
14929
+ // otherwise, printed if !is_null( sek_get_seks_post( NIMBLE_GLOBAL_SKOPE_ID ) )
14930
  if ( sek_has_global_sections() ) {
14931
  $this->_instantiate_css_handler( array( 'skope_id' => NIMBLE_GLOBAL_SKOPE_ID, 'is_global_stylesheet' => true ) );
14932
  }
14935
  sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' =>the skope_id should not be empty' );
14936
  }
14937
  }//print_or_enqueue_seks_style
14938
+
14939
+
14940
+ // @param params = array( array( 'skope_id' => NIMBLE_GLOBAL_SKOPE_ID, 'is_global_stylesheet' => true ) )
14941
  private function _instantiate_css_handler( $params = array() ) {
14942
  $params = wp_parse_args( $params, array( 'skope_id' => '', 'is_global_stylesheet' => false ) );
14943
  new Sek_Dyn_CSS_Handler( array(
14944
  'id' => $params['skope_id'],
14945
  'skope_id' => $params['skope_id'],
14946
+ // property "is_global_stylesheet" has been added when fixing https://github.com/presscustomizr/nimble-builder/issues/273
14947
  'is_global_stylesheet' => $params['is_global_stylesheet'],
14948
  'mode' => is_customize_preview() ? Sek_Dyn_CSS_Handler::MODE_INLINE : Sek_Dyn_CSS_Handler::MODE_FILE,
14949
+ //these are taken in account only when 'mode' is 'file'
14950
  'force_write' => true, //<- write if the file doesn't exist
14951
  'force_rewrite' => is_user_logged_in() && current_user_can( 'customize' ), //<- write even if the file exists
14952
  'hook' => ( ! defined( 'DOING_AJAX' ) && is_customize_preview() ) ? 'wp_head' : ''
14967
  private $form_composition;
14968
 
14969
  function _setup_simple_forms() {
14970
+ //Hooks
14971
  add_action( 'parse_request', array( $this, 'simple_form_parse_request' ), 20 );
14972
  add_action( 'wp_enqueue_scripts', array( $this, 'maybe_enqueue_recaptcha_scripts' ), 0 );
14973
  add_action( 'body_class', array( $this, 'set_the_recaptcha_badge_visibility_class') );
14974
+
14975
+ // Note : form input need to be prefixed to avoid a collision with reserved WordPress input
14976
+ // @see : https://stackoverflow.com/questions/15685020/wordpress-form-submission-and-the-404-error-page#16636051
14977
  $this->form_composition = array(
14978
  'nimble_simple_cf' => array(
14979
  'type' => 'hidden',
15024
  )
15025
  );
15026
  }//_setup_simple_forms
15027
+
15028
+
15029
+ //@hook: parse_request
15030
  function simple_form_parse_request() {
15031
  if ( ! isset( $_POST['nimble_simple_cf'] ) )
15032
  return;
15033
+
15034
+ // get the module options
15035
+ // we are before 'wp', so let's use the posted skope_id and level_id to get our $module_user_values
15036
  $module_model = array();
15037
  if ( isset( $_POST['nimble_skope_id'] ) && '_skope_not_set_' !== $_POST['nimble_skope_id'] ) {
15038
  $local_sektions = sek_get_skoped_seks( $_POST['nimble_skope_id'] );
15052
  sek_error_log( __FUNCTION__ . ' => invalid module model');
15053
  return;
15054
  }
15055
+
15056
+ //update the form with the posted values
15057
  foreach ( $this->form_composition as $name => $field ) {
15058
  $form_composition[ $name ] = $field;
15059
  if ( isset( $_POST[ $name ] ) ) {
15060
  $form_composition[ $name ][ 'value' ] = $_POST[ $name ];
15061
  }
15062
  }
15063
+ //set the form composition according to the user's options
15064
  $form_composition = $this->_set_form_composition( $form_composition, $module_model );
15065
+ //generate fields
15066
  $this->fields = $this->simple_form_generate_fields( $form_composition );
15067
+ //generate form
15068
  $this->form = $this->simple_form_generate_form( $this->fields );
15069
+
15070
+ //mailer
15071
  $this->mailer = new Sek_Mailer( $this->form );
15072
  $this->mailer->maybe_send( $form_composition, $module_model );
15073
  }
15074
+
15075
+ // Fired @hook wp_enqueue_scripts
15076
+ // @return void()
15077
  function maybe_enqueue_recaptcha_scripts() {
15078
+ // enabled if
15079
+ // - not customizing
15080
+ // - global 'recaptcha' options has the following values
15081
+ // - enabled === true
15082
+ // - public_key entered
15083
+ // - private_key entered
15084
+ // - the current page does not include a form in a local or global location
15085
  if ( skp_is_customizing() || !sek_is_recaptcha_globally_enabled() || !sek_front_sections_include_a_form() )
15086
  return;
15087
 
15088
+ // @todo, we don't handle the case when reCaptcha is globally enabled but disabled for a particular form.
15089
+
15090
  $global_recaptcha_opts = sek_get_global_option_value('recaptcha');
15091
  $global_recaptcha_opts = is_array( $global_recaptcha_opts ) ? $global_recaptcha_opts : array();
15092
 
15098
  wp_enqueue_script( 'google-recaptcha', $url, array(), '3.0', true );
15099
  add_action('wp_footer', array( $this, 'print_recaptcha_inline_js'), 100 );
15100
  }
15101
+
15102
+ // @hook wp_footer
15103
+ // printed only when sek_is_recaptcha_globally_enabled()
15104
+ // AND
15105
+ // sek_front_sections_include_a_form()
15106
  function print_recaptcha_inline_js() {
15107
  ?>
15108
  <script type="text/javascript" id="nimble-inline-recaptcha">
15111
  execute: function() {
15112
  grecaptcha.execute(
15113
  sitekey,
15114
+ // see https://developers.google.com/recaptcha/docs/v3#actions
15115
  { action: ( window.sekFrontLocalized && sekFrontLocalized.skope_id ) ? sekFrontLocalized.skope_id.replace( 'skp__' , 'nimble_form__' ) : 'nimble_builder_form' }
15116
  ).then( function( token ) {
15117
  var forms = document.getElementsByTagName( 'form' );
15133
  </script>
15134
  <?php
15135
  }
15136
+
15137
+ // @hook body_class
15138
  public function set_the_recaptcha_badge_visibility_class( $classes ) {
15139
+ // Shall we print the badge ?
15140
+ // @todo : we don't handle the case when recaptcha badge is globally displayed but
15141
+ // the current page has disabled recaptcha
15142
  if ( ! sek_is_recaptcha_badge_globally_displayed() ) {
15143
  $classes[] = 'sek-hide-rc-badge';
15144
  }
15145
  return $classes;
15146
  }
15147
+
15148
+
15149
+ // Rendering
15150
+ // Invoked from the tmpl
15151
+ // @return string
15152
+ // @param module_options is the module level "value" property. @see tmpl/modules/simple_form_module_tmpl.php
15153
  function get_simple_form_html( $module_model ) {
15154
  $html = '';
15155
+ //set the form composition according to the user's options
15156
  $form_composition = $this->_set_form_composition( $this->form_composition, $module_model );
15157
+ //generate fields
15158
  $fields = isset( $this->fields ) ? $this->fields : $this->simple_form_generate_fields( $form_composition );
15159
+ //generate form
15160
  $form = isset( $this->form ) ? $this->form : $this->simple_form_generate_form( $fields );
15161
 
15162
  $module_id = is_array( $module_model ) && array_key_exists('id', $module_model ) ? $module_model['id'] : '';
15165
  <div id="sek-form-respond">
15166
  <?php
15167
  $echo_form = true;
15168
+ // When loading the page after a send attempt, focus on the module html element with a javascript animation
15169
  if ( ! is_null( $this->mailer ) ) {
15170
  if ( 'sent' == $status_code = $this->mailer->get_status() ) {
15171
  $echo_form = false;
15211
  <?php
15212
  return ob_get_clean();
15213
  }
15214
+
15215
+ //set the fields to render
15216
  private function _set_form_composition( $form_composition, $module_model = array() ) {
15217
 
15218
  $user_form_composition = array();
15221
  return $user_form_composition;
15222
  }
15223
  $module_user_values = array_key_exists( 'value', $module_model ) ? $module_model['value'] : array();
15224
+ //sek_error_log( '$module_model', $module_model );
15225
  $form_fields_options = empty( $module_user_values['form_fields'] ) ? array() : $module_user_values['form_fields'];
15226
  $form_button_options = empty( $module_user_values['form_button'] ) ? array() : $module_user_values['form_button'];
15227
  $form_submission_options = empty( $module_user_values['form_submission'] ) ? array() : $module_user_values['form_submission'];
15228
 
15229
  foreach ( $form_composition as $field_id => $field_data ) {
15230
+ //sek_error_log( '$field_data', $field_data );
15231
  switch ( $field_id ) {
15232
  case 'nimble_name':
15233
  if ( ! empty( $form_fields_options['show_name_field'] ) && sek_is_checked( $form_fields_options['show_name_field'] ) ) {
15254
  $user_form_composition[$field_id] = $field_data;
15255
  $user_form_composition[$field_id]['label'] = esc_attr( $form_fields_options['email_field_label'] );
15256
  break;
15257
+ //'additional_attrs' => array( 'class' => 'sek-btn' ),
15258
  case 'nimble_submit':
15259
  $user_form_composition[$field_id] = $field_data;
15260
  $visual_effect_class = '';
15261
+ //visual effect classes
15262
  if ( array_key_exists( 'use_box_shadow', $form_button_options ) && true === sek_booleanize_checkbox_val( $form_button_options['use_box_shadow'] ) ) {
15263
  $visual_effect_class = ' box-shadow';
15264
  if ( array_key_exists( 'push_effect', $form_button_options ) && true === sek_booleanize_checkbox_val( $form_button_options['push_effect'] ) ) {
15270
  break;
15271
  case 'nimble_skope_id':
15272
  $user_form_composition[$field_id] = $field_data;
15273
+ // When the form is submitted, we grab the skope_id from the posted value, because it is too early to build it.
15274
+ // of course we don't need to set this input value when customizing.
15275
  $skope_id = '';
15276
  if ( ! skp_is_customizing() ) {
15277
  $skope_id = isset( $_POST['nimble_skope_id'] ) ? $_POST['nimble_skope_id'] : sek_get_level_skope_id( $module_model['id'] );
15278
  }
15279
+
15280
+ // always use the posted skope_id
15281
+ // => in a scenario in which we post the form several times, the skp_get_skope_id() won't be available after the first submit action
15282
  $user_form_composition[$field_id]['value'] = $skope_id;
15283
  break;
15284
  case 'nimble_level_id':
15285
  $user_form_composition[$field_id] = $field_data;
15286
  $user_form_composition[$field_id]['value'] = $module_model['id'];
15287
  break;
15288
+ // print the recaptcha input field if
15289
+ // 1) reCAPTCHA enabled in the global options AND properly setup with non empty keys
15290
+ // 2) reCAPTCHA enabled for this particular form
15291
  case 'nimble_recaptcha_resp' :
15292
  if ( ! skp_is_customizing() && sek_is_recaptcha_globally_enabled() && 'disabled' !== $form_submission_options['recaptcha_enabled'] ) {
15293
  $user_form_composition[$field_id] = $field_data;
15301
  }
15302
  return $user_form_composition;
15303
  }
15304
+
15305
+
15306
+ //generate the fields
15307
  function simple_form_generate_fields( $form_composition = array() ) {
15308
  $form_composition = empty( $form_composition ) ? $this->form_composition : $form_composition;
15309
  $fields_ = array();
15321
 
15322
  return $fields_;
15323
  }
15324
+
15325
+
15326
+ //generate the fields
15327
  function simple_form_generate_form( $fields ) {
15328
  $form = new Sek_Form();
15329
  $form->add_fields( $fields );
15349
  $this->attributes = wp_parse_args( $args, array(
15350
  'action' => '',
15351
  'method' => 'post'
15352
+ //TODO: add html callback
15353
  ) );
15354
  }
15355
 
15373
  }
15374
  return null;
15375
  }
15376
+
15377
+ //make sure fields are well formed
15378
  public function has_invalid_field() {
15379
  $has_invalid_field = false;
15380
 
15453
  'wrapper_tag' => '',
15454
  'wrapper_class' => array( 'sek-form-field' ),
15455
  'label' => '',
15456
+ //TODO: allow callbacks
15457
  'before_label' => '',
15458
  'after_label' => '',
15459
  'before_input' => '',
15471
 
15472
  public function html() {
15473
  $label = $this->data[ 'label' ];
15474
+
15475
+ //label stuff
15476
  if ( $label ) {
15477
  if ( true == $this->input->get_data( 'required' ) ) {
15478
  $label .= ' *';
15479
+ //$label .= ' ' . esc_html__( '(required)', 'text_doma' );
15480
  }
15481
  $label = sprintf( '%1$s<label for="%2$s">%3$s</label>%4$s',
15482
  $this->data[ 'before_label' ],
15485
  $this->data[ 'after_label' ]
15486
  );
15487
  }
15488
+
15489
+ //the input
15490
  $html = sprintf( '%s%s%s%s',
15491
  $label,
15492
  $this->data[ 'before_input' ],
15493
  $this->input,
15494
  $this->data[ 'after_input' ]
15495
  );
15496
+
15497
+ //any wrapper?
15498
  if ( $this->data[ 'wrapper_tag' ] ) {
15499
  $wrapper_tag = tag_escape( $this->data[ 'wrapper_tag' ] );
15500
  $wrapper_class = $this->data[ 'wrapper_class' ] ? ' class="'. implode( ' ', array_map('sanitize_html_class', $this->data[ 'wrapper_class' ] ) ) .'"' : '';
15531
  protected $attributes = array( 'id', 'name', 'required' );
15532
 
15533
  public function __construct( $args ) {
15534
+ //no name no party
15535
+ //TODO: raise exception
15536
  if ( ! isset( $args['name'] ) ) {
15537
  error_log( __FUNCTION__ . ' => contact form input name not set' );
15538
  return;
15590
  case 'nimble_subject' :
15591
  $value = __('An email subject', 'nimble-builder');
15592
  break;
15593
+ // case 'nimble_message' :
15594
+ // $value = __('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.', 'text-domain');
15595
+ // break;
15596
  }
15597
  }
15598
  return $value;
15800
  $this-> form = $form;
15801
 
15802
  $this->messages = array(
15803
+ //status => message
15804
+ //'not_sent' => __( 'Message was not sent. Try Again.', 'text_doma'),
15805
+ //'sent' => __( 'Thanks! Your message has been sent.', 'text_doma'),
15806
  'aborted' => __( 'Please supply correct information.', 'nimble-builder') //<-todo too much generic
15807
  );
15808
  $this->status = 'init';
15809
+
15810
+ // Validate reCAPTCHA if submitted
15811
+ // When sek_is_recaptcha_globally_enabled(), the hidden input 'nimble_recaptcha_resp' is rendered with a value set to a token remotely fetched with a js script
15812
+ // @see print_recaptcha_inline_js
15813
+ // on submission, we get the posted token value, and validate it with a remote http request to the google api
15814
  if ( isset( $_POST['nimble_recaptcha_resp'] ) ) {
15815
  if ( !$this->validate_recaptcha( $_POST['nimble_recaptcha_resp'] ) ) {
15816
  $this->status = 'recaptcha_fail';
15820
  }
15821
  }
15822
  }
15823
+
15824
+
15825
+ //@return bool
15826
  private function validate_recaptcha( $recaptcha_token ) {
15827
  $is_valid = false;
15828
  $endpoint = 'https://www.google.com/recaptcha/api/siteverify';
15829
  $global_recaptcha_opts = sek_get_global_option_value('recaptcha');
15830
  $global_recaptcha_opts = is_array( $global_recaptcha_opts ) ? $global_recaptcha_opts : array();
15831
+ // the user did not enter the key yet.
15832
+ // let's validate
15833
  if ( empty($global_recaptcha_opts['private_key']) )
15834
  return true;
15835
+
15836
+ //$public = $global_recaptcha_opts['public_key'];
15837
  $request = array(
15838
  'body' => array(
15839
  'secret' => $global_recaptcha_opts['private_key'],
15840
  'response' => $recaptcha_token
15841
  ),
15842
  );
15843
+
15844
+ // cache the recaptcha_errors
15845
  $response = wp_remote_post( esc_url_raw( $endpoint ), $request );
15846
  if ( is_array( $response ) ) {
15847
  $maybe_recaptcha_errors = wp_remote_retrieve_body( $response );
15852
  }
15853
 
15854
  }
15855
+
15856
+ //sek_error_log('reCAPTCHA response ?', $response );
15857
+ // There
15858
  if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
15859
  $this->recaptcha_errors = sprintf( __('There was a problem when performing the reCAPTCHA http request.', 'nimble-builder') );
15860
  return $is_valid;
15861
  }
15862
+
15863
+ // At this point, we can check the score if there not already an error messages, like a re-submission problem for example
15864
  if ( '_no_error_' === $this->recaptcha_errors ) {
15865
  $response_body = wp_remote_retrieve_body( $response );
15866
  $response_body = json_decode( $response_body, true );
15867
+
15868
+ // see https://developers.google.com/recaptcha/docs/v3#score
15869
  $score = isset( $response_body['score'] ) ? $response_body['score'] : 0;
15870
+
15871
+ // get the user defined threshold
15872
+ // must be normalized to be 0 >= threshold >= 1
15873
  $user_score_threshold = array_key_exists('score', $global_recaptcha_opts) ? $global_recaptcha_opts['score'] : 0.5;
15874
  $user_score_threshold = !is_numeric( $user_score_threshold ) ? 0.5 : $user_score_threshold;
15875
  $user_score_threshold = $user_score_threshold > 1 ? 1 : $user_score_threshold;
15884
 
15885
  return $is_valid;
15886
  }
15887
+
15888
+
15889
+ // Depending on the user options, some fields might exists in the $form object
15890
+ // We need to check their existence ( @see https://github.com/presscustomizr/nimble-builder/issues/399 )
15891
  public function maybe_send( $form_composition, $module_model ) {
15892
+ // the captcha validation has been made on Sek_Mailer instantiation
15893
  if ( 'recaptcha_fail' === $this->status ) {
15894
  return;
15895
  }
15896
 
15897
+ //sek_error_log('$form_composition ??', $form_composition );
15898
+ //sek_error_log('$module_model ??', $module_model );
15899
+ //sek_error_log('$this->form ??', $form_composition , $this->form );
15900
+
15901
  $invalid_field = $this->form->has_invalid_field();
15902
  if ( false !== $invalid_field ) {
15903
  $this->status = 'aborted';
15906
  }
15907
 
15908
  $module_user_values = array_key_exists( 'value', $module_model ) ? $module_model['value'] : array();
15909
+ //sek_error_log( '$module_model', $module_model );
15910
  $submission_options = empty( $module_user_values['form_submission'] ) ? array() : $module_user_values['form_submission'];
15911
+
15912
+ //<-allow html? -> TODO: turn into option
15913
  $allow_html = true;
15914
 
15915
  $sender_email = $this->form->get_field('nimble_email')->get_input()->get_value();
15927
  } else {
15928
  $subject = sprintf( __( 'Someone sent a message from %1$s', 'nimble-builder' ), get_bloginfo( 'name' ) );
15929
  }
15930
+
15931
+
15932
+
15933
+ // $sender_website = sprintf( __( 'Website: %1$s %2$s', 'text_doma' ),
15934
+ // $this->form->get_field('website')->get_input()->get_value(),
15935
+ // $allow_html ? '<br><br><br>': "\r\n\r\n\r\n"
15936
+ // );
15937
+
15938
+ // the sender's email is written in the email's header reply-to field.
15939
+ // But it is also written inside the message body following this issue, https://github.com/presscustomizr/nimble-builder/issues/218
15940
  $before_message = sprintf( '%1$s: %2$s &lt;%3$s&gt;', __('From', 'nimble-builder'), $sender_name, $sender_email );//$sender_website;
15941
  $before_message .= sprintf( '<br>%1$s: %2$s', __('Subject', 'nimble-builder'), $subject );
15942
  $after_message = '';
15953
  if ( !empty( $sender_body_message ) ) {
15954
  $sender_body_message = sprintf( '<br><br>%1$s: <br>%2$s',
15955
  __('Message body', 'nimble-builder'),
15956
+ //$allow_html ? '<br><br>': "\r\n\r\n",
15957
  $sender_body_message
15958
  );
15959
  }
15985
 
15986
  public function get_message( $status, $module_model ) {
15987
  $module_user_values = array_key_exists( 'value', $module_model ) ? $module_model['value'] : array();
15988
+ //sek_error_log( '$module_model', $module_model );
15989
  $submission_options = empty( $module_user_values['form_submission'] ) ? array() : $module_user_values['form_submission'];
15990
 
15991
  $submission_message = isset( $this->messages[ $status ] ) ? $this->messages[ $status ] : '';
15992
+
15993
+ // the check with strlen( preg_replace('/\s+/' ... ) allow user to "hack" the custom submission message with a blank space
15994
+ // because if the field is empty it will fallback on the default value
15995
  switch( $status ) {
15996
  case 'not_sent' :
15997
  if ( array_key_exists( 'failure_message', $submission_options ) && !empty( $submission_options['failure_message'] ) && 0 < strlen( preg_replace('/\s+/', '', $submission_options['failure_message'] ) ) ) {
16025
  }
16026
  return $submission_message;
16027
  }
16028
+
16029
+
16030
+
16031
+
16032
+ // inspired from wpcf7
16033
  private function get_from_email() {
16034
  $admin_email = get_option( 'admin_email' );
16035
  $sitename = strtolower( $_SERVER['SERVER_NAME'] );
16050
  }
16051
  }//Sek_Mailer
16052
  endif;
16053
+
16054
+
16055
+
16056
+
16057
+
16058
+
16059
+
16060
+
16061
+
16062
+
16063
+
16064
+
16065
+ // inspired by wpcf7
16066
  function sek_simple_form_mail_template() {
16067
  $template = array(
16068
  'subject' =>
nimble-builder.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Nimble Page Builder
4
  * Description: Powerful drag and drop page builder using the native WordPress customizer.
5
- * Version: 1.7.4
6
  * Text Domain: nimble-builder
7
  * Author: Press Customizr
8
  * Author URI: https://nimblebuilder.com/?utm_source=wp-plugins&utm_medium=wp-dashboard&utm_campaign=author-uri
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  /* ------------------------------------------------------------------------- *
14
  * CONSTANTS
15
  /* ------------------------------------------------------------------------- */
16
- $current_version = "1.7.4";
17
  if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
18
  if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
19
  if ( !defined( 'NIMBLE_BASE_URL' ) ) { define( 'NIMBLE_BASE_URL' , plugins_url( NIMBLE_DIR_NAME ) ); }
2
  /**
3
  * Plugin Name: Nimble Page Builder
4
  * Description: Powerful drag and drop page builder using the native WordPress customizer.
5
+ * Version: 1.7.5
6
  * Text Domain: nimble-builder
7
  * Author: Press Customizr
8
  * Author URI: https://nimblebuilder.com/?utm_source=wp-plugins&utm_medium=wp-dashboard&utm_campaign=author-uri
13
  /* ------------------------------------------------------------------------- *
14
  * CONSTANTS
15
  /* ------------------------------------------------------------------------- */
16
+ $current_version = "1.7.5";
17
  if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
18
  if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
19
  if ( !defined( 'NIMBLE_BASE_URL' ) ) { define( 'NIMBLE_BASE_URL' , plugins_url( NIMBLE_DIR_NAME ) ); }
readme.txt CHANGED
@@ -5,8 +5,8 @@ Plugin URI: https://wordpress.org/plugins/nimble-builder/
5
  Tags: page builder, visual editor, customizer, drag and drop, header, footer, landing page, contact form, grid, post grid
6
  Requires at least: 4.7
7
  Requires PHP: 5.4
8
- Tested up to: 5.2.0
9
- Stable tag: 1.7.4
10
  License: GPLv3
11
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8FMNQPU36U27J&source=url
@@ -109,10 +109,13 @@ Nimble builder works with any WordPress theme. If you experience any problem wit
109
  7. **Theme** : try to switch to another WordPress theme, like the default WordPress theme. If you use a child theme, activate the parent theme instead.
110
 
111
  == Upgrade Notice ==
112
- = 1.7.4 =
113
- Now pages and posts that have Nimble sections are included in the search results when a match is found with the textual content created with Nimble Builder.
114
 
115
  == Changelog ==
 
 
 
116
  = 1.7.4 : May 10th 2019 =
117
  * improved : pages and posts that have Nimble sections are included in the search results
118
  * improved : anchor links => allow scroll animations between sections
5
  Tags: page builder, visual editor, customizer, drag and drop, header, footer, landing page, contact form, grid, post grid
6
  Requires at least: 4.7
7
  Requires PHP: 5.4
8
+ Tested up to: 5.2.1
9
+ Stable tag: 1.7.5
10
  License: GPLv3
11
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8FMNQPU36U27J&source=url
109
  7. **Theme** : try to switch to another WordPress theme, like the default WordPress theme. If you use a child theme, activate the parent theme instead.
110
 
111
  == Upgrade Notice ==
112
+ = 1.7.5 =
113
+ Performance improvements for the live customizer part of Nimble Builder.
114
 
115
  == Changelog ==
116
+ = 1.7.5 : May 21st 2019 =
117
+ * improved : performance improvements on the first load of the live customizer
118
+
119
  = 1.7.4 : May 10th 2019 =
120
  * improved : pages and posts that have Nimble sections are included in the search results
121
  * improved : anchor links => allow scroll animations between sections