PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / trunk
Secure Custom Fields vtrunk
6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / assets / build / js / scf-bindings.min.js
secure-custom-fields / assets / build / js Last commit date
commands 3 weeks ago pro 3 weeks ago acf-escaped-html-notice.asset.php 1 year ago acf-escaped-html-notice.js 1 year ago acf-escaped-html-notice.js.map 1 year ago acf-escaped-html-notice.min.asset.php 8 months ago acf-escaped-html-notice.min.js 8 months ago acf-field-group.asset.php 3 months ago acf-field-group.js 3 months ago acf-field-group.js.map 3 months ago acf-field-group.min.asset.php 3 months ago acf-field-group.min.js 3 months ago acf-input.asset.php 3 weeks ago acf-input.js 3 weeks ago acf-input.js.map 3 weeks ago acf-input.min.asset.php 3 weeks ago acf-input.min.js 3 weeks ago acf-internal-post-type.asset.php 8 months ago acf-internal-post-type.js 8 months ago acf-internal-post-type.js.map 8 months ago acf-internal-post-type.min.asset.php 8 months ago acf-internal-post-type.min.js 8 months ago acf.asset.php 8 months ago acf.js 8 months ago acf.js.map 8 months ago acf.min.asset.php 8 months ago acf.min.js 8 months ago index.php 1 year ago scf-bindings.asset.php 3 weeks ago scf-bindings.js 3 weeks ago scf-bindings.js.map 3 weeks ago scf-bindings.min.asset.php 3 weeks ago scf-bindings.min.js 3 weeks ago
scf-bindings.min.js
1 lines
1 (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,n=window.wp.coreData,r=window.wp.editor,o=window.wp.i18n;function s(e){return e?e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}let l={};const a=e=>l[e]||null;(0,t.registerBlockBindingsSource)({name:"acf/field",label:(0,o.__)("SCF Fields","secure-custom-fields"),getLabel({args:e,select:t}){const n=e?.key;if(!n)return(0,o.__)("SCF Fields","secure-custom-fields");const r=a(n);return r?.label?r.label:s(n)},getValues({context:e,bindings:t,select:o}){const{getCurrentPostType:l}=o(r.store);if("wp_template"===l()){const e={};return Object.entries(t).forEach(([t,{args:n}={}])=>{const r=n?.key;if(!r)return void(e[t]="");const o=a(r);e[t]=o?.label||s(r)}),e}const{getEditedEntityRecord:c}=o(n.store),i=function(e){if(!e?.acf)return{};const t={};return Object.entries(e.acf).forEach(([e,n])=>{if(e.endsWith("_source")){const r=e.replace("_source","");t[r]=n}}),t}(e?.postType&&e?.postId?c("postType",e.postType,e.postId):void 0),u={};return Object.entries(t).forEach(([e,{args:t}={}])=>{const n=function(e,t,n){const r=t?.key,o=n[r];if(!o)return"";const s=o.type,l=o.formatted_value;switch(s){case"image":return function(e,t){if(!e)return"";switch(t){case"url":return e.url||"";case"alt":return e.alt||"";case"title":return e.title||"";case"id":return e.id||e.ID||"";default:return""}}(l,e);case"checkbox":return Array.isArray(l)?l.join(", "):l?String(l):"";default:return l?String(l):""}}(e,t,i);u[e]=n}),u},canUserEditValue:()=>!1});const c=window.wp.element,i=window.wp.hooks,u=window.wp.compose,d=window.wp.blockEditor,p=window.wp.components,f={"core/paragraph":{content:["text","textarea","date_picker","number","range"]},"core/heading":{content:["text","textarea","date_picker","number","range"]},"core/image":{id:["image"],url:["image"],title:["image"],alt:["image"]},"core/button":{url:["url"],text:["text","checkbox","select","date_picker"],linkTarget:["text","checkbox","select"],rel:["text","checkbox","select"]}},m="acf/field";function g(e,t,n=null){if(!e||0===e.length)return[];const r=function(e,t=null){const n=f[e];return n?t?n[t]||null:[...new Set(Object.values(n).flat())]:null}(t,n);return r?e.filter(e=>r.includes(e.type)):e}const b=window.wp.data,w=window.wp.apiFetch;var y=e.n(w);const h=window.wp.url;function _(e){const[t,n]=(0,c.useState)({}),[r,o]=(0,c.useState)(!1),[s,a]=(0,c.useState)(null);return(0,c.useEffect)(()=>{if(!e)return n({}),o(!1),void a(null);let t=!1;o(!0),a(null);return(async()=>{try{const r=(0,h.addQueryArgs)(`/wp/v2/types/${e}`,{context:"edit"}),s=await y()({path:r});if(t)return;const a=function(e){const t={};return Array.isArray(e)?(e.forEach(e=>{Array.isArray(e.fields)&&e.fields.forEach(e=>{t[e.name]={label:e.label,type:e.type}})}),t):t}(s.scf_field_groups);(e=>{l={...l,...e}})(a),n(a),o(!1)}catch(e){t||(a(e),o(!1))}})(),()=>{t=!0}},[e]),{fields:t,isLoading:r,error:s}}const E=(0,u.createHigherOrderComponent)(e=>t=>{const s=function(e){const t=f[e];return t?Object.keys(t):[]}(t.name),{updateBlockBindings:l,removeAllBlockBindings:a}=(0,d.useBlockBindingsUtils)(),{isSiteEditor:i,templatePostType:u}=(0,b.useSelect)(e=>{const{getCurrentPostType:t,getCurrentPostId:o}=e(r.store),{getEditedEntityRecord:s}=e(n.store),l=t(),a=o();if("wp_template"!==l)return{isSiteEditor:!1,templatePostType:null};const c=s("postType","wp_template",a);var i;return{isSiteEditor:!0,templatePostType:(i=c?.slug||"")?i.startsWith("single-")?i.replace("single-",""):i.startsWith("archive-")?i.replace("archive-",""):"single"===i?"post":null:null}},[]),w=(0,b.useSelect)(e=>{const{getCurrentPostType:t,getCurrentPostId:o}=e(r.store),{getEditedEntityRecord:s}=e(n.store),l=t(),a=o();if(!l||!a||"wp_template"===l)return{};const c=s("postType",l,a),i={};return c?.acf&&Object.entries(c.acf).forEach(([e,t])=>{if(e.endsWith("_source")){const n=e.replace("_source","");Object.hasOwn(c.acf,n)&&(i[n]=t)}}),i},[]),{fields:y}=_(u),h=i?y:w,E=(0,c.useMemo)(()=>{return(e=h)&&0!==Object.keys(e).length?Object.entries(e).map(([e,t])=>({value:e,label:t.label,type:t.type})):[];var e},[h]),{boundFields:k,setBoundFields:x}=function(e){const[t,n]=(0,c.useState)({});return(0,c.useEffect)(()=>{const t=e?.metadata?.bindings||{},r={};Object.keys(t).forEach(e=>{t[e]?.args?.key&&(r[e]=t[e].args.key)}),n(r)},[e?.metadata?.bindings]),{boundFields:t,setBoundFields:n}}(t.attributes),v=(0,c.useCallback)((e=null)=>g(E,t.name,e),[E,t.name]),C=(0,c.useMemo)(()=>function(e,t){if(!t||t.length<=1)return!1;const n=f[e];if(!n)return!1;const r=n[t[0]]||[];return t.every(e=>{const t=n[e]||[];return t.length===r.length&&t.every(e=>r.includes(e))})}(t.name,s),[t.name,s]),S=(0,c.useCallback)((e,t)=>{if(Array.isArray(e)){const n={...k},r={};e.forEach(e=>{n[e]=t,r[e]=t?{source:m,args:{key:t}}:void 0}),x(n),l(r)}else x(n=>({...n,[e]:t})),l({[e]:t?{source:m,args:{key:t}}:void 0})},[k,x,l]),B=(0,c.useCallback)(()=>{a(),x({})},[a,x]);return(0,c.useMemo)(()=>i?s&&s.length>0:E.length>0&&s&&s.length>0,[i,E,s])?React.createElement(React.Fragment,null,React.createElement(d.InspectorControls,t,React.createElement(p.__experimentalToolsPanel,{label:(0,o.__)("Connect to a field","secure-custom-fields"),resetAll:B},C?React.createElement(p.__experimentalToolsPanelItem,{hasValue:()=>!!k[s[0]],label:(0,o.__)("All attributes","secure-custom-fields"),onDeselect:()=>S(s,null),isShownByDefault:!0},React.createElement(p.ComboboxControl,{label:(0,o.__)("Field","secure-custom-fields"),placeholder:(0,o.__)("Select a field","secure-custom-fields"),options:v(),value:k[s[0]]||"",onChange:e=>S(s,e),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})):s.map(e=>React.createElement(p.__experimentalToolsPanelItem,{key:`scf-binding-${e}`,hasValue:()=>!!k[e],label:e,onDeselect:()=>S(e,null),isShownByDefault:!0},React.createElement(p.ComboboxControl,{label:e,placeholder:(0,o.__)("Select a field","secure-custom-fields"),options:v(e),value:k[e]||"",onChange:t=>S(e,t),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}))))),React.createElement(e,t)):React.createElement(e,t)},"withCustomControls");(0,i.addFilter)("editor.BlockEdit","secure-custom-fields/with-custom-controls",E)})();