From 60de585044748d23c51f54d9ddc9dbe609528e07 Mon Sep 17 00:00:00 2001 From: Lai Power Date: Thu, 28 Mar 2024 09:39:59 +0000 Subject: [PATCH] updated plugin `Menu Icons` version 0.13.10 --- wp-content/plugins/menu-icons/CHANGELOG.md | 13 + wp-content/plugins/menu-icons/CONTRIBUTING.md | 13 - wp-content/plugins/menu-icons/menu-icons.php | 11 +- wp-content/plugins/menu-icons/readme.md | 4 + wp-content/plugins/menu-icons/readme.txt | 19 + .../codeinwp/themeisle-sdk/CHANGELOG.md | 19 + .../assets/images/themeisle-logo.svg | 519 ++++++++++++++++++ .../js/build/survey/survey_deps.asset.php | 1 + .../assets/js/build/survey/survey_deps.js | 1 + .../vendor/codeinwp/themeisle-sdk/load.php | 2 +- .../codeinwp/themeisle-sdk/src/Loader.php | 3 +- .../src/Modules/Announcements.php | 379 +++++++++++++ .../themeisle-sdk/src/Modules/Logger.php | 30 +- .../themeisle-sdk/src/Modules/Promotions.php | 35 +- .../src/Modules/Script_loader.php | 142 +++++ .../vendor/codeinwp/themeisle-sdk/start.php | 2 + .../menu-icons/vendor/composer/installed.json | 12 +- .../menu-icons/vendor/composer/installed.php | 18 +- 18 files changed, 1170 insertions(+), 53 deletions(-) delete mode 100644 wp-content/plugins/menu-icons/CONTRIBUTING.md create mode 100644 wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/themeisle-logo.svg create mode 100644 wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.asset.php create mode 100644 wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.js create mode 100644 wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php create mode 100644 wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Script_loader.php diff --git a/wp-content/plugins/menu-icons/CHANGELOG.md b/wp-content/plugins/menu-icons/CHANGELOG.md index e9e42461..f3ff8825 100644 --- a/wp-content/plugins/menu-icons/CHANGELOG.md +++ b/wp-content/plugins/menu-icons/CHANGELOG.md @@ -1,3 +1,16 @@ +##### [Version 0.13.10](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.9...v0.13.10) (2024-03-26) + +### Improvements +- Updated internal dependencies +- Improved readme to link to the public source files +- Filter promotions + +##### [Version 0.13.9](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.8...v0.13.9) (2024-02-23) + +### Fixes +- Updated dependencies +- Harden security + ##### [Version 0.13.8](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.7...v0.13.8) (2023-12-19) - SDK Updates diff --git a/wp-content/plugins/menu-icons/CONTRIBUTING.md b/wp-content/plugins/menu-icons/CONTRIBUTING.md deleted file mode 100644 index 36b5b5b1..00000000 --- a/wp-content/plugins/menu-icons/CONTRIBUTING.md +++ /dev/null @@ -1,13 +0,0 @@ -## Releasing - -This repository uses conventional [changelog commit](https://github.com/Codeinwp/conventional-changelog-simple-preset) messages to trigger release - -How to release a new version: - -- Clone the master branch -- Do your changes -- Send a PR to master and merge it using the following subject message - - `release: ` - for patch release - - `release(minor): ` - for minor release - - `release(major): ` - for major release - The release notes will inherit the body of the commit message which triggered the release. For more details check the [simple-preset](https://github.com/Codeinwp/conventional-changelog-simple-preset) that we use. \ No newline at end of file diff --git a/wp-content/plugins/menu-icons/menu-icons.php b/wp-content/plugins/menu-icons/menu-icons.php index 94d881d9..09d5e38d 100644 --- a/wp-content/plugins/menu-icons/menu-icons.php +++ b/wp-content/plugins/menu-icons/menu-icons.php @@ -11,7 +11,7 @@ * Plugin name: Menu Icons * Plugin URI: https://github.com/Codeinwp/wp-menu-icons * Description: Spice up your navigation menus with pretty icons, easily. - * Version: 0.13.8 + * Version: 0.13.10 * Author: ThemeIsle * Author URI: https://themeisle.com * License: GPLv2 @@ -29,7 +29,7 @@ final class Menu_Icons { const DISMISS_NOTICE = 'menu-icons-dismiss-notice'; - const VERSION = '0.13.8'; + const VERSION = '0.13.10'; /** * Holds plugin data @@ -103,11 +103,16 @@ final class Menu_Icons { add_action( 'admin_action_menu_icon_hide_notice', array( __CLASS__, 'wp_menu_icons_dismiss_dashboard_notice' ) ); add_filter( - 'menu_icons_load_promotions', + 'wp_menu_icons_load_promotions', function() { return array( 'otter' ); } ); + add_filter( + 'wp_menu_icons_dissallowed_promotions', function () { + return array( 'om-editor', 'om-image-block' ); + } + ); } diff --git a/wp-content/plugins/menu-icons/readme.md b/wp-content/plugins/menu-icons/readme.md index 022a073a..a3291563 100644 --- a/wp-content/plugins/menu-icons/readme.md +++ b/wp-content/plugins/menu-icons/readme.md @@ -45,6 +45,10 @@ Menu icons works with most of the themes out there, especially with popular ones Development of this plugin is done on [GitHub](https://github.com/codeinwp/wp-menu-icons). **Pull requests welcome**. Please see [issues reported](https://github.com/codeinwp/wp-menu-icons/issues) there before going to the plugin forum. +All the code and sources is publicly available on [GitHub/wp-menu-icons](https://github.com/codeinwp/wp-menu-icons) for this plugin and +for the [SDK](https://github.com/Codeinwp/themeisle-sdk). + + ## If you like this plugin, then consider checking out our other projects: ## [CodeinWP Blog](https://www.codeinwp.com/blog/) – Designer's Guide To WordPress diff --git a/wp-content/plugins/menu-icons/readme.txt b/wp-content/plugins/menu-icons/readme.txt index 93335fd5..654ae46d 100644 --- a/wp-content/plugins/menu-icons/readme.txt +++ b/wp-content/plugins/menu-icons/readme.txt @@ -225,6 +225,25 @@ Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/). == Changelog == +##### [Version 0.13.10](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.9...v0.13.10) (2024-03-26) + +### Improvements +- Updated internal dependencies +- Improved readme to link to the public source files +- Filter promotions + + + + +##### [Version 0.13.9](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.8...v0.13.9) (2024-02-23) + +### Fixes +- Updated dependencies +- Harden security + + + + ##### [Version 0.13.8](https://github.com/codeinwp/wp-menu-icons/compare/v0.13.7...v0.13.8) (2023-12-19) - SDK Updates diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md index 095213d7..dbe38cb7 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md @@ -1,3 +1,22 @@ +##### [Version 3.3.15](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.14...v3.3.15) (2024-03-26) + +### Improvements +- Add a filter to disallow promotions on specific products. +- Update Formbricks + +##### [Version 3.3.14](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.13...v3.3.14) (2024-02-27) + +- Add Announcement Module +- Add Script Loader Module + +##### [Version 3.3.13](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.12...v3.3.13) (2024-02-01) + +- Updated nonce check + +##### [Version 3.3.12](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.11...v3.3.12) (2024-01-31) + +- fix: prevent reference key set for users with no capability + ##### [Version 3.3.11](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.10...v3.3.11) (2023-12-12) - fix: cached requests for wp options diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/themeisle-logo.svg b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/themeisle-logo.svg new file mode 100644 index 00000000..4f1ab4f7 --- /dev/null +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/images/themeisle-logo.svg @@ -0,0 +1,519 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.asset.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.asset.php new file mode 100644 index 00000000..266568de --- /dev/null +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.asset.php @@ -0,0 +1 @@ + array(), 'version' => '7eac74bcd8abf2e43780'); diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.js b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.js new file mode 100644 index 00000000..9025518a --- /dev/null +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/assets/js/build/survey/survey_deps.js @@ -0,0 +1 @@ +(()=>{"use strict";var e=Object.defineProperty,t=(t,n,s)=>(((t,n,s)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s})(t,"symbol"!=typeof n?n+"":n,s),s);const n=e=>({ok:!1,error:e});async function s(e,t,s,i){const r=new URL(t,e),o=JSON.stringify(i),a=(d=fetch,(...e)=>{try{return{ok:!0,data:d(...e)}}catch(e){return{ok:!1,error:e}}})(r.toString(),{method:s,headers:{"Content-Type":"application/json"},body:o});var d;if(!1===a.ok)return n(a.error);const c=await a.data,{data:u}=await c.json();return c.ok?(e=>({ok:!0,data:e}))(u):n({code:"network_error",message:c.statusText,status:c.status,url:r})}class i{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return s(this.apiHost,`/api/v1/client/${this.environmentId}/actions`,"POST",e)}}class r{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return s(this.apiHost,`/api/v1/client/${this.environmentId}/displays`,"POST",e)}async update(e,t){return s(this.apiHost,`/api/v1/client/${this.environmentId}/displays/${e}`,"PUT",t)}}class o{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return s(this.apiHost,`/api/v1/client/${this.environmentId}/people`,"POST",{environmentId:this.environmentId,userId:e})}async update(e,t){return s(this.apiHost,`/api/v1/client/${this.environmentId}/people/${e}`,"POST",t)}}class a{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return s(this.apiHost,`/api/v1/client/${this.environmentId}/responses`,"POST",e)}async update({responseId:e,finished:t,data:n,ttc:i}){return s(this.apiHost,`/api/v1/client/${this.environmentId}/responses/${e}`,"PUT",{finished:t,data:n,ttc:i})}}class d{constructor(e,t){this.apiHost=e,this.environmentId=t}async uploadFile(e,{allowedFileExtensions:t,surveyId:n}={}){if(!(e instanceof Blob&&e instanceof File))throw new Error("Invalid file type. Expected Blob or File, but received "+typeof e);const s={fileName:e.name,fileType:e.type,allowedFileExtensions:t,surveyId:n},i=await fetch(`${this.apiHost}/api/v1/client/${this.environmentId}/storage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok)throw new Error(`Upload failed with status: ${i.status}`);const r=await i.json(),{data:o}=r,{signedUrl:a,fileUrl:d,signingData:c,presignedFields:u,updatedFileName:l}=o;let g={};if(c){const{signature:t,timestamp:s,uuid:i}=c;g={"X-File-Type":e.type,"X-File-Name":encodeURIComponent(l),"X-Survey-ID":n??"","X-Signature":t,"X-Timestamp":String(s),"X-UUID":i}}const p=new FormData;u&&Object.keys(u).forEach((e=>{p.append(e,u[e])})),p.append("file",e);const h=await fetch(a,{method:"POST",...c?{headers:g}:{},body:p});if(!h.ok){if(c){const e=await h.json(),t=new Error(e.message);throw t.name="FileTooLargeError",t}const e=await h.text();if(u&&e&&e.includes("EntityTooLarge")){const e=new Error("File size exceeds the size limit for your plan");throw e.name="FileTooLargeError",e}throw new Error(`Upload failed with status: ${h.status}`)}return d}}class c{constructor(e){const{apiHost:t,environmentId:n}=e;this.response=new a(t,n),this.display=new r(t,n),this.action=new i(t,n),this.people=new o(t,n),this.storage=new d(t,n)}}class u{constructor(e){this.client=new c(e)}}class l{constructor(){this.logLevel="error"}static getInstance(){return l.instance||(l.instance=new l),l.instance}configure(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)}logger(e,t){if("debug"===t&&"debug"!==this.logLevel)return;const n=`🧱 Formbricks - ${(new Date).toISOString()} [${t.toUpperCase()}] - ${e}`;"error"===t?console.error(n):console.log(n)}debug(e){this.logger(e,"debug")}error(e){this.logger(e,"error")}}const g=e=>({ok:!0,value:e}),p=e=>({ok:!1,error:e}),h=e=>(...t)=>{try{return{ok:!0,value:e(...t)}}catch(e){return{ok:!1,error:e}}},v=l.getInstance(),f=class e{constructor(e){this.customized=!1,e?(this.handleError=e,this.customized=!0):this.handleError=e=>l.getInstance().error(JSON.stringify(e))}static getInstance(){return e.instance||(e.instance=new e),e.instance}static init(t){this.initialized=!0,e.instance=new e(t)}printStatus(){v.debug("Custom error handler: "+(this.customized?"yes":"no"))}handle(e){console.warn("🧱 Formbricks - Global error: ",e),this.handleError(e)}};f.initialized=!1;let w=f;const y="formbricks-js";class m{constructor(){this.config=null;const e=this.loadFromLocalStorage();e.ok&&(this.config=e.value)}static getInstance(){return m.instance||(m.instance=new m),m.instance}update(e){if(e){const t=new Date((new Date).getTime()+12e4);this.config={...this.config,...e,expiresAt:t},this.saveToLocalStorage()}}get(){if(!this.config)throw new Error("config is null, maybe the init function was not called?");return this.config}loadFromLocalStorage(){if("undefined"!=typeof window){const e=localStorage.getItem(y);if(e){const t=JSON.parse(e);return t.expiresAt&&new Date(t.expiresAt)<=new Date?p(new Error("Config in local storage has expired")):g(JSON.parse(e))}}return p(new Error("No or invalid config in local storage"))}saveToLocalStorage(){return h((()=>localStorage.setItem(y,JSON.stringify(this.config))))()}resetConfig(){return this.config=null,h((()=>localStorage.removeItem(y)))()}}const I=(e,t)=>{const n=Math.abs(t.getTime()-e.getTime());return Math.floor(n/864e5)},b=()=>window.location.search.includes("formbricksDebug=true"),k=m.getInstance(),S=l.getInstance();let E=null;const H=async(e,t=!1)=>{var n;try{const s=await(async({apiHost:e,environmentId:t,userId:n},s)=>{const i=`${e}/api/v1/client/${t}/in-app/sync`,r="?version=1.6.0";let o={};if((s||b())&&(o.cache="no-cache",S.debug("No cache option set for sync")),!n){const e=i+r,t=await fetch(e,o);if(!t.ok){const n=await t.json();return p({code:"network_error",status:t.status,message:"Error syncing with backend",url:e,responseMessage:n.message})}return g((await t.json()).data)}const a=`${i}/${n}${r}`,d=await fetch(a,o);if(!d.ok){const e=await d.json();return p({code:"network_error",status:d.status,message:"Error syncing with backend",url:a,responseMessage:e.message})}const c=await d.json(),{data:u}=c;return g(u)})(e,t);if(!0!==(null==s?void 0:s.ok))throw S.error(`Sync failed: ${JSON.stringify(s.error)}`),s.error;let i;try{i=k.get().state}catch(e){}let r={surveys:s.value.surveys,noCodeActionClasses:s.value.noCodeActionClasses,product:s.value.product,attributes:(null==(n=s.value.person)?void 0:n.attributes)||{}};if(e.userId){const e=r.surveys.map((e=>e.name));S.debug("Fetched "+e.length+" surveys during sync: "+e.join(", "))}else{r={...r,displays:(null==i?void 0:i.displays)||[]},r=C(r);const e=r.surveys.map((e=>e.name));S.debug("Fetched "+e.length+" surveys during sync: "+e.join(", "))}k.update({apiHost:e.apiHost,environmentId:e.environmentId,userId:e.userId,state:r})}catch(e){throw S.error(`Error during sync: ${e}`),e}},C=e=>{const{displays:t,product:n}=e;let{surveys:s}=e;if(!t)return e;let i=s.filter((e=>{if("respondMultiple"===e.displayOption)return!0;if("displayOnce"===e.displayOption)return 0===t.filter((t=>t.surveyId===e.id)).length;if("displayMultiple"===e.displayOption)return 0===t.filter((t=>t.surveyId===e.id&&t.responded)).length;throw Error("Invalid displayOption")}));const r=t.length>0?t[t.length-1]:void 0;return i=i.filter((e=>{if(r){if(null!==e.recontactDays){const n=t.filter((t=>t.surveyId===e.id))[0];return!n||I(new Date,new Date(n.createdAt))>=e.recontactDays}return null===n.recontactDays||I(new Date,new Date(r.createdAt))>=n.recontactDays}return!0})),{...e,surveys:i}},$=()=>{"undefined"!=typeof window&&null!==E&&(window.clearInterval(E),E=null)},A=e=>new Promise((t=>setTimeout(t,e)));class L{constructor(e,n){t(this,"queue",[]),t(this,"config"),t(this,"surveyState"),t(this,"isRequestInProgress",!1),t(this,"api"),this.config=e,this.surveyState=n,this.api=new u({apiHost:e.apiHost,environmentId:e.environmentId})}add(e){this.surveyState.accumulateResponse(e),this.config.setSurveyState&&this.config.setSurveyState(this.surveyState),this.queue.push(e),this.processQueue()}async processQueue(){if(this.isRequestInProgress)return;if(0===this.queue.length)return;this.isRequestInProgress=!0;const e=this.queue[0];let t=0;for(;t=this.config.retryAttempts?(console.error("Failed to send response after 2 attempts."),this.config.onResponseSendingFailed&&this.config.onResponseSendingFailed(e),this.isRequestInProgress=!1):(this.isRequestInProgress=!1,this.processQueue())}async sendResponse(e){try{if(null!==this.surveyState.responseId)await this.api.client.response.update({...e,responseId:this.surveyState.responseId});else{const t=await this.api.client.response.create({...e,surveyId:this.surveyState.surveyId,userId:this.surveyState.userId||null,singleUseId:this.surveyState.singleUseId||null});if(!t.ok)throw new Error("Could not create response");if(this.surveyState.displayId)try{await this.api.client.display.update(this.surveyState.displayId,{responseId:t.data.id})}catch(e){console.error("Failed to update display, proceeding with the response.",e)}this.surveyState.updateResponseId(t.data.id),this.config.setSurveyState&&this.config.setSurveyState(this.surveyState)}return!0}catch(e){return console.error(e),!1}}updateSurveyState(e){this.surveyState=e}}class F{constructor(e,n,s,i){t(this,"responseId",null),t(this,"displayId",null),t(this,"userId",null),t(this,"surveyId"),t(this,"responseAcc",{finished:!1,data:{},ttc:{}}),t(this,"singleUseId"),this.surveyId=e,this.userId=i??null,this.singleUseId=n??null,this.responseId=s??null}setSurveyId(e){this.surveyId=e,this.clear()}copy(){const e=new F(this.surveyId,this.singleUseId??void 0,this.responseId??void 0,this.userId??void 0);return e.responseId=this.responseId,e.responseAcc=this.responseAcc,e}updateResponseId(e){this.responseId=e}updateDisplayId(e){this.displayId=e}updateUserId(e){this.userId=e}accumulateResponse(e){this.responseAcc={finished:e.finished,ttc:e.ttc,data:{...this.responseAcc.data,...e.data}}}isResponseFinished(){return this.responseAcc.finished}clear(){this.responseId=null,this.responseAcc={finished:!1,data:{},ttc:{}}}}const O=F,U="formbricks-web-container",D=m.getInstance(),P=l.getInstance(),T=w.getInstance();let x=!1,N=e=>{};const R=async e=>{if(x)return void P.debug("A survey is already running. Skipping.");x=!0,e.delay&&P.debug(`Delaying survey by ${e.delay} seconds.`);const t=D.get().state.product,n=new O(e.id,null,null,D.get().userId),s=new L({apiHost:D.get().apiHost,environmentId:D.get().environmentId,retryAttempts:2,onResponseSendingFailed:()=>{N(!0)}},n),i=e.productOverwrites??{},r=i.brandColor??t.brandColor,o=i.highlightBorderColor??t.highlightBorderColor,a=i.clickOutsideClose??t.clickOutsideClose,d=i.darkOverlay??t.darkOverlay,c=i.placement??t.placement,l=t.inAppSurveyBranding,g=await M();setTimeout((()=>{g.renderSurveyModal({survey:e,brandColor:r,isBrandingEnabled:l,clickOutside:a,darkOverlay:d,highlightBorderColor:o,placement:c,getSetIsError:e=>{N=e},onDisplay:async()=>{const{userId:t}=D.get();if(!t){const t={createdAt:new Date,surveyId:e.id,responded:!1},n=D.get().state.displays,s=n?[...n,t]:[t],i=D.get();let r=C({...i.state,displays:s});D.update({...i,state:r})}const i=new u({apiHost:D.get().apiHost,environmentId:D.get().environmentId}),r=await i.client.display.create({surveyId:e.id,userId:t});if(!r.ok)throw new Error("Could not create display");const{id:o}=r.data;n.updateDisplayId(o),s.updateSurveyState(n)},onResponse:e=>{const{userId:t}=D.get();if(!t){const e=D.get().state.displays,t=e&&e[e.length-1];if(!t)throw new Error("No lastDisplay found");if(!t.responded){t.responded=!0;const n=D.get();let s=C({...n.state,displays:e});D.update({...n,state:s})}}t&&n.updateUserId(t),s.updateSurveyState(n),s.add({data:e.data,ttc:e.ttc,finished:e.finished})},onClose:z,onFileUpload:async(e,t)=>{const n=new u({apiHost:D.get().apiHost,environmentId:D.get().environmentId});return await n.client.storage.uploadFile(e,t)},onRetry:()=>{N(!1),s.processQueue()}})}),1e3*e.delay)},z=async()=>{var e;if(null==(e=document.getElementById(U))||e.remove(),j(),!D.get().userId){const e=D.get().state,t=C(e);return D.update({...D.get(),state:t}),void(x=!1)}try{await H({apiHost:D.get().apiHost,environmentId:D.get().environmentId,userId:D.get().userId},!0),x=!1}catch(e){T.handle(e)}},j=()=>{const e=document.createElement("div");e.id=U,document.body.appendChild(e)},M=()=>new Promise(((e,t)=>{if(window.formbricksSurveys)e(window.formbricksSurveys);else{const n=document.createElement("script");n.src="https://unpkg.com/@formbricks/surveys@^1.6.0/dist/index.umd.js",n.async=!0,n.onload=()=>e(window.formbricksSurveys),n.onerror=e=>{console.error("Failed to load Formbricks Surveys library:",e),t(e)},document.head.appendChild(n)}})),q=l.getInstance(),_=m.getInstance(),B=["Exit Intent (Desktop)","50% Scroll"],J=async e=>{var t;const{userId:n,state:{surveys:s=[]}}=_.get();s.forEach((async t=>{const{inlineTriggers:n}=t,{codeConfig:s}=n??{};e!==(null==s?void 0:s.identifier)||await R(t)}));const i={environmentId:_.get().environmentId,userId:n,name:e};if(n&&!B.includes(e)){q.debug(`Sending action "${e}" to backend`);const t=new u({apiHost:_.get().apiHost,environmentId:_.get().environmentId}),s=await t.client.action.create({...i,userId:n});if(!s.ok)return p({code:"network_error",message:`Error tracking action ${e}`,status:500,url:`${_.get().apiHost}/api/v1/client/${_.get().environmentId}/actions`,responseMessage:s.error.message});b()&&await H({environmentId:_.get().environmentId,apiHost:_.get().apiHost,userId:n},!0)}q.debug(`Formbricks: Action "${e}" tracked`);const r=null==(t=_.get().state)?void 0:t.surveys;return r&&r.length>0?await X(e,r):q.debug("No active surveys to display"),{ok:!0,value:void 0}},X=async(e,t)=>{for(const s of t)if(!s.displayPercentage||(n=s.displayPercentage,Math.floor(100*Math.random())+1<=n)){for(const t of s.triggers)if(t===e)return q.debug(`Formbricks: survey ${s.id} triggered by action "${e}"`),void await R(s)}else q.debug("Survey display skipped based on displayPercentage.");var n},Q=e=>async(...t)=>{try{return{ok:!0,data:await e(...t)}}catch(e){return{ok:!1,error:e}}};let W=!1,Y=async function(e){if(e.clientY<=0){const e=await J("Exit Intent (Desktop)");if(!0!==e.ok)return p(e.error)}};const G=()=>{W&&(document.removeEventListener("mouseleave",Y),W=!1)};let K=!1,V=!1,Z=async()=>{const e=window.scrollY,t=window.innerHeight,n=document.documentElement.scrollHeight;if(0===e&&(V=!1),!V&&e/(n-t)>=.5){V=!0;const e=await J("50% Scroll");if(!0!==e.ok)return p(e.error)}};const ee=()=>{K&&(window.removeEventListener("scroll",Z),K=!1)},te=m.getInstance(),ne=l.getInstance(),se=w.getInstance(),ie=async()=>{var e;ne.debug(`Checking page url: ${window.location.href}`);const{state:t}=te.get(),{noCodeActionClasses:n=[],surveys:s=[]}=t??{},i=n.filter((e=>{const{innerHtml:t,cssSelector:n,pageUrl:s}=e.noCodeConfig||{};return s&&!t&&!n})),r=s.filter((e=>{var t;const{pageUrl:n,cssSelector:s,innerHtml:i}=(null==(t=e.inlineTriggers)?void 0:t.noCodeConfig)||{};return n&&!s&&!i}));if(i.length>0)for(const t of i){if(!(null==(e=t.noCodeConfig)?void 0:e.pageUrl))continue;const{noCodeConfig:{pageUrl:n}}=t,s=de(window.location.href,n.value,n.rule);if(!0!==s.ok)return p(s.error);if(!1===s.value)continue;const i=await J(t.name);if(!0!==i.ok)return p(i.error)}return r.length>0&&r.forEach((e=>{const{noCodeConfig:t}=e.inlineTriggers??{},{pageUrl:n}=t??{};if(n){const t=de(window.location.href,n.value,n.rule);if(!0!==t.ok)return p(t.error);R(e)}})),{ok:!0,value:void 0}};let re=!1;const oe=()=>ie(),ae=()=>{"undefined"!=typeof window&&re&&(window.removeEventListener("hashchange",oe),window.removeEventListener("popstate",oe),window.removeEventListener("pushstate",oe),window.removeEventListener("replacestate",oe),window.removeEventListener("load",oe),re=!1)};function de(e,t,n){switch(n){case"exactMatch":return g(e===t);case"contains":return g(e.includes(t));case"startsWith":return g(e.startsWith(t));case"endsWith":return g(e.endsWith(t));case"notMatch":return g(e!==t);case"notContains":return g(!e.includes(t));default:return p({code:"invalid_match_type",message:"Invalid match type"})}}const ce=(e,t)=>{var n,s,i,r,o,a,d,c;const u=null==(s=null==(n=t.noCodeConfig)?void 0:n.innerHtml)?void 0:s.value,l=null==(r=null==(i=t.noCodeConfig)?void 0:i.cssSelector)?void 0:r.value,g=null==(a=null==(o=t.noCodeConfig)?void 0:o.pageUrl)?void 0:a.value,p=null==(c=null==(d=t.noCodeConfig)?void 0:d.pageUrl)?void 0:c.rule;if(!u&&!l&&!g)return!1;if(u&&e.innerHTML!==u)return!1;if(l){const t=l.split(/\s*(?=[.#])/);for(let n of t)if(!e.matches(n))return!1}if(g&&p){const e=de(window.location.href,g,p);if(!e.ok||!e.value)return!1}return!0};let ue=!1;const le=e=>(e=>{const{state:t}=te.get();if(!t)return;const{noCodeActionClasses:n}=t;if(!n)return;const s=e.target;n.forEach((e=>{ce(s,e)&&J(e.name).then((e=>{var t,n;n=e=>{se.handle(e)},!0===(t=e).ok?t.value:n(t.error)}))}));const i=t.surveys;i&&0!==i.length&&i.forEach((e=>{const{inlineTriggers:t}=e;t&&ce(s,t)&&R(e)}))})(e),ge=()=>{ue&&(document.removeEventListener("click",le),ue=!1)};let pe=!1;const he=m.getInstance(),ve=l.getInstance(),fe=async()=>(ve.error("'setUserId' is no longer supported. Please set the userId in the init call instead."),{ok:!0,value:void 0}),we=async(e,t)=>{if(ve.debug("Setting attribute: "+e+" to value: "+t),((e,t)=>he.get().state.attributes[e]===t)(e,t.toString()))return ve.debug("Attribute already set to this value. Skipping update."),{ok:!0,value:void 0};const n=await(async(e,t)=>{const{apiHost:n,environmentId:s,userId:i}=he.get();if(!i)return p({code:"missing_person",message:"Unable to update attribute. User identification deactivated. No userId set."});const r={attributes:{[e]:t}},o=new u({apiHost:n,environmentId:s}),a=await o.client.people.update(i,r);return a.ok?(a.data.changed&&(ve.debug("Attribute updated. Syncing..."),await H({environmentId:s,apiHost:n,userId:i},!0)),{ok:!0,value:void 0}):p({code:"network_error",status:500,message:`Error updating person with userId ${i}`,url:`${he.get().apiHost}/api/v1/client/${s}/people/${i}`,responseMessage:a.error.message})})(e,t.toString());return n.ok?(he.update({environmentId:he.get().environmentId,apiHost:he.get().apiHost,userId:he.get().userId,state:{...he.get().state,attributes:{...he.get().state.attributes,[e]:t.toString()}}}),{ok:!0,value:void 0}):p(n.error)},ye=async()=>{Ee()},me=async()=>{ve.debug("Resetting state & getting new state from backend"),z();const e={environmentId:he.get().environmentId,apiHost:he.get().apiHost,userId:he.get().userId};await ye();try{return await Se(e),{ok:!0,value:void 0}}catch(e){return p(e)}},Ie=m.getInstance(),be=l.getInstance();let ke=!1;const Se=async e=>{if(ke)return be.debug("Already initialized, skipping initialization."),{ok:!0,value:void 0};if(b()&&be.configure({logLevel:"debug"}),w.getInstance().printStatus(),be.debug("Start initialize"),!e.environmentId)return be.debug("No environmentId provided"),p({code:"missing_field",field:"environmentId"});if(!e.apiHost)return be.debug("No apiHost provided"),p({code:"missing_field",field:"apiHost"});if(be.debug("Adding widget container to DOM"),j(),!e.userId&&e.attributes)return be.error("No userId provided but attributes. Cannot update attributes without userId."),p({code:"missing_field",field:"userId"});let t,n=null;if(e.userId&&e.attributes){const t=await(async(e,t,n,s)=>{var i,r;if(!n)return p({code:"missing_person",message:"Unable to update attribute. User identification deactivated. No userId set."});const o={...s};try{const e=null==(r=null==(i=he.get())?void 0:i.state)?void 0:r.attributes;if(e)for(const[t,n]of Object.entries(e))o[t]===n&&delete o[t]}catch(e){ve.debug("config not set; sending all attributes to backend")}if(0===Object.keys(o).length)return ve.debug("No attributes to update. Skipping update."),g(o);ve.debug("Updating attributes: "+JSON.stringify(o));const a={attributes:o},d=new u({apiHost:e,environmentId:t}),c=await d.client.people.update(n,a);return c.ok?g(o):p({code:"network_error",status:500,message:`Error updating person with userId ${n}`,url:`${e}/api/v1/client/${t}/people/${n}`,responseMessage:c.error.message})})(e.apiHost,e.environmentId,e.userId,e.attributes);if(!0!==t.ok)return p(t.error);n=t.value}try{t=Ie.get()}catch(e){be.debug("No existing configuration found.")}return t&&t.state&&t.environmentId===e.environmentId&&t.apiHost===e.apiHost&&t.userId===e.userId&&t.expiresAt?(be.debug("Found existing configuration."),t.expiresAt0&&Ie.update({environmentId:Ie.get().environmentId,apiHost:Ie.get().apiHost,userId:Ie.get().userId,state:{...Ie.get().state,attributes:{...Ie.get().state.attributes,...e.attributes}}}),be.debug("Adding event listeners"),"undefined"!=typeof window&&null===E&&(E=window.setInterval((async()=>{k.get().expiresAt&&new Date(k.get().expiresAt)>=new Date||(S.debug("Config has expired. Starting sync."),await H({apiHost:k.get().apiHost,environmentId:k.get().environmentId,userId:k.get().userId}))}),3e4)),"undefined"==typeof window||re||(window.addEventListener("hashchange",oe),window.addEventListener("popstate",oe),window.addEventListener("pushstate",oe),window.addEventListener("replacestate",oe),window.addEventListener("load",oe),re=!0),"undefined"==typeof window||ue||(document.addEventListener("click",le),ue=!0),"undefined"==typeof document||W||(document.querySelector("body").addEventListener("mouseleave",Y),W=!0),"undefined"==typeof window||K||(window.addEventListener("load",(()=>{window.addEventListener("scroll",Z)})),K=!0),pe||(window.addEventListener("beforeunload",(()=>{$(),ae(),ge(),G(),ee()})),pe=!0),ke=!0,be.debug("Initialized"),ie(),{ok:!0,value:void 0}},Ee=()=>{be.debug("Deinitializing"),z(),$(),ae(),ge(),G(),ee(),pe&&(window.removeEventListener("beforeunload",(()=>{$(),ae(),ge(),G(),ee()})),pe=!1),Ie.resetConfig(),ke=!1};l.getInstance().debug("Create command queue");const He=new class{constructor(){this.queue=[],this.running=!1,this.resolvePromise=null,this.commandPromise=null}add(e=!0,t,...n){this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||(this.commandPromise=new Promise((e=>{this.resolvePromise=e,this.run()})))}async wait(){this.running&&await this.commandPromise}async run(){for(this.running=!0;this.queue.length>0;){const e=w.getInstance(),t=this.queue.shift();if(!t)continue;if(t.checkInitialized){const t=(be.debug("Check if initialized"),ke&&w.initialized?{ok:!0,value:void 0}:p({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));t&&!0!==t.ok&&e.handle(t.error)}const n=async()=>await(null==t?void 0:t.command.apply(null,null==t?void 0:t.commandArgs)),s=await Q(n)();s&&(s.ok&&s.data&&!s.data.ok&&e.handle(s.data.error),!0!==s.ok&&e.handle(s.error))}this.running=!1,this.resolvePromise&&(this.resolvePromise(),this.resolvePromise=null,this.commandPromise=null)}},Ce=async(e,t)=>{He.add(!0,we,e,t),await He.wait()},$e={init:async e=>{w.init(e.errorHandler),He.add(!1,Se,e),await He.wait()},setUserId:async()=>{He.add(!0,fe),await He.wait()},setEmail:async e=>{Ce("email",e),await He.wait()},setAttribute:Ce,track:async(e,t={})=>{He.add(!0,J,e,t),await He.wait()},logout:async()=>{He.add(!0,ye),await He.wait()},reset:async()=>{He.add(!0,me),await He.wait()},registerRouteChange:async()=>{He.add(!0,ie),await He.wait()},getApi:()=>{const e=m.getInstance(),{environmentId:t,apiHost:n}=e.get();if(!t||!n)throw new Error("formbricks.init() must be called before getApi()");return new u({apiHost:n,environmentId:t})}};document.addEventListener("DOMContentLoaded",(()=>{window.tsdk_formbricks=$e,window.dispatchEvent(new Event("themeisle:survey:loaded"))}))})(); \ No newline at end of file diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php index 3659a105..cdbe0c66 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php @@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) { return; } // Current SDK version and path. -$themeisle_sdk_version = '3.3.11'; +$themeisle_sdk_version = '3.3.15'; $themeisle_sdk_path = dirname( __FILE__ ); global $themeisle_sdk_max_version; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Loader.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Loader.php index bf85ae9e..2464690d 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Loader.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Loader.php @@ -46,6 +46,7 @@ final class Loader { * @var array The modules which SDK will be using. */ private static $available_modules = [ + 'script_loader', 'dashboard_widget', 'rollback', 'uninstall_feedback', @@ -59,6 +60,7 @@ final class Loader { 'welcome', 'compatibilities', 'about_us', + 'announcements', ]; /** @@ -146,5 +148,4 @@ final class Loader { public static function get_version() { return self::$version; } - } diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php new file mode 100644 index 00000000..e75a9b9d --- /dev/null +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php @@ -0,0 +1,379 @@ + array( + 'start' => '2024-11-25 00:00:00', + 'end' => '2024-12-03 23:59:59', + 'rendered' => false, + ), + ); + + /** + * Holds the option prefix for the announcements. + * + * This is used to store the dismiss date for each announcement. + * + * @var string + */ + public $option_prefix = 'themeisle_sdk_announcement_'; + + /** + * Holds the time for the current request. + * + * @var string + */ + public $time = ''; + + /** + * Check if the module can be loaded. + * + * @param Product $product Product data. + * + * @return bool + */ + public function can_load( $product ) { + if ( $this->is_from_partner( $product ) ) { + return false; + } + + return true; + } + + /** + * Load the module for the selected product. + * + * @param Product $product Product data. + * + * @return void + */ + public function load( $product ) { + if ( ! current_user_can( 'install_plugins' ) ) { + return; + } + + $this->product = $product; + + add_action( 'admin_init', array( $this, 'load_announcements' ) ); + add_filter( 'themeisle_sdk_active_announcements', array( $this, 'get_active_announcements' ) ); + add_filter( 'themeisle_sdk_announcements', array( $this, 'get_announcements_for_plugins' ) ); + } + + /** + * Load all valid announcements. + * + * @return void + */ + public function load_announcements() { + $active = $this->get_active_announcements(); + + if ( empty( $active ) ) { + return; + } + + foreach ( $active as $announcement ) { + + $method = $announcement . '_notice_render'; + + if ( method_exists( $this, $method ) ) { + add_action( 'admin_notices', array( $this, $method ) ); + } + } + + // Load the ajax handler. + add_action( 'wp_ajax_themeisle_sdk_dismiss_announcement', array( $this, 'disable_notification_ajax' ) ); + } + + /** + * Get all active announcements. + * + * @return array List of active announcements. + */ + public function get_active_announcements() { + $active = array(); + + foreach ( self::$timeline as $announcement_slug => $dates ) { + if ( $this->is_active( $dates ) && $this->can_show( $announcement_slug, $dates ) ) { + $active[] = $announcement_slug; + } + } + + return $active; + } + + /** + * Get all announcements along with plugin specific data. + * + * @return array List of announcements. + */ + public function get_announcements_for_plugins() { + + $announcements = array(); + + foreach ( self::$timeline as $announcement => $dates ) { + $announcements[ $announcement ] = $dates; + + if ( false !== strpos( $announcement, 'black_friday' ) ) { + $announcements[ $announcement ]['active'] = $this->is_active( $dates ); + + // Dashboard banners URLs. + $announcements[ $announcement ]['feedzy_dashboard_url'] = tsdk_utmify( 'https://themeisle.com/plugins/feedzy-rss-feeds/blackfriday/', 'bfcm24', 'dashboard' ); + $announcements[ $announcement ]['neve_dashboard_url'] = tsdk_utmify( 'https://themeisle.com/themes/neve/blackfriday/', 'bfcm24', 'dashboard' ); + $announcements[ $announcement ]['otter_dashboard_url'] = tsdk_utmify( 'https://themeisle.com/plugins/otter-blocks/blackfriday/', 'bfcm24', 'dashboard' ); + + // Customizer banners URLs. + $announcements[ $announcement ]['hestia_customizer_url'] = tsdk_utmify( 'https://themeisle.com/black-friday/', 'bfcm24', 'hestiacustomizer' ); + $announcements[ $announcement ]['neve_customizer_url'] = tsdk_utmify( 'https://themeisle.com/black-friday/', 'bfcm24', 'nevecustomizer' ); + + // Banners urgency text. + $remaining_time = $this->get_remaining_time_for_event( $dates['end'] ); + $announcements[ $announcement ]['remaining_time'] = $remaining_time; + $announcements[ $announcement ]['urgency_text'] = ! empty( $remaining_time ) ? 'Hurry up! Only ' . $remaining_time . ' left.' : ''; + } + } + + return apply_filters( 'themeisle_sdk_announcements_data', $announcements ); + } + + /** + * Get the announcement data. + * + * @param string $announcement The announcement to get the data for. + * + * @return array + */ + public function get_announcement_data( $announcement ) { + return ! empty( $announcement ) && is_string( $announcement ) && isset( self::$timeline[ $announcement ] ) ? self::$timeline[ $announcement ] : array(); + } + + /** + * Check if the announcement has an active timeline. + * + * @param array $dates The announcement to check. + * + * @return bool + */ + public function is_active( $dates ) { + + if ( empty( $this->time ) ) { + $this->time = current_time( 'Y-m-d' ); + } + + $start = isset( $dates['start'] ) ? $dates['start'] : null; + $end = isset( $dates['end'] ) ? $dates['end'] : null; + + if ( $start && $end ) { + return $start <= $this->time && $this->time <= $end; + } elseif ( $start ) { + return $this->time >= $start; + } elseif ( $end ) { + return $this->time <= $end; + } + + return false; + } + + /** + * Get the remaining time for the event in a human readable format. + * + * @param string $end_date The end date for event. + * @return string Remaining time for the event. + */ + public function get_remaining_time_for_event( $end_date ) { + if ( empty( $end_date ) || ! is_string( $end_date ) ) { + return ''; + } + + try { + $end_date = new \DateTime( $end_date, new \DateTimeZone( 'GMT' ) ); + $current_date = new \DateTime( 'now', new \DateTimeZone( 'GMT' ) ); + $diff = $end_date->diff( $current_date ); + + if ( $diff->days > 0 ) { + return $diff->days === 1 ? $diff->format( '%a day' ) : $diff->format( '%a days' ); + } + + if ( $diff->h > 0 ) { + return $diff->h === 1 ? $diff->format( '%h hour' ) : $diff->format( '%h hours' ); + } + + if ( $diff->i > 0 ) { + return $diff->i === 1 ? $diff->format( '%i minute' ) : $diff->format( '%i minutes' ); + } + + return $diff->s === 1 ? $diff->format( '%s second' ) : $diff->format( '%s seconds' ); + } catch ( \Exception $e ) { + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { + error_log( $e->getMessage() ); // phpcs:ignore + } + } + + return ''; + } + + /** + * Check if the announcement can be shown. + * + * @param string $announcement_slug The announcement to check. + * @param array $dates The announcement to check. + * + * @return bool + */ + public function can_show( $announcement_slug, $dates ) { + $dismiss_date = get_option( $this->option_prefix . $announcement_slug, false ); + + if ( false === $dismiss_date ) { + return true; + } + + // If the start date is after the dismiss date, show the notice. + $start = isset( $dates['start'] ) ? $dates['start'] : null; + if ( $start && $dismiss_date < $start ) { + return true; + } + + return false; + } + + /** + * Disable the notification via ajax. + * + * @return void + */ + public function disable_notification_ajax() { + if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'dismiss_themeisle_event_notice' ) ) { + wp_die( 'Invalid nonce! Refresh the page and try again.' ); + } + + if ( ! isset( $_POST['announcement'] ) || ! is_string( $_POST['announcement'] ) ) { + wp_die( 'Invalid announcement! Refresh the page and try again.' ); + } + + $announcement = sanitize_key( $_POST['announcement'] ); + + update_option( $this->option_prefix . $announcement, current_time( 'Y-m-d' ) ); + wp_die( 'success' ); + } + + /** + * Render the Black Friday notice. + * + * @return void + */ + public function black_friday_notice_render() { + + // Prevent the notice from being rendered twice. + if ( self::$timeline['black_friday']['rendered'] ) { + return; + } + self::$timeline['black_friday']['rendered'] = true; + + $product_names = array(); + + foreach ( Loader::get_products() as $product ) { + $slug = $product->get_slug(); + + // Do not add if the contains the string 'pro'. + if ( strpos( $slug, 'pro' ) !== false ) { + continue; + } + + $product_names[] = $product->get_name(); + } + + // Randomize the products and get only 4. + shuffle( $product_names ); + $product_names = array_slice( $product_names, 0, 4 ); + + ?> + +
+ +

