PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.8.8.9
Advanced Custom Fields: Extended v0.8.8.9
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 3 years ago field-groups 3 years ago fields 3 years ago fields-settings 3 years ago locations 3 years ago modules 3 years ago screens 3 years ago acfe-field-functions.php 3 years ago acfe-field-group-functions.php 3 years ago acfe-file-functions.php 3 years ago acfe-form-functions.php 3 years ago acfe-helper-functions.php 3 years ago acfe-meta-functions.php 3 years ago acfe-post-functions.php 3 years ago acfe-screen-functions.php 3 years ago acfe-template-functions.php 3 years ago acfe-term-functions.php 3 years ago acfe-user-functions.php 3 years ago acfe-wp-functions.php 3 years ago assets.php 3 years ago compatibility.php 3 years ago field-extend.php 3 years ago field.php 3 years ago hooks.php 3 years ago init.php 3 years ago local-meta.php 3 years ago multilang.php 3 years ago settings.php 3 years ago third-party.php 3 years ago upgrades.php 3 years ago
assets.php
197 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 /**
12 * construct
13 */
14 function __construct(){
15
16 // Hooks
17 add_action('init', array($this, 'init'));
18 add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
19 add_action('acf/admin_enqueue_scripts', array($this, 'acf_admin_enqueue_scripts'));
20 add_action('acf/input/admin_enqueue_scripts', array($this, 'acf_input_admin_enqueue_scripts'));
21 add_action('acf/enqueue_scripts', array($this, 'acf_enqueue_scripts'), 99);
22
23 }
24
25
26 /**
27 * init
28 */
29 function init(){
30
31 // vars
32 $version = ACFE_VERSION;
33 $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
34
35 // register scripts
36 wp_register_script('acf-extended', acfe_get_url("assets/js/acfe{$min}.js"), array('acf'), $version);
37 wp_register_script('acf-extended-input', acfe_get_url("assets/js/acfe-input{$min}.js"), array('acf-extended', 'acf-input'), $version);
38 wp_register_script('acf-extended-admin', acfe_get_url("assets/js/acfe-admin{$min}.js"), array('acf-extended'), $version);
39 wp_register_script('acf-extended-field-group', acfe_get_url("assets/js/acfe-field-group{$min}.js"), array('acf-extended', 'acf-field-group'), $version);
40 wp_register_script('acf-extended-ui', acfe_get_url("assets/js/acfe-ui{$min}.js"), array('acf-extended'), $version);
41
42 // register styles
43 wp_register_style('acf-extended', acfe_get_url("assets/css/acfe{$min}.css"), array(), $version);
44 wp_register_style('acf-extended-input', acfe_get_url("assets/css/acfe-input{$min}.css"), array(), $version);
45 wp_register_style('acf-extended-admin', acfe_get_url("assets/css/acfe-admin{$min}.css"), array(), $version);
46 wp_register_style('acf-extended-field-group', acfe_get_url("assets/css/acfe-field-group{$min}.css"), array(), $version);
47 wp_register_style('acf-extended-ui', acfe_get_url("assets/css/acfe-ui{$min}.css"), array(), $version);
48
49 }
50
51
52 /**
53 * admin_enqueue_scripts
54 *
55 * All admin pages
56 */
57 function admin_enqueue_scripts(){
58
59 // admin
60 wp_enqueue_style('acf-extended-admin');
61
62 // field groups
63 if(acf_is_screen(array('edit-acf-field-group', 'acf-field-group'))){
64 wp_enqueue_style('acf-extended-field-group');
65 }
66
67 }
68
69
70 /**
71 * acf_admin_enqueue_scripts
72 *
73 * acf/admin_enqueue_scripts
74 *
75 * When acf_enqueue_script('acf') is used
76 */
77 function acf_admin_enqueue_scripts(){
78
79 // global
80 wp_enqueue_style('acf-extended');
81 wp_enqueue_script('acf-extended');
82
83 }
84
85
86 /**
87 * acf_input_admin_enqueue_scripts
88 *
89 * acf/input/admin_enqueue_scripts
90 *
91 * When acf_enqueue_scripts() is used (including acf-input.js)
92 */
93 function acf_input_admin_enqueue_scripts(){
94
95 // input
96 wp_enqueue_style('acf-extended-input');
97 wp_enqueue_script('acf-extended-input');
98
99 // admin
100 if(is_admin()){
101 wp_enqueue_script('acf-extended-admin');
102 }
103
104 // field group
105 if(acf_is_screen(array('acf-field-group'))){
106 wp_enqueue_script('acf-extended-field-group');
107 }
108
109 }
110
111 /**
112 * acf_enqueue_scripts
113 *
114 * acf/enqueue_scripts:99
115 *
116 * When acf_enqueue_script('acf') is used (late)
117 */
118 function acf_enqueue_scripts(){
119
120 // data
121 $data = array(
122 'version' => ACFE_VERSION,
123 'home_url' => home_url(),
124 'is_admin' => is_admin(),
125 'is_user_logged_in' => is_user_logged_in(),
126 );
127
128 // text
129 $text = array(
130 'Close' => __('Close', 'acfe'),
131 'Read more' => __('Read more', 'acfe'),
132 'Details' => __('Details', 'acfe'),
133 'Debug' => __('Debug', 'acfe'),
134 );
135
136 // filters
137 $data = apply_filters('acfe/localize_data', $data);
138 $text = apply_filters('acfe/localize_text', $text);
139
140 // localize
141 acfe_localize_data($data);
142 acf_localize_text($text);
143
144 }
145
146 }
147
148 new acfe_assets();
149
150 endif;
151
152 /**
153 * acfe_localize_data
154 *
155 * @param $data
156 */
157 function acfe_localize_data($data){
158
159 $acfe_data = acfe_get_localize_data();
160 $acfe_data = array_merge($acfe_data, $data);
161
162 acf_localize_data(array('acfe' => $acfe_data));
163
164 }
165
166
167 /**
168 * acfe_get_localize_data
169 * @return array|false|string[]
170 */
171 function acfe_get_localize_data(){
172
173 return acf_get_array(acf_maybe_get(acf_get_instance('ACF_Assets')->data, 'acfe', array()));
174
175 }
176
177
178 /**
179 * acfe_localize_append_data
180 *
181 * @param $name
182 * @param $data
183 */
184 function acfe_append_localize_data($name, $data){
185
186 $acfe_data = acfe_get_localize_data();
187
188 if(!isset($acfe_data[ $name ])){
189 $acfe_data[ $name ] = array();
190 }
191
192 $acfe_data[ $name ] = acf_get_array($acfe_data[ $name ]);
193 $acfe_data[ $name ][] = $data;
194
195 acfe_localize_data($acfe_data);
196
197 }