47a0306b by Jeff Balicki

staff

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 8c411026
Showing 373 changed files with 4943 additions and 0 deletions
1 /*!***************************************************************************************************************************************************************************************************************!*\
2 !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./src/advanced-custom-fields-pro/assets/src/sass/acf-dark.scss ***!
3 \***************************************************************************************************************************************************************************************************************/
4 /*--------------------------------------------------------------------------------------------
5 *
6 * Dark mode
7 *
8 * WordPress plugin: https://en-au.wordpress.org/plugins/dark-mode/
9 * Github Documentation: https://github.com/danieltj27/Dark-Mode/wiki/Help:-Plugin-Compatibility-Guide
10 *
11 *--------------------------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------------------------
13 *
14 * Global
15 *
16 *---------------------------------------------------------------------------------------------*/
17 .acf-box {
18 background-color: #32373c;
19 border-color: #191f25;
20 color: #bbc8d4;
21 }
22 .acf-box .title,
23 .acf-box .footer {
24 border-color: #23282d;
25 }
26 .acf-box h2 {
27 color: #bbc8d4;
28 }
29 .acf-box table, .acf-box tbody, .acf-box tr {
30 background: transparent !important;
31 }
32
33 .acf-thead {
34 color: #bbc8d4;
35 border-color: #191f25;
36 }
37
38 .acf-tfoot {
39 background-color: #2d3136;
40 border-color: #23282d;
41 }
42
43 .acf-table.-clear,
44 .acf-table.-clear tr {
45 background: transparent !important;
46 }
47
48 .acf-loading-overlay {
49 background: rgba(0, 0, 0, 0.5);
50 }
51
52 /*---------------------------------------------------------------------------------------------
53 *
54 * Fields
55 *
56 *---------------------------------------------------------------------------------------------*/
57 .acf-fields > .acf-field {
58 border-color: #23282d;
59 }
60
61 .acf-fields.-left > .acf-field:before {
62 background: rgba(0, 0, 0, 0.1);
63 border-color: #23282d;
64 }
65
66 .acf-fields.-border {
67 background-color: #32373c;
68 border-color: #191f25;
69 color: #bbc8d4;
70 }
71
72 .acf-field[data-width] + .acf-field[data-width] {
73 border-color: #23282d;
74 }
75
76 .acf-input-prepend,
77 .acf-input-append {
78 background-color: #32373c;
79 border-color: #191f25;
80 color: #bbc8d4;
81 }
82
83 .acf-fields > .acf-tab-wrap {
84 background-color: #32373c;
85 border-color: #191f25;
86 color: #bbc8d4;
87 }
88 .acf-fields > .acf-tab-wrap .acf-tab-group {
89 background-color: #2d3136;
90 border-color: #23282d;
91 }
92 .acf-fields > .acf-tab-wrap .acf-tab-group li a {
93 background-color: #2d3136;
94 border-color: #23282d;
95 }
96 .acf-fields > .acf-tab-wrap .acf-tab-group li a:hover {
97 background-color: #2d3136;
98 border-color: #23282d;
99 color: #bbc8d4;
100 }
101 .acf-fields > .acf-tab-wrap .acf-tab-group li.active a {
102 background-color: #32373c;
103 border-color: #191f25;
104 color: #bbc8d4;
105 }
106
107 .acf-fields.-sidebar:before {
108 background-color: #2d3136;
109 border-color: #23282d;
110 }
111
112 .acf-fields.-sidebar.-left:before {
113 background-color: #2d3136;
114 border-color: #23282d;
115 background: #23282d;
116 }
117 .acf-fields.-sidebar.-left > .acf-tab-wrap.-left .acf-tab-group li a {
118 background-color: #2d3136;
119 border-color: #23282d;
120 }
121 .acf-fields.-sidebar.-left > .acf-tab-wrap.-left .acf-tab-group li.active a {
122 background-color: #2d3136;
123 border-color: #23282d;
124 }
125
126 .acf-file-uploader .show-if-value {
127 background-color: #32373c;
128 border-color: #191f25;
129 color: #bbc8d4;
130 }
131 .acf-file-uploader .show-if-value .file-icon {
132 background-color: #2d3136;
133 border-color: #23282d;
134 }
135
136 .acf-oembed {
137 background-color: #2d3136;
138 border-color: #23282d;
139 }
140 .acf-oembed .title {
141 background-color: #50626f;
142 border-color: #191f25;
143 color: #fff;
144 }
145
146 .acf-gallery {
147 background-color: #2d3136;
148 border-color: #23282d;
149 }
150 .acf-gallery .acf-gallery-main {
151 background: #23282d;
152 }
153 .acf-gallery .acf-gallery-attachment .margin {
154 background-color: #2d3136;
155 border-color: #23282d;
156 }
157 .acf-gallery .acf-gallery-side {
158 background-color: #2d3136;
159 border-color: #23282d;
160 }
161 .acf-gallery .acf-gallery-side .acf-gallery-side-info {
162 background-color: #2d3136;
163 border-color: #23282d;
164 }
165 .acf-gallery .acf-gallery-toolbar {
166 background-color: #2d3136;
167 border-color: #23282d;
168 }
169
170 .acf-button-group label:not(.selected) {
171 background-color: #2d3136;
172 border-color: #23282d;
173 }
174
175 .acf-switch:not(.-on) {
176 background-color: #2d3136;
177 border-color: #23282d;
178 }
179 .acf-switch:not(.-on) .acf-switch-slider {
180 background-color: #50626f;
181 border-color: #191f25;
182 color: #fff;
183 }
184
185 .acf-link .link-wrap {
186 background-color: #2d3136;
187 border-color: #23282d;
188 }
189
190 .acf-relationship .filters {
191 background-color: #32373c;
192 border-color: #191f25;
193 color: #bbc8d4;
194 }
195 .acf-relationship .selection {
196 background-color: #2d3136;
197 border-color: #23282d;
198 }
199 .acf-relationship .selection .choices,
200 .acf-relationship .selection .choices-list,
201 .acf-relationship .selection .values {
202 background-color: #2d3136;
203 border-color: #23282d;
204 }
205
206 .acf-taxonomy-field .categorychecklist-holder {
207 background-color: #2d3136;
208 border-color: #23282d;
209 }
210
211 .acf-google-map {
212 background-color: #2d3136;
213 border-color: #23282d;
214 }
215 .acf-google-map .title {
216 background-color: #50626f;
217 border-color: #191f25;
218 color: #fff;
219 }
220
221 .acf-accordion {
222 background-color: #32373c;
223 border-color: #191f25;
224 color: #bbc8d4;
225 }
226
227 .acf-field.acf-accordion .acf-accordion-content > .acf-fields {
228 border-color: #191f25;
229 }
230
231 .acf-flexible-content .layout {
232 background-color: #32373c;
233 border-color: #191f25;
234 color: #bbc8d4;
235 }
236 .acf-flexible-content .layout .acf-fc-layout-handle {
237 background-color: #2d3136;
238 border-color: #23282d;
239 }
240 .acf-flexible-content .layout .acf-fc-layout-handle .acf-fc-layout-order {
241 background-color: #32373c;
242 border-color: #191f25;
243 color: #bbc8d4;
244 }
245
246 #wpbody .acf-table {
247 background-color: #2d3136;
248 border-color: #23282d;
249 }
250 #wpbody .acf-table > tbody > tr,
251 #wpbody .acf-table > thead > tr {
252 background: transparent;
253 }
254 #wpbody .acf-table > tbody > tr > td,
255 #wpbody .acf-table > tbody > tr > th,
256 #wpbody .acf-table > thead > tr > td,
257 #wpbody .acf-table > thead > tr > th {
258 border-color: #191f25;
259 }
260
261 .acf-field select optgroup, .acf-field select optgroup:nth-child(2n) {
262 background: #50626f;
263 }
264
265 /*---------------------------------------------------------------------------------------------
266 *
267 * Field Group
268 *
269 *---------------------------------------------------------------------------------------------*/
270 #acf-field-group-fields .acf-field-list-wrap {
271 background-color: #32373c;
272 border-color: #191f25;
273 color: #bbc8d4;
274 }
275 #acf-field-group-fields .acf-field-list .no-fields-message {
276 background-color: #32373c;
277 border-color: #191f25;
278 color: #bbc8d4;
279 }
280 #acf-field-group-fields .acf-field-object {
281 background-color: #32373c;
282 border-color: #191f25;
283 color: #bbc8d4;
284 border-color: #23282d;
285 }
286 #acf-field-group-fields .acf-field-object table, #acf-field-group-fields .acf-field-object tbody, #acf-field-group-fields .acf-field-object tr, #acf-field-group-fields .acf-field-object td, #acf-field-group-fields .acf-field-object th {
287 background: transparent;
288 border-color: #23282d;
289 }
290 #acf-field-group-fields .acf-field-object .acf-field .acf-label {
291 background-color: #2d3136;
292 border-color: #23282d;
293 }
294 #acf-field-group-fields .acf-field-object.ui-sortable-helper {
295 border-color: #191f25;
296 box-shadow: none;
297 }
298 #acf-field-group-fields .acf-field-object.ui-sortable-placeholder {
299 background-color: #2d3136;
300 border-color: #23282d;
301 box-shadow: none;
302 }
303 #acf-field-group-fields .acf-field-object + .acf-field-object-tab::before,
304 #acf-field-group-fields .acf-field-object + .acf-field-object-accordion::before {
305 background-color: #2d3136;
306 border-color: #23282d;
307 }
308
309 /*---------------------------------------------------------------------------------------------
310 *
311 * Admin: Tools
312 *
313 *---------------------------------------------------------------------------------------------*/
314 .acf-meta-box-wrap .acf-fields {
315 background-color: #50626f;
316 border-color: #191f25;
317 color: #fff;
318 background: transparent;
319 }
320
321 /*# sourceMappingURL=acf-dark.css.map*/
...\ No newline at end of file ...\ No newline at end of file
1 .acf-box{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-box .title,.acf-box .footer{border-color:#23282d}.acf-box h2{color:#bbc8d4}.acf-box table,.acf-box tbody,.acf-box tr{background:transparent !important}.acf-thead{color:#bbc8d4;border-color:#191f25}.acf-tfoot{background-color:#2d3136;border-color:#23282d}.acf-table.-clear,.acf-table.-clear tr{background:transparent !important}.acf-loading-overlay{background:rgba(0,0,0,.5)}.acf-fields>.acf-field{border-color:#23282d}.acf-fields.-left>.acf-field:before{background:rgba(0,0,0,.1);border-color:#23282d}.acf-fields.-border{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-field[data-width]+.acf-field[data-width]{border-color:#23282d}.acf-input-prepend,.acf-input-append{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-fields>.acf-tab-wrap{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-fields>.acf-tab-wrap .acf-tab-group{background-color:#2d3136;border-color:#23282d}.acf-fields>.acf-tab-wrap .acf-tab-group li a{background-color:#2d3136;border-color:#23282d}.acf-fields>.acf-tab-wrap .acf-tab-group li a:hover{background-color:#2d3136;border-color:#23282d;color:#bbc8d4}.acf-fields>.acf-tab-wrap .acf-tab-group li.active a{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-fields.-sidebar:before{background-color:#2d3136;border-color:#23282d}.acf-fields.-sidebar.-left:before{background-color:#2d3136;border-color:#23282d;background:#23282d}.acf-fields.-sidebar.-left>.acf-tab-wrap.-left .acf-tab-group li a{background-color:#2d3136;border-color:#23282d}.acf-fields.-sidebar.-left>.acf-tab-wrap.-left .acf-tab-group li.active a{background-color:#2d3136;border-color:#23282d}.acf-file-uploader .show-if-value{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-file-uploader .show-if-value .file-icon{background-color:#2d3136;border-color:#23282d}.acf-oembed{background-color:#2d3136;border-color:#23282d}.acf-oembed .title{background-color:#50626f;border-color:#191f25;color:#fff}.acf-gallery{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-main{background:#23282d}.acf-gallery .acf-gallery-attachment .margin{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-side{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-side .acf-gallery-side-info{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-toolbar{background-color:#2d3136;border-color:#23282d}.acf-button-group label:not(.selected){background-color:#2d3136;border-color:#23282d}.acf-switch:not(.-on){background-color:#2d3136;border-color:#23282d}.acf-switch:not(.-on) .acf-switch-slider{background-color:#50626f;border-color:#191f25;color:#fff}.acf-link .link-wrap{background-color:#2d3136;border-color:#23282d}.acf-relationship .filters{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-relationship .selection{background-color:#2d3136;border-color:#23282d}.acf-relationship .selection .choices,.acf-relationship .selection .choices-list,.acf-relationship .selection .values{background-color:#2d3136;border-color:#23282d}.acf-taxonomy-field .categorychecklist-holder{background-color:#2d3136;border-color:#23282d}.acf-google-map{background-color:#2d3136;border-color:#23282d}.acf-google-map .title{background-color:#50626f;border-color:#191f25;color:#fff}.acf-accordion{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-field.acf-accordion .acf-accordion-content>.acf-fields{border-color:#191f25}.acf-flexible-content .layout{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-flexible-content .layout .acf-fc-layout-handle{background-color:#2d3136;border-color:#23282d}.acf-flexible-content .layout .acf-fc-layout-handle .acf-fc-layout-order{background-color:#32373c;border-color:#191f25;color:#bbc8d4}#wpbody .acf-table{background-color:#2d3136;border-color:#23282d}#wpbody .acf-table>tbody>tr,#wpbody .acf-table>thead>tr{background:transparent}#wpbody .acf-table>tbody>tr>td,#wpbody .acf-table>tbody>tr>th,#wpbody .acf-table>thead>tr>td,#wpbody .acf-table>thead>tr>th{border-color:#191f25}.acf-field select optgroup,.acf-field select optgroup:nth-child(2n){background:#50626f}#acf-field-group-fields .acf-field-list-wrap{background-color:#32373c;border-color:#191f25;color:#bbc8d4}#acf-field-group-fields .acf-field-list .no-fields-message{background-color:#32373c;border-color:#191f25;color:#bbc8d4}#acf-field-group-fields .acf-field-object{background-color:#32373c;border-color:#191f25;color:#bbc8d4;border-color:#23282d}#acf-field-group-fields .acf-field-object table,#acf-field-group-fields .acf-field-object tbody,#acf-field-group-fields .acf-field-object tr,#acf-field-group-fields .acf-field-object td,#acf-field-group-fields .acf-field-object th{background:transparent;border-color:#23282d}#acf-field-group-fields .acf-field-object .acf-field .acf-label{background-color:#2d3136;border-color:#23282d}#acf-field-group-fields .acf-field-object.ui-sortable-helper{border-color:#191f25;box-shadow:none}#acf-field-group-fields .acf-field-object.ui-sortable-placeholder{background-color:#2d3136;border-color:#23282d;box-shadow:none}#acf-field-group-fields .acf-field-object+.acf-field-object-tab::before,#acf-field-group-fields .acf-field-object+.acf-field-object-accordion::before{background-color:#2d3136;border-color:#23282d}.acf-meta-box-wrap .acf-fields{background-color:#50626f;border-color:#191f25;color:#fff;background:transparent}
1 #acf-field-group-fields>.inside,#acf-field-group-locations>.inside,#acf-field-group-options>.inside{padding:0;margin:0}.postbox .handle-order-higher,.postbox .handle-order-lower{display:none}#minor-publishing-actions,#misc-publishing-actions #visibility,#misc-publishing-actions .edit-timestamp{display:none}#minor-publishing{border-bottom:0 none}#misc-pub-section{border-bottom:0 none}#misc-publishing-actions .misc-pub-section{border-bottom-color:#f5f5f5}#acf-field-group-fields{border:0 none;box-shadow:none}#acf-field-group-fields>.postbox-header,#acf-field-group-fields>.handlediv,#acf-field-group-fields>.hndle{display:none}#acf-field-group-fields a{text-decoration:none}#acf-field-group-fields a:active,#acf-field-group-fields a:focus{outline:none;box-shadow:none}#acf-field-group-fields .li-field-order{width:20%}#acf-field-group-fields .li-field-label{width:30%}#acf-field-group-fields .li-field-name{width:25%}#acf-field-group-fields .li-field-type{width:25%}#acf-field-group-fields .li-field-key{display:none}#acf-field-group-fields.show-field-keys .li-field-label,#acf-field-group-fields.show-field-keys .li-field-name,#acf-field-group-fields.show-field-keys .li-field-type,#acf-field-group-fields.show-field-keys .li-field-key{width:20%}#acf-field-group-fields.show-field-keys .li-field-key{display:block}#acf-field-group-fields .acf-field-list-wrap{border:#ccd0d4 solid 1px}#acf-field-group-fields .acf-field-list{background:#f5f5f5;margin-top:-1px}#acf-field-group-fields .acf-field-list .no-fields-message{padding:15px 15px;background:#fff;display:none}#acf-field-group-fields .acf-field-list.-empty .no-fields-message{display:block}.acf-admin-3-8 #acf-field-group-fields .acf-field-list-wrap{border-color:#dfdfdf}.acf-field-object{border-top:#eee solid 1px;background:#fff}.acf-field-object.ui-sortable-helper{border-top-color:#fff;box-shadow:0 0 0 1px #dfdfdf,0 1px 4px rgba(0,0,0,.1)}.acf-field-object.ui-sortable-placeholder{box-shadow:0 -1px 0 0 #dfdfdf;visibility:visible !important;background:#f9f9f9;border-top-color:transparent;min-height:54px}.acf-field-object.ui-sortable-placeholder:after,.acf-field-object.ui-sortable-placeholder:before{visibility:hidden}.acf-field-object>.meta{display:none}.acf-field-object>.handle a{-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.acf-field-object>.handle li{padding-top:10px;padding-bottom:10px;word-wrap:break-word}.acf-field-object>.handle .acf-icon{margin:1px 0 0;cursor:move;background:transparent;float:left;height:28px;line-height:26px;width:28px;font-size:13px;color:#444;position:relative;z-index:1}.acf-field-object>.handle strong{display:block;padding-bottom:6px;font-size:14px;line-height:14px;min-height:14px}.acf-field-object>.handle .row-options{visibility:hidden}.acf-field-object>.handle .row-options a{margin-right:4px}.acf-field-object>.handle .row-options a.delete-field{color:#a00}.acf-field-object>.handle .row-options a.delete-field:hover{color:red}.acf-field-object.open+.acf-field-object{border-top-color:#e1e1e1}.acf-field-object.open>.handle{background:#2a9bd9;border:#2696d3 solid 1px;text-shadow:#268fbb 0 1px 0;color:#fff;position:relative;margin:-1px -1px 0 -1px}.acf-field-object.open>.handle a{color:#fff !important}.acf-field-object.open>.handle a:hover{text-decoration:underline !important}.acf-field-object.open>.handle .acf-icon{border-color:#fff;color:#fff}.acf-field-object.open>.handle .acf-required{color:#fff}.acf-field-object:hover>.handle .row-options,.acf-field-object.-hover>.handle .row-options{visibility:visible}.acf-field-object>.settings{display:none;width:100%}.acf-field-object>.settings>.acf-table{border:none}.acf-field-object .rule-groups{margin-top:20px}.rule-groups h4{margin:3px 0}.rule-groups .rule-group{margin:0 0 5px}.rule-groups .rule-group h4{margin:0 0 3px}.rule-groups .rule-group td.param{width:35%}.rule-groups .rule-group td.operator{width:20%}.rule-groups .rule-group td.add{width:40px}.rule-groups .rule-group td.remove{width:28px;vertical-align:middle}.rule-groups .rule-group td.remove a{visibility:hidden}.rule-groups .rule-group tr:hover td.remove a{visibility:visible}.rule-groups .rule-group select:empty{background:#f8f8f8}.rule-groups:not(.rule-groups-multiple) .rule-group:first-child tr:first-child td.remove a{visibility:hidden !important}#acf-field-group-options tr[data-name=hide_on_screen] li{float:left;width:33%}@media(max-width: 1100px){#acf-field-group-options tr[data-name=hide_on_screen] li{width:50%}}table.conditional-logic-rules{background:transparent;border:0 none;border-radius:0}table.conditional-logic-rules tbody td{background:transparent;border:0 none !important;padding:5px 2px !important}.acf-field-object-tab .acf-field-setting-name,.acf-field-object-accordion .acf-field-setting-name,.acf-field-object-tab .acf-field-setting-instructions,.acf-field-object-accordion .acf-field-setting-instructions,.acf-field-object-tab .acf-field-setting-required,.acf-field-object-accordion .acf-field-setting-required,.acf-field-object-tab .acf-field-setting-warning,.acf-field-object-accordion .acf-field-setting-warning,.acf-field-object-tab .acf-field-setting-wrapper,.acf-field-object-accordion .acf-field-setting-wrapper{display:none}.acf-field-object-tab .li-field-name,.acf-field-object-accordion .li-field-name{visibility:hidden}.acf-field-object+.acf-field-object-tab:before,.acf-field-object+.acf-field-object-accordion:before{display:block;content:"";height:5px;width:100%;background:#f5f5f5;border-top:#e1e1e1 solid 1px;border-bottom:#e1e1e1 solid 1px;margin-top:-1px}.acf-admin-3-8 .acf-field-object+.acf-field-object-tab:before,.acf-admin-3-8 .acf-field-object+.acf-field-object-accordion:before{border-color:#e5e5e5}.acf-field-object-tab p:first-child,.acf-field-object-accordion p:first-child{margin:.5em 0}.acf-field-object-accordion .acf-field-setting-instructions{display:table-row}.acf-field-object-message tr[data-name=name],.acf-field-object-message tr[data-name=instructions],.acf-field-object-message tr[data-name=required]{display:none !important}.acf-field-object-message .li-field-name{visibility:hidden}.acf-field-object-message textarea{height:175px !important}.acf-field-object-separator tr[data-name=name],.acf-field-object-separator tr[data-name=instructions],.acf-field-object-separator tr[data-name=required]{display:none !important}.acf-field-object-date-picker .acf-radio-list li,.acf-field-object-time-picker .acf-radio-list li,.acf-field-object-date-time-picker .acf-radio-list li{line-height:25px}.acf-field-object-date-picker .acf-radio-list span,.acf-field-object-time-picker .acf-radio-list span,.acf-field-object-date-time-picker .acf-radio-list span{display:inline-block;min-width:10em}.acf-field-object-date-picker .acf-radio-list input[type=text],.acf-field-object-time-picker .acf-radio-list input[type=text],.acf-field-object-date-time-picker .acf-radio-list input[type=text]{width:100px}.acf-field-object-date-time-picker .acf-radio-list span{min-width:15em}.acf-field-object-date-time-picker .acf-radio-list input[type=text]{width:200px}#slugdiv .inside{padding:12px;margin:0}#slugdiv input[type=text]{width:100%;height:28px;font-size:14px}html[dir=rtl] .acf-field-object.open>.handle{margin:-1px -1px 0}html[dir=rtl] .acf-field-object.open>.handle .acf-icon{float:right}html[dir=rtl] .acf-field-object.open>.handle .li-field-order{padding-left:0 !important;padding-right:15px !important}@media only screen and (max-width: 850px){tr.acf-field,td.acf-label,td.acf-input{display:block !important;width:auto !important;border:0 none !important}tr.acf-field{border-top:#ededed solid 1px !important;margin-bottom:0 !important}td.acf-label{background:transparent !important;padding-bottom:0 !important}}
This diff could not be displayed because it is too large.
1 /*!******************************************************************************************************************************************************************************************************************************!*\
2 !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./src/advanced-custom-fields-pro/assets/src/sass/pro/acf-pro-field-group.scss ***!
3 \******************************************************************************************************************************************************************************************************************************/
4 /*--------------------------------------------------------------------------------------------
5 *
6 * Vars
7 *
8 *--------------------------------------------------------------------------------------------*/
9 /* colors */
10 /* acf-field */
11 /* responsive */
12 /*--------------------------------------------------------------------------------------------
13 *
14 * Mixins
15 *
16 *--------------------------------------------------------------------------------------------*/
17 /*---------------------------------------------------------------------------------------------
18 *
19 * Flexible Content
20 *
21 *---------------------------------------------------------------------------------------------*/
22 .acf-field-setting-fc_layout .acf-fc-meta {
23 margin: 0 0 10px;
24 padding: 0;
25 }
26 .acf-field-setting-fc_layout .acf-fc-meta li {
27 margin: 0 0 10px;
28 padding: 0;
29 }
30 .acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,
31 .acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min {
32 float: left;
33 width: 33%;
34 padding-right: 10px;
35 }
36 .acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,
37 .acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend,
38 .acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend {
39 min-width: 60px;
40 }
41 .acf-field-setting-fc_layout .acf-fl-actions {
42 visibility: hidden;
43 }
44 .acf-field-setting-fc_layout .acf-fl-actions .reorder-layout {
45 cursor: move;
46 }
47 .acf-field-setting-fc_layout .acf-fl-actions a {
48 padding: 1px 0;
49 font-size: 13px;
50 line-height: 20px;
51 }
52 .acf-field-setting-fc_layout:hover .acf-fl-actions, .acf-field-setting-fc_layout.-hover .acf-fl-actions {
53 visibility: visible;
54 }
55
56 /*---------------------------------------------------------------------------------------------
57 *
58 * Clone
59 *
60 *---------------------------------------------------------------------------------------------*/
61 .acf-field-object-clone {
62 /* group */
63 /* seamless */
64 }
65 .acf-field-object-clone[data-display=seamless] .acf-field-setting-instructions,
66 .acf-field-object-clone[data-display=seamless] .acf-field-setting-layout,
67 .acf-field-object-clone[data-display=seamless] .acf-field-setting-wrapper,
68 .acf-field-object-clone[data-display=seamless] .acf-field-setting-conditional_logic {
69 display: none;
70 }
71
72 /*# sourceMappingURL=acf-pro-field-group.css.map*/
...\ No newline at end of file ...\ No newline at end of file
1 {"version":3,"file":"acf-pro-field-group.css","mappings":";;;AAAA;;;;8FAAA;AAMA;AAOA;AAQA;ACrBA;;;;8FAAA;ACAA;;;;+FAAA;AASC;EACC;EACA;ACUF;ADRE;EACC;EACA;ACUH;ADPE;;EAEC;EACA;EACA;ACSH;ADNE;;;EAGC;ACQH;ADHC;EACC;ACKF;ADHE;EACC;ACKH;ADFE;EACC;EACA;EACA;ACIH;ADEG;EACC;ACAJ;;ADMA;;;;+FAAA;AAMA;EAEC;EAOA;ACXD;ADcE;;;;EAIC;ACZH,C","sources":["webpack://advanced-custom-fields-pro/./src/advanced-custom-fields-pro/assets/src/sass/_variables.scss","webpack://advanced-custom-fields-pro/./src/advanced-custom-fields-pro/assets/src/sass/_mixins.scss","webpack://advanced-custom-fields-pro/./src/advanced-custom-fields-pro/assets/src/sass/pro/_field-group.scss","webpack://advanced-custom-fields-pro/./src/advanced-custom-fields-pro/assets/src/sass/pro/acf-pro-field-group.scss"],"sourcesContent":["/*--------------------------------------------------------------------------------------------\n*\n*\tVars\n*\n*--------------------------------------------------------------------------------------------*/\n\n/* colors */\n$acf_blue: #2a9bd9;\n$acf_notice: #2a9bd9;\n$acf_error: #d94f4f;\n$acf_success: #49ad52;\n$acf_warning: #fd8d3b;\n\n/* acf-field */\n$field_padding: 15px 12px;\n$field_padding_x: 12px;\n$field_padding_y: 15px;\n$fp: 15px 12px;\n$fy: 15px;\n$fx: 12px;\n\n/* responsive */\n$md: 880px;\n$sm: 640px;\n\n// Admin.\n$wp-card-border: #ccd0d4;\t\t\t// Card border.\n$wp-card-border-1: #d5d9dd;\t\t\t// Card inner border 1: Structural (darker).\n$wp-card-border-2: #eeeeee;\t\t\t// Card inner border 2: Fields (lighter).\n$wp-input-border: #7e8993;\t\t\t// Input border.\n\n// Admin 3.8\n$wp38-card-border: #E5E5E5;\t\t\t// Card border.\n$wp38-card-border-1: #dfdfdf;\t\t// Card inner border 1: Structural (darker).\n$wp38-card-border-2: #eeeeee;\t\t// Card inner border 2: Fields (lighter).\n$wp38-input-border: #dddddd;\t\t// Input border.","/*--------------------------------------------------------------------------------------------\n*\n* Mixins\n*\n*--------------------------------------------------------------------------------------------*/\n@mixin clearfix() {\n\t&:after {\n\t\tdisplay: block;\n\t\tclear: both;\n\t\tcontent: \"\";\n\t}\n}\n\n@mixin border-box() {\n\t-webkit-box-sizing: border-box;\n\t-moz-box-sizing: border-box;\n\tbox-sizing: border-box;\n}\n\n@mixin centered() {\n\tposition: absolute;\n\ttop: 50%;\n\tleft: 50%;\n\ttransform: translate(-50%, -50%);\n}\n\n@mixin animate( $properties: 'all' ) {\n\t-webkit-transition: $properties 0.3s ease; // Safari 3.2+, Chrome\n -moz-transition: $properties 0.3s ease; \t// Firefox 4-15\n -o-transition: $properties 0.3s ease; \t\t// Opera 10.5–12.00\n transition: $properties 0.3s ease; \t\t// Firefox 16+, Opera 12.50+\n}\n\n@mixin rtl() {\n\thtml[dir=\"rtl\"] & {\n\t\ttext-align: right;\n\t\t@content;\n\t}\n}\n\n@mixin wp-admin( $version: '3-8' ) {\n\t.acf-admin-#{$version} & {\n\t\t@content;\n\t}\n}","/*---------------------------------------------------------------------------------------------\n*\n*\tFlexible Content\n*\t\n*---------------------------------------------------------------------------------------------*/\n\n.acf-field-setting-fc_layout {\n\t\n\t// meta\n\t.acf-fc-meta {\n\t\tmargin: 0 0 10px;\n\t\tpadding: 0;\n\t\t\n\t\tli {\n\t\t\tmargin: 0 0 10px;\n\t\t\tpadding: 0;\n\t\t}\n\t\t\n\t\t.acf-fc-meta-display,\n\t\t.acf-fc-meta-min {\n\t\t\tfloat: left;\n\t\t\twidth: 33%;\n\t\t\tpadding-right: 10px;\n\t\t}\n\t\t\n\t\t.acf-fc-meta-label .acf-input-prepend,\n\t\t.acf-fc-meta-name .acf-input-prepend,\n\t\t.acf-fc-meta-display .acf-input-prepend {\n\t\t\tmin-width: 60px;\n\t\t}\n\t}\n\t\n\t// actions\n\t.acf-fl-actions {\n\t\tvisibility: hidden;\n\t\t\n\t\t.reorder-layout {\n\t\t\tcursor: move;\n\t\t}\n\t\t\n\t\ta {\n\t\t\tpadding: 1px 0;\n\t\t\tfont-size: 13px;\n\t\t\tline-height: 20px;\n\t\t}\n\t}\n\t\n\t// hover\n\t&:hover, &.-hover {\n\t\t .acf-fl-actions {\n\t\t \tvisibility: visible;\n\t\t }\n\t}\n}\n\n\n/*---------------------------------------------------------------------------------------------\n*\n*\tClone\n*\t\n*---------------------------------------------------------------------------------------------*/\n\n.acf-field-object-clone {\n\t\n\t/* group */\n\t&[data-display=\"group\"] {\n\t\t\n\t\t\n\t}\n\t\n\t\n\t/* seamless */\n\t&[data-display=\"seamless\"] {\n\t\t\n\t\t.acf-field-setting-instructions,\n\t\t.acf-field-setting-layout,\n\t\t.acf-field-setting-wrapper,\n\t\t.acf-field-setting-conditional_logic {\n\t\t\tdisplay: none;\n\t\t}\n\t\t\n\t}\n\t\n}","/*--------------------------------------------------------------------------------------------\n*\n*\tVars\n*\n*--------------------------------------------------------------------------------------------*/\n/* colors */\n/* acf-field */\n/* responsive */\n/*--------------------------------------------------------------------------------------------\n*\n* Mixins\n*\n*--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n*\n*\tFlexible Content\n*\t\n*---------------------------------------------------------------------------------------------*/\n.acf-field-setting-fc_layout .acf-fc-meta {\n margin: 0 0 10px;\n padding: 0;\n}\n.acf-field-setting-fc_layout .acf-fc-meta li {\n margin: 0 0 10px;\n padding: 0;\n}\n.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,\n.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min {\n float: left;\n width: 33%;\n padding-right: 10px;\n}\n.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,\n.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend,\n.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend {\n min-width: 60px;\n}\n.acf-field-setting-fc_layout .acf-fl-actions {\n visibility: hidden;\n}\n.acf-field-setting-fc_layout .acf-fl-actions .reorder-layout {\n cursor: move;\n}\n.acf-field-setting-fc_layout .acf-fl-actions a {\n padding: 1px 0;\n font-size: 13px;\n line-height: 20px;\n}\n.acf-field-setting-fc_layout:hover .acf-fl-actions, .acf-field-setting-fc_layout.-hover .acf-fl-actions {\n visibility: visible;\n}\n\n/*---------------------------------------------------------------------------------------------\n*\n*\tClone\n*\t\n*---------------------------------------------------------------------------------------------*/\n.acf-field-object-clone {\n /* group */\n /* seamless */\n}\n.acf-field-object-clone[data-display=seamless] .acf-field-setting-instructions,\n.acf-field-object-clone[data-display=seamless] .acf-field-setting-layout,\n.acf-field-object-clone[data-display=seamless] .acf-field-setting-wrapper,\n.acf-field-object-clone[data-display=seamless] .acf-field-setting-conditional_logic {\n display: none;\n}"],"names":[],"sourceRoot":""}
...\ No newline at end of file ...\ No newline at end of file
1 .acf-field-setting-fc_layout .acf-fc-meta{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta li{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min{float:left;width:33%;padding-right:10px}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend{min-width:60px}.acf-field-setting-fc_layout .acf-fl-actions{visibility:hidden}.acf-field-setting-fc_layout .acf-fl-actions .reorder-layout{cursor:move}.acf-field-setting-fc_layout .acf-fl-actions a{padding:1px 0;font-size:13px;line-height:20px}.acf-field-setting-fc_layout:hover .acf-fl-actions,.acf-field-setting-fc_layout.-hover .acf-fl-actions{visibility:visible}.acf-field-object-clone[data-display=seamless] .acf-field-setting-instructions,.acf-field-object-clone[data-display=seamless] .acf-field-setting-layout,.acf-field-object-clone[data-display=seamless] .acf-field-setting-wrapper,.acf-field-object-clone[data-display=seamless] .acf-field-setting-conditional_logic{display:none}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 !function(){var e={436:function(){!function(e){var t=acf.FieldSetting.extend({type:"clone",name:"display",render:function(){var e=this.field.val();this.$fieldObject.attr("data-display",e)}});acf.registerFieldSetting(t);var i=acf.FieldSetting.extend({type:"clone",name:"prefix_label",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("label")+" "),this.$("code").html(e+"%field_label%")}});acf.registerFieldSetting(i);var a=acf.FieldSetting.extend({type:"clone",name:"prefix_name",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("name")+"_"),this.$("code").html(e+"%field_name%")}});acf.registerFieldSetting(a),new acf.Model({filters:{select2_args:"select2Args"},select2Args:function(e,t,i,a,l){return"acf/fields/clone/query"==i.ajaxAction&&(e.closeOnSelect=!1,l.data.ajaxData=this.ajaxData),e},ajaxData:function(t){return t.fields={},acf.getFieldObjects().map((function(e){t.fields[e.prop("key")]={key:e.prop("key"),type:e.prop("type"),label:e.prop("label"),ancestors:e.getParents().length}})),t.title=e("#title").val(),t}})}(jQuery)},309:function(){var e,t;e=jQuery,t=acf.FieldSetting.extend({type:"flexible_content",name:"fc_layout",events:{"blur .layout-label":"onChangeLabel","click .add-layout":"onClickAdd","click .duplicate-layout":"onClickDuplicate","click .delete-layout":"onClickDelete"},$input:function(t){return e("#"+this.getInputId()+"-"+t)},$list:function(){return this.$(".acf-field-list:first")},getInputId:function(){return this.fieldObject.getInputId()+"-layouts-"+this.field.get("id")},getFields:function(){return acf.getFieldObjects({parent:this.$el})},getChildren:function(){return acf.getFieldObjects({list:this.$list()})},initialize:function(){var e=this.$el.parent();e.hasClass("ui-sortable")||e.sortable({items:"> .acf-field-setting-fc_layout",handle:".reorder-layout",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,stop:this.proxy((function(e,t){this.fieldObject.save()}))}),this.updateFieldLayouts()},updateFieldLayouts:function(){this.getChildren().map(this.updateFieldLayout,this)},updateFieldLayout:function(e){e.prop("parent_layout",this.get("id"))},onChangeLabel:function(e,t){var i=t.val(),a=this.$input("name");""==a.val()&&acf.val(a,acf.strSanitize(i))},onClickAdd:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:i,replace:a,after:function(e,t){var i=t.find(".acf-field-list:first");i.children(".acf-field-object").remove(),i.addClass("-empty"),t.find(".acf-fc-meta input").val("")}}),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDuplicate:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:i,replace:a});var l=acf.getFieldObjects({parent:$layout});l.length&&(l.map((function(e){e.wipe(),e.updateParent()})),acf.doAction("duplicate_field_objects",l,this.fieldObject,this.fieldObject)),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDelete:function(e,t){if(e.shiftKey)return this.delete();this.$el.addClass("-hover"),acf.newTooltip({confirmRemove:!0,target:t,context:this,confirm:function(){this.delete()},cancel:function(){this.$el.removeClass("-hover")}})},delete:function(){if(!this.$el.siblings(".acf-field-setting-fc_layout").length)return alert(acf.__("Flexible Content requires at least 1 layout")),!1;this.getFields().map((function(e){e.delete({animate:!1})})),acf.remove(this.$el),this.fieldObject.save()}}),acf.registerFieldSetting(t),new acf.Model({actions:{sortstop_field_object:"updateParentLayout",change_field_object_parent:"updateParentLayout"},updateParentLayout:function(e){var t=e.getParent();if(t&&"flexible_content"===t.prop("type")){var i=e.$el.closest(".acf-field-setting-fc_layout"),a=acf.getFieldSetting(i);e.has("parent_layout")||e.prop("parent_layout",0),e.prop("parent_layout",a.get("id"))}else e.prop("parent_layout",null)}})},166:function(){var e;jQuery,e=acf.FieldSetting.extend({type:"repeater",name:"collapsed",events:{"focus select":"onFocus"},onFocus:function(e,t){var i=t,a=[];a.push({label:i.find('option[value=""]').text(),value:""});var l=this.fieldObject.$(".acf-field-list:first");acf.getFieldObjects({list:l}).map((function(e){a.push({label:e.prop("label"),value:e.prop("key")})})),acf.renderSelect(i,a)}}),acf.registerFieldSetting(e)}},t={};function i(a){var l=t[a];if(void 0!==l)return l.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,i),n.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";i(166),i(309),i(436)}()}();
...\ No newline at end of file ...\ No newline at end of file
1 <svg width="16" height="14" viewBox="0 0 16 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2 <path d="M15.0007 5.3894H1.03223" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
3 <path d="M8.8642 12.6272C8.4484 13.0748 7.74042 13.1294 7.26844 12.7363C7.22349 12.6927 7.17854 12.6599 7.14482 12.6162L1.27873 6.04436H1.2776C0.929234 5.6513 0.906759 5.08353 1.22142 4.66863L3.70495 1.43674C3.90723 1.15286 4.24437 1 4.60397 1H11.3466C11.695 1 12.0321 1.15286 12.2456 1.43674L14.7404 4.65771C15.0551 5.0617 15.0326 5.62946 14.6842 6.02253L8.8642 12.6272Z" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
4 <path d="M4.12207 1.15283L7.83052 12.9885" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
5 <path d="M11.9096 1.15283L8.24609 12.9776" stroke="#425FDD" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
6 </svg>
1 /**!
2 * wp-color-picker-alpha
3 *
4 * Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
5 * Only run in input and is defined data alpha in true
6 *
7 * Version: 3.0.0
8 * https://github.com/kallookoo/wp-color-picker-alpha
9 * Licensed under the GPLv2 license or later.
10 */
11 ! ( function ( e, a ) {
12 var l,
13 o = { version: 300 };
14 if (
15 'wpColorPickerAlpha' in window &&
16 'version' in window.wpColorPickerAlpha
17 ) {
18 var t = parseInt( window.wpColorPickerAlpha.version, 10 );
19 if ( ! isNaN( t ) && o.version <= t ) return;
20 }
21 Color.fn.hasOwnProperty( 'to_s' ) ||
22 ( ( Color.fn.to_s = function ( o ) {
23 'hex' === ( o = o || 'hex' ) && this._alpha < 1 && ( o = 'rgba' );
24 var a = '';
25 return (
26 'hex' === o
27 ? ( a = this.toString() )
28 : this.error ||
29 ( a = this.toCSS( o )
30 .replace( /\(\s+/, '(' )
31 .replace( /\s+\)/, ')' ) ),
32 a
33 );
34 } ),
35 ( window.wpColorPickerAlpha = o ),
36 ( l =
37 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==' ),
38 e.widget( 'a8c.iris', e.a8c.iris, {
39 alphaOptions: { alphaEnabled: ! 1 },
40 _getColor: function ( o ) {
41 return (
42 o === a && ( o = this._color ),
43 this.alphaOptions.alphaEnabled
44 ? ( ( o = o.to_s( this.alphaOptions.alphaColorType ) ),
45 this.alphaOptions.alphaColorWithSpace ||
46 ( o = o.replace( /\s+/g, '' ) ),
47 o )
48 : o.toString()
49 );
50 },
51 _create: function () {
52 try {
53 this.alphaOptions = this.element.wpColorPicker(
54 'instance'
55 ).alphaOptions;
56 } catch ( o ) {}
57 e.extend( {}, this.alphaOptions, {
58 alphaEnabled: ! 1,
59 alphaCustomWidth: 130,
60 alphaReset: ! 1,
61 alphaColorType: 'hex',
62 alphaColorWithSpace: ! 1,
63 } ),
64 this._super();
65 },
66 _addInputListeners: function ( i ) {
67 function o( o ) {
68 var a = i.val(),
69 t = new Color( a ),
70 a = a.replace( /^(#|(rgb|hsl)a?)/, '' ),
71 r = l.alphaOptions.alphaColorType;
72 i.removeClass( 'iris-error' ),
73 t.error
74 ? '' !== a && i.addClass( 'iris-error' )
75 : ( 'hex' === r &&
76 'keyup' === o.type &&
77 a.match( /^[0-9a-fA-F]{3}$/ ) ) ||
78 ( t.toIEOctoHex() !== l._color.toIEOctoHex() &&
79 l._setOption( 'color', l._getColor( t ) ) );
80 }
81 var l = this;
82 i.on( 'change', o ).on( 'keyup', l._debounce( o, 100 ) ),
83 l.options.hide &&
84 i.one( 'focus', function () {
85 l.show();
86 } );
87 },
88 _initControls: function () {
89 var t, o, a, r;
90 this._super(),
91 this.alphaOptions.alphaEnabled &&
92 ( ( a = ( o = ( t = this ).controls.strip.clone(
93 ! 1,
94 ! 1
95 ) ).find( '.iris-slider-offset' ) ),
96 ( r = { stripAlpha: o, stripAlphaSlider: a } ),
97 o.addClass( 'iris-strip-alpha' ),
98 a.addClass( 'iris-slider-offset-alpha' ),
99 o.appendTo( t.picker.find( '.iris-picker-inner' ) ),
100 e.each( r, function ( o, a ) {
101 t.controls[ o ] = a;
102 } ),
103 t.controls.stripAlphaSlider.slider( {
104 orientation: 'vertical',
105 min: 0,
106 max: 100,
107 step: 1,
108 value: parseInt( 100 * t._color._alpha ),
109 slide: function ( o, a ) {
110 ( t.active = 'strip' ),
111 ( t._color._alpha = parseFloat(
112 a.value / 100
113 ) ),
114 t._change.apply( t, arguments );
115 },
116 } ) );
117 },
118 _dimensions: function ( o ) {
119 if ( ( this._super( o ), this.alphaOptions.alphaEnabled ) ) {
120 for (
121 var a = this,
122 t = a.options,
123 r = a.controls.square,
124 o = a.picker.find( '.iris-strip' ),
125 i = Math.round(
126 a.picker.outerWidth( ! 0 ) -
127 ( t.border ? 22 : 0 )
128 ),
129 l = Math.round( r.outerWidth() ),
130 e = Math.round( ( i - l ) / 2 ),
131 s = Math.round( e / 2 ),
132 n = Math.round( l + 2 * e + 2 * s );
133 i < n;
134
135 )
136 ( e = Math.round( e - 2 ) ),
137 ( s = Math.round( s - 1 ) ),
138 ( n = Math.round( l + 2 * e + 2 * s ) );
139 r.css( 'margin', '0' ),
140 o.width( e ).css( 'margin-left', s + 'px' );
141 }
142 },
143 _change: function () {
144 var o,
145 a,
146 t,
147 r = this,
148 i = r.active;
149 r._super(),
150 r.alphaOptions.alphaEnabled &&
151 ( ( o = r.controls ),
152 ( a = parseInt( 100 * r._color._alpha ) ),
153 ( t = [
154 'rgb(' +
155 ( t = r._color.toRgb() ).r +
156 ',' +
157 t.g +
158 ',' +
159 t.b +
160 ') 0%',
161 'rgba(' + t.r + ',' + t.g + ',' + t.b + ', 0) 100%',
162 ] ),
163 r.picker
164 .closest( '.wp-picker-container' )
165 .find( '.wp-color-result' ),
166 ( r.options.color = r._getColor() ),
167 o.stripAlpha.css( {
168 background:
169 'linear-gradient(to bottom, ' +
170 t.join( ', ' ) +
171 '), url(' +
172 l +
173 ')',
174 } ),
175 i && o.stripAlphaSlider.slider( 'value', a ),
176 r._color.error ||
177 r.element
178 .removeClass( 'iris-error' )
179 .val( r.options.color ),
180 r.picker
181 .find( '.iris-palette-container' )
182 .on( 'click.palette', '.iris-palette', function () {
183 var o = e( this ).data( 'color' );
184 r.alphaOptions.alphaReset &&
185 ( ( r._color._alpha = 1 ),
186 ( o = r._getColor() ) ),
187 r._setOption( 'color', o );
188 } ) );
189 },
190 _paintDimension: function ( o, a ) {
191 var t = this,
192 r = ! 1;
193 t.alphaOptions.alphaEnabled &&
194 'strip' === a &&
195 ( ( r = t._color ),
196 ( t._color = new Color( r.toString() ) ),
197 ( t.hue = t._color.h() ) ),
198 t._super( o, a ),
199 r && ( t._color = r );
200 },
201 _setOption: function ( o, a ) {
202 var t = this;
203 if ( 'color' !== o || ! t.alphaOptions.alphaEnabled )
204 return t._super( o, a );
205 ( a = '' + a ),
206 ( newColor = new Color( a ).setHSpace( t.options.mode ) ),
207 newColor.error ||
208 t._getColor( newColor ) === t._getColor() ||
209 ( ( t._color = newColor ),
210 ( t.options.color = t._getColor() ),
211 ( t.active = 'external' ),
212 t._change() );
213 },
214 color: function ( o ) {
215 return ! 0 === o
216 ? this._color.clone()
217 : o === a
218 ? this._getColor()
219 : void this.option( 'color', o );
220 },
221 } ),
222 e.widget( 'wp.wpColorPicker', e.wp.wpColorPicker, {
223 alphaOptions: { alphaEnabled: ! 1 },
224 _getAlphaOptions: function () {
225 var r = this.element,
226 o = r.data( 'type' ) || this.options.type,
227 i = r.data( 'defaultColor' ) || r.val(),
228 l = {
229 alphaEnabled: r.data( 'alphaEnabled' ) || ! 1,
230 alphaCustomWidth: 130,
231 alphaReset: ! 1,
232 alphaColorType: 'rgb',
233 alphaColorWithSpace: ! 1,
234 };
235 return (
236 l.alphaEnabled &&
237 ( l.alphaEnabled = r.is( 'input' ) && 'full' === o ),
238 l.alphaEnabled &&
239 ( ( l.alphaColorWithSpace = i && i.match( /\s/ ) ),
240 e.each( l, function ( o, a ) {
241 var t = r.data( o ) || a;
242 switch ( o ) {
243 case 'alphaCustomWidth':
244 ( t = t ? parseInt( t, 10 ) : 0 ),
245 ( t = isNaN( t ) ? a : t );
246 break;
247 case 'alphaColorType':
248 t.match( /^(hex|(rgb|hsl)a?)$/ ) ||
249 ( t =
250 i && i.match( /^#/ )
251 ? 'hex'
252 : i && i.match( /^hsla?/ )
253 ? 'hsl'
254 : a );
255 break;
256 default:
257 t = !! t;
258 }
259 l[ o ] = t;
260 } ) ),
261 l
262 );
263 },
264 _create: function () {
265 e.support.iris &&
266 ( ( this.alphaOptions = this._getAlphaOptions() ),
267 this._super() );
268 },
269 _addListeners: function () {
270 if ( ! this.alphaOptions.alphaEnabled ) return this._super();
271 var t = this,
272 r = t.element,
273 i = t.toggler.is( 'a' );
274 ( this.alphaOptions.defaultWidth = r.width() ),
275 this.alphaOptions.alphaCustomWidth &&
276 r.width(
277 parseInt(
278 this.alphaOptions.defaultWidth +
279 this.alphaOptions.alphaCustomWidth,
280 10
281 )
282 ),
283 t.toggler.css( {
284 position: 'relative',
285 'background-image': 'url(' + l + ')',
286 } ),
287 i
288 ? t.toggler.html( '<span class="color-alpha" />' )
289 : t.toggler.append( '<span class="color-alpha" />' ),
290 ( t.colorAlpha = t.toggler.find( 'span.color-alpha' ).css( {
291 width: '30px',
292 height: '100%',
293 position: 'absolute',
294 top: 0,
295 'background-color': r.val(),
296 } ) ),
297 'ltr' === t.colorAlpha.css( 'direction' )
298 ? t.colorAlpha.css( {
299 'border-bottom-left-radius': '2px',
300 'border-top-left-radius': '2px',
301 left: 0,
302 } )
303 : t.colorAlpha.css( {
304 'border-bottom-right-radius': '2px',
305 'border-top-right-radius': '2px',
306 right: 0,
307 } ),
308 r.iris( {
309 change: function ( o, a ) {
310 t.colorAlpha.css( {
311 'background-color': a.color.to_s(
312 t.alphaOptions.alphaColorType
313 ),
314 } ),
315 e.isFunction( t.options.change ) &&
316 t.options.change.call( this, o, a );
317 },
318 } ),
319 t.wrap.on( 'click.wpcolorpicker', function ( o ) {
320 o.stopPropagation();
321 } ),
322 t.toggler.click( function () {
323 t.toggler.hasClass( 'wp-picker-open' )
324 ? t.close()
325 : t.open();
326 } ),
327 r.change( function ( o ) {
328 var a = e( this ).val();
329 ( r.hasClass( 'iris-error' ) ||
330 '' === a ||
331 a.match( /^(#|(rgb|hsl)a?)$/ ) ) &&
332 ( i && t.toggler.removeAttr( 'style' ),
333 t.colorAlpha.css( 'background-color', '' ),
334 e.isFunction( t.options.clear ) &&
335 t.options.clear.call( this, o ) );
336 } ),
337 t.button.click( function ( o ) {
338 e( this ).hasClass( 'wp-picker-default' )
339 ? r.val( t.options.defaultColor ).change()
340 : e( this ).hasClass( 'wp-picker-clear' ) &&
341 ( r.val( '' ),
342 i && t.toggler.removeAttr( 'style' ),
343 t.colorAlpha.css( 'background-color', '' ),
344 e.isFunction( t.options.clear ) &&
345 t.options.clear.call( this, o ),
346 r.trigger( 'change' ) );
347 } );
348 },
349 } ) );
350 } )( jQuery );
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
2 .ui-timepicker-div dl { text-align: left; }
3 .ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
4 .ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
5 .ui-timepicker-div td { font-size: 90%; }
6 .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
7 .ui-timepicker-div .ui_tpicker_unit_hide{ display: none; }
8
9 .ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input { background: none; color: inherit; border: none; outline: none; border-bottom: solid 1px #555; width: 95%; }
10 .ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus { border-bottom-color: #aaa; }
11
12 .ui-timepicker-rtl{ direction: rtl; }
13 .ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
14 .ui-timepicker-rtl dl dt{ float: right; clear: right; }
15 .ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
16
17 /* Shortened version style */
18 .ui-timepicker-div.ui-timepicker-oneLine { padding-right: 2px; }
19 .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,
20 .ui-timepicker-div.ui-timepicker-oneLine dt { display: none; }
21 .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label { display: block; padding-top: 2px; }
22 .ui-timepicker-div.ui-timepicker-oneLine dl { text-align: right; }
23 .ui-timepicker-div.ui-timepicker-oneLine dl dd,
24 .ui-timepicker-div.ui-timepicker-oneLine dl dd > div { display:inline-block; margin:0; }
25 .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
26 .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
27 .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
28 .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
29 .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
30 .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }
...\ No newline at end of file ...\ No newline at end of file
1 /*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
2 * http://trentrichardson.com/examples/timepicker
3 * Copyright (c) 2016 Trent Richardson; Licensed MIT */
4
5 .ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:0 10px 10px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0 0;border:0;margin:0;padding:0}.ui-timepicker-div .ui_tpicker_unit_hide{display:none}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input{background:0 0;color:inherit;border:0;outline:0;border-bottom:solid 1px #555;width:95%}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus{border-bottom-color:#aaa}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}.ui-timepicker-div.ui-timepicker-oneLine{padding-right:2px}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,.ui-timepicker-div.ui-timepicker-oneLine dt{display:none}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label{display:block;padding-top:2px}.ui-timepicker-div.ui-timepicker-oneLine dl{text-align:right}.ui-timepicker-div.ui-timepicker-oneLine dl dd,.ui-timepicker-div.ui-timepicker-oneLine dl dd>div{display:inline-block;margin:0}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before{content:':';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before{content:'.';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{display:none}
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 // Register store for form data.
4 acf_register_store( 'form' );
5
6 /**
7 * acf_set_form_data
8 *
9 * Sets data about the current form.
10 *
11 * @date 6/10/13
12 * @since 5.0.0
13 *
14 * @param string $name The store name.
15 * @param array $data Array of data to start the store with.
16 * @return ACF_Data
17 */
18 function acf_set_form_data( $name = '', $data = false ) {
19 return acf_get_store( 'form' )->set( $name, $data );
20 }
21
22 /**
23 * acf_get_form_data
24 *
25 * Gets data about the current form.
26 *
27 * @date 6/10/13
28 * @since 5.0.0
29 *
30 * @param string $name The store name.
31 * @return mixed
32 */
33 function acf_get_form_data( $name = '' ) {
34 return acf_get_store( 'form' )->get( $name );
35 }
36
37 /**
38 * acf_form_data
39 *
40 * Called within a form to set important information and render hidden inputs.
41 *
42 * @date 15/10/13
43 * @since 5.0.0
44 *
45 * @param void
46 * @return void
47 */
48 function acf_form_data( $data = array() ) {
49
50 // Apply defaults.
51 $data = wp_parse_args(
52 $data,
53 array(
54
55 /** @type string The current screen (post, user, taxonomy, etc). */
56 'screen' => 'post',
57
58 /** @type int|string The ID of current post being edited. */
59 'post_id' => 0,
60
61 /** @type bool Enables AJAX validation. */
62 'validation' => true,
63 )
64 );
65
66 // Create nonce using screen.
67 $data['nonce'] = wp_create_nonce( $data['screen'] );
68
69 // Append "changed" input used within "_wp_post_revision_fields" action.
70 $data['changed'] = 0;
71
72 // Set data.
73 acf_set_form_data( $data );
74
75 // Render HTML.
76 ?>
77 <div id="acf-form-data" class="acf-hidden">
78 <?php
79
80 // Create hidden inputs from $data
81 foreach ( $data as $name => $value ) {
82 acf_hidden_input(
83 array(
84 'id' => '_acf_' . $name,
85 'name' => '_acf_' . $name,
86 'value' => $value,
87 )
88 );
89 }
90
91 /**
92 * Fires within the #acf-form-data element to add extra HTML.
93 *
94 * @date 15/10/13
95 * @since 5.0.0
96 *
97 * @param array $data The form data.
98 */
99 do_action( 'acf/form_data', $data );
100 do_action( 'acf/input/form_data', $data );
101
102 ?>
103 </div>
104 <?php
105 }
106
107
108 /**
109 * acf_save_post
110 *
111 * Saves the $_POST data.
112 *
113 * @date 15/10/13
114 * @since 5.0.0
115 *
116 * @param int|string $post_id The post id.
117 * @param array $values An array of values to override $_POST.
118 * @return bool True if save was successful.
119 */
120 function acf_save_post( $post_id = 0, $values = null ) {
121
122 // Override $_POST data with $values.
123 if ( $values !== null ) {
124 $_POST['acf'] = $values;
125 }
126
127 // Bail early if no data to save.
128 if ( empty( $_POST['acf'] ) ) {
129 return false;
130 }
131
132 // Set form data (useful in various filters/actions).
133 acf_set_form_data( 'post_id', $post_id );
134
135 // Filter $_POST data for users without the 'unfiltered_html' capability.
136 if ( ! acf_allow_unfiltered_html() ) {
137 $_POST['acf'] = wp_kses_post_deep( $_POST['acf'] );
138 }
139
140 // Do generic action.
141 do_action( 'acf/save_post', $post_id );
142
143 // Return true.
144 return true;
145 }
146
147 /**
148 * _acf_do_save_post
149 *
150 * Private function hooked into 'acf/save_post' to actually save the $_POST data.
151 * This allows developers to hook in before and after ACF has actually saved the data.
152 *
153 * @date 11/1/19
154 * @since 5.7.10
155 *
156 * @param int|string $post_id The post id.
157 * @return void
158 */
159 function _acf_do_save_post( $post_id = 0 ) {
160
161 // Check and update $_POST data.
162 if ( $_POST['acf'] ) {
163 acf_update_values( $_POST['acf'], $post_id );
164 }
165 }
166
167 // Run during generic action.
168 add_action( 'acf/save_post', '_acf_do_save_post' );
1 <?php
2
3 // Register store.
4 acf_register_store( 'hook-variations' );
5
6 /**
7 * acf_add_filter_variations
8 *
9 * Registers variations for the given filter.
10 *
11 * @date 26/1/19
12 * @since 5.7.11
13 *
14 * @param string $filter The filter name.
15 * @param array $variations An array variation keys.
16 * @param int $index The param index to find variation values.
17 * @return void
18 */
19 function acf_add_filter_variations( $filter = '', $variations = array(), $index = 0 ) {
20
21 // Store replacement data.
22 acf_get_store( 'hook-variations' )->set(
23 $filter,
24 array(
25 'type' => 'filter',
26 'variations' => $variations,
27 'index' => $index,
28 )
29 );
30
31 // Add generic handler.
32 // Use a priotiry of 10, and accepted args of 10 (ignored by WP).
33 add_filter( $filter, '_acf_apply_hook_variations', 10, 10 );
34 }
35
36 /**
37 * acf_add_action_variations
38 *
39 * Registers variations for the given action.
40 *
41 * @date 26/1/19
42 * @since 5.7.11
43 *
44 * @param string $action The action name.
45 * @param array $variations An array variation keys.
46 * @param int $index The param index to find variation values.
47 * @return void
48 */
49 function acf_add_action_variations( $action = '', $variations = array(), $index = 0 ) {
50
51 // Store replacement data.
52 acf_get_store( 'hook-variations' )->set(
53 $action,
54 array(
55 'type' => 'action',
56 'variations' => $variations,
57 'index' => $index,
58 )
59 );
60
61 // Add generic handler.
62 // Use a priotiry of 10, and accepted args of 10 (ignored by WP).
63 add_action( $action, '_acf_apply_hook_variations', 10, 10 );
64 }
65
66 /**
67 * _acf_apply_hook_variations
68 *
69 * Applies hook variations during apply_filters() or do_action().
70 *
71 * @date 25/1/19
72 * @since 5.7.11
73 *
74 * @param mixed
75 * @return mixed
76 */
77 function _acf_apply_hook_variations() {
78
79 // Get current filter.
80 $filter = current_filter();
81
82 // Get args provided.
83 $args = func_get_args();
84
85 // Get variation information.
86 $variations = acf_get_store( 'hook-variations' )->get( $filter );
87 $index = $variations['index'];
88 $type = $variations['type'];
89 $variations = $variations['variations'];
90
91 // Find field in args using index.
92 $field = $args[ $index ];
93
94 // Loop over variations and apply filters.
95 foreach ( $variations as $variation ) {
96
97 // Get value from field.
98 // First look for "backup" value ("_name", "_key").
99 if ( isset( $field[ "_$variation" ] ) ) {
100 $value = $field[ "_$variation" ];
101 } elseif ( isset( $field[ $variation ] ) ) {
102 $value = $field[ $variation ];
103 } else {
104 continue;
105 }
106
107 // Apply filters.
108 if ( $type === 'filter' ) {
109 $args[0] = apply_filters_ref_array( "$filter/$variation=$value", $args );
110
111 // Or do action.
112 } else {
113 do_action_ref_array( "$filter/$variation=$value", $args );
114 }
115 }
116
117 // Return first arg.
118 return $args[0];
119 }
120
121 // Register store.
122 acf_register_store( 'deprecated-hooks' );
123
124 /**
125 * acf_add_deprecated_filter
126 *
127 * Registers a deprecated filter to run during the replacement.
128 *
129 * @date 25/1/19
130 * @since 5.7.11
131 *
132 * @param string $deprecated The deprecated hook.
133 * @param string $version The version this hook was deprecated.
134 * @param string $replacement The replacement hook.
135 * @return void
136 */
137 function acf_add_deprecated_filter( $deprecated, $version, $replacement ) {
138
139 // Store replacement data.
140 acf_get_store( 'deprecated-hooks' )->append(
141 array(
142 'type' => 'filter',
143 'deprecated' => $deprecated,
144 'replacement' => $replacement,
145 'version' => $version,
146 )
147 );
148
149 // Add generic handler.
150 // Use a priority of 10, and accepted args of 10 (ignored by WP).
151 add_filter( $replacement, '_acf_apply_deprecated_hook', 10, 10 );
152 }
153
154 /**
155 * acf_add_deprecated_action
156 *
157 * Registers a deprecated action to run during the replacement.
158 *
159 * @date 25/1/19
160 * @since 5.7.11
161 *
162 * @param string $deprecated The deprecated hook.
163 * @param string $version The version this hook was deprecated.
164 * @param string $replacement The replacement hook.
165 * @return void
166 */
167 function acf_add_deprecated_action( $deprecated, $version, $replacement ) {
168
169 // Store replacement data.
170 acf_get_store( 'deprecated-hooks' )->append(
171 array(
172 'type' => 'action',
173 'deprecated' => $deprecated,
174 'replacement' => $replacement,
175 'version' => $version,
176 )
177 );
178
179 // Add generic handler.
180 // Use a priority of 10, and accepted args of 10 (ignored by WP).
181 add_filter( $replacement, '_acf_apply_deprecated_hook', 10, 10 );
182 }
183
184 /**
185 * Applies a deprecated filter during apply_filters() or do_action().
186 *
187 * @date 25/1/19
188 * @since 5.7.11
189 *
190 * @param mixed
191 * @return mixed
192 */
193 function _acf_apply_deprecated_hook() {
194 // Get current hook.
195 $current_hook = current_filter();
196
197 // Get args provided.
198 $args = func_get_args();
199
200 // Get deprecated items for this hook.
201 $deprecated_hooks = acf_get_store( 'deprecated-hooks' )->query( array( 'replacement' => $current_hook ) );
202
203 // Loop over results.
204 foreach ( $deprecated_hooks as $hook ) {
205 // Check if anyone is hooked into this deprecated hook.
206 if ( isset( $hook['deprecated'] ) && has_filter( $hook['deprecated'] ) ) {
207
208 // Log warning.
209 // _deprecated_hook( $deprecated, $version, $hook );
210
211 // Apply the item/do the action.
212 if ( $hook['type'] === 'filter' ) {
213 $args[0] = apply_filters_ref_array( $hook['deprecated'], $args );
214 } else {
215 do_action_ref_array( $hook['deprecated'], $args );
216 }
217 }
218 }
219
220 // Return first arg.
221 return $args[0];
222 }
223
1 <?php
2
3 /**
4 * acf_filter_attrs
5 *
6 * Filters out empty attrs from the provided array.
7 *
8 * @date 11/6/19
9 * @since 5.8.1
10 *
11 * @param array $attrs The array of attrs.
12 * @return array
13 */
14 function acf_filter_attrs( $attrs ) {
15
16 // Filter out empty attrs but allow "0" values.
17 $filtered = array_filter( $attrs, 'acf_not_empty' );
18
19 // Correct specific attributes (required="required").
20 foreach ( array( 'required', 'readonly', 'disabled', 'multiple' ) as $key ) {
21 unset( $filtered[ $key ] );
22 if ( ! empty( $attrs[ $key ] ) ) {
23 $filtered[ $key ] = $key;
24 }
25 }
26 return $filtered;
27 }
28
29 /**
30 * acf_esc_attrs
31 *
32 * Generated valid HTML from an array of attrs.
33 *
34 * @date 11/6/19
35 * @since 5.8.1
36 *
37 * @param array $attrs The array of attrs.
38 * @return string
39 */
40 function acf_esc_attrs( $attrs ) {
41 $html = '';
42
43 // Loop over attrs and validate data types.
44 foreach ( $attrs as $k => $v ) {
45
46 // String (but don't trim value).
47 if ( is_string( $v ) && ( $k !== 'value' ) ) {
48 $v = trim( $v );
49
50 // Boolean
51 } elseif ( is_bool( $v ) ) {
52 $v = $v ? 1 : 0;
53
54 // Object
55 } elseif ( is_array( $v ) || is_object( $v ) ) {
56 $v = json_encode( $v );
57 }
58
59 // Generate HTML.
60 $html .= sprintf( ' %s="%s"', esc_attr( $k ), esc_attr( $v ) );
61 }
62
63 // Return trimmed.
64 return trim( $html );
65 }
66
67
68 /**
69 * Sanitizes text content and strips out disallowed HTML.
70 *
71 * This function emulates `wp_kses_post()` with a context of "acf" for extensibility.
72 *
73 * @date 16/4/21
74 * @since 5.9.6
75 *
76 * @param string $string
77 * @return string
78 */
79 function acf_esc_html( $string = '' ) {
80 return wp_kses( (string) $string, 'acf' );
81 }
82
83 /**
84 * Private callback for the "wp_kses_allowed_html" filter used to return allowed HTML for "acf" context.
85 *
86 * @date 16/4/21
87 * @since 5.9.6
88 *
89 * @param array $tags An array of allowed tags.
90 * @param string $context The context name.
91 * @return array.
92 */
93
94 function _acf_kses_allowed_html( $tags, $context ) {
95 global $allowedposttags;
96
97 if ( $context === 'acf' ) {
98 return $allowedposttags;
99 }
100 return $tags;
101 }
102
103 add_filter( 'wp_kses_allowed_html', '_acf_kses_allowed_html', 0, 2 );
104
105 /**
106 * acf_html_input
107 *
108 * Returns the HTML of an input.
109 *
110 * @date 13/6/19
111 * @since 5.8.1
112 *
113 * @param array $attrs The array of attrs.
114 * @return string
115 */
116 // function acf_html_input( $attrs = array() ) {
117 // return sprintf( '<input %s/>', acf_esc_attrs($attrs) );
118 // }
119
120 /**
121 * acf_hidden_input
122 *
123 * Renders the HTML of a hidden input.
124 *
125 * @date 3/02/2014
126 * @since 5.0.0
127 *
128 * @param array $attrs The array of attrs.
129 * @return string
130 */
131 function acf_hidden_input( $attrs = array() ) {
132 echo acf_get_hidden_input( $attrs );
133 }
134
135 /**
136 * acf_get_hidden_input
137 *
138 * Returns the HTML of a hidden input.
139 *
140 * @date 3/02/2014
141 * @since 5.0.0
142 *
143 * @param array $attrs The array of attrs.
144 * @return string
145 */
146 function acf_get_hidden_input( $attrs = array() ) {
147 return sprintf( '<input type="hidden" %s/>', acf_esc_attrs( $attrs ) );
148 }
149
150 /**
151 * acf_text_input
152 *
153 * Renders the HTML of a text input.
154 *
155 * @date 3/02/2014
156 * @since 5.0.0
157 *
158 * @param array $attrs The array of attrs.
159 * @return string
160 */
161 function acf_text_input( $attrs = array() ) {
162 echo acf_get_text_input( $attrs );
163 }
164
165 /**
166 * acf_get_text_input
167 *
168 * Returns the HTML of a text input.
169 *
170 * @date 3/02/2014
171 * @since 5.0.0
172 *
173 * @param array $attrs The array of attrs.
174 * @return string
175 */
176 function acf_get_text_input( $attrs = array() ) {
177 $attrs = wp_parse_args(
178 $attrs,
179 array(
180 'type' => 'text',
181 )
182 );
183 if ( isset( $attrs['value'] ) && is_string( $attrs['value'] ) ) {
184 $attrs['value'] = htmlspecialchars( $attrs['value'] );
185 }
186 return sprintf( '<input %s/>', acf_esc_attrs( $attrs ) );
187 }
188
189 /**
190 * acf_file_input
191 *
192 * Renders the HTML of a file input.
193 *
194 * @date 3/02/2014
195 * @since 5.0.0
196 *
197 * @param array $attrs The array of attrs.
198 * @return string
199 */
200 function acf_file_input( $attrs = array() ) {
201 echo acf_get_file_input( $attrs );
202 }
203
204 /**
205 * acf_get_file_input
206 *
207 * Returns the HTML of a file input.
208 *
209 * @date 3/02/2014
210 * @since 5.0.0
211 *
212 * @param array $attrs The array of attrs.
213 * @return string
214 */
215 function acf_get_file_input( $attrs = array() ) {
216 return sprintf( '<input type="file" %s/>', acf_esc_attrs( $attrs ) );
217 }
218
219 /**
220 * acf_textarea_input
221 *
222 * Renders the HTML of a textarea input.
223 *
224 * @date 3/02/2014
225 * @since 5.0.0
226 *
227 * @param array $attrs The array of attrs.
228 * @return string
229 */
230 function acf_textarea_input( $attrs = array() ) {
231 echo acf_get_textarea_input( $attrs );
232 }
233
234 /**
235 * acf_get_textarea_input
236 *
237 * Returns the HTML of a textarea input.
238 *
239 * @date 3/02/2014
240 * @since 5.0.0
241 *
242 * @param array $attrs The array of attrs.
243 * @return string
244 */
245 function acf_get_textarea_input( $attrs = array() ) {
246 $value = '';
247 if ( isset( $attrs['value'] ) ) {
248 $value = $attrs['value'];
249 unset( $attrs['value'] );
250 }
251 return sprintf( '<textarea %s>%s</textarea>', acf_esc_attrs( $attrs ), esc_textarea( $value ) );
252 }
253
254 /**
255 * acf_checkbox_input
256 *
257 * Renders the HTML of a checkbox input.
258 *
259 * @date 3/02/2014
260 * @since 5.0.0
261 *
262 * @param array $attrs The array of attrs.
263 * @return string
264 */
265 function acf_checkbox_input( $attrs = array() ) {
266 echo acf_get_checkbox_input( $attrs );
267 }
268
269 /**
270 * acf_get_checkbox_input
271 *
272 * Returns the HTML of a checkbox input.
273 *
274 * @date 3/02/2014
275 * @since 5.0.0
276 *
277 * @param array $attrs The array of attrs.
278 * @return string
279 */
280 function acf_get_checkbox_input( $attrs = array() ) {
281
282 // Allow radio or checkbox type.
283 $attrs = wp_parse_args(
284 $attrs,
285 array(
286 'type' => 'checkbox',
287 )
288 );
289
290 // Get label.
291 $label = '';
292 if ( isset( $attrs['label'] ) ) {
293 $label = $attrs['label'];
294 unset( $attrs['label'] );
295 }
296
297 // Render.
298 $checked = isset( $attrs['checked'] );
299 return '<label' . ( $checked ? ' class="selected"' : '' ) . '><input ' . acf_esc_attr( $attrs ) . '/> ' . acf_esc_html( $label ) . '</label>';
300 }
301
302 /**
303 * acf_radio_input
304 *
305 * Renders the HTML of a radio input.
306 *
307 * @date 3/02/2014
308 * @since 5.0.0
309 *
310 * @param array $attrs The array of attrs.
311 * @return string
312 */
313 function acf_radio_input( $attrs = array() ) {
314 echo acf_get_radio_input( $attrs );
315 }
316
317 /**
318 * acf_get_radio_input
319 *
320 * Returns the HTML of a radio input.
321 *
322 * @date 3/02/2014
323 * @since 5.0.0
324 *
325 * @param array $attrs The array of attrs.
326 * @return string
327 */
328 function acf_get_radio_input( $attrs = array() ) {
329 $attrs['type'] = 'radio';
330 return acf_get_checkbox_input( $attrs );
331 }
332
333 /**
334 * acf_select_input
335 *
336 * Renders the HTML of a select input.
337 *
338 * @date 3/02/2014
339 * @since 5.0.0
340 *
341 * @param array $attrs The array of attrs.
342 * @return string
343 */
344 function acf_select_input( $attrs = array() ) {
345 echo acf_get_select_input( $attrs );
346 }
347
348 /**
349 * acf_select_input
350 *
351 * Returns the HTML of a select input.
352 *
353 * @date 3/02/2014
354 * @since 5.0.0
355 *
356 * @param array $attrs The array of attrs.
357 * @return string
358 */
359 function acf_get_select_input( $attrs = array() ) {
360 $value = (array) acf_extract_var( $attrs, 'value' );
361 $choices = (array) acf_extract_var( $attrs, 'choices' );
362 return sprintf(
363 '<select %s>%s</select>',
364 acf_esc_attrs( $attrs ),
365 acf_walk_select_input( $choices, $value )
366 );
367 }
368
369 /**
370 * acf_walk_select_input
371 *
372 * Returns the HTML of a select input's choices.
373 *
374 * @date 27/6/17
375 * @since 5.6.0
376 *
377 * @param array $choices The choices to walk through.
378 * @param array $values The selected choices.
379 * @param array $depth The current walk depth.
380 * @return string
381 */
382 function acf_walk_select_input( $choices = array(), $values = array(), $depth = 0 ) {
383 $html = '';
384
385 // Sanitize values for 'selected' matching (only once).
386 if ( $depth == 0 ) {
387 $values = array_map( 'esc_attr', $values );
388 }
389
390 // Loop over choices and append to html.
391 if ( $choices ) {
392 foreach ( $choices as $value => $label ) {
393
394 // Multiple (optgroup)
395 if ( is_array( $label ) ) {
396 $html .= sprintf(
397 '<optgroup label="%s">%s</optgroup>',
398 esc_attr( $value ),
399 acf_walk_select_input( $label, $values, $depth + 1 )
400 );
401
402 // single (option)
403 } else {
404 $attrs = array(
405 'value' => $value,
406 );
407
408 // If is selected.
409 $pos = array_search( esc_attr( $value ), $values );
410 if ( $pos !== false ) {
411 $attrs['selected'] = 'selected';
412 $attrs['data-i'] = $pos;
413 }
414 $html .= sprintf( '<option %s>%s</option>', acf_esc_attr( $attrs ), esc_html( $label ) );
415 }
416 }
417 }
418 return $html;
419 }
420
421 /**
422 * acf_clean_atts
423 *
424 * See acf_filter_attrs().
425 *
426 * @date 3/10/17
427 * @since 5.6.3
428 *
429 * @param array $attrs The array of attrs.
430 * @return string
431 */
432 function acf_clean_atts( $attrs ) {
433 return acf_filter_attrs( $attrs );
434 }
435
436 /**
437 * acf_esc_atts
438 *
439 * See acf_esc_attrs().
440 *
441 * @date 27/6/17
442 * @since 5.6.0
443 *
444 * @param array $attrs The array of attrs.
445 * @return string
446 */
447 function acf_esc_atts( $attrs ) {
448 return acf_esc_attrs( $attrs );
449 }
450
451 /**
452 * acf_esc_attr
453 *
454 * See acf_esc_attrs().
455 *
456 * @date 13/6/19
457 * @since 5.8.1
458 * @deprecated 5.6.0
459 *
460 * @param array $attrs The array of attrs.
461 * @return string
462 */
463 function acf_esc_attr( $attrs ) {
464 return acf_esc_attrs( $attrs );
465 }
466
467 /**
468 * acf_esc_attr_e
469 *
470 * See acf_esc_attrs().
471 *
472 * @date 13/6/19
473 * @since 5.8.1
474 * @deprecated 5.6.0
475 *
476 * @param array $attrs The array of attrs.
477 * @return string
478 */
479 function acf_esc_attr_e( $attrs ) {
480 echo acf_esc_attrs( $attrs );
481 }
482
483 /**
484 * acf_esc_atts_e
485 *
486 * See acf_esc_attrs().
487 *
488 * @date 13/6/19
489 * @since 5.8.1
490 * @deprecated 5.6.0
491 *
492 * @param array $attrs The array of attrs.
493 * @return string
494 */
495 function acf_esc_atts_e( $attrs ) {
496 echo acf_esc_attrs( $attrs );
497 }
1 <?php
2
3 /**
4 * Returns available templates for each post type.
5 *
6 * @date 29/8/17
7 * @since 5.6.2
8 *
9 * @param void
10 * @return array
11 */
12 function acf_get_post_templates() {
13
14 // Check store.
15 $cache = acf_get_data( 'post_templates' );
16 if ( $cache !== null ) {
17 return $cache;
18 }
19
20 // Initialize templates with default placeholder for pages.
21 $post_templates = array();
22 $post_templates['page'] = array();
23
24 // Loop over post types and append their templates.
25 if ( method_exists( 'WP_Theme', 'get_page_templates' ) ) {
26 $post_types = get_post_types();
27 foreach ( $post_types as $post_type ) {
28 $templates = wp_get_theme()->get_page_templates( null, $post_type );
29 if ( $templates ) {
30 $post_templates[ $post_type ] = $templates;
31 }
32 }
33 }
34
35 // Update store.
36 acf_set_data( 'post_templates', $post_templates );
37
38 // Return templates.
39 return $post_templates;
40 }
1 <?php
2
3 /**
4 * acf_get_users
5 *
6 * Similar to the get_users() function but with extra functionality.
7 *
8 * @date 9/1/19
9 * @since 5.7.10
10 *
11 * @param array $args The query args.
12 * @return array
13 */
14 function acf_get_users( $args = array() ) {
15
16 // Get users.
17 $users = get_users( $args );
18
19 // Maintain order.
20 if ( $users && $args['include'] ) {
21
22 // Generate order array.
23 $order = array();
24 foreach ( $users as $i => $user ) {
25 $order[ $i ] = array_search( $user->ID, $args['include'] );
26 }
27
28 // Sort results.
29 array_multisort( $order, $users );
30 }
31
32 // Return
33 return $users;
34 }
35
36 /**
37 * acf_get_user_result
38 *
39 * Returns a result containing "id" and "text" for the given user.
40 *
41 * @date 21/5/19
42 * @since 5.8.1
43 *
44 * @param WP_User $user The user object.
45 * @return array
46 */
47 function acf_get_user_result( $user ) {
48
49 // Vars.
50 $id = $user->ID;
51 $text = $user->user_login;
52
53 // Add name.
54 if ( $user->first_name && $user->last_name ) {
55 $text .= " ({$user->first_name} {$user->last_name})";
56 } elseif ( $user->first_name ) {
57 $text .= " ({$user->first_name})";
58 }
59 return compact( 'id', 'text' );
60 }
61
62
63 /**
64 * acf_get_user_role_labels
65 *
66 * Returns an array of user roles in the format "name => label".
67 *
68 * @date 20/5/19
69 * @since 5.8.1
70 *
71 * @param array $roles A specific array of roles.
72 * @return array
73 */
74 function acf_get_user_role_labels( $roles = array() ) {
75 $all_roles = wp_roles()->get_names();
76
77 // Load all roles if none provided.
78 if ( empty( $roles ) ) {
79 $roles = array_keys( $all_roles );
80 }
81
82 // Loop over roles and populare labels.
83 $lables = array();
84 foreach ( $roles as $role ) {
85 if ( isset( $all_roles[ $role ] ) ) {
86 $lables[ $role ] = translate_user_role( $all_roles[ $role ] );
87 }
88 }
89
90 // Return labels.
91 return $lables;
92 }
93
94 /**
95 * acf_allow_unfiltered_html
96 *
97 * Returns true if the current user is allowed to save unfiltered HTML.
98 *
99 * @date 9/1/19
100 * @since 5.7.10
101 *
102 * @param void
103 * @return bool
104 */
105 function acf_allow_unfiltered_html() {
106
107 // Check capability.
108 $allow_unfiltered_html = current_user_can( 'unfiltered_html' );
109
110 /**
111 * Filters whether the current user is allowed to save unfiltered HTML.
112 *
113 * @date 9/1/19
114 * @since 5.7.10
115 *
116 * @param bool allow_unfiltered_html The result.
117 */
118 return apply_filters( 'acf/allow_unfiltered_html', $allow_unfiltered_html );
119 }
1 <?php
2
3 // Globals.
4 global $acf_stores, $acf_instances;
5
6 // Initialize plaeholders.
7 $acf_stores = array();
8 $acf_instances = array();
9
10 /**
11 * acf_new_instance
12 *
13 * Creates a new instance of the given class and stores it in the instances data store.
14 *
15 * @date 9/1/19
16 * @since 5.7.10
17 *
18 * @param string $class The class name.
19 * @return object The instance.
20 */
21 function acf_new_instance( $class = '' ) {
22 global $acf_instances;
23 return $acf_instances[ $class ] = new $class();
24 }
25
26 /**
27 * acf_get_instance
28 *
29 * Returns an instance for the given class.
30 *
31 * @date 9/1/19
32 * @since 5.7.10
33 *
34 * @param string $class The class name.
35 * @return object The instance.
36 */
37 function acf_get_instance( $class = '' ) {
38 global $acf_instances;
39 if ( ! isset( $acf_instances[ $class ] ) ) {
40 $acf_instances[ $class ] = new $class();
41 }
42 return $acf_instances[ $class ];
43 }
44
45 /**
46 * acf_register_store
47 *
48 * Registers a data store.
49 *
50 * @date 9/1/19
51 * @since 5.7.10
52 *
53 * @param string $name The store name.
54 * @param array $data Array of data to start the store with.
55 * @return ACF_Data
56 */
57 function acf_register_store( $name = '', $data = false ) {
58
59 // Create store.
60 $store = new ACF_Data( $data );
61
62 // Register store.
63 global $acf_stores;
64 $acf_stores[ $name ] = $store;
65
66 // Return store.
67 return $store;
68 }
69
70 /**
71 * acf_get_store
72 *
73 * Returns a data store.
74 *
75 * @date 9/1/19
76 * @since 5.7.10
77 *
78 * @param string $name The store name.
79 * @return ACF_Data
80 */
81 function acf_get_store( $name = '' ) {
82 global $acf_stores;
83 return isset( $acf_stores[ $name ] ) ? $acf_stores[ $name ] : false;
84 }
85
86 /**
87 * acf_switch_stores
88 *
89 * Triggered when switching between sites on a multisite installation.
90 *
91 * @date 13/2/19
92 * @since 5.7.11
93 *
94 * @param int $site_id New blog ID.
95 * @param int prev_blog_id Prev blog ID.
96 * @return void
97 */
98 function acf_switch_stores( $site_id, $prev_site_id ) {
99
100 // Loop over stores and call switch_site().
101 global $acf_stores;
102 foreach ( $acf_stores as $store ) {
103 $store->switch_site( $site_id, $prev_site_id );
104 }
105 }
106 add_action( 'switch_blog', 'acf_switch_stores', 10, 2 );
107
108 /**
109 * acf_get_path
110 *
111 * Returns the plugin path to a specified file.
112 *
113 * @date 28/9/13
114 * @since 5.0.0
115 *
116 * @param string $filename The specified file.
117 * @return string
118 */
119 function acf_get_path( $filename = '' ) {
120 return ACF_PATH . ltrim( $filename, '/' );
121 }
122
123 /**
124 * acf_get_url
125 *
126 * Returns the plugin url to a specified file.
127 * This function also defines the ACF_URL constant.
128 *
129 * @date 12/12/17
130 * @since 5.6.8
131 *
132 * @param string $filename The specified file.
133 * @return string
134 */
135 function acf_get_url( $filename = '' ) {
136 if ( ! defined( 'ACF_URL' ) ) {
137 define( 'ACF_URL', acf_get_setting( 'url' ) );
138 }
139 return ACF_URL . ltrim( $filename, '/' );
140 }
141
142 /*
143 * acf_include
144 *
145 * Includes a file within the ACF plugin.
146 *
147 * @date 10/3/14
148 * @since 5.0.0
149 *
150 * @param string $filename The specified file.
151 * @return void
152 */
153 function acf_include( $filename = '' ) {
154 $file_path = acf_get_path( $filename );
155 if ( file_exists( $file_path ) ) {
156 include_once $file_path;
157 }
158 }
1 <?php
2
3 // Register store.
4 acf_register_store( 'values' )->prop( 'multisite', true );
5
6 /**
7 * acf_get_reference
8 *
9 * Retrieves the field key for a given field name and post_id.
10 *
11 * @date 26/1/18
12 * @since 5.6.5
13 *
14 * @param string $field_name The name of the field. eg 'sub_heading'.
15 * @param mixed $post_id The post_id of which the value is saved against.
16 * @return string The field key.
17 */
18 function acf_get_reference( $field_name, $post_id ) {
19
20 // Allow filter to short-circuit load_value logic.
21 $reference = apply_filters( 'acf/pre_load_reference', null, $field_name, $post_id );
22 if ( $reference !== null ) {
23 return $reference;
24 }
25
26 // Get hidden meta for this field name.
27 $reference = acf_get_metadata( $post_id, $field_name, true );
28
29 /**
30 * Filters the reference value.
31 *
32 * @date 25/1/19
33 * @since 5.7.11
34 *
35 * @param string $reference The reference value.
36 * @param string $field_name The field name.
37 * @param (int|string) $post_id The post ID where meta is stored.
38 */
39 return apply_filters( 'acf/load_reference', $reference, $field_name, $post_id );
40 }
41
42 /**
43 * Retrieves the value for a given field and post_id.
44 *
45 * @date 28/09/13
46 * @since 5.0.0
47 *
48 * @param int|string $post_id The post id.
49 * @param array $field The field array.
50 * @return mixed
51 */
52 function acf_get_value( $post_id, $field ) {
53
54 // Allow filter to short-circuit load_value logic.
55 $value = apply_filters( 'acf/pre_load_value', null, $post_id, $field );
56 if ( $value !== null ) {
57 return $value;
58 }
59
60 // Get field name.
61 $field_name = $field['name'];
62
63 // Get field ID & type.
64 $decoded = acf_decode_post_id( $post_id );
65
66 $allow_load = true;
67
68 // If we don't have a proper field array, the field doesn't exist currently.
69 if ( empty( $field['type'] ) && empty( $field['key'] ) ) {
70
71 // Check if we should trigger warning about accessing fields too early via action.
72 do_action( 'acf/get_invalid_field_value', $field, __FUNCTION__ );
73
74 if ( apply_filters( 'acf/prevent_access_to_unknown_fields', false ) || ( 'option' === $decoded['type'] && 'options' !== $decoded['id'] ) ) {
75 $allow_load = false;
76 }
77 }
78
79 // If we're using a non options_ option key, ensure we have a valid reference key.
80 if ( 'option' === $decoded['type'] && 'options' !== $decoded['id'] ) {
81 $meta = acf_get_metadata( $post_id, $field_name, true );
82 if ( ! $meta ) {
83 $allow_load = false;
84 } elseif ( $meta !== $field['key'] ) {
85 if ( ! isset( $field['__key'] ) || $meta !== $field['__key'] ) {
86 $allow_load = false;
87 }
88 }
89 }
90
91 // Load Store.
92 $store = acf_get_store( 'values' );
93
94 // If we're allowing load, check the store or load value from database.
95 if ( $allow_load ) {
96 if ( $store->has( "$post_id:$field_name" ) ) {
97 return $store->get( "$post_id:$field_name" );
98 }
99
100 $value = acf_get_metadata( $post_id, $field_name );
101 }
102
103 // Use field's default_value if no meta was found.
104 if ( $value === null && isset( $field['default_value'] ) ) {
105 $value = $field['default_value'];
106 }
107
108 /**
109 * Filters the $value after it has been loaded.
110 *
111 * @date 28/09/13
112 * @since 5.0.0
113 *
114 * @param mixed $value The value to preview.
115 * @param string $post_id The post ID for this value.
116 * @param array $field The field array.
117 */
118 $value = apply_filters( 'acf/load_value', $value, $post_id, $field );
119
120 // Update store if we allowed the value load.
121 if ( $allow_load ) {
122 $store->set( "$post_id:$field_name", $value );
123 }
124
125 // Return value.
126 return $value;
127 }
128
129 // Register variation.
130 acf_add_filter_variations( 'acf/load_value', array( 'type', 'name', 'key' ), 2 );
131
132 /**
133 * acf_format_value
134 *
135 * Returns a formatted version of the provided value.
136 *
137 * @date 28/09/13
138 * @since 5.0.0
139 *
140 * @param mixed $value The field value.
141 * @param (int|string) $post_id The post id.
142 * @param array $field The field array.
143 * @return mixed.
144 */
145 function acf_format_value( $value, $post_id, $field ) {
146
147 // Allow filter to short-circuit load_value logic.
148 $check = apply_filters( 'acf/pre_format_value', null, $value, $post_id, $field );
149 if ( $check !== null ) {
150 return $check;
151 }
152
153 // Get field name.
154 $field_name = $field['name'];
155
156 // Check store.
157 $store = acf_get_store( 'values' );
158 if ( $store->has( "$post_id:$field_name:formatted" ) ) {
159 return $store->get( "$post_id:$field_name:formatted" );
160 }
161
162 /**
163 * Filters the $value for use in a template function.
164 *
165 * @date 28/09/13
166 * @since 5.0.0
167 *
168 * @param mixed $value The value to preview.
169 * @param string $post_id The post ID for this value.
170 * @param array $field The field array.
171 */
172 $value = apply_filters( 'acf/format_value', $value, $post_id, $field );
173
174 // Update store.
175 $store->set( "$post_id:$field_name:formatted", $value );
176
177 // Return value.
178 return $value;
179 }
180
181 // Register variation.
182 acf_add_filter_variations( 'acf/format_value', array( 'type', 'name', 'key' ), 2 );
183
184 /**
185 * acf_update_value
186 *
187 * Updates the value for a given field and post_id.
188 *
189 * @date 28/09/13
190 * @since 5.0.0
191 *
192 * @param mixed $value The new value.
193 * @param (int|string) $post_id The post id.
194 * @param array $field The field array.
195 * @return bool.
196 */
197 function acf_update_value( $value, $post_id, $field ) {
198
199 // Allow filter to short-circuit update_value logic.
200 $check = apply_filters( 'acf/pre_update_value', null, $value, $post_id, $field );
201 if ( $check !== null ) {
202 return $check;
203 }
204
205 /**
206 * Filters the $value before it is updated.
207 *
208 * @date 28/09/13
209 * @since 5.0.0
210 *
211 * @param mixed $value The value to update.
212 * @param string $post_id The post ID for this value.
213 * @param array $field The field array.
214 * @param mixed $original The original value before modification.
215 */
216 $value = apply_filters( 'acf/update_value', $value, $post_id, $field, $value );
217
218 // Allow null to delete value.
219 if ( $value === null ) {
220 return acf_delete_value( $post_id, $field );
221 }
222
223 // Update meta.
224 $return = acf_update_metadata( $post_id, $field['name'], $value );
225
226 // Update reference.
227 acf_update_metadata( $post_id, $field['name'], $field['key'], true );
228
229 // Delete stored data.
230 acf_flush_value_cache( $post_id, $field['name'] );
231
232 // Return update status.
233 return $return;
234 }
235
236 // Register variation.
237 acf_add_filter_variations( 'acf/update_value', array( 'type', 'name', 'key' ), 2 );
238
239 /**
240 * acf_update_values
241 *
242 * Updates an array of values.
243 *
244 * @date 26/2/19
245 * @since 5.7.13
246 *
247 * @param array values The array of values.
248 * @param (int|string) $post_id The post id.
249 * @return void
250 */
251 function acf_update_values( $values, $post_id ) {
252
253 // Loop over values.
254 foreach ( $values as $key => $value ) {
255
256 // Get field.
257 $field = acf_get_field( $key );
258
259 // Update value.
260 if ( $field ) {
261 acf_update_value( $value, $post_id, $field );
262 }
263 }
264 }
265
266 /**
267 * acf_flush_value_cache
268 *
269 * Deletes all cached data for this value.
270 *
271 * @date 22/1/19
272 * @since 5.7.10
273 *
274 * @param (int|string) $post_id The post id.
275 * @param string $field_name The field name.
276 * @return void
277 */
278 function acf_flush_value_cache( $post_id = 0, $field_name = '' ) {
279
280 // Delete stored data.
281 acf_get_store( 'values' )
282 ->remove( "$post_id:$field_name" )
283 ->remove( "$post_id:$field_name:formatted" );
284 }
285
286 /**
287 * acf_delete_value
288 *
289 * Deletes the value for a given field and post_id.
290 *
291 * @date 28/09/13
292 * @since 5.0.0
293 *
294 * @param (int|string) $post_id The post id.
295 * @param array $field The field array.
296 * @return bool.
297 */
298 function acf_delete_value( $post_id, $field ) {
299
300 /**
301 * Fires before a value is deleted.
302 *
303 * @date 28/09/13
304 * @since 5.0.0
305 *
306 * @param string $post_id The post ID for this value.
307 * @param mixed $name The meta name.
308 * @param array $field The field array.
309 */
310 do_action( 'acf/delete_value', $post_id, $field['name'], $field );
311
312 // Delete meta.
313 $return = acf_delete_metadata( $post_id, $field['name'] );
314
315 // Delete reference.
316 acf_delete_metadata( $post_id, $field['name'], true );
317
318 // Delete stored data.
319 acf_flush_value_cache( $post_id, $field['name'] );
320
321 // Return delete status.
322 return $return;
323 }
324
325 // Register variation.
326 acf_add_filter_variations( 'acf/delete_value', array( 'type', 'name', 'key' ), 2 );
327
328 /**
329 * acf_preview_value
330 *
331 * Return a human friendly 'preview' for a given field value.
332 *
333 * @date 28/09/13
334 * @since 5.0.0
335 *
336 * @param mixed $value The new value.
337 * @param (int|string) $post_id The post id.
338 * @param array $field The field array.
339 * @return bool.
340 */
341 function acf_preview_value( $value, $post_id, $field ) {
342
343 /**
344 * Filters the $value before used in HTML.
345 *
346 * @date 24/10/16
347 * @since 5.5.0
348 *
349 * @param mixed $value The value to preview.
350 * @param string $post_id The post ID for this value.
351 * @param array $field The field array.
352 */
353 return apply_filters( 'acf/preview_value', $value, $post_id, $field );
354 }
355
356 // Register variation.
357 acf_add_filter_variations( 'acf/preview_value', array( 'type', 'name', 'key' ), 2 );
358
359 /**
360 * Potentially log an error if a field doesn't exist when we expect it to.
361 *
362 * @param array $field An array representing the field that a value was requested for.
363 * @param string $function The function that noticed the problem.
364 *
365 * @return void
366 */
367 function acf_log_invalid_field_notice( $field, $function ) {
368 // If "init" has fired, ACF probably wasn't initialized early.
369 if ( did_action( 'init' ) ) {
370 return;
371 }
372
373 $error_text = sprintf(
374 __( '<strong>%1$s</strong> - We\'ve detected one or more calls to retrieve ACF field values before ACF has been initialized. This is not supported and can result in malformed or missing data. <a href="%2$s" target="_blank">Learn how to fix this</a>.', 'acf' ),
375 acf_get_setting( 'name' ),
376 'https://www.advancedcustomfields.com/resources/acf-field-functions/'
377 );
378 _doing_it_wrong( $function, $error_text, '5.11.1' );
379 }
380 add_action( 'acf/get_invalid_field_value', 'acf_log_invalid_field_notice', 10, 2 );
1 <?php
2
3 /**
4 * Returns a WordPress object type.
5 *
6 * @date 1/4/20
7 * @since 5.9.0
8 *
9 * @param string $object_type The object type (post, term, user, etc).
10 * @param string $object_subtype Optional object subtype (post type, taxonomy).
11 * @return object
12 */
13 function acf_get_object_type( $object_type, $object_subtype = '' ) {
14 $props = array(
15 'type' => $object_type,
16 'subtype' => $object_subtype,
17 'name' => '',
18 'label' => '',
19 'icon' => '',
20 );
21
22 // Set unique identifier as name.
23 if ( $object_subtype ) {
24 $props['name'] = "$object_type/$object_subtype";
25 } else {
26 $props['name'] = $object_type;
27 }
28
29 // Set label and icon.
30 switch ( $object_type ) {
31 case 'post':
32 if ( $object_subtype ) {
33 $post_type = get_post_type_object( $object_subtype );
34 if ( $post_type ) {
35 $props['label'] = $post_type->labels->name;
36 $props['icon'] = acf_with_default( $post_type->menu_icon, 'dashicons-admin-post' );
37 } else {
38 return false;
39 }
40 } else {
41 $props['label'] = __( 'Posts', 'acf' );
42 $props['icon'] = 'dashicons-admin-post';
43 }
44 break;
45 case 'term':
46 if ( $object_subtype ) {
47 $taxonomy = get_taxonomy( $object_subtype );
48 if ( $taxonomy ) {
49 $props['label'] = $taxonomy->labels->name;
50 } else {
51 return false;
52 }
53 } else {
54 $props['label'] = __( 'Taxonomies', 'acf' );
55 }
56 $props['icon'] = 'dashicons-tag';
57 break;
58 case 'attachment':
59 $props['label'] = __( 'Attachments', 'acf' );
60 $props['icon'] = 'dashicons-admin-media';
61 break;
62 case 'comment':
63 $props['label'] = __( 'Comments', 'acf' );
64 $props['icon'] = 'dashicons-admin-comments';
65 break;
66 case 'widget':
67 $props['label'] = __( 'Widgets', 'acf' );
68 $props['icon'] = 'dashicons-screenoptions';
69 break;
70 case 'menu':
71 $props['label'] = __( 'Menus', 'acf' );
72 $props['icon'] = 'dashicons-admin-appearance';
73 break;
74 case 'menu_item':
75 $props['label'] = __( 'Menu items', 'acf' );
76 $props['icon'] = 'dashicons-admin-appearance';
77 break;
78 case 'user':
79 $props['label'] = __( 'Users', 'acf' );
80 $props['icon'] = 'dashicons-admin-users';
81 break;
82 case 'option':
83 $props['label'] = __( 'Options', 'acf' );
84 $props['icon'] = 'dashicons-admin-generic';
85 break;
86 case 'block':
87 $props['label'] = __( 'Blocks', 'acf' );
88 $props['icon'] = acf_version_compare( 'wp', '>=', '5.5' ) ? 'dashicons-block-default' : 'dashicons-layout';
89 break;
90 default:
91 return false;
92 }
93
94 // Convert to object.
95 $object = (object) $props;
96
97 /**
98 * Filters the object type.
99 *
100 * @date 6/4/20
101 * @since 5.9.0
102 *
103 * @param object $object The object props.
104 * @param string $object_type The object type (post, term, user, etc).
105 * @param string $object_subtype Optional object subtype (post type, taxonomy).
106 */
107 return apply_filters( 'acf/get_object_type', $object, $object_type, $object_subtype );
108 }
109
110 /**
111 * Decodes a post_id value such as 1 or "user_1" into an array containing the type and ID.
112 *
113 * @date 25/1/19
114 * @since 5.7.11
115 *
116 * @param (int|string) $post_id The post id.
117 * @return array
118 */
119 function acf_decode_post_id( $post_id = 0 ) {
120 $type = '';
121 $id = 0;
122
123 // Interpret numeric value (123).
124 if ( is_numeric( $post_id ) ) {
125 $type = 'post';
126 $id = $post_id;
127
128 // Interpret string value ("user_123" or "option").
129 } elseif ( is_string( $post_id ) ) {
130 $i = strrpos( $post_id, '_' );
131 if ( $i > 0 ) {
132 $type = substr( $post_id, 0, $i );
133 $id = substr( $post_id, $i + 1 );
134 } else {
135 $type = $post_id;
136 $id = '';
137 }
138
139 // Handle incorrect param type.
140 } else {
141 return compact( 'type', 'id' );
142 }
143
144 // Validate props based on param format.
145 $format = $type . '_' . ( is_numeric( $id ) ? '%d' : '%s' );
146 switch ( $format ) {
147 case 'post_%d':
148 $type = 'post';
149 $id = absint( $id );
150 break;
151 case 'term_%d':
152 $type = 'term';
153 $id = absint( $id );
154 break;
155 case 'attachment_%d':
156 $type = 'post';
157 $id = absint( $id );
158 break;
159 case 'comment_%d':
160 $type = 'comment';
161 $id = absint( $id );
162 break;
163 case 'widget_%s':
164 case 'widget_%d':
165 $type = 'option';
166 $id = $post_id;
167 break;
168 case 'menu_%d':
169 $type = 'term';
170 $id = absint( $id );
171 break;
172 case 'menu_item_%d':
173 $type = 'post';
174 $id = absint( $id );
175 break;
176 case 'user_%d':
177 $type = 'user';
178 $id = absint( $id );
179 break;
180 case 'block_%s':
181 case 'block_%d':
182 $type = 'block';
183 $id = $post_id;
184 break;
185 case 'option_%s':
186 $type = 'option';
187 $id = $post_id;
188 break;
189 case 'blog_%d':
190 case 'site_%d':
191 // Allow backwards compatibility for custom taxonomies.
192 $type = taxonomy_exists( $type ) ? 'term' : 'blog';
193 $id = absint( $id );
194 break;
195 default:
196 // Check for taxonomy name.
197 if ( taxonomy_exists( $type ) && is_numeric( $id ) ) {
198 $type = 'term';
199 $id = absint( $id );
200 break;
201 }
202
203 // Treat unknown post_id format as an option.
204 $type = 'option';
205 $id = $post_id;
206 break;
207 }
208
209 /**
210 * Filters the decoded post_id information.
211 *
212 * @date 25/1/19
213 * @since 5.7.11
214 *
215 * @param array $props An array containing "type" and "id" information.
216 * @param (int|string) $post_id The post id.
217 */
218 return apply_filters( 'acf/decode_post_id', compact( 'type', 'id' ), $post_id );
219 }
220
221 /**
222 * Determine the REST base for a post type or taxonomy object. Note that this is not intended for use
223 * with term or post objects but is, instead, to be used with the underlying WP_Post_Type and WP_Taxonomy
224 * instances.
225 *
226 * @param WP_Post_Type|WP_Taxonomy $type_object
227 * @return string|null
228 */
229 function acf_get_object_type_rest_base( $type_object ) {
230 if ( $type_object instanceof WP_Post_Type || $type_object instanceof WP_Taxonomy ) {
231 return ! empty( $type_object->rest_base ) ? $type_object->rest_base : $type_object->name;
232 }
233
234 return null;
235 }
236
237 /**
238 * Extract the ID of a given object/array. This supports all expected types handled by our update_fields() and
239 * load_fields() callbacks.
240 *
241 * @param WP_Post|WP_User|WP_Term|WP_Comment|array $object
242 * @return int|mixed|null
243 */
244 function acf_get_object_id( $object ) {
245 if ( is_object( $object ) ) {
246 switch ( get_class( $object ) ) {
247 case WP_User::class:
248 case WP_Post::class:
249 return (int) $object->ID;
250 case WP_Term::class:
251 return (int) $object->term_id;
252 case WP_Comment::class:
253 return (int) $object->comment_ID;
254 }
255 } elseif ( isset( $object['id'] ) ) {
256 return (int) $object['id'];
257
258 } elseif ( isset( $object['ID'] ) ) {
259 return (int) $object['ID'];
260 }
261
262 return null;
263 }
1 <?php
2 /**
3 * ACF Admin Notices
4 *
5 * Functions and classes to manage admin notices.
6 *
7 * @date 10/1/19
8 * @since 5.7.10
9 */
10
11 // Exit if accessed directly.
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 // Register notices store.
17 acf_register_store( 'notices' );
18
19 /**
20 * ACF_Admin_Notice
21 *
22 * Class used to create an admin notice.
23 *
24 * @date 10/1/19
25 * @since 5.7.10
26 */
27 if ( ! class_exists( 'ACF_Admin_Notice' ) ) :
28
29 class ACF_Admin_Notice extends ACF_Data {
30
31 /** @var array Storage for data. */
32 var $data = array(
33
34 /** @type string Text displayed in notice. */
35 'text' => '',
36
37 /** @type string The type of notice (warning, error, success, info). */
38 'type' => 'info',
39
40 /** @type bool If the notice can be dismissed. */
41 'dismissible' => true,
42 );
43
44 /**
45 * render
46 *
47 * Renders the notice HTML.
48 *
49 * @date 27/12/18
50 * @since 5.8.0
51 *
52 * @param void
53 * @return void
54 */
55 function render() {
56 $notice_text = $this->get( 'text' );
57 $notice_type = $this->get( 'type' );
58 $is_dismissible = $this->get( 'dismissible' );
59
60 printf(
61 '<div class="acf-admin-notice notice notice-%s %s">%s</div>',
62 esc_attr( $notice_type ),
63 $is_dismissible ? 'is-dismissible' : '',
64 acf_esc_html( wpautop( acf_punctify( $notice_text ) ) )
65 );
66 }
67 }
68
69 endif; // class_exists check
70
71 /**
72 * acf_new_admin_notice
73 *
74 * Instantiates and returns a new model.
75 *
76 * @date 23/12/18
77 * @since 5.8.0
78 *
79 * @param array $data Optional data to set.
80 * @return ACF_Admin_Notice
81 */
82 function acf_new_admin_notice( $data = false ) {
83
84 // Create notice.
85 $instance = new ACF_Admin_Notice( $data );
86
87 // Register notice.
88 acf_get_store( 'notices' )->set( $instance->cid, $instance );
89
90 // Return notice.
91 return $instance;
92 }
93
94 /**
95 * acf_render_admin_notices
96 *
97 * Renders all admin notices HTML.
98 *
99 * @date 10/1/19
100 * @since 5.7.10
101 *
102 * @param void
103 * @return void
104 */
105 function acf_render_admin_notices() {
106
107 // Get notices.
108 $notices = acf_get_store( 'notices' )->get_data();
109
110 // Loop over notices and render.
111 if ( $notices ) {
112 foreach ( $notices as $notice ) {
113 $notice->render();
114 }
115 }
116 }
117
118 // Render notices during admin action.
119 add_action( 'admin_notices', 'acf_render_admin_notices', 99 );
120
121 /**
122 * acf_add_admin_notice
123 *
124 * Creates and returns a new notice.
125 *
126 * @date 17/10/13
127 * @since 5.0.0
128 *
129 * @param string $text The admin notice text.
130 * @param string $class The type of notice (warning, error, success, info).
131 * @param string $dismissable Is this notification dismissible (default true) (since 5.11.0)
132 * @return ACF_Admin_Notice
133 */
134 function acf_add_admin_notice( $text = '', $type = 'info', $dismissible = true ) {
135 return acf_new_admin_notice(
136 array(
137 'text' => $text,
138 'type' => $type,
139 'dismissible' => $dismissible,
140 )
141 );
142 }
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'acf_admin_tools' ) ) :
8
9 class acf_admin_tools {
10
11
12 /** @var array Contains an array of admin tool instances */
13 var $tools = array();
14
15
16 /** @var string The active tool */
17 var $active = '';
18
19
20 /**
21 * __construct
22 *
23 * This function will setup the class functionality
24 *
25 * @date 10/10/17
26 * @since 5.6.3
27 *
28 * @param n/a
29 * @return n/a
30 */
31
32 function __construct() {
33
34 // actions
35 add_action( 'admin_menu', array( $this, 'admin_menu' ) );
36
37 }
38
39
40 /**
41 * register_tool
42 *
43 * This function will store a tool tool class
44 *
45 * @date 10/10/17
46 * @since 5.6.3
47 *
48 * @param string $class
49 * @return n/a
50 */
51
52 function register_tool( $class ) {
53
54 $instance = new $class();
55 $this->tools[ $instance->name ] = $instance;
56
57 }
58
59
60 /**
61 * get_tool
62 *
63 * This function will return a tool tool class
64 *
65 * @date 10/10/17
66 * @since 5.6.3
67 *
68 * @param string $name
69 * @return n/a
70 */
71
72 function get_tool( $name ) {
73
74 return isset( $this->tools[ $name ] ) ? $this->tools[ $name ] : null;
75
76 }
77
78
79 /**
80 * get_tools
81 *
82 * This function will return an array of all tools
83 *
84 * @date 10/10/17
85 * @since 5.6.3
86 *
87 * @param n/a
88 * @return array
89 */
90
91 function get_tools() {
92
93 return $this->tools;
94
95 }
96
97
98 /*
99 * admin_menu
100 *
101 * This function will add the ACF menu item to the WP admin
102 *
103 * @type action (admin_menu)
104 * @date 28/09/13
105 * @since 5.0.0
106 *
107 * @param n/a
108 * @return n/a
109 */
110
111 function admin_menu() {
112
113 // bail early if no show_admin
114 if ( ! acf_get_setting( 'show_admin' ) ) {
115 return;
116 }
117
118 // add page
119 $page = add_submenu_page( 'edit.php?post_type=acf-field-group', __( 'Tools', 'acf' ), __( 'Tools', 'acf' ), acf_get_setting( 'capability' ), 'acf-tools', array( $this, 'html' ) );
120
121 // actions
122 add_action( 'load-' . $page, array( $this, 'load' ) );
123
124 }
125
126
127 /**
128 * load
129 *
130 * description
131 *
132 * @date 10/10/17
133 * @since 5.6.3
134 *
135 * @param n/a
136 * @return n/a
137 */
138
139 function load() {
140
141 // disable filters (default to raw data)
142 acf_disable_filters();
143
144 // include tools
145 $this->include_tools();
146
147 // check submit
148 $this->check_submit();
149
150 // load acf scripts
151 acf_enqueue_scripts();
152
153 }
154
155
156 /**
157 * include_tools
158 *
159 * description
160 *
161 * @date 10/10/17
162 * @since 5.6.3
163 *
164 * @param n/a
165 * @return n/a
166 */
167
168 function include_tools() {
169
170 // include
171 acf_include( 'includes/admin/tools/class-acf-admin-tool.php' );
172 acf_include( 'includes/admin/tools/class-acf-admin-tool-export.php' );
173 acf_include( 'includes/admin/tools/class-acf-admin-tool-import.php' );
174
175 // action
176 do_action( 'acf/include_admin_tools' );
177
178 }
179
180
181 /**
182 * check_submit
183 *
184 * description
185 *
186 * @date 10/10/17
187 * @since 5.6.3
188 *
189 * @param n/a
190 * @return n/a
191 */
192
193 function check_submit() {
194
195 // loop
196 foreach ( $this->get_tools() as $tool ) {
197
198 // load
199 $tool->load();
200
201 // submit
202 if ( acf_verify_nonce( $tool->name ) ) {
203 $tool->submit();
204 }
205 }
206
207 }
208
209
210 /**
211 * html
212 *
213 * description
214 *
215 * @date 10/10/17
216 * @since 5.6.3
217 *
218 * @param n/a
219 * @return n/a
220 */
221
222 function html() {
223
224 // vars
225 $screen = get_current_screen();
226 $active = acf_maybe_get_GET( 'tool' );
227
228 // view
229 $view = array(
230 'screen_id' => $screen->id,
231 'active' => $active,
232 );
233
234 // register metaboxes
235 foreach ( $this->get_tools() as $tool ) {
236
237 // check active
238 if ( $active && $active !== $tool->name ) {
239 continue;
240 }
241
242 // add metabox
243 add_meta_box( 'acf-admin-tool-' . $tool->name, acf_esc_html( $tool->title ), array( $this, 'metabox_html' ), $screen->id, 'normal', 'default', array( 'tool' => $tool->name ) );
244
245 }
246
247 // view
248 acf_get_view( 'html-admin-tools', $view );
249
250 }
251
252
253 /**
254 * meta_box_html
255 *
256 * description
257 *
258 * @date 10/10/17
259 * @since 5.6.3
260 *
261 * @param n/a
262 * @return n/a
263 */
264
265 function metabox_html( $post, $metabox ) {
266
267 // vars
268 $tool = $this->get_tool( $metabox['args']['tool'] );
269
270 ?>
271 <form method="post">
272 <?php $tool->html(); ?>
273 <?php acf_nonce_input( $tool->name ); ?>
274 </form>
275 <?php
276
277 }
278
279 }
280
281 // initialize
282 acf()->admin_tools = new acf_admin_tools();
283
284 endif; // class_exists check
285
286
287 /*
288 * acf_register_admin_tool
289 *
290 * alias of acf()->admin_tools->register_tool()
291 *
292 * @type function
293 * @date 31/5/17
294 * @since 5.6.0
295 *
296 * @param n/a
297 * @return n/a
298 */
299
300 function acf_register_admin_tool( $class ) {
301
302 return acf()->admin_tools->register_tool( $class );
303
304 }
305
306
307 /*
308 * acf_get_admin_tools_url
309 *
310 * This function will return the admin URL to the tools page
311 *
312 * @type function
313 * @date 31/5/17
314 * @since 5.6.0
315 *
316 * @param n/a
317 * @return n/a
318 */
319
320 function acf_get_admin_tools_url() {
321
322 return admin_url( 'edit.php?post_type=acf-field-group&page=acf-tools' );
323
324 }
325
326
327 /*
328 * acf_get_admin_tool_url
329 *
330 * This function will return the admin URL to the tools page
331 *
332 * @type function
333 * @date 31/5/17
334 * @since 5.6.0
335 *
336 * @param n/a
337 * @return n/a
338 */
339
340 function acf_get_admin_tool_url( $tool = '' ) {
341
342 return acf_get_admin_tools_url() . '&tool=' . $tool;
343
344 }
345
346
347 ?>
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
8
9 class ACF_Admin_Upgrade {
10
11 /**
12 * __construct
13 *
14 * Sets up the class functionality.
15 *
16 * @date 31/7/18
17 * @since 5.7.2
18 *
19 * @param void
20 * @return void
21 */
22 function __construct() {
23
24 // actions
25 add_action( 'admin_menu', array( $this, 'admin_menu' ), 20 );
26 if ( is_multisite() ) {
27 add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ), 20 );
28 }
29 }
30
31 /**
32 * admin_menu
33 *
34 * Setus up logic if DB Upgrade is needed on a single site.
35 *
36 * @date 24/8/18
37 * @since 5.7.4
38 *
39 * @param void
40 * @return void
41 */
42 function admin_menu() {
43
44 // check if upgrade is avaialble
45 if ( acf_has_upgrade() ) {
46
47 // add notice
48 add_action( 'admin_notices', array( $this, 'admin_notices' ) );
49
50 // add page
51 $page = add_submenu_page( 'index.php', __( 'Upgrade Database', 'acf' ), __( 'Upgrade Database', 'acf' ), acf_get_setting( 'capability' ), 'acf-upgrade', array( $this, 'admin_html' ) );
52
53 // actions
54 add_action( 'load-' . $page, array( $this, 'admin_load' ) );
55 }
56 }
57
58 /**
59 * network_admin_menu
60 *
61 * Sets up admin logic if DB Upgrade is required on a multi site.
62 *
63 * @date 24/8/18
64 * @since 5.7.4
65 *
66 * @param void
67 * @return void
68 */
69 function network_admin_menu() {
70
71 // Vars.
72 $upgrade = false;
73
74 // Loop over sites and check for upgrades.
75 $sites = get_sites( array( 'number' => 0 ) );
76 if ( $sites ) {
77
78 // Unhook action to avoid memory issue (as seen in wp-includes/ms-site.php).
79 remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
80 foreach ( $sites as $site ) {
81
82 // Switch site.
83 switch_to_blog( $site->blog_id );
84
85 // Check for upgrade.
86 $site_upgrade = acf_has_upgrade();
87
88 // Restore site.
89 // Ideally, we would switch back to the original site at after looping, however,
90 // the restore_current_blog() is needed to modify global vars.
91 restore_current_blog();
92
93 // Check if upgrade was found.
94 if ( $site_upgrade ) {
95 $upgrade = true;
96 break;
97 }
98 }
99 add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
100 }
101
102 // Bail early if no upgrade is needed.
103 if ( ! $upgrade ) {
104 return;
105 }
106
107 // Add notice.
108 add_action( 'network_admin_notices', array( $this, 'network_admin_notices' ) );
109
110 // Add page.
111 $page = add_submenu_page(
112 'index.php',
113 __( 'Upgrade Database', 'acf' ),
114 __( 'Upgrade Database', 'acf' ),
115 acf_get_setting( 'capability' ),
116 'acf-upgrade-network',
117 array( $this, 'network_admin_html' )
118 );
119 add_action( "load-$page", array( $this, 'network_admin_load' ) );
120 }
121
122 /**
123 * admin_load
124 *
125 * Runs during the loading of the admin page.
126 *
127 * @date 24/8/18
128 * @since 5.7.4
129 *
130 * @param type $var Description. Default.
131 * @return type Description.
132 */
133 function admin_load() {
134
135 // remove prompt
136 remove_action( 'admin_notices', array( $this, 'admin_notices' ) );
137
138 // Enqueue core script.
139 acf_enqueue_script( 'acf' );
140 }
141
142 /**
143 * network_admin_load
144 *
145 * Runs during the loading of the network admin page.
146 *
147 * @date 24/8/18
148 * @since 5.7.4
149 *
150 * @param type $var Description. Default.
151 * @return type Description.
152 */
153 function network_admin_load() {
154
155 // remove prompt
156 remove_action( 'network_admin_notices', array( $this, 'network_admin_notices' ) );
157
158 // Enqueue core script.
159 acf_enqueue_script( 'acf' );
160 }
161
162 /**
163 * admin_notices
164 *
165 * Displays the DB Upgrade prompt.
166 *
167 * @date 23/8/18
168 * @since 5.7.3
169 *
170 * @param void
171 * @return void
172 */
173 function admin_notices() {
174
175 // vars
176 $view = array(
177 'button_text' => __( 'Upgrade Database', 'acf' ),
178 'button_url' => admin_url( 'index.php?page=acf-upgrade' ),
179 'confirm' => true,
180 );
181
182 // view
183 acf_get_view( 'html-notice-upgrade', $view );
184 }
185
186 /**
187 * network_admin_notices
188 *
189 * Displays the DB Upgrade prompt on a multi site.
190 *
191 * @date 23/8/18
192 * @since 5.7.3
193 *
194 * @param void
195 * @return void
196 */
197 function network_admin_notices() {
198
199 // vars
200 $view = array(
201 'button_text' => __( 'Review sites & upgrade', 'acf' ),
202 'button_url' => network_admin_url( 'index.php?page=acf-upgrade-network' ),
203 'confirm' => false,
204 );
205
206 // view
207 acf_get_view( 'html-notice-upgrade', $view );
208 }
209
210 /**
211 * admin_html
212 *
213 * Displays the HTML for the admin page.
214 *
215 * @date 24/8/18
216 * @since 5.7.4
217 *
218 * @param void
219 * @return void
220 */
221 function admin_html() {
222 acf_get_view( 'html-admin-page-upgrade' );
223 }
224
225 /**
226 * network_admin_html
227 *
228 * Displays the HTML for the network upgrade admin page.
229 *
230 * @date 24/8/18
231 * @since 5.7.4
232 *
233 * @param void
234 * @return void
235 */
236 function network_admin_html() {
237 acf_get_view( 'html-admin-page-upgrade-network' );
238 }
239 }
240
241 // instantiate
242 acf_new_instance( 'ACF_Admin_Upgrade' );
243
244 endif; // class_exists check
245
246
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'ACF_Admin' ) ) :
8
9 class ACF_Admin {
10
11 /**
12 * Constructor.
13 *
14 * @date 23/06/12
15 * @since 5.0.0
16 *
17 * @param void
18 * @return void
19 */
20 function __construct() {
21 // Add actions.
22 add_action( 'admin_menu', array( $this, 'admin_menu' ) );
23 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
24 add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
25 add_action( 'current_screen', array( $this, 'current_screen' ) );
26 }
27
28 /**
29 * Adds the ACF menu item.
30 *
31 * @date 28/09/13
32 * @since 5.0.0
33 *
34 * @param void
35 * @return void
36 */
37 function admin_menu() {
38
39 // Bail early if ACF is hidden.
40 if ( ! acf_get_setting( 'show_admin' ) ) {
41 return;
42 }
43
44 // Vars.
45 $slug = 'edit.php?post_type=acf-field-group';
46 $cap = acf_get_setting( 'capability' );
47
48 // Add menu items.
49 add_menu_page( __( 'Custom Fields', 'acf' ), __( 'Custom Fields', 'acf' ), $cap, $slug, false, 'dashicons-welcome-widgets-menus', 80 );
50 add_submenu_page( $slug, __( 'Field Groups', 'acf' ), __( 'Field Groups', 'acf' ), $cap, $slug );
51 add_submenu_page( $slug, __( 'Add New', 'acf' ), __( 'Add New', 'acf' ), $cap, 'post-new.php?post_type=acf-field-group' );
52 }
53
54 /**
55 * Enqueues global admin styling.
56 *
57 * @date 28/09/13
58 * @since 5.0.0
59 *
60 * @param void
61 * @return void
62 */
63 function admin_enqueue_scripts() {
64 wp_enqueue_style( 'acf-global' );
65 }
66
67 /**
68 * Appends custom admin body classes.
69 *
70 * @date 5/11/19
71 * @since 5.8.7
72 *
73 * @param string $classes Space-separated list of CSS classes.
74 * @return string
75 */
76 function admin_body_class( $classes ) {
77 global $wp_version;
78
79 // Determine body class version.
80 $wp_minor_version = floatval( $wp_version );
81 if ( $wp_minor_version >= 5.3 ) {
82 $classes .= ' acf-admin-5-3';
83 } else {
84 $classes .= ' acf-admin-3-8';
85 }
86
87 // Add browser for specific CSS.
88 $classes .= ' acf-browser-' . acf_get_browser();
89
90 // Return classes.
91 return $classes;
92 }
93
94 /**
95 * Adds custom functionality to "ACF" admin pages.
96 *
97 * @date 7/4/20
98 * @since 5.9.0
99 *
100 * @param void
101 * @return void
102 */
103 function current_screen( $screen ) {
104
105 // Determine if the current page being viewed is "ACF" related.
106 if ( isset( $screen->post_type ) && $screen->post_type === 'acf-field-group' ) {
107 add_action( 'in_admin_header', array( $this, 'in_admin_header' ) );
108 add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
109 $this->setup_help_tab();
110 }
111 }
112
113 /**
114 * Sets up the admin help tab.
115 *
116 * @date 20/4/20
117 * @since 5.9.0
118 *
119 * @param void
120 * @return void
121 */
122 public function setup_help_tab() {
123 $screen = get_current_screen();
124
125 // Overview tab.
126 $screen->add_help_tab(
127 array(
128 'id' => 'overview',
129 'title' => __( 'Overview', 'acf' ),
130 'content' =>
131 '<p><strong>' . __( 'Overview', 'acf' ) . '</strong></p>' .
132 '<p>' . __( 'The Advanced Custom Fields plugin provides a visual form builder to customize WordPress edit screens with extra fields, and an intuitive API to display custom field values in any theme template file.', 'acf' ) . '</p>' .
133 '<p>' . sprintf(
134 __( 'Before creating your first Field Group, we recommend first reading our <a href="%s" target="_blank">Getting started</a> guide to familiarize yourself with the plugin\'s philosophy and best practises.', 'acf' ),
135 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/'
136 ) . '</p>' .
137 '<p>' . __( 'Please use the Help & Support tab to get in touch should you find yourself requiring assistance.', 'acf' ) . '</p>' .
138 '',
139 )
140 );
141
142 // Help tab.
143 $screen->add_help_tab(
144 array(
145 'id' => 'help',
146 'title' => __( 'Help & Support', 'acf' ),
147 'content' =>
148 '<p><strong>' . __( 'Help & Support', 'acf' ) . '</strong></p>' .
149 '<p>' . __( 'We are fanatical about support, and want you to get the best out of your website with ACF. If you run into any difficulties, there are several places you can find help:', 'acf' ) . '</p>' .
150 '<ul>' .
151 '<li>' . sprintf(
152 __( '<a href="%s" target="_blank">Documentation</a>. Our extensive documentation contains references and guides for most situations you may encounter.', 'acf' ),
153 'https://www.advancedcustomfields.com/resources/'
154 ) . '</li>' .
155 '<li>' . sprintf(
156 __( '<a href="%s" target="_blank">Discussions</a>. We have an active and friendly community on our Community Forums who may be able to help you figure out the ‘how-tos’ of the ACF world.', 'acf' ),
157 'https://support.advancedcustomfields.com/'
158 ) . '</li>' .
159 '<li>' . sprintf(
160 __( '<a href="%s" target="_blank">Help Desk</a>. The support professionals on our Help Desk will assist with your more in depth, technical challenges.', 'acf' ),
161 'https://www.advancedcustomfields.com/support/'
162 ) . '</li>' .
163 '</ul>',
164 )
165 );
166
167 // Sidebar.
168 $screen->set_help_sidebar(
169 '<p><strong>' . __( 'Information', 'acf' ) . '</strong></p>' .
170 '<p><span class="dashicons dashicons-admin-plugins"></span> ' . sprintf( __( 'Version %s', 'acf' ), ACF_VERSION ) . '</p>' .
171 '<p><span class="dashicons dashicons-wordpress"></span> <a href="https://wordpress.org/plugins/advanced-custom-fields/" target="_blank">' . __( 'View details', 'acf' ) . '</a></p>' .
172 '<p><span class="dashicons dashicons-admin-home"></span> <a href="https://www.advancedcustomfields.com/" target="_blank" target="_blank">' . __( 'Visit website', 'acf' ) . '</a></p>' .
173 ''
174 );
175 }
176
177 /**
178 * Renders the admin navigation element.
179 *
180 * @date 27/3/20
181 * @since 5.9.0
182 *
183 * @param void
184 * @return void
185 */
186 function in_admin_header() {
187 acf_get_view( 'html-admin-navigation' );
188 }
189
190 /**
191 * Modifies the admin footer text.
192 *
193 * @date 7/4/20
194 * @since 5.9.0
195 *
196 * @param string $text The admin footer text.
197 * @return string
198 */
199 function admin_footer_text( $text ) {
200 // Use RegExp to append "ACF" after the <a> element allowing translations to read correctly.
201 return preg_replace( '/(<a[\S\s]+?\/a>)/', '$1 ' . __( 'and', 'acf' ) . ' <a href="https://www.advancedcustomfields.com" target="_blank">ACF</a>', $text, 1 );
202 }
203
204 }
205
206 // Instantiate.
207 acf_new_instance( 'ACF_Admin' );
208
209 endif; // class_exists check
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
8
9 class ACF_Admin_Tool_Import extends ACF_Admin_Tool {
10
11
12 /**
13 * initialize
14 *
15 * This function will initialize the admin tool
16 *
17 * @date 10/10/17
18 * @since 5.6.3
19 *
20 * @param n/a
21 * @return n/a
22 */
23
24 function initialize() {
25
26 // vars
27 $this->name = 'import';
28 $this->title = __( 'Import Field Groups', 'acf' );
29 $this->icon = 'dashicons-upload';
30
31 }
32
33
34 /**
35 * html
36 *
37 * This function will output the metabox HTML
38 *
39 * @date 10/10/17
40 * @since 5.6.3
41 *
42 * @param n/a
43 * @return n/a
44 */
45
46 function html() {
47
48 ?>
49 <p><?php _e( 'Select the Advanced Custom Fields JSON file you would like to import. When you click the import button below, ACF will import the field groups.', 'acf' ); ?></p>
50 <div class="acf-fields">
51 <?php
52
53 acf_render_field_wrap(
54 array(
55 'label' => __( 'Select File', 'acf' ),
56 'type' => 'file',
57 'name' => 'acf_import_file',
58 'value' => false,
59 'uploader' => 'basic',
60 )
61 );
62
63 ?>
64 </div>
65 <p class="acf-submit">
66 <input type="submit" class="button button-primary" value="<?php _e( 'Import File', 'acf' ); ?>" />
67 </p>
68 <?php
69
70 }
71
72
73 /**
74 * submit
75 *
76 * This function will run when the tool's form has been submit
77 *
78 * @date 10/10/17
79 * @since 5.6.3
80 *
81 * @param n/a
82 * @return n/a
83 */
84
85 function submit() {
86
87 // Check file size.
88 if ( empty( $_FILES['acf_import_file']['size'] ) ) {
89 return acf_add_admin_notice( __( 'No file selected', 'acf' ), 'warning' );
90 }
91
92 // Get file data.
93 $file = $_FILES['acf_import_file'];
94
95 // Check errors.
96 if ( $file['error'] ) {
97 return acf_add_admin_notice( __( 'Error uploading file. Please try again', 'acf' ), 'warning' );
98 }
99
100 // Check file type.
101 if ( pathinfo( $file['name'], PATHINFO_EXTENSION ) !== 'json' ) {
102 return acf_add_admin_notice( __( 'Incorrect file type', 'acf' ), 'warning' );
103 }
104
105 // Read JSON.
106 $json = file_get_contents( $file['tmp_name'] );
107 $json = json_decode( $json, true );
108
109 // Check if empty.
110 if ( ! $json || ! is_array( $json ) ) {
111 return acf_add_admin_notice( __( 'Import file empty', 'acf' ), 'warning' );
112 }
113
114 // Ensure $json is an array of groups.
115 if ( isset( $json['key'] ) ) {
116 $json = array( $json );
117 }
118
119 // Remeber imported field group ids.
120 $ids = array();
121
122 // Loop over json
123 foreach ( $json as $field_group ) {
124
125 // Search database for existing field group.
126 $post = acf_get_field_group_post( $field_group['key'] );
127 if ( $post ) {
128 $field_group['ID'] = $post->ID;
129 }
130
131 // Import field group.
132 $field_group = acf_import_field_group( $field_group );
133
134 // append message
135 $ids[] = $field_group['ID'];
136 }
137
138 // Count number of imported field groups.
139 $total = count( $ids );
140
141 // Generate text.
142 $text = sprintf( _n( 'Imported 1 field group', 'Imported %s field groups', $total, 'acf' ), $total );
143
144 // Add links to text.
145 $links = array();
146 foreach ( $ids as $id ) {
147 $links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
148 }
149 $text .= ' ' . implode( ', ', $links );
150
151 // Add notice
152 acf_add_admin_notice( $text, 'success' );
153 }
154 }
155
156 // initialize
157 acf_register_admin_tool( 'ACF_Admin_Tool_Import' );
158
159 endif; // class_exists check
160
161 ?>
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
8
9 class ACF_Admin_Tool {
10
11
12 /** @var string Tool name */
13 var $name = '';
14
15
16 /** @var string Tool title */
17 var $title = '';
18
19
20 /** @var string Dashicon slug */
21 // var $icon = '';
22
23
24 /** @var boolean Redirect form to single */
25 // var $redirect = false;
26
27
28 /**
29 * get_name
30 *
31 * This function will return the Tool's name
32 *
33 * @date 19/10/17
34 * @since 5.6.3
35 *
36 * @param n/a
37 * @return n/a
38 */
39
40 function get_name() {
41 return $this->name;
42 }
43
44
45 /**
46 * get_title
47 *
48 * This function will return the Tool's title
49 *
50 * @date 19/10/17
51 * @since 5.6.3
52 *
53 * @param n/a
54 * @return n/a
55 */
56
57 function get_title() {
58 return $this->title;
59 }
60
61
62 /**
63 * get_url
64 *
65 * This function will return the Tool's title
66 *
67 * @date 19/10/17
68 * @since 5.6.3
69 *
70 * @param n/a
71 * @return n/a
72 */
73
74 function get_url() {
75 return acf_get_admin_tool_url( $this->name );
76 }
77
78
79 /**
80 * is_active
81 *
82 * This function will return true if the tool is active
83 *
84 * @date 19/10/17
85 * @since 5.6.3
86 *
87 * @param n/a
88 * @return bool
89 */
90
91 function is_active() {
92 return acf_maybe_get_GET( 'tool' ) === $this->name;
93 }
94
95
96 /*
97 * __construct
98 *
99 * This function will setup the class functionality
100 *
101 * @type function
102 * @date 27/6/17
103 * @since 5.6.0
104 *
105 * @param n/a
106 * @return n/a
107 */
108
109 function __construct() {
110
111 // initialize
112 $this->initialize();
113
114 }
115
116
117 /**
118 * initialize
119 *
120 * This function will initialize the admin tool
121 *
122 * @date 10/10/17
123 * @since 5.6.3
124 *
125 * @param n/a
126 * @return n/a
127 */
128
129 function initialize() {
130
131 /* do nothing */
132
133 }
134
135
136
137 /**
138 * load
139 *
140 * This function is called during the admin page load
141 *
142 * @date 10/10/17
143 * @since 5.6.3
144 *
145 * @param n/a
146 * @return n/a
147 */
148
149 function load() {
150
151 /* do nothing */
152
153 }
154
155
156 /**
157 * html
158 *
159 * This function will output the metabox HTML
160 *
161 * @date 10/10/17
162 * @since 5.6.3
163 *
164 * @param n/a
165 * @return n/a
166 */
167
168 function html() {
169
170 }
171
172
173 /**
174 * submit
175 *
176 * This function will run when the tool's form has been submit
177 *
178 * @date 10/10/17
179 * @since 5.6.3
180 *
181 * @param n/a
182 * @return n/a
183 */
184
185 function submit() {
186
187 }
188
189
190 }
191
192 endif; // class_exists check
193
194
1 <?php
2
3 // vars
4 $disabled = false;
5
6
7 // empty
8 if ( empty( $field['conditional_logic'] ) ) {
9
10 $disabled = true;
11 $field['conditional_logic'] = array(
12
13 // group 0
14 array(
15
16 // rule 0
17 array(),
18 ),
19 );
20 }
21
22 ?>
23 <tr class="acf-field acf-field-true-false acf-field-setting-conditional_logic" data-type="true_false" data-name="conditional_logic">
24 <td class="acf-label">
25 <label><?php _e( 'Conditional Logic', 'acf' ); ?></label>
26 </td>
27 <td class="acf-input">
28 <?php
29
30 acf_render_field(
31 array(
32 'type' => 'true_false',
33 'name' => 'conditional_logic',
34 'prefix' => $field['prefix'],
35 'value' => $disabled ? 0 : 1,
36 'ui' => 1,
37 'class' => 'conditions-toggle',
38 )
39 );
40
41 ?>
42 <div class="rule-groups"
43 <?php
44 if ( $disabled ) :
45 ?>
46 style="display:none;"<?php endif; ?>>
47
48 <?php
49 foreach ( $field['conditional_logic'] as $group_id => $group ) :
50
51 // validate
52 if ( empty( $group ) ) {
53 continue;
54 }
55
56
57 // vars
58 // $group_id must be completely different to $rule_id to avoid JS issues
59 $group_id = "group_{$group_id}";
60 $h4 = ( $group_id == 'group_0' ) ? __( 'Show this field if', 'acf' ) : __( 'or', 'acf' );
61
62 ?>
63 <div class="rule-group" data-id="<?php echo $group_id; ?>">
64
65 <h4><?php echo $h4; ?></h4>
66
67 <table class="acf-table -clear">
68 <tbody>
69 <?php
70 foreach ( $group as $rule_id => $rule ) :
71
72 // valid rule
73 $rule = wp_parse_args(
74 $rule,
75 array(
76 'field' => '',
77 'operator' => '',
78 'value' => '',
79 )
80 );
81
82
83 // vars
84 // $group_id must be completely different to $rule_id to avoid JS issues
85 $rule_id = "rule_{$rule_id}";
86 $prefix = "{$field['prefix']}[conditional_logic][{$group_id}][{$rule_id}]";
87
88 // data attributes
89 $attributes = array(
90 'data-id' => $rule_id,
91 'data-field' => $rule['field'],
92 'data-operator' => $rule['operator'],
93 'data-value' => $rule['value'],
94 );
95
96 ?>
97 <tr class="rule" <?php acf_esc_attr_e( $attributes ); ?>>
98 <td class="param">
99 <?php
100
101 acf_render_field(
102 array(
103 'type' => 'select',
104 'prefix' => $prefix,
105 'name' => 'field',
106 'class' => 'condition-rule-field',
107 'disabled' => $disabled,
108 'value' => $rule['field'],
109 'choices' => array(
110 $rule['field'] => $rule['field'],
111 ),
112 )
113 );
114
115 ?>
116 </td>
117 <td class="operator">
118 <?php
119
120 acf_render_field(
121 array(
122 'type' => 'select',
123 'prefix' => $prefix,
124 'name' => 'operator',
125 'class' => 'condition-rule-operator',
126 'disabled' => $disabled,
127 'value' => $rule['operator'],
128 'choices' => array(
129 $rule['operator'] => $rule['operator'],
130 ),
131 )
132 );
133
134 ?>
135 </td>
136 <td class="value">
137 <?php
138
139 // create field
140 acf_render_field(
141 array(
142 'type' => 'select',
143 'prefix' => $prefix,
144 'name' => 'value',
145 'class' => 'condition-rule-value',
146 'disabled' => $disabled,
147 'value' => $rule['value'],
148 'choices' => array(
149 $rule['value'] => $rule['value'],
150 ),
151 )
152 );
153
154 ?>
155 </td>
156 <td class="add">
157 <a href="#" class="button add-conditional-rule"><?php _e( 'and', 'acf' ); ?></a>
158 </td>
159 <td class="remove">
160 <a href="#" class="acf-icon -minus remove-conditional-rule"></a>
161 </td>
162 </tr>
163 <?php endforeach; ?>
164 </tbody>
165 </table>
166
167 </div>
168 <?php endforeach; ?>
169
170 <h4><?php _e( 'or', 'acf' ); ?></h4>
171
172 <a href="#" class="button add-conditional-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
173
174 </div>
175
176 </td>
177 </tr>
1 <?php
2
3 // Define input name prefix using unique identifier.
4 $input_prefix = 'acf_fields[' . $field['ID'] . ']';
5 $input_id = acf_idify( $input_prefix );
6
7 // Update field props.
8 $field['prefix'] = $input_prefix;
9
10 // Elements.
11 $div_attrs = array(
12 'class' => 'acf-field-object acf-field-object-' . acf_slugify( $field['type'] ),
13 'data-id' => $field['ID'],
14 'data-key' => $field['key'],
15 'data-type' => $field['type'],
16 );
17
18 // Misc template vars.
19 $field_label = acf_get_field_label( $field, 'admin' );
20 $field_type_label = acf_get_field_type_label( $field['type'] );
21
22 ?>
23 <div <?php echo acf_esc_attr( $div_attrs ); ?>>
24
25 <div class="meta">
26 <?php
27 $meta_inputs = array(
28 'ID' => $field['ID'],
29 'key' => $field['key'],
30 'parent' => $field['parent'],
31 'menu_order' => $i,
32 'save' => '',
33 );
34 foreach ( $meta_inputs as $k => $v ) :
35 acf_hidden_input(
36 array(
37 'name' => $input_prefix . '[' . $k . ']',
38 'value' => $v,
39 'id' => $input_id . '-' . $k,
40 )
41 );
42 endforeach;
43 ?>
44 </div>
45
46 <div class="handle">
47 <ul class="acf-hl acf-tbody">
48 <li class="li-field-order">
49 <span class="acf-icon acf-sortable-handle" title="<?php _e( 'Drag to reorder', 'acf' ); ?>"><?php echo ( $i + 1 ); ?></span>
50 </li>
51 <li class="li-field-label">
52 <strong>
53 <a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php echo acf_esc_html( $field_label ); ?></a>
54 </strong>
55 <div class="row-options">
56 <a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php _e( 'Edit', 'acf' ); ?></a>
57 <a class="duplicate-field" title="<?php _e( 'Duplicate field', 'acf' ); ?>" href="#"><?php _e( 'Duplicate', 'acf' ); ?></a>
58 <a class="move-field" title="<?php _e( 'Move field to another group', 'acf' ); ?>" href="#"><?php _e( 'Move', 'acf' ); ?></a>
59 <a class="delete-field" title="<?php _e( 'Delete field', 'acf' ); ?>" href="#"><?php _e( 'Delete', 'acf' ); ?></a>
60 </div>
61 </li>
62 <?php // whitespace before field name looks odd but fixes chrome bug selecting all text in row ?>
63 <li class="li-field-name"> <?php echo esc_html( $field['name'] ); ?></li>
64 <li class="li-field-key"> <?php echo esc_html( $field['key'] ); ?></li>
65 <li class="li-field-type"> <?php echo esc_html( $field_type_label ); ?></li>
66 </ul>
67 </div>
68
69 <div class="settings">
70 <table class="acf-table">
71 <tbody class="acf-field-settings">
72 <?php
73
74 // label
75 acf_render_field_setting(
76 $field,
77 array(
78 'label' => __( 'Field Label', 'acf' ),
79 'instructions' => __( 'This is the name which will appear on the EDIT page', 'acf' ),
80 'name' => 'label',
81 'type' => 'text',
82 'class' => 'field-label',
83 ),
84 true
85 );
86
87
88 // name
89 acf_render_field_setting(
90 $field,
91 array(
92 'label' => __( 'Field Name', 'acf' ),
93 'instructions' => __( 'Single word, no spaces. Underscores and dashes allowed', 'acf' ),
94 'name' => 'name',
95 'type' => 'text',
96 'class' => 'field-name',
97 ),
98 true
99 );
100
101
102 // type
103 acf_render_field_setting(
104 $field,
105 array(
106 'label' => __( 'Field Type', 'acf' ),
107 'instructions' => '',
108 'type' => 'select',
109 'name' => 'type',
110 'choices' => acf_get_grouped_field_types(),
111 'class' => 'field-type',
112 ),
113 true
114 );
115
116
117 // instructions
118 acf_render_field_setting(
119 $field,
120 array(
121 'label' => __( 'Instructions', 'acf' ),
122 'instructions' => __( 'Instructions for authors. Shown when submitting data', 'acf' ),
123 'type' => 'textarea',
124 'name' => 'instructions',
125 'rows' => 5,
126 ),
127 true
128 );
129
130
131 // required
132 acf_render_field_setting(
133 $field,
134 array(
135 'label' => __( 'Required?', 'acf' ),
136 'instructions' => '',
137 'type' => 'true_false',
138 'name' => 'required',
139 'ui' => 1,
140 'class' => 'field-required',
141 ),
142 true
143 );
144
145
146 // 3rd party settings
147 do_action( 'acf/render_field_settings', $field );
148
149
150 // type specific settings
151 do_action( "acf/render_field_settings/type={$field['type']}", $field );
152
153
154 // conditional logic
155 acf_get_view( 'field-group-field-conditional-logic', array( 'field' => $field ) );
156
157
158 // wrapper
159 acf_render_field_wrap(
160 array(
161 'label' => __( 'Wrapper Attributes', 'acf' ),
162 'instructions' => '',
163 'type' => 'number',
164 'name' => 'width',
165 'prefix' => $field['prefix'] . '[wrapper]',
166 'value' => $field['wrapper']['width'],
167 'prepend' => __( 'width', 'acf' ),
168 'append' => '%',
169 'wrapper' => array(
170 'data-name' => 'wrapper',
171 'class' => 'acf-field-setting-wrapper',
172 ),
173 ),
174 'tr'
175 );
176
177 acf_render_field_wrap(
178 array(
179 'label' => '',
180 'instructions' => '',
181 'type' => 'text',
182 'name' => 'class',
183 'prefix' => $field['prefix'] . '[wrapper]',
184 'value' => $field['wrapper']['class'],
185 'prepend' => __( 'class', 'acf' ),
186 'wrapper' => array(
187 'data-append' => 'wrapper',
188 ),
189 ),
190 'tr'
191 );
192
193 acf_render_field_wrap(
194 array(
195 'label' => '',
196 'instructions' => '',
197 'type' => 'text',
198 'name' => 'id',
199 'prefix' => $field['prefix'] . '[wrapper]',
200 'value' => $field['wrapper']['id'],
201 'prepend' => __( 'id', 'acf' ),
202 'wrapper' => array(
203 'data-append' => 'wrapper',
204 ),
205 ),
206 'tr'
207 );
208
209 ?>
210 <tr class="acf-field acf-field-save">
211 <td class="acf-label"></td>
212 <td class="acf-input">
213 <ul class="acf-hl">
214 <li>
215 <a class="button edit-field" title="<?php _e( 'Close Field', 'acf' ); ?>" href="#"><?php _e( 'Close Field', 'acf' ); ?></a>
216 </li>
217 </ul>
218 </td>
219 </tr>
220 </tbody>
221 </table>
222 </div>
223
224 </div>
1 <div class="acf-field-list-wrap">
2
3 <ul class="acf-hl acf-thead">
4 <li class="li-field-order"><?php _e( 'Order', 'acf' ); ?></li>
5 <li class="li-field-label"><?php _e( 'Label', 'acf' ); ?></li>
6 <li class="li-field-name"><?php _e( 'Name', 'acf' ); ?></li>
7 <li class="li-field-key"><?php _e( 'Key', 'acf' ); ?></li>
8 <li class="li-field-type"><?php _e( 'Type', 'acf' ); ?></li>
9 </ul>
10
11 <div class="acf-field-list
12 <?php
13 if ( ! $fields ) {
14 echo ' -empty'; }
15 ?>
16 ">
17
18 <div class="no-fields-message">
19 <?php _e( 'No fields. Click the <strong>+ Add Field</strong> button to create your first field.', 'acf' ); ?>
20 </div>
21
22 <?php
23 if ( $fields ) :
24
25 foreach ( $fields as $i => $field ) :
26
27 acf_get_view(
28 'field-group-field',
29 array(
30 'field' => $field,
31 'i' => $i,
32 )
33 );
34
35 endforeach;
36
37 endif;
38 ?>
39
40 </div>
41
42 <ul class="acf-hl acf-tfoot">
43 <li class="acf-fr">
44 <a href="#" class="button button-primary button-large add-field"><?php _e( '+ Add Field', 'acf' ); ?></a>
45 </li>
46 </ul>
47
48 <?php
49 if ( ! $parent ) :
50
51 // get clone
52 $clone = acf_get_valid_field(
53 array(
54 'ID' => 'acfcloneindex',
55 'key' => 'acfcloneindex',
56 'label' => __( 'New Field', 'acf' ),
57 'name' => 'new_field',
58 'type' => 'text',
59 )
60 );
61
62 ?>
63 <script type="text/html" id="tmpl-acf-field">
64 <?php
65 acf_get_view(
66 'field-group-field',
67 array(
68 'field' => $clone,
69 'i' => 0,
70 )
71 );
72 ?>
73 </script>
74 <?php endif; ?>
75
76 </div>
1 <?php
2
3 // global
4 global $field_group;
5
6 ?>
7 <div class="acf-field">
8 <div class="acf-label">
9 <label><?php _e( 'Rules', 'acf' ); ?></label>
10 <p class="description"><?php _e( 'Create a set of rules to determine which edit screens will use these advanced custom fields', 'acf' ); ?></p>
11 </div>
12 <div class="acf-input">
13 <div class="rule-groups">
14
15 <?php
16 foreach ( $field_group['location'] as $i => $group ) :
17
18 // bail ealry if no group
19 if ( empty( $group ) ) {
20 return;
21 }
22
23
24 // view
25 acf_get_view(
26 'html-location-group',
27 array(
28 'group' => $group,
29 'group_id' => "group_{$i}",
30 )
31 );
32
33 endforeach;
34 ?>
35
36 <h4><?php _e( 'or', 'acf' ); ?></h4>
37
38 <a href="#" class="button add-location-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
39
40 </div>
41 </div>
42 </div>
43 <script type="text/javascript">
44 if( typeof acf !== 'undefined' ) {
45
46 acf.newPostbox({
47 'id': 'acf-field-group-locations',
48 'label': 'left'
49 });
50
51 }
52 </script>
1 <?php
2
3 // global
4 global $field_group;
5
6
7 // active
8 acf_render_field_wrap(
9 array(
10 'label' => __( 'Active', 'acf' ),
11 'instructions' => '',
12 'type' => 'true_false',
13 'name' => 'active',
14 'prefix' => 'acf_field_group',
15 'value' => $field_group['active'],
16 'ui' => 1,
17 // 'ui_on_text' => __('Active', 'acf'),
18 // 'ui_off_text' => __('Inactive', 'acf'),
19 )
20 );
21
22
23 // Show fields in REST API.
24 if ( acf_get_setting( 'rest_api_enabled' ) ) {
25 acf_render_field_wrap(
26 array(
27 'label' => __( 'Show in REST API', 'acf' ),
28 'instructions' => '',
29 'type' => 'true_false',
30 'name' => 'show_in_rest',
31 'prefix' => 'acf_field_group',
32 'value' => $field_group['show_in_rest'],
33 'ui' => 1,
34 // 'ui_on_text' => __('Active', 'acf'),
35 // 'ui_off_text' => __('Inactive', 'acf'),
36 )
37 );
38 }
39
40
41 // style
42 acf_render_field_wrap(
43 array(
44 'label' => __( 'Style', 'acf' ),
45 'instructions' => '',
46 'type' => 'select',
47 'name' => 'style',
48 'prefix' => 'acf_field_group',
49 'value' => $field_group['style'],
50 'choices' => array(
51 'default' => __( 'Standard (WP metabox)', 'acf' ),
52 'seamless' => __( 'Seamless (no metabox)', 'acf' ),
53 ),
54 )
55 );
56
57
58 // position
59 acf_render_field_wrap(
60 array(
61 'label' => __( 'Position', 'acf' ),
62 'instructions' => '',
63 'type' => 'select',
64 'name' => 'position',
65 'prefix' => 'acf_field_group',
66 'value' => $field_group['position'],
67 'choices' => array(
68 'acf_after_title' => __( 'High (after title)', 'acf' ),
69 'normal' => __( 'Normal (after content)', 'acf' ),
70 'side' => __( 'Side', 'acf' ),
71 ),
72 'default_value' => 'normal',
73 )
74 );
75
76
77 // label_placement
78 acf_render_field_wrap(
79 array(
80 'label' => __( 'Label placement', 'acf' ),
81 'instructions' => '',
82 'type' => 'select',
83 'name' => 'label_placement',
84 'prefix' => 'acf_field_group',
85 'value' => $field_group['label_placement'],
86 'choices' => array(
87 'top' => __( 'Top aligned', 'acf' ),
88 'left' => __( 'Left aligned', 'acf' ),
89 ),
90 )
91 );
92
93
94 // instruction_placement
95 acf_render_field_wrap(
96 array(
97 'label' => __( 'Instruction placement', 'acf' ),
98 'instructions' => '',
99 'type' => 'select',
100 'name' => 'instruction_placement',
101 'prefix' => 'acf_field_group',
102 'value' => $field_group['instruction_placement'],
103 'choices' => array(
104 'label' => __( 'Below labels', 'acf' ),
105 'field' => __( 'Below fields', 'acf' ),
106 ),
107 )
108 );
109
110
111 // menu_order
112 acf_render_field_wrap(
113 array(
114 'label' => __( 'Order No.', 'acf' ),
115 'instructions' => __( 'Field groups with a lower order will appear first', 'acf' ),
116 'type' => 'number',
117 'name' => 'menu_order',
118 'prefix' => 'acf_field_group',
119 'value' => $field_group['menu_order'],
120 )
121 );
122
123
124 // description
125 acf_render_field_wrap(
126 array(
127 'label' => __( 'Description', 'acf' ),
128 'instructions' => __( 'Shown in field group list', 'acf' ),
129 'type' => 'text',
130 'name' => 'description',
131 'prefix' => 'acf_field_group',
132 'value' => $field_group['description'],
133 )
134 );
135
136
137 // hide on screen
138 $choices = array(
139 'permalink' => __( 'Permalink', 'acf' ),
140 'the_content' => __( 'Content Editor', 'acf' ),
141 'excerpt' => __( 'Excerpt', 'acf' ),
142 'custom_fields' => __( 'Custom Fields', 'acf' ),
143 'discussion' => __( 'Discussion', 'acf' ),
144 'comments' => __( 'Comments', 'acf' ),
145 'revisions' => __( 'Revisions', 'acf' ),
146 'slug' => __( 'Slug', 'acf' ),
147 'author' => __( 'Author', 'acf' ),
148 'format' => __( 'Format', 'acf' ),
149 'page_attributes' => __( 'Page Attributes', 'acf' ),
150 'featured_image' => __( 'Featured Image', 'acf' ),
151 'categories' => __( 'Categories', 'acf' ),
152 'tags' => __( 'Tags', 'acf' ),
153 'send-trackbacks' => __( 'Send Trackbacks', 'acf' ),
154 );
155 if ( acf_get_setting( 'remove_wp_meta_box' ) ) {
156 unset( $choices['custom_fields'] );
157 }
158
159 acf_render_field_wrap(
160 array(
161 'label' => __( 'Hide on screen', 'acf' ),
162 'instructions' => __( '<b>Select</b> items to <b>hide</b> them from the edit screen.', 'acf' ) . '<br /><br />' . __( "If multiple field groups appear on an edit screen, the first field group's options will be used (the one with the lowest order number)", 'acf' ),
163 'type' => 'checkbox',
164 'name' => 'hide_on_screen',
165 'prefix' => 'acf_field_group',
166 'value' => $field_group['hide_on_screen'],
167 'toggle' => true,
168 'choices' => $choices,
169 )
170 );
171
172
173 // 3rd party settings
174 do_action( 'acf/render_field_group_settings', $field_group );
175
176 ?>
177 <div class="acf-hidden">
178 <input type="hidden" name="acf_field_group[key]" value="<?php echo $field_group['key']; ?>" />
179 </div>
180 <script type="text/javascript">
181 if( typeof acf !== 'undefined' ) {
182
183 acf.newPostbox({
184 'id': 'acf-field-group-options',
185 'label': 'left'
186 });
187
188 }
189 </script>
1 <?php
2 /**
3 * The template for displaying admin navigation.
4 *
5 * @date 27/3/20
6 * @since 5.9.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 global $submenu, $parent_file, $submenu_file, $plugin_page, $pagenow;
14
15 // Vars.
16 $parent_slug = 'edit.php?post_type=acf-field-group';
17
18 // Generate array of navigation items.
19 $tabs = array();
20 if ( isset( $submenu[ $parent_slug ] ) ) {
21 foreach ( $submenu[ $parent_slug ] as $i => $sub_item ) {
22
23 // Check user can access page.
24 if ( ! current_user_can( $sub_item[1] ) ) {
25 continue;
26 }
27
28 // Ignore "Add New".
29 if ( $i === 1 ) {
30 continue;
31 }
32
33 // Define tab.
34 $tab = array(
35 'text' => $sub_item[0],
36 'url' => $sub_item[2],
37 );
38
39 // Convert submenu slug "test" to "$parent_slug&page=test".
40 if ( ! strpos( $sub_item[2], '.php' ) ) {
41 $tab['url'] = add_query_arg( array( 'page' => $sub_item[2] ), $parent_slug );
42 }
43
44 // Detect active state.
45 if ( $submenu_file === $sub_item[2] || $plugin_page === $sub_item[2] ) {
46 $tab['is_active'] = true;
47 }
48
49 // Special case for "Add New" page.
50 if ( $i === 0 && $submenu_file === 'post-new.php?post_type=acf-field-group' ) {
51 $tab['is_active'] = true;
52 }
53 $tabs[] = $tab;
54 }
55 }
56
57 /**
58 * Filters the admin navigation tabs.
59 *
60 * @date 27/3/20
61 * @since 5.9.0
62 *
63 * @param array $tabs The array of navigation tabs.
64 */
65 $tabs = apply_filters( 'acf/admin/toolbar', $tabs );
66
67 // Bail early if set to false.
68 if ( $tabs === false ) {
69 return;
70 }
71
72 ?>
73 <div class="acf-admin-toolbar">
74 <h2><i class="acf-tab-icon dashicons dashicons-welcome-widgets-menus"></i> <?php echo acf_get_setting( 'name' ); ?></h2>
75 <?php
76 foreach ( $tabs as $tab ) {
77 printf(
78 '<a class="acf-tab%s" href="%s">%s</a>',
79 ! empty( $tab['is_active'] ) ? ' is-active' : '',
80 esc_url( $tab['url'] ),
81 acf_esc_html( $tab['text'] )
82 );
83 }
84 ?>
85
86 <?php if ( ! defined( 'ACF_PRO' ) || ! ACF_PRO ) : ?>
87 <a target="_blank" href="https://www.advancedcustomfields.com/pro/?utm_source=ACF%2BFree&utm_medium=insideplugin&utm_campaign=ACF%2Bupgrade" class="btn-upgrade">
88 <img src="<?php echo acf_get_url( 'assets/images/icon-upgrade-pro.svg' ); ?>" />
89 <p><?php _e( 'Upgrade to Pro', 'acf' ); ?></p>
90 </a>
91 <?php endif; ?>
92
93 </div>
1 <?php
2
3 /**
4 * Network Admin Database Upgrade
5 *
6 * Shows the databse upgrade process.
7 *
8 * @date 24/8/18
9 * @since 5.7.4
10 * @param void
11 */
12
13 ?>
14 <style type="text/css">
15
16 /* hide steps */
17 .show-on-complete {
18 display: none;
19 }
20
21 </style>
22 <div id="acf-upgrade-wrap" class="wrap">
23
24 <h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
25
26 <p><?php echo sprintf( __( 'The following sites require a DB upgrade. Check the ones you want to update and then click %s.', 'acf' ), '"' . __( 'Upgrade Sites', 'acf' ) . '"' ); ?></p>
27 <p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites"></p>
28
29 <table class="wp-list-table widefat">
30 <thead>
31 <tr>
32 <td class="manage-column check-column" scope="col">
33 <input type="checkbox" id="sites-select-all">
34 </td>
35 <th class="manage-column" scope="col" style="width:33%;">
36 <label for="sites-select-all"><?php _e( 'Site', 'acf' ); ?></label>
37 </th>
38 <th><?php _e( 'Description', 'acf' ); ?></th>
39 </tr>
40 </thead>
41 <tfoot>
42 <tr>
43 <td class="manage-column check-column" scope="col">
44 <input type="checkbox" id="sites-select-all-2">
45 </td>
46 <th class="manage-column" scope="col">
47 <label for="sites-select-all-2"><?php _e( 'Site', 'acf' ); ?></label>
48 </th>
49 <th><?php _e( 'Description', 'acf' ); ?></th>
50 </tr>
51 </tfoot>
52 <tbody id="the-list">
53 <?php
54
55 $sites = acf_get_sites();
56 if ( $sites ) :
57 foreach ( $sites as $i => $site ) :
58
59 // switch blog
60 switch_to_blog( $site['blog_id'] );
61
62 ?>
63 <tr
64 <?php
65 if ( $i % 2 == 0 ) :
66 ?>
67 class="alternate"<?php endif; ?>>
68 <th class="check-column" scope="row">
69 <?php if ( acf_has_upgrade() ) : ?>
70 <input type="checkbox" value="<?php echo $site['blog_id']; ?>" name="checked[]">
71 <?php endif; ?>
72 </th>
73 <td>
74 <strong><?php echo get_bloginfo( 'name' ); ?></strong><br /><?php echo home_url(); ?>
75 </td>
76 <td>
77 <?php if ( acf_has_upgrade() ) : ?>
78 <span class="response"><?php printf( __( 'Site requires database upgrade from %1$s to %2$s', 'acf' ), acf_get_db_version(), ACF_VERSION ); ?></span>
79 <?php else : ?>
80 <?php _e( 'Site is up to date', 'acf' ); ?>
81 <?php endif; ?>
82 </td>
83 </tr>
84 <?php
85
86 // restore
87 restore_current_blog();
88
89 endforeach;
90 endif;
91
92 ?>
93 </tbody>
94 </table>
95
96 <p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites-2"></p>
97 <p class="show-on-complete"><?php echo sprintf( __( 'Database Upgrade complete. <a href="%s">Return to network dashboard</a>', 'acf' ), network_admin_url() ); ?></p>
98
99 <script type="text/javascript">
100 (function($) {
101
102 var upgrader = new acf.Model({
103 events: {
104 'click #upgrade-sites': 'onClick',
105 'click #upgrade-sites-2': 'onClick'
106 },
107 $inputs: function(){
108 return $('#the-list input:checked');
109 },
110 onClick: function( e, $el ){
111
112 // prevent default
113 e.preventDefault();
114
115 // bail early if no selection
116 if( !this.$inputs().length ) {
117 return alert('<?php _e( 'Please select at least one site to upgrade.', 'acf' ); ?>');
118 }
119
120 // confirm action
121 if( !confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>") ) {
122 return;
123 }
124
125 // upgrade
126 this.upgrade();
127 },
128 upgrade: function(){
129
130 // vars
131 var $inputs = this.$inputs();
132
133 // bail early if no sites selected
134 if( !$inputs.length ) {
135 return this.complete();
136 }
137
138 // disable buttons
139 $('.button').prop('disabled', true);
140
141 // vars
142 var $input = $inputs.first();
143 var $row = $input.closest('tr');
144 var text = '';
145 var success = false;
146
147 // show loading
148 $row.find('.response').html('<i class="acf-loading"></i></span> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?>');
149
150 // send ajax request to upgrade DB
151 $.ajax({
152 url: acf.get('ajaxurl'),
153 dataType: 'json',
154 type: 'post',
155 data: acf.prepareForAjax({
156 action: 'acf/ajax/upgrade',
157 blog_id: $input.val()
158 }),
159 success: function( json ){
160 success = true;
161 $input.remove();
162 text = '<?php _e( 'Upgrade complete.', 'acf' ); ?>';
163 },
164 error: function( jqXHR, textStatus, errorThrown ){
165 text = '<?php _e( 'Upgrade failed.', 'acf' ); ?>';
166 if( error = acf.getXhrError(jqXHR) ) {
167 text += ' <code>' + error + '</code>';
168 }
169 },
170 complete: this.proxy(function(){
171
172 // display text
173 $row.find('.response').html( text );
174
175 // if successful upgrade, proceed to next site. Otherwise, skip to complete.
176 if( success ) {
177 this.upgrade();
178 } else {
179 this.complete();
180 }
181 })
182 });
183 },
184 complete: function(){
185
186 // enable buttons
187 $('.button').prop('disabled', false);
188
189 // show message
190 $('.show-on-complete').show();
191 }
192 });
193
194 })(jQuery);
195 </script>
196 </div>
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.