PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / trunk
Advanced Custom Fields: Extended vtrunk
0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / assets.php
acf-extended / includes Last commit date
admin 1 month ago field-groups 1 month ago fields 1 month ago fields-settings 1 month ago forms 1 month ago locations 1 month ago modules 1 month ago screens 1 month ago acfe-deprecated-functions.php 2 years ago acfe-field-functions.php 1 month ago acfe-field-group-functions.php 1 month ago acfe-file-functions.php 1 year ago acfe-form-functions.php 1 month ago acfe-helper-array-functions.php 1 month ago acfe-helper-functions.php 1 month ago acfe-helper-multi-functions.php 1 month ago acfe-helper-string-functions.php 1 month ago acfe-meta-functions.php 1 month ago acfe-post-functions.php 1 month ago acfe-screen-functions.php 1 month ago acfe-template-functions.php 1 month ago acfe-term-functions.php 1 month ago acfe-user-functions.php 1 month ago acfe-wp-functions.php 3 years ago assets.php 1 month ago compatibility-acf-5.8.php 2 months ago compatibility-acf-5.9.php 1 month ago compatibility-acf-6.5.php 1 month ago compatibility.php 1 month ago field-extend.php 2 months ago field.php 2 months ago hooks.php 1 month ago init.php 1 month ago local-meta.php 3 years ago media.php 1 month ago module-acf.php 1 month ago module-db.php 1 month ago module-l10n.php 1 month ago module-legacy.php 3 years ago module-manager.php 2 months ago module-post.php 1 month ago module-posts.php 2 months ago module-upgrades.php 3 years ago module.php 1 month ago multilang.php 1 month ago revisions.php 2 months ago screen.php 1 month ago settings.php 1 month ago template-tags.php 1 month ago third-party.php 3 years ago upgrades.php 1 month ago
assets.php
265 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_assets')):
8
9 class acfe_assets{
10
11 public $data = array();
12
13 /**
14 * construct
15 */
16 function __construct(){
17
18 // Hooks
19 add_action('init', array($this, 'init'));
20 add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
21 add_action('acf/admin_enqueue_scripts', array($this, 'acf_admin_enqueue_scripts'));
22 add_action('acf/input/admin_enqueue_scripts', array($this, 'acf_input_admin_enqueue_scripts'));
23 add_action('acf/enqueue_scripts', array($this, 'acf_enqueue_scripts'), 99);
24
25 }
26
27
28 /**
29 * init
30 */
31 function init(){
32
33 // vars
34 $version = ACFE_VERSION;
35 $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
36
37 // register scripts
38 wp_register_script('acf-extended', acfe_get_url("assets/js/acfe{$min}.js"), array('acf'), $version);
39 wp_register_script('acf-extended-input', acfe_get_url("assets/js/acfe-input{$min}.js"), array('acf-extended', 'acf-input'), $version);
40 wp_register_script('acf-extended-admin', acfe_get_url("assets/js/acfe-admin{$min}.js"), array('acf-extended'), $version);
41 wp_register_script('acf-extended-field-group', acfe_get_url("assets/js/acfe-field-group{$min}.js"), array('acf-extended', 'acf-field-group'), $version);
42 wp_register_script('acf-extended-ui', acfe_get_url("assets/js/acfe-ui{$min}.js"), array('acf-extended'), $version);
43
44 // register styles
45 wp_register_style('acf-extended', acfe_get_url("assets/css/acfe{$min}.css"), array(), $version);
46 wp_register_style('acf-extended-input', acfe_get_url("assets/css/acfe-input{$min}.css"), array(), $version);
47 wp_register_style('acf-extended-admin', acfe_get_url("assets/css/acfe-admin{$min}.css"), array(), $version);
48 wp_register_style('acf-extended-admin-input', acfe_get_url("assets/css/acfe-admin-input{$min}.css"), array(), $version);
49 wp_register_style('acf-extended-field-group', acfe_get_url("assets/css/acfe-field-group{$min}.css"), array(), $version);
50 wp_register_style('acf-extended-ui', acfe_get_url("assets/css/acfe-ui{$min}.css"), array(), $version);
51
52 }
53
54
55 /**
56 * admin_enqueue_scripts
57 *
58 * All WP admin pages
59 */
60 function admin_enqueue_scripts(){
61
62 // admin
63 wp_enqueue_style('acf-extended-admin');
64
65 // admin (not internal acf pages)
66 if(!acf_is_filter_enabled('acfe/acf_internal_page')){
67 wp_enqueue_style('acf-extended-admin-input');
68 }
69
70 // field groups
71 if(acf_is_screen(array('edit-acf-field-group', 'acf-field-group'))){
72 wp_enqueue_style('acf-extended-field-group');
73 }
74
75 }
76
77
78 /**
79 * acf_admin_enqueue_scripts
80 *
81 * acf/admin_enqueue_scripts
82 *
83 * When acf_enqueue_script('acf') is used
84 */
85 function acf_admin_enqueue_scripts(){
86
87 // global
88 wp_enqueue_style('acf-extended');
89 wp_enqueue_script('acf-extended');
90
91 }
92
93
94 /**
95 * acf_input_admin_enqueue_scripts
96 *
97 * acf/input/admin_enqueue_scripts
98 *
99 * When acf_enqueue_scripts() is used (including acf-input.js)
100 */
101 function acf_input_admin_enqueue_scripts(){
102
103 // input
104 wp_enqueue_style('acf-extended-input');
105 wp_enqueue_script('acf-extended-input');
106
107 // admin
108 if(is_admin()){
109 wp_enqueue_script('acf-extended-admin');
110 }
111
112 // field group
113 if(acf_is_screen(array('acf-field-group'))){
114 wp_enqueue_script('acf-extended-field-group');
115 }
116
117 }
118
119 /**
120 * acf_enqueue_scripts
121 *
122 * acf/enqueue_scripts:99
123 *
124 * When acf_enqueue_script('acf') is used (late)
125 */
126 function acf_enqueue_scripts(){
127
128 // text
129 $text = apply_filters('acfe/localize_text', array(
130 'Apply' => __('Apply', 'acfe'),
131 'Close' => __('Close', 'acfe'),
132 'Update' => __('Update', 'acfe'),
133 'Read more' => __('Read more', 'acfe'),
134 'Details' => __('Details', 'acfe'),
135 'Debug' => __('Debug', 'acfe'),
136 'Local file is different from the version in database.' => __('Local file is different from the version in database.', 'acfe'),
137 'Do you want to replace the local file with the current settings?' => __('Do you want to replace the local file with the current settings?', 'acfe'),
138 ));
139
140 acf_localize_text($text);
141
142 // data
143 $data = apply_filters('acfe/localize_data', array(
144 'version' => ACFE_VERSION,
145 'home_url' => home_url(),
146 'is_admin' => is_admin(),
147 'is_user_logged_in' => is_user_logged_in(),
148 ));
149
150 // set data
151 $this->set_data($data);
152
153 // localize
154 acfe_localize_data();
155
156 }
157
158
159 /**
160 * get_data
161 *
162 * @param $path
163 * @param $default
164 *
165 * @return array|mixed|null
166 */
167 function get_data($path = null, $default = null){
168 return !$path ? $this->data : acfe_get($this->data, $path, $default);
169 }
170
171
172 /**
173 * set_data
174 *
175 * @param $path
176 * @param $value
177 *
178 * @return void
179 */
180 function set_data($path = null, $value = null){
181
182 if($value === null){
183 $value = $path;
184 $path = null;
185 }
186
187 if(!$path){
188 $this->data = array_merge($this->data, $value);
189 }else{
190 acfe_set($this->data, $path, $value);
191 }
192
193 }
194
195
196 /**
197 * unset_data
198 *
199 * @param $path
200 *
201 * @return void
202 */
203 function unset_data($path = null){
204
205 if(!$path){
206 $this->data = array();
207 }else{
208 acfe_unset($this->data, $path);
209 }
210
211 }
212
213 }
214
215 acf_new_instance('acfe_assets');
216
217 endif;
218
219
220 /**
221 * acfe_localize_data
222 *
223 * @return void
224 */
225 function acfe_localize_data(){
226 acf_localize_data(array('acfe' => acfe_get_localize_data()));
227 }
228
229
230 /**
231 * acfe_get_localize_data
232 *
233 * @return array|false|string[]
234 */
235 function acfe_get_localize_data($path = null, $default = null){
236 return acf_get_instance('acfe_assets')->get_data($path, $default);
237 }
238
239
240 /**
241 * acfe_set_localize_data
242 *
243 * @param null $path
244 * @param null $value
245 */
246 function acfe_set_localize_data($path = null, $value = null){
247 acf_get_instance('acfe_assets')->set_data($path, $value);
248 acfe_localize_data();
249 }
250
251
252 /**
253 * acfe_append_localize_data
254 *
255 * @param $path
256 * @param $value
257 *
258 * @return void
259 *
260 * @deprecated
261 */
262 function acfe_append_localize_data($path = null, $value = null){
263 acfe_deprecated_function('acfe_append_localize_data()', '0.9.0.5', 'acfe_set_localize_data()');
264 acfe_set_localize_data($path, $value);
265 }