+ Themeisle Black Friday Sale is Live! - Enjoy Maximum Savings on . + Learn more + +

+
+ + get_sdk_uri() . 'assets/js/build/tracking/tracking.js', - $asset_file['dependencies'], - $asset_file['version'], - true - ); - - wp_localize_script( - 'themeisle_sdk_telemetry_script', - 'tiTelemetry', - array( - 'products' => $products_with_telemetry, - 'endpoint' => self::TELEMETRY_ENDPOINT, - ) - ); + $tracking_handler = apply_filters( 'themeisle_sdk_dependency_script_handler', 'tracking' ); + if ( ! empty( $tracking_handler ) ) { + do_action( 'themeisle_sdk_dependency_enqueue_script', 'tracking' ); + wp_localize_script( + $tracking_handler, + 'tiTelemetry', + array( + 'products' => $products_with_telemetry, + 'endpoint' => self::TELEMETRY_ENDPOINT, + ) + ); + } } catch ( \Exception $e ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { error_log( $e->getMessage() ); // phpcs:ignore diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php index 137e9b7e..d1eab764 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php @@ -33,6 +33,14 @@ class Promotions extends Abstract_Module { */ private $promotions = array(); + /** + * Holds the values of the promotions that are not allowed to be shown. + * Can be filtered by each product. + * + * @var array + */ + private $dissallowed_promotions = array(); + /** * Option key for promos. * @@ -113,6 +121,8 @@ class Promotions extends Abstract_Module { $this->promotions = $this->get_promotions(); + $this->dissallowed_promotions = apply_filters( $product->get_key() . '_dissallowed_promotions', array() ); + foreach ( $this->promotions as $slug => $data ) { if ( ! in_array( $slug, $promotions_to_load, true ) ) { unset( $this->promotions[ $slug ] ); @@ -173,6 +183,19 @@ class Promotions extends Abstract_Module { * @return void */ public function register_reference() { + if ( ! current_user_can( 'activate_plugins' ) ) { + return; + } + + if ( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) ) { + return; + } + + $plugin = rawurldecode( $_GET['plugin'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + if ( wp_verify_nonce( $_GET['_wpnonce'], 'activate-plugin_' . $plugin ) === false ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + return; + } + if ( isset( $_GET['reference_key'] ) ) { update_option( 'otter_reference_key', sanitize_key( $_GET['reference_key'] ) ); } @@ -269,12 +292,12 @@ class Promotions extends Abstract_Module { /** * Third-party compatibility. - * + * * @return boolean */ private function has_conflicts() { global $pagenow; - + // Editor notices aren't compatible with Enfold theme. if ( defined( 'AV_FRAMEWORK_VERSION' ) && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { return true; @@ -493,6 +516,14 @@ class Promotions extends Abstract_Module { $return = array_merge( $return, $this->promotions[ $slug ] ); } + $return = array_filter( + $return, + function ( $value, $key ) { + return ! in_array( $key, $this->dissallowed_promotions, true ); + }, + ARRAY_FILTER_USE_BOTH + ); + return array_keys( $return ); } diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Script_loader.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Script_loader.php new file mode 100644 index 00000000..2933df74 --- /dev/null +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Script_loader.php @@ -0,0 +1,142 @@ +is_from_partner( $product ) ) { + return false; + } + + return true; + } + + /** + * Load module logic. + * + * @param Product $product Product to load. + * + * @return Dependancy Module object. + */ + public function load( $product ) { + $this->product = $product; + $this->setup_actions(); + return $this; + } + + /** + * Setup actions. + */ + private function setup_actions() { + add_filter( 'themeisle_sdk_dependency_script_handler', [ $this, 'get_script_handler' ], 10, 1 ); + add_action( 'themeisle_sdk_dependency_enqueue_script', [ $this, 'enqueue_script' ], 10, 1 ); + } + + /** + * Get the script handler. + * + * @param string $slug The slug of the script. + * + * @return string The script handler. Empty if slug is not a string or not implemented. + */ + public function get_script_handler( $slug ) { + if ( ! is_string( $slug ) ) { + return ''; + } + + if ( 'tracking' !== $slug && 'survey' !== $slug ) { + return ''; + } + + return apply_filters( 'themeisle_sdk_dependency_script_handler_name', 'themeisle_sdk_' . $slug . '_script', $slug ); + } + + /** + * Enqueue the script. + * + * @param string $slug The slug of the script. + */ + public function enqueue_script( $slug ) { + $handler = apply_filters( 'themeisle_sdk_dependency_script_handler', $slug ); + if ( empty( $handler ) ) { + return; + } + + if ( 'tracking' === $slug ) { + $this->load_tracking( $handler ); + } elseif ( 'survey' === $slug ) { + $this->load_survey( $handler ); + } + } + + /** + * Load the survey script. + * + * @param string $handler The script handler. + * + * @return void + */ + public function load_survey( $handler ) { + global $themeisle_sdk_max_path; + $asset_file = require $themeisle_sdk_max_path . '/assets/js/build/survey/survey_deps.asset.php'; + + wp_enqueue_script( + $handler, + $this->get_sdk_uri() . 'assets/js/build/survey/survey_deps.js', + $asset_file['dependencies'], + $asset_file['version'], + true + ); + } + + /** + * Load the tracking script. + * + * @param string $handler The script handler. + * + * @return void + */ + public function load_tracking( $handler ) { + global $themeisle_sdk_max_path; + $asset_file = require $themeisle_sdk_max_path . '/assets/js/build/tracking/tracking.asset.php'; + + wp_enqueue_script( + $handler, + $this->get_sdk_uri() . 'assets/js/build/tracking/tracking.js', + $asset_file['dependencies'], + $asset_file['version'], + true + ); + } +} diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/start.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/start.php index d6ee140a..922e3747 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/start.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/start.php @@ -22,6 +22,7 @@ $files_to_load = [ $themeisle_library_path . '/src/Common/Abstract_module.php', $themeisle_library_path . '/src/Common/Module_factory.php', + $themeisle_library_path . '/src/Modules/Script_loader.php', $themeisle_library_path . '/src/Modules/Dashboard_widget.php', $themeisle_library_path . '/src/Modules/Rollback.php', $themeisle_library_path . '/src/Modules/Uninstall_feedback.php', @@ -36,6 +37,7 @@ $files_to_load = [ $themeisle_library_path . '/src/Modules/Welcome.php', $themeisle_library_path . '/src/Modules/Compatibilities.php', $themeisle_library_path . '/src/Modules/About_us.php', + $themeisle_library_path . '/src/Modules/Announcements.php', ]; $files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) ); diff --git a/wp-content/plugins/menu-icons/vendor/composer/installed.json b/wp-content/plugins/menu-icons/vendor/composer/installed.json index 569ae7b1..3b7316fc 100644 --- a/wp-content/plugins/menu-icons/vendor/composer/installed.json +++ b/wp-content/plugins/menu-icons/vendor/composer/installed.json @@ -128,23 +128,23 @@ }, { "name": "codeinwp/themeisle-sdk", - "version": "3.3.11", - "version_normalized": "3.3.11.0", + "version": "3.3.15", + "version_normalized": "3.3.15.0", "source": { "type": "git", "url": "https://github.com/Codeinwp/themeisle-sdk.git", - "reference": "583c474d8b5a8d12592f4a78ab8fa335aaf42fc0" + "reference": "eb06ae687ee39cbcc316936db1349b8b1092e32f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/583c474d8b5a8d12592f4a78ab8fa335aaf42fc0", - "reference": "583c474d8b5a8d12592f4a78ab8fa335aaf42fc0", + "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/eb06ae687ee39cbcc316936db1349b8b1092e32f", + "reference": "eb06ae687ee39cbcc316936db1349b8b1092e32f", "shasum": "" }, "require-dev": { "codeinwp/phpcs-ruleset": "dev-main" }, - "time": "2023-12-12T10:06:27+00:00", + "time": "2024-03-26T09:05:18+00:00", "type": "library", "installation-source": "dist", "notification-url": "https://packagist.org/downloads/", diff --git a/wp-content/plugins/menu-icons/vendor/composer/installed.php b/wp-content/plugins/menu-icons/vendor/composer/installed.php index 4848d0c6..77d339da 100644 --- a/wp-content/plugins/menu-icons/vendor/composer/installed.php +++ b/wp-content/plugins/menu-icons/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'codeinwp/wp-menu-icons', - 'pretty_version' => 'v0.13.8', - 'version' => '0.13.8.0', - 'reference' => '3d0f5fe65015775d09b4cd6d7db74aa0367430da', + 'pretty_version' => 'v0.13.10', + 'version' => '0.13.10.0', + 'reference' => 'c952a9d2f3db0616568acf8ac3f6eba9a94024c0', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -38,18 +38,18 @@ 'dev_requirement' => false, ), 'codeinwp/themeisle-sdk' => array( - 'pretty_version' => '3.3.11', - 'version' => '3.3.11.0', - 'reference' => '583c474d8b5a8d12592f4a78ab8fa335aaf42fc0', + 'pretty_version' => '3.3.15', + 'version' => '3.3.15.0', + 'reference' => 'eb06ae687ee39cbcc316936db1349b8b1092e32f', 'type' => 'library', 'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk', 'aliases' => array(), 'dev_requirement' => false, ), 'codeinwp/wp-menu-icons' => array( - 'pretty_version' => 'v0.13.8', - 'version' => '0.13.8.0', - 'reference' => '3d0f5fe65015775d09b4cd6d7db74aa0367430da', + 'pretty_version' => 'v0.13.10', + 'version' => '0.13.10.0', + 'reference' => 'c952a9d2f3db0616568acf8ac3f6eba9a94024c0', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(),