Version Description
- Fixing double admin notifications
- Fixing settings issue with Simple Solid Lite template
Download this release
Release Info
Developer | adbox |
Plugin | WordPress Landing Pages |
Version | 2.3.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.3 to 2.3.4
- landing-pages.php +2 -2
- readme.txt +5 -1
- shared/assets/plugins/advanced-custom-fields/acf.php +34 -58
- shared/assets/plugins/advanced-custom-fields/core/api.php +276 -276
- shared/assets/plugins/advanced-custom-fields/core/controllers/addons.php +4 -4
- shared/assets/plugins/advanced-custom-fields/core/controllers/everything_fields.php +13 -30
- shared/assets/plugins/advanced-custom-fields/core/controllers/field_group.php +1 -3
- shared/assets/plugins/advanced-custom-fields/core/controllers/field_groups.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/controllers/revisions.php +3 -3
- shared/assets/plugins/advanced-custom-fields/core/fields/date_picker/date_picker.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/file.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/google-map.php +0 -46
- shared/assets/plugins/advanced-custom-fields/core/fields/image.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/relationship.php +7 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/select.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/text.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/textarea.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/wysiwyg.php +1 -2
- shared/assets/plugins/advanced-custom-fields/css/field-group.css +1 -3
- shared/assets/plugins/advanced-custom-fields/css/input.css +3 -8
- shared/assets/plugins/advanced-custom-fields/js/field-group.js +10 -78
- shared/assets/plugins/advanced-custom-fields/js/field-group.min.js +8 -1
- shared/assets/plugins/advanced-custom-fields/js/input.js +126 -221
- shared/assets/plugins/advanced-custom-fields/js/input.min.js +2 -2
- shared/classes/class.form.php +1 -1
- shared/shortcodes/shortcodes/button.php +1 -1
landing-pages.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Landing Pages
|
4 |
Plugin URI: http://www.inboundnow.com/landing-pages/
|
5 |
Description: Landing page template framework with variant testing and lead capturing through cooperation with Inbound Now's Leads plugin. This is the stand alone version served through WordPress.org.
|
6 |
-
Version: 2.3.
|
7 |
Author: Inbound Now
|
8 |
Author URI: http://www.inboundnow.com/
|
9 |
|
@@ -37,7 +37,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
|
|
37 |
*/
|
38 |
private static function load_constants() {
|
39 |
|
40 |
-
define('LANDINGPAGES_CURRENT_VERSION', '2.3.
|
41 |
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
|
42 |
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
43 |
define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
|
3 |
Plugin Name: Landing Pages
|
4 |
Plugin URI: http://www.inboundnow.com/landing-pages/
|
5 |
Description: Landing page template framework with variant testing and lead capturing through cooperation with Inbound Now's Leads plugin. This is the stand alone version served through WordPress.org.
|
6 |
+
Version: 2.3.4
|
7 |
Author: Inbound Now
|
8 |
Author URI: http://www.inboundnow.com/
|
9 |
|
37 |
*/
|
38 |
private static function load_constants() {
|
39 |
|
40 |
+
define('LANDINGPAGES_CURRENT_VERSION', '2.3.4' );
|
41 |
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
|
42 |
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
43 |
define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
7 |
Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
|
8 |
Requires at least: 3.8
|
9 |
Tested up to: 4.6.0
|
10 |
-
Stable Tag: 2.3.
|
11 |
|
12 |
Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
|
13 |
|
@@ -70,6 +70,10 @@ The plugin is also fully extendable and has a number of actions, filters, and ho
|
|
70 |
|
71 |
== Changelog ==
|
72 |
|
|
|
|
|
|
|
|
|
73 |
= 2.3.3 =
|
74 |
* Updating ACF4
|
75 |
* Adding support for Inbound Forms without redirect URLs (no ajax)
|
7 |
Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
|
8 |
Requires at least: 3.8
|
9 |
Tested up to: 4.6.0
|
10 |
+
Stable Tag: 2.3.4
|
11 |
|
12 |
Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
|
13 |
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 2.3.4 =
|
74 |
+
* Fixing double admin notifications
|
75 |
+
* Fixing settings issue with Simple Solid Lite template
|
76 |
+
|
77 |
= 2.3.3 =
|
78 |
* Updating ACF4
|
79 |
* Adding support for Inbound Forms without redirect URLs (no ajax)
|
shared/assets/plugins/advanced-custom-fields/acf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://www.advancedcustomfields.com/
|
5 |
Description: Customise WordPress with powerful, professional and intuitive fields
|
6 |
-
Version: 4.4.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -43,7 +43,7 @@ class acf
|
|
43 |
'path' => apply_filters('acf/helpers/get_path', __FILE__),
|
44 |
'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
|
45 |
'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
|
46 |
-
'version' => '4.4.
|
47 |
'upgrade_version' => '3.4.1',
|
48 |
'include_3rd_party' => false
|
49 |
);
|
@@ -159,63 +159,42 @@ class acf
|
|
159 |
* @return {mixed} $post_id
|
160 |
*/
|
161 |
|
162 |
-
function get_post_id( $post_id )
|
163 |
-
|
164 |
-
//
|
165 |
-
if( !$post_id )
|
166 |
-
|
167 |
-
|
168 |
-
$post_id = (int) get_the_ID();
|
169 |
-
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
$post_id = get_queried_object();
|
175 |
-
|
176 |
}
|
177 |
-
|
178 |
}
|
179 |
|
180 |
|
181 |
-
//
|
182 |
-
if(
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
$post_id = 'user_' . $post_id->ID;
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
$post_id = $post_id->taxonomy . '_' . $post_id->term_id;
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
$post_id = 'comment_' . $post_id->comment_ID;
|
198 |
-
|
199 |
-
// post
|
200 |
-
} elseif( isset($post_id->ID) ) {
|
201 |
-
|
202 |
$post_id = $post_id->ID;
|
203 |
-
|
204 |
-
// default
|
205 |
-
} else {
|
206 |
-
|
207 |
-
$post_id = 0;
|
208 |
-
|
209 |
}
|
210 |
-
|
211 |
-
}
|
212 |
-
|
213 |
-
|
214 |
-
// allow for option == options
|
215 |
-
if( $post_id === 'option' ) {
|
216 |
-
|
217 |
-
$post_id = 'options';
|
218 |
-
|
219 |
}
|
220 |
|
221 |
|
@@ -230,16 +209,13 @@ class acf
|
|
230 |
* the user wants to load data from a completely different post_id
|
231 |
*/
|
232 |
|
233 |
-
if( isset($_GET['preview_id']) )
|
234 |
-
|
235 |
$autosave = wp_get_post_autosave( $_GET['preview_id'] );
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
$post_id = (int) $autosave->ID;
|
240 |
-
|
241 |
}
|
242 |
-
|
243 |
}
|
244 |
|
245 |
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://www.advancedcustomfields.com/
|
5 |
Description: Customise WordPress with powerful, professional and intuitive fields
|
6 |
+
Version: 4.4.3
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
43 |
'path' => apply_filters('acf/helpers/get_path', __FILE__),
|
44 |
'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
|
45 |
'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
|
46 |
+
'version' => '4.4.3',
|
47 |
'upgrade_version' => '3.4.1',
|
48 |
'include_3rd_party' => false
|
49 |
);
|
159 |
* @return {mixed} $post_id
|
160 |
*/
|
161 |
|
162 |
+
function get_post_id( $post_id )
|
163 |
+
{
|
164 |
+
// set post_id to global
|
165 |
+
if( !$post_id )
|
166 |
+
{
|
167 |
+
global $post;
|
|
|
|
|
168 |
|
169 |
+
if( $post )
|
170 |
+
{
|
171 |
+
$post_id = intval( $post->ID );
|
|
|
|
|
172 |
}
|
|
|
173 |
}
|
174 |
|
175 |
|
176 |
+
// allow for option == options
|
177 |
+
if( $post_id == "option" )
|
178 |
+
{
|
179 |
+
$post_id = "options";
|
180 |
+
}
|
181 |
+
|
182 |
+
|
183 |
+
// object
|
184 |
+
if( is_object($post_id) )
|
185 |
+
{
|
186 |
+
if( isset($post_id->roles, $post_id->ID) )
|
187 |
+
{
|
188 |
$post_id = 'user_' . $post_id->ID;
|
189 |
+
}
|
190 |
+
elseif( isset($post_id->taxonomy, $post_id->term_id) )
|
191 |
+
{
|
|
|
192 |
$post_id = $post_id->taxonomy . '_' . $post_id->term_id;
|
193 |
+
}
|
194 |
+
elseif( isset($post_id->ID) )
|
195 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
$post_id = $post_id->ID;
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
|
200 |
|
209 |
* the user wants to load data from a completely different post_id
|
210 |
*/
|
211 |
|
212 |
+
if( isset($_GET['preview_id']) )
|
213 |
+
{
|
214 |
$autosave = wp_get_post_autosave( $_GET['preview_id'] );
|
215 |
+
if( $autosave->post_parent == $post_id )
|
216 |
+
{
|
217 |
+
$post_id = intval( $autosave->ID );
|
|
|
|
|
218 |
}
|
|
|
219 |
}
|
220 |
|
221 |
|
shared/assets/plugins/advanced-custom-fields/core/api.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
*/
|
18 |
|
19 |
function get_field_reference( $field_name, $post_id ) {
|
20 |
-
|
21 |
// cache
|
22 |
$found = false;
|
23 |
$cache = wp_cache_get( 'field_reference/post_id=' . $post_id . '/name=' . $field_name, 'acf', false, $found );
|
@@ -26,33 +26,33 @@ function get_field_reference( $field_name, $post_id ) {
|
|
26 |
{
|
27 |
return $cache;
|
28 |
}
|
29 |
-
|
30 |
-
|
31 |
// vars
|
32 |
$return = '';
|
33 |
|
34 |
-
|
35 |
// get field key
|
36 |
if( is_numeric($post_id) )
|
37 |
{
|
38 |
-
$return = get_post_meta($post_id, '_' . $field_name, true);
|
39 |
}
|
40 |
elseif( strpos($post_id, 'user_') !== false )
|
41 |
{
|
42 |
$temp_post_id = str_replace('user_', '', $post_id);
|
43 |
-
$return = get_user_meta($temp_post_id, '_' . $field_name, true);
|
44 |
}
|
45 |
else
|
46 |
{
|
47 |
-
$return = get_option('_' . $post_id . '_' . $field_name);
|
48 |
}
|
49 |
-
|
50 |
-
|
51 |
// set cache
|
52 |
wp_cache_set( 'field_reference/post_id=' . $post_id . '/name=' . $field_name, $return, 'acf' );
|
53 |
-
|
54 |
-
|
55 |
-
// return
|
56 |
return $return;
|
57 |
}
|
58 |
|
@@ -73,11 +73,11 @@ function get_field_reference( $field_name, $post_id ) {
|
|
73 |
*/
|
74 |
|
75 |
function get_field_objects( $post_id = false, $options = array() ) {
|
76 |
-
|
77 |
// global
|
78 |
global $wpdb;
|
79 |
-
|
80 |
-
|
81 |
// filter post_id
|
82 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
83 |
|
@@ -85,8 +85,8 @@ function get_field_objects( $post_id = false, $options = array() ) {
|
|
85 |
// vars
|
86 |
$field_key = '';
|
87 |
$value = array();
|
88 |
-
|
89 |
-
|
90 |
// get field_names
|
91 |
if( is_numeric($post_id) )
|
92 |
{
|
@@ -100,7 +100,7 @@ function get_field_objects( $post_id = false, $options = array() ) {
|
|
100 |
elseif( strpos($post_id, 'user_') !== false )
|
101 |
{
|
102 |
$user_id = str_replace('user_', '', $post_id);
|
103 |
-
|
104 |
$keys = $wpdb->get_col($wpdb->prepare(
|
105 |
"SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d and meta_key LIKE %s AND meta_value LIKE %s",
|
106 |
$user_id,
|
@@ -112,7 +112,7 @@ function get_field_objects( $post_id = false, $options = array() ) {
|
|
112 |
{
|
113 |
$keys = $wpdb->get_col($wpdb->prepare(
|
114 |
"SELECT option_value FROM $wpdb->options WHERE option_name LIKE %s",
|
115 |
-
'_' . $post_id . '_%'
|
116 |
));
|
117 |
}
|
118 |
|
@@ -122,24 +122,24 @@ function get_field_objects( $post_id = false, $options = array() ) {
|
|
122 |
foreach( $keys as $key )
|
123 |
{
|
124 |
$field = get_field_object( $key, $post_id, $options );
|
125 |
-
|
126 |
if( !is_array($field) )
|
127 |
{
|
128 |
continue;
|
129 |
}
|
130 |
-
|
131 |
$value[ $field['name'] ] = $field;
|
132 |
}
|
133 |
}
|
134 |
-
|
135 |
-
|
136 |
// no value
|
137 |
if( empty($value) )
|
138 |
{
|
139 |
return false;
|
140 |
}
|
141 |
-
|
142 |
-
|
143 |
// return
|
144 |
return $value;
|
145 |
}
|
@@ -161,16 +161,16 @@ function get_field_objects( $post_id = false, $options = array() ) {
|
|
161 |
*/
|
162 |
|
163 |
function get_fields( $post_id = false, $format_value = true ) {
|
164 |
-
|
165 |
// vars
|
166 |
$options = array(
|
167 |
'load_value' => true,
|
168 |
'format_value' => $format_value
|
169 |
);
|
170 |
-
|
171 |
-
|
172 |
$fields = get_field_objects( $post_id, $options );
|
173 |
-
|
174 |
if( is_array($fields) )
|
175 |
{
|
176 |
foreach( $fields as $k => $field )
|
@@ -178,8 +178,8 @@ function get_fields( $post_id = false, $format_value = true ) {
|
|
178 |
$fields[ $k ] = $field['value'];
|
179 |
}
|
180 |
}
|
181 |
-
|
182 |
-
return $fields;
|
183 |
}
|
184 |
|
185 |
|
@@ -187,7 +187,7 @@ function get_fields( $post_id = false, $format_value = true ) {
|
|
187 |
* get_field()
|
188 |
*
|
189 |
* This function will return a custom field value for a specific field name/key + post_id.
|
190 |
-
* There is a 3rd parameter to turn on/off formating. This means that an Image field will not use
|
191 |
* its 'return option' to format the value but return only what was saved in the database
|
192 |
*
|
193 |
* @type function
|
@@ -200,9 +200,9 @@ function get_fields( $post_id = false, $format_value = true ) {
|
|
200 |
*
|
201 |
* @return mixed $value: the value found
|
202 |
*/
|
203 |
-
|
204 |
function get_field( $field_key, $post_id = false, $format_value = true ) {
|
205 |
-
|
206 |
// vars
|
207 |
$return = false;
|
208 |
$options = array(
|
@@ -210,18 +210,18 @@ function get_field( $field_key, $post_id = false, $format_value = true ) {
|
|
210 |
'format_value' => $format_value
|
211 |
);
|
212 |
|
213 |
-
|
214 |
$field = get_field_object( $field_key, $post_id, $options);
|
215 |
-
|
216 |
-
|
217 |
if( is_array($field) )
|
218 |
{
|
219 |
$return = $field['value'];
|
220 |
}
|
221 |
-
|
222 |
-
|
223 |
return $return;
|
224 |
-
|
225 |
}
|
226 |
|
227 |
|
@@ -244,41 +244,41 @@ function get_field( $field_key, $post_id = false, $format_value = true ) {
|
|
244 |
*/
|
245 |
|
246 |
function get_field_object( $field_key, $post_id = false, $options = array() ) {
|
247 |
-
|
248 |
// make sure add-ons are included
|
249 |
acf()->include_3rd_party();
|
250 |
-
|
251 |
-
|
252 |
// filter post_id
|
253 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
254 |
$field = false;
|
255 |
$orig_field_key = $field_key;
|
256 |
-
|
257 |
-
|
258 |
// defaults for options
|
259 |
$defaults = array(
|
260 |
'load_value' => true,
|
261 |
'format_value' => true,
|
262 |
);
|
263 |
-
|
264 |
$options = array_merge($defaults, $options);
|
265 |
-
|
266 |
-
|
267 |
// is $field_name a name? pre 3.4.0
|
268 |
if( substr($field_key, 0, 6) !== 'field_' )
|
269 |
{
|
270 |
// get field key
|
271 |
$field_key = get_field_reference( $field_key, $post_id );
|
272 |
}
|
273 |
-
|
274 |
-
|
275 |
// get field
|
276 |
if( substr($field_key, 0, 6) === 'field_' )
|
277 |
{
|
278 |
$field = apply_filters('acf/load_field', false, $field_key );
|
279 |
}
|
280 |
-
|
281 |
-
|
282 |
// validate field
|
283 |
if( !$field )
|
284 |
{
|
@@ -296,8 +296,8 @@ function get_field_object( $field_key, $post_id = false, $options = array() ) {
|
|
296 |
if( $options['load_value'] )
|
297 |
{
|
298 |
$field['value'] = apply_filters('acf/load_value', false, $post_id, $field);
|
299 |
-
|
300 |
-
|
301 |
// format value
|
302 |
if( $options['format_value'] )
|
303 |
{
|
@@ -327,14 +327,14 @@ function get_field_object( $field_key, $post_id = false, $options = array() ) {
|
|
327 |
*/
|
328 |
|
329 |
function the_field( $field_name, $post_id = false ) {
|
330 |
-
|
331 |
$value = get_field($field_name, $post_id);
|
332 |
-
|
333 |
if( is_array($value) )
|
334 |
{
|
335 |
$value = @implode(', ',$value);
|
336 |
}
|
337 |
-
|
338 |
echo $value;
|
339 |
}
|
340 |
|
@@ -343,7 +343,7 @@ function the_field( $field_name, $post_id = false ) {
|
|
343 |
* have_rows
|
344 |
*
|
345 |
* This function will instantiate a global variable containing the rows of a repeater or flexible content field,
|
346 |
-
* afterwhich, it will
|
347 |
*
|
348 |
* @type function
|
349 |
* @date 2/09/13
|
@@ -354,29 +354,29 @@ function the_field( $field_name, $post_id = false ) {
|
|
354 |
*/
|
355 |
|
356 |
function have_rows( $field_name, $post_id = false ) {
|
357 |
-
|
358 |
// vars
|
359 |
$depth = 0;
|
360 |
$row = array();
|
361 |
$new_parent_loop = false;
|
362 |
$new_child_loop = false;
|
363 |
-
|
364 |
-
|
365 |
// reference
|
366 |
$_post_id = $post_id;
|
367 |
-
|
368 |
-
|
369 |
// filter post_id
|
370 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
371 |
-
|
372 |
-
|
373 |
// empty?
|
374 |
if( empty($GLOBALS['acf_field']) )
|
375 |
{
|
376 |
// reset
|
377 |
reset_rows( true );
|
378 |
-
|
379 |
-
|
380 |
// create a new loop
|
381 |
$new_parent_loop = true;
|
382 |
}
|
@@ -385,8 +385,8 @@ function have_rows( $field_name, $post_id = false ) {
|
|
385 |
// vars
|
386 |
$row = end( $GLOBALS['acf_field'] );
|
387 |
$prev = prev( $GLOBALS['acf_field'] );
|
388 |
-
|
389 |
-
|
390 |
// If post_id has changed, this is most likely an archive loop
|
391 |
if( $post_id != $row['post_id'] )
|
392 |
{
|
@@ -422,7 +422,7 @@ function have_rows( $field_name, $post_id = false ) {
|
|
422 |
// case: Change in $field_name was due to this being a nested loop
|
423 |
// action: move down one level into a new loop
|
424 |
$new_child_loop = true;
|
425 |
-
|
426 |
}
|
427 |
else
|
428 |
{
|
@@ -430,20 +430,20 @@ function have_rows( $field_name, $post_id = false ) {
|
|
430 |
// action: leave this current loop alone and create a new parent loop
|
431 |
$new_parent_loop = true;
|
432 |
}
|
433 |
-
|
434 |
-
|
435 |
}
|
436 |
}
|
437 |
-
|
438 |
-
|
439 |
if( $new_parent_loop )
|
440 |
{
|
441 |
// vars
|
442 |
$f = get_field_object( $field_name, $post_id );
|
443 |
$v = $f['value'];
|
444 |
unset( $f['value'] );
|
445 |
-
|
446 |
-
|
447 |
// add row
|
448 |
$GLOBALS['acf_field'][] = array(
|
449 |
'name' => $field_name,
|
@@ -452,14 +452,14 @@ function have_rows( $field_name, $post_id = false ) {
|
|
452 |
'i' => -1,
|
453 |
'post_id' => $post_id,
|
454 |
);
|
455 |
-
|
456 |
}
|
457 |
elseif( $new_child_loop )
|
458 |
{
|
459 |
// vars
|
460 |
$f = acf_get_child_field_from_parent_field( $field_name, $row['field'] );
|
461 |
$v = $row['value'][ $row['i'] ][ $field_name ];
|
462 |
-
|
463 |
$GLOBALS['acf_field'][] = array(
|
464 |
'name' => $field_name,
|
465 |
'value' => $v,
|
@@ -468,27 +468,27 @@ function have_rows( $field_name, $post_id = false ) {
|
|
468 |
'post_id' => $post_id,
|
469 |
);
|
470 |
|
471 |
-
}
|
472 |
-
|
473 |
-
|
474 |
// update vars
|
475 |
$row = end( $GLOBALS['acf_field'] );
|
476 |
-
|
477 |
-
|
478 |
if( is_array($row['value']) && array_key_exists( $row['i']+1, $row['value'] ) )
|
479 |
{
|
480 |
// next row exists
|
481 |
return true;
|
482 |
}
|
483 |
-
|
484 |
-
|
485 |
// no next row!
|
486 |
reset_rows();
|
487 |
-
|
488 |
-
|
489 |
// return
|
490 |
return false;
|
491 |
-
|
492 |
}
|
493 |
|
494 |
|
@@ -506,21 +506,21 @@ function have_rows( $field_name, $post_id = false ) {
|
|
506 |
*/
|
507 |
|
508 |
function the_row() {
|
509 |
-
|
510 |
// vars
|
511 |
$depth = count( $GLOBALS['acf_field'] ) - 1;
|
512 |
|
513 |
-
|
514 |
-
|
515 |
// increase row
|
516 |
$GLOBALS['acf_field'][ $depth ]['i']++;
|
517 |
-
|
518 |
-
|
519 |
// get row
|
520 |
$value = $GLOBALS['acf_field'][ $depth ]['value'];
|
521 |
$i = $GLOBALS['acf_field'][ $depth ]['i'];
|
522 |
|
523 |
-
|
524 |
// return
|
525 |
return $value[ $i ];
|
526 |
}
|
@@ -541,7 +541,7 @@ function the_row() {
|
|
541 |
*/
|
542 |
|
543 |
function reset_rows( $hard_reset = false ) {
|
544 |
-
|
545 |
// completely destroy?
|
546 |
if( $hard_reset )
|
547 |
{
|
@@ -551,21 +551,21 @@ function reset_rows( $hard_reset = false ) {
|
|
551 |
{
|
552 |
// vars
|
553 |
$depth = count( $GLOBALS['acf_field'] ) - 1;
|
554 |
-
|
555 |
-
|
556 |
// remove
|
557 |
unset( $GLOBALS['acf_field'][$depth] );
|
558 |
-
|
559 |
-
|
560 |
// refresh index
|
561 |
$GLOBALS['acf_field'] = array_values($GLOBALS['acf_field']);
|
562 |
}
|
563 |
-
|
564 |
-
|
565 |
// return
|
566 |
return true;
|
567 |
-
|
568 |
-
|
569 |
}
|
570 |
|
571 |
|
@@ -573,7 +573,7 @@ function reset_rows( $hard_reset = false ) {
|
|
573 |
* has_sub_field()
|
574 |
*
|
575 |
* This function is used inside a while loop to return either true or false (loop again or stop).
|
576 |
-
* When using a repeater or flexible content field, it will loop through the rows until
|
577 |
* there are none left or a break is detected
|
578 |
*
|
579 |
* @type function
|
@@ -587,18 +587,18 @@ function reset_rows( $hard_reset = false ) {
|
|
587 |
*/
|
588 |
|
589 |
function has_sub_field( $field_name, $post_id = false ) {
|
590 |
-
|
591 |
// vars
|
592 |
$r = have_rows( $field_name, $post_id );
|
593 |
-
|
594 |
-
|
595 |
// if has rows, progress through 1 row for the while loop to work
|
596 |
if( $r )
|
597 |
{
|
598 |
the_row();
|
599 |
}
|
600 |
-
|
601 |
-
|
602 |
// return
|
603 |
return $r;
|
604 |
}
|
@@ -640,25 +640,25 @@ function has_sub_fields( $field_name, $post_id = false )
|
|
640 |
*/
|
641 |
|
642 |
function get_sub_field( $field_name ) {
|
643 |
-
|
644 |
// no field?
|
645 |
if( empty($GLOBALS['acf_field']) )
|
646 |
{
|
647 |
return false;
|
648 |
}
|
649 |
-
|
650 |
-
|
651 |
// vars
|
652 |
$row = end( $GLOBALS['acf_field'] );
|
653 |
-
|
654 |
-
|
655 |
// return value
|
656 |
if( isset($row['value'][ $row['i'] ][ $field_name ]) )
|
657 |
{
|
658 |
return $row['value'][ $row['i'] ][ $field_name ];
|
659 |
}
|
660 |
-
|
661 |
-
|
662 |
// return false
|
663 |
return false;
|
664 |
}
|
@@ -681,12 +681,12 @@ function get_sub_field( $field_name ) {
|
|
681 |
function the_sub_field($field_name)
|
682 |
{
|
683 |
$value = get_sub_field($field_name);
|
684 |
-
|
685 |
if(is_array($value))
|
686 |
{
|
687 |
$value = implode(', ',$value);
|
688 |
}
|
689 |
-
|
690 |
echo $value;
|
691 |
}
|
692 |
|
@@ -702,7 +702,7 @@ function the_sub_field($field_name)
|
|
702 |
*
|
703 |
* @param string $field_name: the name of the field - 'sub_heading'
|
704 |
*
|
705 |
-
* @return array $sub_field
|
706 |
*/
|
707 |
|
708 |
function get_sub_field_object( $child_name )
|
@@ -721,7 +721,7 @@ function get_sub_field_object( $child_name )
|
|
721 |
|
722 |
// return
|
723 |
return acf_get_child_field_from_parent_field( $child_name, $parent );
|
724 |
-
|
725 |
}
|
726 |
|
727 |
|
@@ -737,15 +737,15 @@ function get_sub_field_object( $child_name )
|
|
737 |
* @param string $child_name: the name of the field - 'sub_heading'
|
738 |
* @param array $parent: the parent field object
|
739 |
*
|
740 |
-
* @return array $sub_field
|
741 |
*/
|
742 |
|
743 |
function acf_get_child_field_from_parent_field( $child_name, $parent )
|
744 |
{
|
745 |
// vars
|
746 |
$return = false;
|
747 |
-
|
748 |
-
|
749 |
// find child
|
750 |
if( isset($parent['sub_fields']) && is_array($parent['sub_fields']) )
|
751 |
{
|
@@ -756,7 +756,7 @@ function acf_get_child_field_from_parent_field( $child_name, $parent )
|
|
756 |
$return = $child;
|
757 |
break;
|
758 |
}
|
759 |
-
|
760 |
// perhaps child has grand children?
|
761 |
$grand_child = acf_get_child_field_from_parent_field( $child_name, $child );
|
762 |
if( $grand_child )
|
@@ -778,11 +778,11 @@ function acf_get_child_field_from_parent_field( $child_name, $parent )
|
|
778 |
}
|
779 |
}
|
780 |
}
|
781 |
-
|
782 |
|
783 |
// return
|
784 |
return $return;
|
785 |
-
|
786 |
}
|
787 |
|
788 |
|
@@ -810,7 +810,7 @@ function register_field_group( $array )
|
|
810 |
{
|
811 |
$array['id'] = uniqid();
|
812 |
}
|
813 |
-
|
814 |
|
815 |
// 3.2.5 - changed show_on_page option
|
816 |
if( !isset($array['options']['hide_on_screen']) && isset($array['options']['show_on_page']) )
|
@@ -820,45 +820,45 @@ function register_field_group( $array )
|
|
820 |
unset( $array['options']['show_on_page'] );
|
821 |
}
|
822 |
|
823 |
-
|
824 |
// 4.0.4 - changed location rules architecture
|
825 |
if( isset($array['location']['rules']) )
|
826 |
{
|
827 |
// vars
|
828 |
$groups = array();
|
829 |
$group_no = 0;
|
830 |
-
|
831 |
-
|
832 |
if( is_array($array['location']['rules']) )
|
833 |
{
|
834 |
foreach( $array['location']['rules'] as $rule )
|
835 |
{
|
836 |
$rule['group_no'] = $group_no;
|
837 |
-
|
838 |
// sperate groups?
|
839 |
if( $array['location']['allorany'] == 'any' )
|
840 |
{
|
841 |
$group_no++;
|
842 |
}
|
843 |
-
|
844 |
-
|
845 |
// add to group
|
846 |
$groups[ $rule['group_no'] ][ $rule['order_no'] ] = $rule;
|
847 |
-
|
848 |
-
|
849 |
// sort rules
|
850 |
ksort( $groups[ $rule['group_no'] ] );
|
851 |
-
|
852 |
}
|
853 |
-
|
854 |
// sort groups
|
855 |
ksort( $groups );
|
856 |
}
|
857 |
-
|
858 |
$array['location'] = $groups;
|
859 |
}
|
860 |
-
|
861 |
-
|
862 |
$GLOBALS['acf_register_field_group'][] = $array;
|
863 |
}
|
864 |
|
@@ -871,8 +871,8 @@ function api_acf_get_field_groups( $return )
|
|
871 |
{
|
872 |
return $return;
|
873 |
}
|
874 |
-
|
875 |
-
|
876 |
foreach( $GLOBALS['acf_register_field_group'] as $acf )
|
877 |
{
|
878 |
$return[] = array(
|
@@ -882,7 +882,7 @@ function api_acf_get_field_groups( $return )
|
|
882 |
);
|
883 |
}
|
884 |
|
885 |
-
|
886 |
// order field groups based on menu_order, title
|
887 |
// Obtain a list of columns
|
888 |
foreach( $return as $key => $row )
|
@@ -890,14 +890,14 @@ function api_acf_get_field_groups( $return )
|
|
890 |
$menu_order[ $key ] = $row['menu_order'];
|
891 |
$title[ $key ] = $row['title'];
|
892 |
}
|
893 |
-
|
894 |
// Sort the array with menu_order ascending
|
895 |
// Add $array as the last parameter, to sort by the common key
|
896 |
if(isset($menu_order))
|
897 |
{
|
898 |
array_multisort($menu_order, SORT_ASC, $title, SORT_ASC, $return);
|
899 |
}
|
900 |
-
|
901 |
return $return;
|
902 |
}
|
903 |
|
@@ -916,7 +916,7 @@ function api_acf_field_group_get_fields( $fields, $post_id )
|
|
916 |
{
|
917 |
$fields[] = apply_filters('acf/load_field', $f, $f['key']);
|
918 |
}
|
919 |
-
|
920 |
break;
|
921 |
}
|
922 |
}
|
@@ -984,7 +984,7 @@ function api_acf_field_group_get_options( $options, $post_id )
|
|
984 |
{
|
985 |
if( $acf['id'] == $post_id )
|
986 |
{
|
987 |
-
$options = $acf['options'];
|
988 |
break;
|
989 |
}
|
990 |
}
|
@@ -1010,8 +1010,8 @@ function get_row_layout()
|
|
1010 |
{
|
1011 |
// vars
|
1012 |
$value = get_sub_field('acf_fc_layout');
|
1013 |
-
|
1014 |
-
|
1015 |
return $value;
|
1016 |
}
|
1017 |
|
@@ -1039,24 +1039,24 @@ function acf_shortcode( $atts )
|
|
1039 |
'field' => "",
|
1040 |
'post_id' => false,
|
1041 |
), $atts ) );
|
1042 |
-
|
1043 |
-
|
1044 |
// $field is requird
|
1045 |
if( !$field || $field == "" )
|
1046 |
{
|
1047 |
return "";
|
1048 |
}
|
1049 |
-
|
1050 |
-
|
1051 |
// get value and return it
|
1052 |
$value = get_field( $field, $post_id );
|
1053 |
-
|
1054 |
-
|
1055 |
if( is_array($value) )
|
1056 |
{
|
1057 |
$value = @implode( ', ',$value );
|
1058 |
}
|
1059 |
-
|
1060 |
return $value;
|
1061 |
}
|
1062 |
add_shortcode( 'acf', 'acf_shortcode' );
|
@@ -1080,21 +1080,21 @@ function acf_form_head()
|
|
1080 |
{
|
1081 |
// global vars
|
1082 |
global $post_id;
|
1083 |
-
|
1084 |
-
|
1085 |
// verify nonce
|
1086 |
if( isset($_POST['acf_nonce']) && wp_verify_nonce($_POST['acf_nonce'], 'input') )
|
1087 |
{
|
1088 |
// $post_id to save against
|
1089 |
$post_id = $_POST['post_id'];
|
1090 |
-
|
1091 |
-
|
1092 |
// allow for custom save
|
1093 |
$post_id = apply_filters('acf/pre_save_post', $post_id);
|
1094 |
-
|
1095 |
-
|
1096 |
// save the data
|
1097 |
-
do_action('acf/save_post', $post_id);
|
1098 |
|
1099 |
|
1100 |
// redirect
|
@@ -1104,19 +1104,19 @@ function acf_form_head()
|
|
1104 |
exit;
|
1105 |
}
|
1106 |
}
|
1107 |
-
|
1108 |
-
|
1109 |
// need wp styling
|
1110 |
wp_enqueue_style(array(
|
1111 |
'colors-fresh'
|
1112 |
));
|
1113 |
-
|
1114 |
-
|
1115 |
// actions
|
1116 |
do_action('acf/input/admin_enqueue_scripts');
|
1117 |
|
1118 |
add_action('wp_head', 'acf_form_wp_head');
|
1119 |
-
|
1120 |
}
|
1121 |
|
1122 |
function acf_form_wp_head()
|
@@ -1136,7 +1136,7 @@ function acf_form_wp_head()
|
|
1136 |
*
|
1137 |
* @param array $options: an array containing many options to customize the form
|
1138 |
* string + post_id: post id to get field groups from and save data to. Default is false
|
1139 |
-
* array + field_groups: an array containing field group ID's. If this option is set,
|
1140 |
* the post_id will not be used to dynamically find the field groups
|
1141 |
* boolean + form: display the form tag or not. Defaults to true
|
1142 |
* array + form_attributes: an array containg attributes which will be added into the form tag
|
@@ -1144,7 +1144,7 @@ function acf_form_wp_head()
|
|
1144 |
* string + html_before_fields: html inside form before fields
|
1145 |
* string + html_after_fields: html inside form after fields
|
1146 |
* string + submit_value: value of submit button
|
1147 |
-
* string + updated_message: default updated message. Can be false
|
1148 |
*
|
1149 |
* @return N/A
|
1150 |
*/
|
@@ -1152,8 +1152,8 @@ function acf_form_wp_head()
|
|
1152 |
function acf_form( $options = array() )
|
1153 |
{
|
1154 |
global $post;
|
1155 |
-
|
1156 |
-
|
1157 |
// defaults
|
1158 |
$defaults = array(
|
1159 |
'post_id' => false,
|
@@ -1169,14 +1169,14 @@ function acf_form( $options = array() )
|
|
1169 |
'html_before_fields' => '',
|
1170 |
'html_after_fields' => '',
|
1171 |
'submit_value' => __("Update", 'acf'),
|
1172 |
-
'updated_message' => __("Post updated", 'acf'),
|
1173 |
);
|
1174 |
-
|
1175 |
-
|
1176 |
// merge defaults with options
|
1177 |
$options = array_merge($defaults, $options);
|
1178 |
-
|
1179 |
-
|
1180 |
// merge sub arrays
|
1181 |
foreach( $options as $k => $v )
|
1182 |
{
|
@@ -1185,17 +1185,17 @@ function acf_form( $options = array() )
|
|
1185 |
$options[ $k ] = array_merge($defaults[ $k ], $options[ $k ]);
|
1186 |
}
|
1187 |
}
|
1188 |
-
|
1189 |
-
|
1190 |
// filter post_id
|
1191 |
$options['post_id'] = apply_filters('acf/get_post_id', $options['post_id'] );
|
1192 |
-
|
1193 |
-
|
1194 |
// attributes
|
1195 |
$options['form_attributes']['class'] .= 'acf-form';
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
// register post box
|
1200 |
if( empty($options['field_groups']) )
|
1201 |
{
|
@@ -1203,8 +1203,8 @@ function acf_form( $options = array() )
|
|
1203 |
$filter = array(
|
1204 |
'post_id' => $options['post_id']
|
1205 |
);
|
1206 |
-
|
1207 |
-
|
1208 |
if( strpos($options['post_id'], 'user_') !== false )
|
1209 |
{
|
1210 |
$user_id = str_replace('user_', '', $options['post_id']);
|
@@ -1219,8 +1219,8 @@ function acf_form( $options = array() )
|
|
1219 |
'ef_taxonomy' => $taxonomy_id
|
1220 |
);
|
1221 |
}
|
1222 |
-
|
1223 |
-
|
1224 |
$options['field_groups'] = array();
|
1225 |
$options['field_groups'] = apply_filters( 'acf/location/match_field_groups', $options['field_groups'], $filter );
|
1226 |
}
|
@@ -1231,13 +1231,13 @@ function acf_form( $options = array() )
|
|
1231 |
{
|
1232 |
echo '<div id="message" class="updated"><p>' . $options['updated_message'] . '</p></div>';
|
1233 |
}
|
1234 |
-
|
1235 |
-
|
1236 |
// display form
|
1237 |
if( $options['form'] ): ?>
|
1238 |
<form <?php if($options['form_attributes']){foreach($options['form_attributes'] as $k => $v){echo $k . '="' . $v .'" '; }} ?>>
|
1239 |
<?php endif; ?>
|
1240 |
-
|
1241 |
<div style="display:none">
|
1242 |
<script type="text/javascript">
|
1243 |
acf.o.post_id = <?php echo is_numeric($options['post_id']) ? $options['post_id'] : '"' . $options['post_id'] . '"'; ?>;
|
@@ -1247,49 +1247,49 @@ function acf_form( $options = array() )
|
|
1247 |
<input type="hidden" name="return" value="<?php echo $options['return']; ?>" />
|
1248 |
<?php wp_editor('', 'acf_settings'); ?>
|
1249 |
</div>
|
1250 |
-
|
1251 |
<div id="poststuff">
|
1252 |
<?php
|
1253 |
-
|
1254 |
// html before fields
|
1255 |
echo $options['html_before_fields'];
|
1256 |
-
|
1257 |
-
|
1258 |
$acfs = apply_filters('acf/get_field_groups', array());
|
1259 |
-
|
1260 |
if( is_array($acfs) ){ foreach( $acfs as $acf ){
|
1261 |
-
|
1262 |
// only add the chosen field groups
|
1263 |
if( !in_array( $acf['id'], $options['field_groups'] ) )
|
1264 |
{
|
1265 |
continue;
|
1266 |
}
|
1267 |
-
|
1268 |
-
|
1269 |
// load options
|
1270 |
$acf['options'] = apply_filters('acf/field_group/get_options', array(), $acf['id']);
|
1271 |
-
|
1272 |
-
|
1273 |
// load fields
|
1274 |
$fields = apply_filters('acf/field_group/get_fields', array(), $acf['id']);
|
1275 |
-
|
1276 |
-
|
1277 |
echo '<div id="acf_' . $acf['id'] . '" class="postbox acf_postbox ' . $acf['options']['layout'] . '">';
|
1278 |
echo '<h3 class="hndle"><span>' . $acf['title'] . '</span></h3>';
|
1279 |
echo '<div class="inside">';
|
1280 |
-
|
1281 |
do_action('acf/create_fields', $fields, $options['post_id']);
|
1282 |
-
|
1283 |
echo '</div></div>';
|
1284 |
-
|
1285 |
}}
|
1286 |
-
|
1287 |
-
|
1288 |
// html after fields
|
1289 |
echo $options['html_after_fields'];
|
1290 |
-
|
1291 |
?>
|
1292 |
-
|
1293 |
<?php if( $options['form'] ): ?>
|
1294 |
<!-- Submit -->
|
1295 |
<div class="field">
|
@@ -1297,9 +1297,9 @@ function acf_form( $options = array() )
|
|
1297 |
</div>
|
1298 |
<!-- / Submit -->
|
1299 |
<?php endif; ?>
|
1300 |
-
|
1301 |
</div><!-- <div id="poststuff"> -->
|
1302 |
-
|
1303 |
<?php if( $options['form'] ): ?>
|
1304 |
</form>
|
1305 |
<?php endif;
|
@@ -1326,17 +1326,17 @@ function update_field( $field_key, $value, $post_id = false )
|
|
1326 |
{
|
1327 |
// filter post_id
|
1328 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
1329 |
-
|
1330 |
-
|
1331 |
// vars
|
1332 |
$options = array(
|
1333 |
'load_value' => false,
|
1334 |
'format_value' => false
|
1335 |
);
|
1336 |
-
|
1337 |
$field = get_field_object( $field_key, $post_id, $options);
|
1338 |
|
1339 |
-
|
1340 |
// sub fields? They need formatted data
|
1341 |
if( $field['type'] == 'repeater' )
|
1342 |
{
|
@@ -1352,14 +1352,14 @@ function update_field( $field_key, $value, $post_id = false )
|
|
1352 |
}
|
1353 |
}
|
1354 |
}
|
1355 |
-
|
1356 |
-
|
1357 |
// save
|
1358 |
do_action('acf/update_value', $value, $post_id, $field );
|
1359 |
-
|
1360 |
-
|
1361 |
return true;
|
1362 |
-
|
1363 |
}
|
1364 |
|
1365 |
|
@@ -1426,7 +1426,7 @@ function acf_convert_field_names_to_keys( $value, $field )
|
|
1426 |
{
|
1427 |
return $value;
|
1428 |
}
|
1429 |
-
|
1430 |
|
1431 |
// define sub field keys
|
1432 |
$sub_fields = array();
|
@@ -1437,8 +1437,8 @@ function acf_convert_field_names_to_keys( $value, $field )
|
|
1437 |
$sub_fields[ $sub_field['name'] ] = $sub_field;
|
1438 |
}
|
1439 |
}
|
1440 |
-
|
1441 |
-
|
1442 |
// loop through the values and format the array to use sub field keys
|
1443 |
if( is_array($value) )
|
1444 |
{
|
@@ -1453,21 +1453,21 @@ function acf_convert_field_names_to_keys( $value, $field )
|
|
1453 |
{
|
1454 |
continue;
|
1455 |
}
|
1456 |
-
|
1457 |
-
|
1458 |
// vars
|
1459 |
$sub_field = $sub_fields[ $sub_field_name ];
|
1460 |
$sub_field_value = acf_convert_field_names_to_keys( $sub_field_value, $sub_field );
|
1461 |
-
|
1462 |
-
|
1463 |
// set new value
|
1464 |
$value[$row_i][ $sub_field['key'] ] = $sub_field_value;
|
1465 |
-
|
1466 |
-
|
1467 |
// unset old value
|
1468 |
unset( $value[$row_i][$sub_field_name] );
|
1469 |
-
|
1470 |
-
|
1471 |
}
|
1472 |
// foreach( $row as $sub_field_name => $sub_field_value )
|
1473 |
}
|
@@ -1476,8 +1476,8 @@ function acf_convert_field_names_to_keys( $value, $field )
|
|
1476 |
// foreach( $value as $row_i => $row)
|
1477 |
}
|
1478 |
// if( $value )
|
1479 |
-
|
1480 |
-
|
1481 |
return $value;
|
1482 |
|
1483 |
}
|
@@ -1497,34 +1497,34 @@ function acf_convert_field_names_to_keys( $value, $field )
|
|
1497 |
*/
|
1498 |
|
1499 |
function acf_force_type_array( $var ) {
|
1500 |
-
|
1501 |
// is array?
|
1502 |
if( is_array($var) ) {
|
1503 |
-
|
1504 |
return $var;
|
1505 |
-
|
1506 |
}
|
1507 |
-
|
1508 |
-
|
1509 |
// bail early if empty
|
1510 |
if( empty($var) && !is_numeric($var) ) {
|
1511 |
-
|
1512 |
return array();
|
1513 |
-
|
1514 |
}
|
1515 |
-
|
1516 |
-
|
1517 |
-
// string
|
1518 |
if( is_string($var) ) {
|
1519 |
-
|
1520 |
return explode(',', $var);
|
1521 |
-
|
1522 |
}
|
1523 |
-
|
1524 |
-
|
1525 |
// place in array
|
1526 |
return array( $var );
|
1527 |
-
}
|
1528 |
|
1529 |
|
1530 |
/*
|
@@ -1542,59 +1542,59 @@ function acf_force_type_array( $var ) {
|
|
1542 |
*/
|
1543 |
|
1544 |
function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) {
|
1545 |
-
|
1546 |
// bail early if function does not yet exist or
|
1547 |
if( !function_exists('wp_get_split_term') || empty($terms) ) {
|
1548 |
-
|
1549 |
return $terms;
|
1550 |
-
|
1551 |
}
|
1552 |
-
|
1553 |
-
|
1554 |
// vars
|
1555 |
$is_array = is_array($terms);
|
1556 |
-
|
1557 |
-
|
1558 |
// force into array
|
1559 |
$terms = acf_force_type_array( $terms );
|
1560 |
-
|
1561 |
-
|
1562 |
// force ints
|
1563 |
$terms = array_map('intval', $terms);
|
1564 |
-
|
1565 |
-
|
1566 |
// attempt to find new terms
|
1567 |
foreach( $terms as $i => $term_id ) {
|
1568 |
-
|
1569 |
$new_term_id = wp_get_split_term($term_id, $taxonomy);
|
1570 |
-
|
1571 |
if( $new_term_id ) {
|
1572 |
-
|
1573 |
$terms[ $i ] = $new_term_id;
|
1574 |
-
|
1575 |
}
|
1576 |
-
|
1577 |
}
|
1578 |
-
|
1579 |
-
|
1580 |
// revert array if needed
|
1581 |
if( !$is_array ) {
|
1582 |
-
|
1583 |
$terms = $terms[0];
|
1584 |
-
|
1585 |
}
|
1586 |
-
|
1587 |
-
|
1588 |
// return
|
1589 |
return $terms;
|
1590 |
-
|
1591 |
}
|
1592 |
|
1593 |
|
1594 |
/*
|
1595 |
* Depreceated Functions
|
1596 |
*
|
1597 |
-
* @description:
|
1598 |
* @created: 23/07/12
|
1599 |
*/
|
1600 |
|
@@ -1606,7 +1606,7 @@ function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) {
|
|
1606 |
* @author Elliot Condon
|
1607 |
* @depreciated: 3.3.4 - now use has_sub_field
|
1608 |
* @since 1.0.3
|
1609 |
-
*
|
1610 |
*-------------------------------------------------------------------------------------*/
|
1611 |
|
1612 |
function reset_the_repeater_field()
|
@@ -1622,7 +1622,7 @@ function reset_the_repeater_field()
|
|
1622 |
* @author Elliot Condon
|
1623 |
* @depreciated: 3.3.4 - now use has_sub_field
|
1624 |
* @since 1.0.3
|
1625 |
-
*
|
1626 |
*-------------------------------------------------------------------------------------*/
|
1627 |
|
1628 |
function the_repeater_field($field_name, $post_id = false)
|
@@ -1638,7 +1638,7 @@ function the_repeater_field($field_name, $post_id = false)
|
|
1638 |
* @author Elliot Condon
|
1639 |
* @depreciated: 3.3.4 - now use has_sub_field
|
1640 |
* @since 3.?.?
|
1641 |
-
*
|
1642 |
*-------------------------------------------------------------------------------------*/
|
1643 |
|
1644 |
function the_flexible_field($field_name, $post_id = false)
|
17 |
*/
|
18 |
|
19 |
function get_field_reference( $field_name, $post_id ) {
|
20 |
+
|
21 |
// cache
|
22 |
$found = false;
|
23 |
$cache = wp_cache_get( 'field_reference/post_id=' . $post_id . '/name=' . $field_name, 'acf', false, $found );
|
26 |
{
|
27 |
return $cache;
|
28 |
}
|
29 |
+
|
30 |
+
|
31 |
// vars
|
32 |
$return = '';
|
33 |
|
34 |
+
|
35 |
// get field key
|
36 |
if( is_numeric($post_id) )
|
37 |
{
|
38 |
+
$return = get_post_meta($post_id, '_' . $field_name, true);
|
39 |
}
|
40 |
elseif( strpos($post_id, 'user_') !== false )
|
41 |
{
|
42 |
$temp_post_id = str_replace('user_', '', $post_id);
|
43 |
+
$return = get_user_meta($temp_post_id, '_' . $field_name, true);
|
44 |
}
|
45 |
else
|
46 |
{
|
47 |
+
$return = get_option('_' . $post_id . '_' . $field_name);
|
48 |
}
|
49 |
+
|
50 |
+
|
51 |
// set cache
|
52 |
wp_cache_set( 'field_reference/post_id=' . $post_id . '/name=' . $field_name, $return, 'acf' );
|
53 |
+
|
54 |
+
|
55 |
+
// return
|
56 |
return $return;
|
57 |
}
|
58 |
|
73 |
*/
|
74 |
|
75 |
function get_field_objects( $post_id = false, $options = array() ) {
|
76 |
+
|
77 |
// global
|
78 |
global $wpdb;
|
79 |
+
|
80 |
+
|
81 |
// filter post_id
|
82 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
83 |
|
85 |
// vars
|
86 |
$field_key = '';
|
87 |
$value = array();
|
88 |
+
|
89 |
+
|
90 |
// get field_names
|
91 |
if( is_numeric($post_id) )
|
92 |
{
|
100 |
elseif( strpos($post_id, 'user_') !== false )
|
101 |
{
|
102 |
$user_id = str_replace('user_', '', $post_id);
|
103 |
+
|
104 |
$keys = $wpdb->get_col($wpdb->prepare(
|
105 |
"SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d and meta_key LIKE %s AND meta_value LIKE %s",
|
106 |
$user_id,
|
112 |
{
|
113 |
$keys = $wpdb->get_col($wpdb->prepare(
|
114 |
"SELECT option_value FROM $wpdb->options WHERE option_name LIKE %s",
|
115 |
+
'_' . $post_id . '_%'
|
116 |
));
|
117 |
}
|
118 |
|
122 |
foreach( $keys as $key )
|
123 |
{
|
124 |
$field = get_field_object( $key, $post_id, $options );
|
125 |
+
|
126 |
if( !is_array($field) )
|
127 |
{
|
128 |
continue;
|
129 |
}
|
130 |
+
|
131 |
$value[ $field['name'] ] = $field;
|
132 |
}
|
133 |
}
|
134 |
+
|
135 |
+
|
136 |
// no value
|
137 |
if( empty($value) )
|
138 |
{
|
139 |
return false;
|
140 |
}
|
141 |
+
|
142 |
+
|
143 |
// return
|
144 |
return $value;
|
145 |
}
|
161 |
*/
|
162 |
|
163 |
function get_fields( $post_id = false, $format_value = true ) {
|
164 |
+
|
165 |
// vars
|
166 |
$options = array(
|
167 |
'load_value' => true,
|
168 |
'format_value' => $format_value
|
169 |
);
|
170 |
+
|
171 |
+
|
172 |
$fields = get_field_objects( $post_id, $options );
|
173 |
+
|
174 |
if( is_array($fields) )
|
175 |
{
|
176 |
foreach( $fields as $k => $field )
|
178 |
$fields[ $k ] = $field['value'];
|
179 |
}
|
180 |
}
|
181 |
+
|
182 |
+
return $fields;
|
183 |
}
|
184 |
|
185 |
|
187 |
* get_field()
|
188 |
*
|
189 |
* This function will return a custom field value for a specific field name/key + post_id.
|
190 |
+
* There is a 3rd parameter to turn on/off formating. This means that an Image field will not use
|
191 |
* its 'return option' to format the value but return only what was saved in the database
|
192 |
*
|
193 |
* @type function
|
200 |
*
|
201 |
* @return mixed $value: the value found
|
202 |
*/
|
203 |
+
|
204 |
function get_field( $field_key, $post_id = false, $format_value = true ) {
|
205 |
+
|
206 |
// vars
|
207 |
$return = false;
|
208 |
$options = array(
|
210 |
'format_value' => $format_value
|
211 |
);
|
212 |
|
213 |
+
|
214 |
$field = get_field_object( $field_key, $post_id, $options);
|
215 |
+
|
216 |
+
|
217 |
if( is_array($field) )
|
218 |
{
|
219 |
$return = $field['value'];
|
220 |
}
|
221 |
+
|
222 |
+
|
223 |
return $return;
|
224 |
+
|
225 |
}
|
226 |
|
227 |
|
244 |
*/
|
245 |
|
246 |
function get_field_object( $field_key, $post_id = false, $options = array() ) {
|
247 |
+
|
248 |
// make sure add-ons are included
|
249 |
acf()->include_3rd_party();
|
250 |
+
|
251 |
+
|
252 |
// filter post_id
|
253 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
254 |
$field = false;
|
255 |
$orig_field_key = $field_key;
|
256 |
+
|
257 |
+
|
258 |
// defaults for options
|
259 |
$defaults = array(
|
260 |
'load_value' => true,
|
261 |
'format_value' => true,
|
262 |
);
|
263 |
+
|
264 |
$options = array_merge($defaults, $options);
|
265 |
+
|
266 |
+
|
267 |
// is $field_name a name? pre 3.4.0
|
268 |
if( substr($field_key, 0, 6) !== 'field_' )
|
269 |
{
|
270 |
// get field key
|
271 |
$field_key = get_field_reference( $field_key, $post_id );
|
272 |
}
|
273 |
+
|
274 |
+
|
275 |
// get field
|
276 |
if( substr($field_key, 0, 6) === 'field_' )
|
277 |
{
|
278 |
$field = apply_filters('acf/load_field', false, $field_key );
|
279 |
}
|
280 |
+
|
281 |
+
|
282 |
// validate field
|
283 |
if( !$field )
|
284 |
{
|
296 |
if( $options['load_value'] )
|
297 |
{
|
298 |
$field['value'] = apply_filters('acf/load_value', false, $post_id, $field);
|
299 |
+
|
300 |
+
|
301 |
// format value
|
302 |
if( $options['format_value'] )
|
303 |
{
|
327 |
*/
|
328 |
|
329 |
function the_field( $field_name, $post_id = false ) {
|
330 |
+
|
331 |
$value = get_field($field_name, $post_id);
|
332 |
+
|
333 |
if( is_array($value) )
|
334 |
{
|
335 |
$value = @implode(', ',$value);
|
336 |
}
|
337 |
+
|
338 |
echo $value;
|
339 |
}
|
340 |
|
343 |
* have_rows
|
344 |
*
|
345 |
* This function will instantiate a global variable containing the rows of a repeater or flexible content field,
|
346 |
+
* afterwhich, it will determin if another row exists to loop through
|
347 |
*
|
348 |
* @type function
|
349 |
* @date 2/09/13
|
354 |
*/
|
355 |
|
356 |
function have_rows( $field_name, $post_id = false ) {
|
357 |
+
|
358 |
// vars
|
359 |
$depth = 0;
|
360 |
$row = array();
|
361 |
$new_parent_loop = false;
|
362 |
$new_child_loop = false;
|
363 |
+
|
364 |
+
|
365 |
// reference
|
366 |
$_post_id = $post_id;
|
367 |
+
|
368 |
+
|
369 |
// filter post_id
|
370 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
371 |
+
|
372 |
+
|
373 |
// empty?
|
374 |
if( empty($GLOBALS['acf_field']) )
|
375 |
{
|
376 |
// reset
|
377 |
reset_rows( true );
|
378 |
+
|
379 |
+
|
380 |
// create a new loop
|
381 |
$new_parent_loop = true;
|
382 |
}
|
385 |
// vars
|
386 |
$row = end( $GLOBALS['acf_field'] );
|
387 |
$prev = prev( $GLOBALS['acf_field'] );
|
388 |
+
|
389 |
+
|
390 |
// If post_id has changed, this is most likely an archive loop
|
391 |
if( $post_id != $row['post_id'] )
|
392 |
{
|
422 |
// case: Change in $field_name was due to this being a nested loop
|
423 |
// action: move down one level into a new loop
|
424 |
$new_child_loop = true;
|
425 |
+
|
426 |
}
|
427 |
else
|
428 |
{
|
430 |
// action: leave this current loop alone and create a new parent loop
|
431 |
$new_parent_loop = true;
|
432 |
}
|
433 |
+
|
434 |
+
|
435 |
}
|
436 |
}
|
437 |
+
|
438 |
+
|
439 |
if( $new_parent_loop )
|
440 |
{
|
441 |
// vars
|
442 |
$f = get_field_object( $field_name, $post_id );
|
443 |
$v = $f['value'];
|
444 |
unset( $f['value'] );
|
445 |
+
|
446 |
+
|
447 |
// add row
|
448 |
$GLOBALS['acf_field'][] = array(
|
449 |
'name' => $field_name,
|
452 |
'i' => -1,
|
453 |
'post_id' => $post_id,
|
454 |
);
|
455 |
+
|
456 |
}
|
457 |
elseif( $new_child_loop )
|
458 |
{
|
459 |
// vars
|
460 |
$f = acf_get_child_field_from_parent_field( $field_name, $row['field'] );
|
461 |
$v = $row['value'][ $row['i'] ][ $field_name ];
|
462 |
+
|
463 |
$GLOBALS['acf_field'][] = array(
|
464 |
'name' => $field_name,
|
465 |
'value' => $v,
|
468 |
'post_id' => $post_id,
|
469 |
);
|
470 |
|
471 |
+
}
|
472 |
+
|
473 |
+
|
474 |
// update vars
|
475 |
$row = end( $GLOBALS['acf_field'] );
|
476 |
+
|
477 |
+
|
478 |
if( is_array($row['value']) && array_key_exists( $row['i']+1, $row['value'] ) )
|
479 |
{
|
480 |
// next row exists
|
481 |
return true;
|
482 |
}
|
483 |
+
|
484 |
+
|
485 |
// no next row!
|
486 |
reset_rows();
|
487 |
+
|
488 |
+
|
489 |
// return
|
490 |
return false;
|
491 |
+
|
492 |
}
|
493 |
|
494 |
|
506 |
*/
|
507 |
|
508 |
function the_row() {
|
509 |
+
|
510 |
// vars
|
511 |
$depth = count( $GLOBALS['acf_field'] ) - 1;
|
512 |
|
513 |
+
|
514 |
+
|
515 |
// increase row
|
516 |
$GLOBALS['acf_field'][ $depth ]['i']++;
|
517 |
+
|
518 |
+
|
519 |
// get row
|
520 |
$value = $GLOBALS['acf_field'][ $depth ]['value'];
|
521 |
$i = $GLOBALS['acf_field'][ $depth ]['i'];
|
522 |
|
523 |
+
|
524 |
// return
|
525 |
return $value[ $i ];
|
526 |
}
|
541 |
*/
|
542 |
|
543 |
function reset_rows( $hard_reset = false ) {
|
544 |
+
|
545 |
// completely destroy?
|
546 |
if( $hard_reset )
|
547 |
{
|
551 |
{
|
552 |
// vars
|
553 |
$depth = count( $GLOBALS['acf_field'] ) - 1;
|
554 |
+
|
555 |
+
|
556 |
// remove
|
557 |
unset( $GLOBALS['acf_field'][$depth] );
|
558 |
+
|
559 |
+
|
560 |
// refresh index
|
561 |
$GLOBALS['acf_field'] = array_values($GLOBALS['acf_field']);
|
562 |
}
|
563 |
+
|
564 |
+
|
565 |
// return
|
566 |
return true;
|
567 |
+
|
568 |
+
|
569 |
}
|
570 |
|
571 |
|
573 |
* has_sub_field()
|
574 |
*
|
575 |
* This function is used inside a while loop to return either true or false (loop again or stop).
|
576 |
+
* When using a repeater or flexible content field, it will loop through the rows until
|
577 |
* there are none left or a break is detected
|
578 |
*
|
579 |
* @type function
|
587 |
*/
|
588 |
|
589 |
function has_sub_field( $field_name, $post_id = false ) {
|
590 |
+
|
591 |
// vars
|
592 |
$r = have_rows( $field_name, $post_id );
|
593 |
+
|
594 |
+
|
595 |
// if has rows, progress through 1 row for the while loop to work
|
596 |
if( $r )
|
597 |
{
|
598 |
the_row();
|
599 |
}
|
600 |
+
|
601 |
+
|
602 |
// return
|
603 |
return $r;
|
604 |
}
|
640 |
*/
|
641 |
|
642 |
function get_sub_field( $field_name ) {
|
643 |
+
|
644 |
// no field?
|
645 |
if( empty($GLOBALS['acf_field']) )
|
646 |
{
|
647 |
return false;
|
648 |
}
|
649 |
+
|
650 |
+
|
651 |
// vars
|
652 |
$row = end( $GLOBALS['acf_field'] );
|
653 |
+
|
654 |
+
|
655 |
// return value
|
656 |
if( isset($row['value'][ $row['i'] ][ $field_name ]) )
|
657 |
{
|
658 |
return $row['value'][ $row['i'] ][ $field_name ];
|
659 |
}
|
660 |
+
|
661 |
+
|
662 |
// return false
|
663 |
return false;
|
664 |
}
|
681 |
function the_sub_field($field_name)
|
682 |
{
|
683 |
$value = get_sub_field($field_name);
|
684 |
+
|
685 |
if(is_array($value))
|
686 |
{
|
687 |
$value = implode(', ',$value);
|
688 |
}
|
689 |
+
|
690 |
echo $value;
|
691 |
}
|
692 |
|
702 |
*
|
703 |
* @param string $field_name: the name of the field - 'sub_heading'
|
704 |
*
|
705 |
+
* @return array $sub_field
|
706 |
*/
|
707 |
|
708 |
function get_sub_field_object( $child_name )
|
721 |
|
722 |
// return
|
723 |
return acf_get_child_field_from_parent_field( $child_name, $parent );
|
724 |
+
|
725 |
}
|
726 |
|
727 |
|
737 |
* @param string $child_name: the name of the field - 'sub_heading'
|
738 |
* @param array $parent: the parent field object
|
739 |
*
|
740 |
+
* @return array $sub_field
|
741 |
*/
|
742 |
|
743 |
function acf_get_child_field_from_parent_field( $child_name, $parent )
|
744 |
{
|
745 |
// vars
|
746 |
$return = false;
|
747 |
+
|
748 |
+
|
749 |
// find child
|
750 |
if( isset($parent['sub_fields']) && is_array($parent['sub_fields']) )
|
751 |
{
|
756 |
$return = $child;
|
757 |
break;
|
758 |
}
|
759 |
+
|
760 |
// perhaps child has grand children?
|
761 |
$grand_child = acf_get_child_field_from_parent_field( $child_name, $child );
|
762 |
if( $grand_child )
|
778 |
}
|
779 |
}
|
780 |
}
|
781 |
+
|
782 |
|
783 |
// return
|
784 |
return $return;
|
785 |
+
|
786 |
}
|
787 |
|
788 |
|
810 |
{
|
811 |
$array['id'] = uniqid();
|
812 |
}
|
813 |
+
|
814 |
|
815 |
// 3.2.5 - changed show_on_page option
|
816 |
if( !isset($array['options']['hide_on_screen']) && isset($array['options']['show_on_page']) )
|
820 |
unset( $array['options']['show_on_page'] );
|
821 |
}
|
822 |
|
823 |
+
|
824 |
// 4.0.4 - changed location rules architecture
|
825 |
if( isset($array['location']['rules']) )
|
826 |
{
|
827 |
// vars
|
828 |
$groups = array();
|
829 |
$group_no = 0;
|
830 |
+
|
831 |
+
|
832 |
if( is_array($array['location']['rules']) )
|
833 |
{
|
834 |
foreach( $array['location']['rules'] as $rule )
|
835 |
{
|
836 |
$rule['group_no'] = $group_no;
|
837 |
+
|
838 |
// sperate groups?
|
839 |
if( $array['location']['allorany'] == 'any' )
|
840 |
{
|
841 |
$group_no++;
|
842 |
}
|
843 |
+
|
844 |
+
|
845 |
// add to group
|
846 |
$groups[ $rule['group_no'] ][ $rule['order_no'] ] = $rule;
|
847 |
+
|
848 |
+
|
849 |
// sort rules
|
850 |
ksort( $groups[ $rule['group_no'] ] );
|
851 |
+
|
852 |
}
|
853 |
+
|
854 |
// sort groups
|
855 |
ksort( $groups );
|
856 |
}
|
857 |
+
|
858 |
$array['location'] = $groups;
|
859 |
}
|
860 |
+
|
861 |
+
|
862 |
$GLOBALS['acf_register_field_group'][] = $array;
|
863 |
}
|
864 |
|
871 |
{
|
872 |
return $return;
|
873 |
}
|
874 |
+
|
875 |
+
|
876 |
foreach( $GLOBALS['acf_register_field_group'] as $acf )
|
877 |
{
|
878 |
$return[] = array(
|
882 |
);
|
883 |
}
|
884 |
|
885 |
+
|
886 |
// order field groups based on menu_order, title
|
887 |
// Obtain a list of columns
|
888 |
foreach( $return as $key => $row )
|
890 |
$menu_order[ $key ] = $row['menu_order'];
|
891 |
$title[ $key ] = $row['title'];
|
892 |
}
|
893 |
+
|
894 |
// Sort the array with menu_order ascending
|
895 |
// Add $array as the last parameter, to sort by the common key
|
896 |
if(isset($menu_order))
|
897 |
{
|
898 |
array_multisort($menu_order, SORT_ASC, $title, SORT_ASC, $return);
|
899 |
}
|
900 |
+
|
901 |
return $return;
|
902 |
}
|
903 |
|
916 |
{
|
917 |
$fields[] = apply_filters('acf/load_field', $f, $f['key']);
|
918 |
}
|
919 |
+
|
920 |
break;
|
921 |
}
|
922 |
}
|
984 |
{
|
985 |
if( $acf['id'] == $post_id )
|
986 |
{
|
987 |
+
$options = (isset($acf['options'])) ? $acf['options'] : array();
|
988 |
break;
|
989 |
}
|
990 |
}
|
1010 |
{
|
1011 |
// vars
|
1012 |
$value = get_sub_field('acf_fc_layout');
|
1013 |
+
|
1014 |
+
|
1015 |
return $value;
|
1016 |
}
|
1017 |
|
1039 |
'field' => "",
|
1040 |
'post_id' => false,
|
1041 |
), $atts ) );
|
1042 |
+
|
1043 |
+
|
1044 |
// $field is requird
|
1045 |
if( !$field || $field == "" )
|
1046 |
{
|
1047 |
return "";
|
1048 |
}
|
1049 |
+
|
1050 |
+
|
1051 |
// get value and return it
|
1052 |
$value = get_field( $field, $post_id );
|
1053 |
+
|
1054 |
+
|
1055 |
if( is_array($value) )
|
1056 |
{
|
1057 |
$value = @implode( ', ',$value );
|
1058 |
}
|
1059 |
+
|
1060 |
return $value;
|
1061 |
}
|
1062 |
add_shortcode( 'acf', 'acf_shortcode' );
|
1080 |
{
|
1081 |
// global vars
|
1082 |
global $post_id;
|
1083 |
+
|
1084 |
+
|
1085 |
// verify nonce
|
1086 |
if( isset($_POST['acf_nonce']) && wp_verify_nonce($_POST['acf_nonce'], 'input') )
|
1087 |
{
|
1088 |
// $post_id to save against
|
1089 |
$post_id = $_POST['post_id'];
|
1090 |
+
|
1091 |
+
|
1092 |
// allow for custom save
|
1093 |
$post_id = apply_filters('acf/pre_save_post', $post_id);
|
1094 |
+
|
1095 |
+
|
1096 |
// save the data
|
1097 |
+
do_action('acf/save_post', $post_id);
|
1098 |
|
1099 |
|
1100 |
// redirect
|
1104 |
exit;
|
1105 |
}
|
1106 |
}
|
1107 |
+
|
1108 |
+
|
1109 |
// need wp styling
|
1110 |
wp_enqueue_style(array(
|
1111 |
'colors-fresh'
|
1112 |
));
|
1113 |
+
|
1114 |
+
|
1115 |
// actions
|
1116 |
do_action('acf/input/admin_enqueue_scripts');
|
1117 |
|
1118 |
add_action('wp_head', 'acf_form_wp_head');
|
1119 |
+
|
1120 |
}
|
1121 |
|
1122 |
function acf_form_wp_head()
|
1136 |
*
|
1137 |
* @param array $options: an array containing many options to customize the form
|
1138 |
* string + post_id: post id to get field groups from and save data to. Default is false
|
1139 |
+
* array + field_groups: an array containing field group ID's. If this option is set,
|
1140 |
* the post_id will not be used to dynamically find the field groups
|
1141 |
* boolean + form: display the form tag or not. Defaults to true
|
1142 |
* array + form_attributes: an array containg attributes which will be added into the form tag
|
1144 |
* string + html_before_fields: html inside form before fields
|
1145 |
* string + html_after_fields: html inside form after fields
|
1146 |
* string + submit_value: value of submit button
|
1147 |
+
* string + updated_message: default updated message. Can be false
|
1148 |
*
|
1149 |
* @return N/A
|
1150 |
*/
|
1152 |
function acf_form( $options = array() )
|
1153 |
{
|
1154 |
global $post;
|
1155 |
+
|
1156 |
+
|
1157 |
// defaults
|
1158 |
$defaults = array(
|
1159 |
'post_id' => false,
|
1169 |
'html_before_fields' => '',
|
1170 |
'html_after_fields' => '',
|
1171 |
'submit_value' => __("Update", 'acf'),
|
1172 |
+
'updated_message' => __("Post updated", 'acf'),
|
1173 |
);
|
1174 |
+
|
1175 |
+
|
1176 |
// merge defaults with options
|
1177 |
$options = array_merge($defaults, $options);
|
1178 |
+
|
1179 |
+
|
1180 |
// merge sub arrays
|
1181 |
foreach( $options as $k => $v )
|
1182 |
{
|
1185 |
$options[ $k ] = array_merge($defaults[ $k ], $options[ $k ]);
|
1186 |
}
|
1187 |
}
|
1188 |
+
|
1189 |
+
|
1190 |
// filter post_id
|
1191 |
$options['post_id'] = apply_filters('acf/get_post_id', $options['post_id'] );
|
1192 |
+
|
1193 |
+
|
1194 |
// attributes
|
1195 |
$options['form_attributes']['class'] .= 'acf-form';
|
1196 |
+
|
1197 |
+
|
1198 |
+
|
1199 |
// register post box
|
1200 |
if( empty($options['field_groups']) )
|
1201 |
{
|
1203 |
$filter = array(
|
1204 |
'post_id' => $options['post_id']
|
1205 |
);
|
1206 |
+
|
1207 |
+
|
1208 |
if( strpos($options['post_id'], 'user_') !== false )
|
1209 |
{
|
1210 |
$user_id = str_replace('user_', '', $options['post_id']);
|
1219 |
'ef_taxonomy' => $taxonomy_id
|
1220 |
);
|
1221 |
}
|
1222 |
+
|
1223 |
+
|
1224 |
$options['field_groups'] = array();
|
1225 |
$options['field_groups'] = apply_filters( 'acf/location/match_field_groups', $options['field_groups'], $filter );
|
1226 |
}
|
1231 |
{
|
1232 |
echo '<div id="message" class="updated"><p>' . $options['updated_message'] . '</p></div>';
|
1233 |
}
|
1234 |
+
|
1235 |
+
|
1236 |
// display form
|
1237 |
if( $options['form'] ): ?>
|
1238 |
<form <?php if($options['form_attributes']){foreach($options['form_attributes'] as $k => $v){echo $k . '="' . $v .'" '; }} ?>>
|
1239 |
<?php endif; ?>
|
1240 |
+
|
1241 |
<div style="display:none">
|
1242 |
<script type="text/javascript">
|
1243 |
acf.o.post_id = <?php echo is_numeric($options['post_id']) ? $options['post_id'] : '"' . $options['post_id'] . '"'; ?>;
|
1247 |
<input type="hidden" name="return" value="<?php echo $options['return']; ?>" />
|
1248 |
<?php wp_editor('', 'acf_settings'); ?>
|
1249 |
</div>
|
1250 |
+
|
1251 |
<div id="poststuff">
|
1252 |
<?php
|
1253 |
+
|
1254 |
// html before fields
|
1255 |
echo $options['html_before_fields'];
|
1256 |
+
|
1257 |
+
|
1258 |
$acfs = apply_filters('acf/get_field_groups', array());
|
1259 |
+
|
1260 |
if( is_array($acfs) ){ foreach( $acfs as $acf ){
|
1261 |
+
|
1262 |
// only add the chosen field groups
|
1263 |
if( !in_array( $acf['id'], $options['field_groups'] ) )
|
1264 |
{
|
1265 |
continue;
|
1266 |
}
|
1267 |
+
|
1268 |
+
|
1269 |
// load options
|
1270 |
$acf['options'] = apply_filters('acf/field_group/get_options', array(), $acf['id']);
|
1271 |
+
|
1272 |
+
|
1273 |
// load fields
|
1274 |
$fields = apply_filters('acf/field_group/get_fields', array(), $acf['id']);
|
1275 |
+
|
1276 |
+
|
1277 |
echo '<div id="acf_' . $acf['id'] . '" class="postbox acf_postbox ' . $acf['options']['layout'] . '">';
|
1278 |
echo '<h3 class="hndle"><span>' . $acf['title'] . '</span></h3>';
|
1279 |
echo '<div class="inside">';
|
1280 |
+
|
1281 |
do_action('acf/create_fields', $fields, $options['post_id']);
|
1282 |
+
|
1283 |
echo '</div></div>';
|
1284 |
+
|
1285 |
}}
|
1286 |
+
|
1287 |
+
|
1288 |
// html after fields
|
1289 |
echo $options['html_after_fields'];
|
1290 |
+
|
1291 |
?>
|
1292 |
+
|
1293 |
<?php if( $options['form'] ): ?>
|
1294 |
<!-- Submit -->
|
1295 |
<div class="field">
|
1297 |
</div>
|
1298 |
<!-- / Submit -->
|
1299 |
<?php endif; ?>
|
1300 |
+
|
1301 |
</div><!-- <div id="poststuff"> -->
|
1302 |
+
|
1303 |
<?php if( $options['form'] ): ?>
|
1304 |
</form>
|
1305 |
<?php endif;
|
1326 |
{
|
1327 |
// filter post_id
|
1328 |
$post_id = apply_filters('acf/get_post_id', $post_id );
|
1329 |
+
|
1330 |
+
|
1331 |
// vars
|
1332 |
$options = array(
|
1333 |
'load_value' => false,
|
1334 |
'format_value' => false
|
1335 |
);
|
1336 |
+
|
1337 |
$field = get_field_object( $field_key, $post_id, $options);
|
1338 |
|
1339 |
+
|
1340 |
// sub fields? They need formatted data
|
1341 |
if( $field['type'] == 'repeater' )
|
1342 |
{
|
1352 |
}
|
1353 |
}
|
1354 |
}
|
1355 |
+
|
1356 |
+
|
1357 |
// save
|
1358 |
do_action('acf/update_value', $value, $post_id, $field );
|
1359 |
+
|
1360 |
+
|
1361 |
return true;
|
1362 |
+
|
1363 |
}
|
1364 |
|
1365 |
|
1426 |
{
|
1427 |
return $value;
|
1428 |
}
|
1429 |
+
|
1430 |
|
1431 |
// define sub field keys
|
1432 |
$sub_fields = array();
|
1437 |
$sub_fields[ $sub_field['name'] ] = $sub_field;
|
1438 |
}
|
1439 |
}
|
1440 |
+
|
1441 |
+
|
1442 |
// loop through the values and format the array to use sub field keys
|
1443 |
if( is_array($value) )
|
1444 |
{
|
1453 |
{
|
1454 |
continue;
|
1455 |
}
|
1456 |
+
|
1457 |
+
|
1458 |
// vars
|
1459 |
$sub_field = $sub_fields[ $sub_field_name ];
|
1460 |
$sub_field_value = acf_convert_field_names_to_keys( $sub_field_value, $sub_field );
|
1461 |
+
|
1462 |
+
|
1463 |
// set new value
|
1464 |
$value[$row_i][ $sub_field['key'] ] = $sub_field_value;
|
1465 |
+
|
1466 |
+
|
1467 |
// unset old value
|
1468 |
unset( $value[$row_i][$sub_field_name] );
|
1469 |
+
|
1470 |
+
|
1471 |
}
|
1472 |
// foreach( $row as $sub_field_name => $sub_field_value )
|
1473 |
}
|
1476 |
// foreach( $value as $row_i => $row)
|
1477 |
}
|
1478 |
// if( $value )
|
1479 |
+
|
1480 |
+
|
1481 |
return $value;
|
1482 |
|
1483 |
}
|
1497 |
*/
|
1498 |
|
1499 |
function acf_force_type_array( $var ) {
|
1500 |
+
|
1501 |
// is array?
|
1502 |
if( is_array($var) ) {
|
1503 |
+
|
1504 |
return $var;
|
1505 |
+
|
1506 |
}
|
1507 |
+
|
1508 |
+
|
1509 |
// bail early if empty
|
1510 |
if( empty($var) && !is_numeric($var) ) {
|
1511 |
+
|
1512 |
return array();
|
1513 |
+
|
1514 |
}
|
1515 |
+
|
1516 |
+
|
1517 |
+
// string
|
1518 |
if( is_string($var) ) {
|
1519 |
+
|
1520 |
return explode(',', $var);
|
1521 |
+
|
1522 |
}
|
1523 |
+
|
1524 |
+
|
1525 |
// place in array
|
1526 |
return array( $var );
|
1527 |
+
}
|
1528 |
|
1529 |
|
1530 |
/*
|
1542 |
*/
|
1543 |
|
1544 |
function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) {
|
1545 |
+
|
1546 |
// bail early if function does not yet exist or
|
1547 |
if( !function_exists('wp_get_split_term') || empty($terms) ) {
|
1548 |
+
|
1549 |
return $terms;
|
1550 |
+
|
1551 |
}
|
1552 |
+
|
1553 |
+
|
1554 |
// vars
|
1555 |
$is_array = is_array($terms);
|
1556 |
+
|
1557 |
+
|
1558 |
// force into array
|
1559 |
$terms = acf_force_type_array( $terms );
|
1560 |
+
|
1561 |
+
|
1562 |
// force ints
|
1563 |
$terms = array_map('intval', $terms);
|
1564 |
+
|
1565 |
+
|
1566 |
// attempt to find new terms
|
1567 |
foreach( $terms as $i => $term_id ) {
|
1568 |
+
|
1569 |
$new_term_id = wp_get_split_term($term_id, $taxonomy);
|
1570 |
+
|
1571 |
if( $new_term_id ) {
|
1572 |
+
|
1573 |
$terms[ $i ] = $new_term_id;
|
1574 |
+
|
1575 |
}
|
1576 |
+
|
1577 |
}
|
1578 |
+
|
1579 |
+
|
1580 |
// revert array if needed
|
1581 |
if( !$is_array ) {
|
1582 |
+
|
1583 |
$terms = $terms[0];
|
1584 |
+
|
1585 |
}
|
1586 |
+
|
1587 |
+
|
1588 |
// return
|
1589 |
return $terms;
|
1590 |
+
|
1591 |
}
|
1592 |
|
1593 |
|
1594 |
/*
|
1595 |
* Depreceated Functions
|
1596 |
*
|
1597 |
+
* @description:
|
1598 |
* @created: 23/07/12
|
1599 |
*/
|
1600 |
|
1606 |
* @author Elliot Condon
|
1607 |
* @depreciated: 3.3.4 - now use has_sub_field
|
1608 |
* @since 1.0.3
|
1609 |
+
*
|
1610 |
*-------------------------------------------------------------------------------------*/
|
1611 |
|
1612 |
function reset_the_repeater_field()
|
1622 |
* @author Elliot Condon
|
1623 |
* @depreciated: 3.3.4 - now use has_sub_field
|
1624 |
* @since 1.0.3
|
1625 |
+
*
|
1626 |
*-------------------------------------------------------------------------------------*/
|
1627 |
|
1628 |
function the_repeater_field($field_name, $post_id = false)
|
1638 |
* @author Elliot Condon
|
1639 |
* @depreciated: 3.3.4 - now use has_sub_field
|
1640 |
* @since 3.?.?
|
1641 |
+
*
|
1642 |
*-------------------------------------------------------------------------------------*/
|
1643 |
|
1644 |
function the_flexible_field($field_name, $post_id = false)
|
shared/assets/plugins/advanced-custom-fields/core/controllers/addons.php
CHANGED
@@ -172,11 +172,11 @@ class acf_addons
|
|
172 |
'url' => 'http://wordpress.org/extend/plugins/acf-field-date-time-picker/'
|
173 |
);
|
174 |
$free[] = array(
|
175 |
-
'title' => __("
|
176 |
'description' => __("Find addresses and coordinates of a desired location",'acf'),
|
177 |
'thumbnail' => $dir . 'images/add-ons/google-maps-field-thumb.jpg',
|
178 |
-
'active' => class_exists('
|
179 |
-
'url' => 'https://
|
180 |
);
|
181 |
$free[] = array(
|
182 |
'title' => __("Contact Form 7 Field",'acf'),
|
@@ -253,7 +253,7 @@ class acf_addons
|
|
253 |
<script type="text/javascript">
|
254 |
(function($) {
|
255 |
|
256 |
-
$(window).
|
257 |
|
258 |
$('#add-ons .add-on-group').each(function(){
|
259 |
|
172 |
'url' => 'http://wordpress.org/extend/plugins/acf-field-date-time-picker/'
|
173 |
);
|
174 |
$free[] = array(
|
175 |
+
'title' => __("Location Field",'acf'),
|
176 |
'description' => __("Find addresses and coordinates of a desired location",'acf'),
|
177 |
'thumbnail' => $dir . 'images/add-ons/google-maps-field-thumb.jpg',
|
178 |
+
'active' => class_exists('acf_field_location'),
|
179 |
+
'url' => 'https://github.com/elliotcondon/acf-location-field/'
|
180 |
);
|
181 |
$free[] = array(
|
182 |
'title' => __("Contact Form 7 Field",'acf'),
|
253 |
<script type="text/javascript">
|
254 |
(function($) {
|
255 |
|
256 |
+
$(window).load(function(){
|
257 |
|
258 |
$('#add-ons .add-on-group').each(function(){
|
259 |
|
shared/assets/plugins/advanced-custom-fields/core/controllers/everything_fields.php
CHANGED
@@ -209,7 +209,7 @@ if( !isset($_POST['acf_nonce']) || !wp_verify_nonce($_POST['acf_nonce'], 'input'
|
|
209 |
|
210 |
|
211 |
// validate page
|
212 |
-
if( in_array( $pagenow, array( 'edit-tags.php', '
|
213 |
{
|
214 |
$return = true;
|
215 |
}
|
@@ -275,43 +275,26 @@ if( !isset($_POST['acf_nonce']) || !wp_verify_nonce($_POST['acf_nonce'], 'input'
|
|
275 |
$this->data['option_name'] = "shopp_category_" . $_GET['id'];
|
276 |
}
|
277 |
|
278 |
-
}
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
$
|
283 |
-
|
284 |
-
|
285 |
-
// $_GET
|
286 |
-
if( !empty($_GET['taxonomy']) ) {
|
287 |
-
|
288 |
-
$taxonomy = filter_var($_GET['taxonomy'], FILTER_SANITIZE_STRING);
|
289 |
-
|
290 |
-
}
|
291 |
-
|
292 |
-
if( !empty($_GET['tag_ID']) ) {
|
293 |
-
|
294 |
-
$term_id = filter_var($_GET['tag_ID'], FILTER_SANITIZE_NUMBER_INT);
|
295 |
-
|
296 |
-
}
|
297 |
-
|
298 |
-
|
299 |
-
// update filter
|
300 |
-
$filter['ef_taxonomy'] = $taxonomy;
|
301 |
|
302 |
|
303 |
-
// add
|
304 |
$this->data['page_type'] = "taxonomy";
|
|
|
|
|
305 |
$this->data['page_action'] = "add";
|
306 |
$this->data['option_name'] = "";
|
307 |
|
|
|
|
|
|
|
|
|
308 |
|
309 |
-
// edit
|
310 |
-
if( $term_id ) {
|
311 |
-
|
312 |
$this->data['page_action'] = "edit";
|
313 |
-
$this->data['option_name'] = $taxonomy . "_" . $
|
314 |
-
|
315 |
}
|
316 |
|
317 |
}
|
209 |
|
210 |
|
211 |
// validate page
|
212 |
+
if( in_array( $pagenow, array( 'edit-tags.php', 'profile.php', 'user-new.php', 'user-edit.php', 'media.php' ) ) )
|
213 |
{
|
214 |
$return = true;
|
215 |
}
|
275 |
$this->data['option_name'] = "shopp_category_" . $_GET['id'];
|
276 |
}
|
277 |
|
278 |
+
}
|
279 |
+
if( $pagenow == "edit-tags.php" && isset($_GET['taxonomy']) )
|
280 |
+
{
|
281 |
+
// filter
|
282 |
+
$_GET['taxonomy'] = filter_var($_GET['taxonomy'], FILTER_SANITIZE_STRING);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
|
|
|
285 |
$this->data['page_type'] = "taxonomy";
|
286 |
+
$filter['ef_taxonomy'] = $_GET['taxonomy'];
|
287 |
+
|
288 |
$this->data['page_action'] = "add";
|
289 |
$this->data['option_name'] = "";
|
290 |
|
291 |
+
if( isset($_GET['action']) && $_GET['action'] == "edit" )
|
292 |
+
{
|
293 |
+
// filter
|
294 |
+
$_GET['tag_ID'] = filter_var($_GET['tag_ID'], FILTER_SANITIZE_NUMBER_INT);
|
295 |
|
|
|
|
|
|
|
296 |
$this->data['page_action'] = "edit";
|
297 |
+
$this->data['option_name'] = $_GET['taxonomy'] . "_" . $_GET['tag_ID'];
|
|
|
298 |
}
|
299 |
|
300 |
}
|
shared/assets/plugins/advanced-custom-fields/core/controllers/field_group.php
CHANGED
@@ -350,8 +350,7 @@ class acf_field_group
|
|
350 |
|
351 |
function admin_head()
|
352 |
{
|
353 |
-
|
354 |
-
global $wp_version, $post;
|
355 |
|
356 |
|
357 |
// l10n
|
@@ -379,7 +378,6 @@ class acf_field_group
|
|
379 |
acf.nonce = "<?php echo wp_create_nonce( 'acf_nonce' ); ?>";
|
380 |
acf.admin_url = "<?php echo admin_url(); ?>";
|
381 |
acf.ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
|
382 |
-
acf.wp_version = "<?php echo $wp_version; ?>";
|
383 |
|
384 |
|
385 |
// l10n
|
350 |
|
351 |
function admin_head()
|
352 |
{
|
353 |
+
global $post;
|
|
|
354 |
|
355 |
|
356 |
// l10n
|
378 |
acf.nonce = "<?php echo wp_create_nonce( 'acf_nonce' ); ?>";
|
379 |
acf.admin_url = "<?php echo admin_url(); ?>";
|
380 |
acf.ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
|
|
|
381 |
|
382 |
|
383 |
// l10n
|
shared/assets/plugins/advanced-custom-fields/core/controllers/field_groups.php
CHANGED
@@ -358,7 +358,7 @@ class acf_field_groups
|
|
358 |
<p><?php _e("Absolutely <strong>no</strong> changes have been made to the database between versions 3 and 4. This means you can roll back to version 3 without any issues.",'acf'); ?></p>
|
359 |
|
360 |
<h4><?php _e("Potential Issues",'acf'); ?></h4>
|
361 |
-
<p><?php printf(__('Due to the sizable changes
|
362 |
|
363 |
<div class="acf-alert acf-alert-error">
|
364 |
<p><strong><?php _e("Really Important!",'acf'); ?></strong> <?php printf(__('If you updated the ACF plugin without prior knowledge of such changes, please roll back to the latest %sversion 3%s of this plugin.','acf'),'<a href="http://wordpress.org/extend/plugins/advanced-custom-fields/developers/">','</a>'); ?></p>
|
358 |
<p><?php _e("Absolutely <strong>no</strong> changes have been made to the database between versions 3 and 4. This means you can roll back to version 3 without any issues.",'acf'); ?></p>
|
359 |
|
360 |
<h4><?php _e("Potential Issues",'acf'); ?></h4>
|
361 |
+
<p><?php printf(__('Due to the sizable changes surounding Add-ons, field types and action/filters, your website may not operate correctly. It is important that you read the full %sMigrating from v3 to v4%s guide to view the full list of changes.','acf'),'<a href="http://www.advancedcustomfields.com/resources/getting-started/migrating-from-v3-to-v4/" target="_blank">','</a>'); ?></p>
|
362 |
|
363 |
<div class="acf-alert acf-alert-error">
|
364 |
<p><strong><?php _e("Really Important!",'acf'); ?></strong> <?php printf(__('If you updated the ACF plugin without prior knowledge of such changes, please roll back to the latest %sversion 3%s of this plugin.','acf'),'<a href="http://wordpress.org/extend/plugins/advanced-custom-fields/developers/">','</a>'); ?></p>
|
shared/assets/plugins/advanced-custom-fields/core/controllers/revisions.php
CHANGED
@@ -115,7 +115,7 @@ class acf_revisions
|
|
115 |
$post_id = 0;
|
116 |
|
117 |
|
118 |
-
//
|
119 |
if( isset($_POST['post_id']) )
|
120 |
{
|
121 |
$post_id = $_POST['post_id'];
|
@@ -154,7 +154,7 @@ class acf_revisions
|
|
154 |
|
155 |
|
156 |
// WP 3.5: left vs right
|
157 |
-
// Add a value of the revision ID (as there is no way to
|
158 |
if( isset($_GET['action'], $_GET['left'], $_GET['right']) && $_GET['action'] == 'diff' )
|
159 |
{
|
160 |
global $left_revision, $right_revision;
|
@@ -193,7 +193,7 @@ class acf_revisions
|
|
193 |
$post_id = 0;
|
194 |
|
195 |
|
196 |
-
//
|
197 |
if( isset($post->ID) )
|
198 |
{
|
199 |
// WP 3.6
|
115 |
$post_id = 0;
|
116 |
|
117 |
|
118 |
+
// determin $post_id
|
119 |
if( isset($_POST['post_id']) )
|
120 |
{
|
121 |
$post_id = $_POST['post_id'];
|
154 |
|
155 |
|
156 |
// WP 3.5: left vs right
|
157 |
+
// Add a value of the revision ID (as there is no way to determin this within the '_wp_post_revision_field_' filter!)
|
158 |
if( isset($_GET['action'], $_GET['left'], $_GET['right']) && $_GET['action'] == 'diff' )
|
159 |
{
|
160 |
global $left_revision, $right_revision;
|
193 |
$post_id = 0;
|
194 |
|
195 |
|
196 |
+
// determin $post_id
|
197 |
if( isset($post->ID) )
|
198 |
{
|
199 |
// WP 3.6
|
shared/assets/plugins/advanced-custom-fields/core/fields/date_picker/date_picker.php
CHANGED
@@ -124,7 +124,7 @@ class acf_field_date_picker extends acf_field
|
|
124 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
125 |
<td class="label">
|
126 |
<label><?php _e("Save format",'acf'); ?></label>
|
127 |
-
<p class="description"><?php _e("This format will
|
128 |
<p><?php _e("\"yymmdd\" is the most versatile save format. Read more about",'acf'); ?> <a href="http://docs.jquery.com/UI/Datepicker/formatDate"><?php _e("jQuery date formats",'acf'); ?></a></p>
|
129 |
</td>
|
130 |
<td>
|
124 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
125 |
<td class="label">
|
126 |
<label><?php _e("Save format",'acf'); ?></label>
|
127 |
+
<p class="description"><?php _e("This format will determin the value saved to the database and returned via the API",'acf'); ?></p>
|
128 |
<p><?php _e("\"yymmdd\" is the most versatile save format. Read more about",'acf'); ?> <a href="http://docs.jquery.com/UI/Datepicker/formatDate"><?php _e("jQuery date formats",'acf'); ?></a></p>
|
129 |
</td>
|
130 |
<td>
|
shared/assets/plugins/advanced-custom-fields/core/fields/file.php
CHANGED
@@ -26,7 +26,7 @@ class acf_field_file extends acf_field
|
|
26 |
'select' => __("Select File",'acf'),
|
27 |
'edit' => __("Edit File",'acf'),
|
28 |
'update' => __("Update File",'acf'),
|
29 |
-
'uploadedTo' => __("
|
30 |
);
|
31 |
|
32 |
|
26 |
'select' => __("Select File",'acf'),
|
27 |
'edit' => __("Edit File",'acf'),
|
28 |
'update' => __("Update File",'acf'),
|
29 |
+
'uploadedTo' => __("uploaded to this post",'acf'),
|
30 |
);
|
31 |
|
32 |
|
shared/assets/plugins/advanced-custom-fields/core/fields/google-map.php
CHANGED
@@ -265,52 +265,6 @@ class acf_field_google_map extends acf_field
|
|
265 |
return $value;
|
266 |
}
|
267 |
|
268 |
-
|
269 |
-
/*
|
270 |
-
* input_admin_footer
|
271 |
-
*
|
272 |
-
* description
|
273 |
-
*
|
274 |
-
* @type function
|
275 |
-
* @date 6/03/2014
|
276 |
-
* @since 5.0.0
|
277 |
-
*
|
278 |
-
* @param $post_id (int)
|
279 |
-
* @return $post_id (int)
|
280 |
-
*/
|
281 |
-
|
282 |
-
function input_admin_head() {
|
283 |
-
|
284 |
-
add_action( 'admin_footer', array( $this, 'input_admin_footer') );
|
285 |
-
|
286 |
-
}
|
287 |
-
|
288 |
-
function input_admin_footer() {
|
289 |
-
|
290 |
-
// vars
|
291 |
-
$api = array(
|
292 |
-
'libraries' => 'places',
|
293 |
-
'key' => '',
|
294 |
-
'client' => ''
|
295 |
-
);
|
296 |
-
|
297 |
-
|
298 |
-
// filter
|
299 |
-
$api = apply_filters('acf/fields/google_map/api', $api);
|
300 |
-
|
301 |
-
|
302 |
-
// remove empty
|
303 |
-
if( empty($api['key']) ) unset($api['key']);
|
304 |
-
if( empty($api['client']) ) unset($api['client']);
|
305 |
-
|
306 |
-
|
307 |
-
?>
|
308 |
-
<script type="text/javascript">
|
309 |
-
acf.fields.google_map.api = <?php echo json_encode($api); ?>;
|
310 |
-
</script>
|
311 |
-
<?php
|
312 |
-
|
313 |
-
}
|
314 |
}
|
315 |
|
316 |
new acf_field_google_map();
|
265 |
return $value;
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
269 |
|
270 |
new acf_field_google_map();
|
shared/assets/plugins/advanced-custom-fields/core/fields/image.php
CHANGED
@@ -27,7 +27,7 @@ class acf_field_image extends acf_field
|
|
27 |
'select' => __("Select Image",'acf'),
|
28 |
'edit' => __("Edit Image",'acf'),
|
29 |
'update' => __("Update Image",'acf'),
|
30 |
-
'uploadedTo' => __("
|
31 |
);
|
32 |
|
33 |
|
27 |
'select' => __("Select Image",'acf'),
|
28 |
'edit' => __("Edit Image",'acf'),
|
29 |
'update' => __("Update Image",'acf'),
|
30 |
+
'uploadedTo' => __("uploaded to this post",'acf'),
|
31 |
);
|
32 |
|
33 |
|
shared/assets/plugins/advanced-custom-fields/core/fields/relationship.php
CHANGED
@@ -26,7 +26,13 @@ class acf_field_relationship extends acf_field
|
|
26 |
'return_format' => 'object'
|
27 |
);
|
28 |
$this->l10n = array(
|
29 |
-
'max' => __("Maximum values reached ( {max} values )",'acf')
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
);
|
31 |
|
32 |
|
26 |
'return_format' => 'object'
|
27 |
);
|
28 |
$this->l10n = array(
|
29 |
+
'max' => __("Maximum values reached ( {max} values )",'acf'),
|
30 |
+
'tmpl_li' => '
|
31 |
+
<li>
|
32 |
+
<a href="#" data-post_id="<%= post_id %>"><%= title %><span class="acf-button-remove"></span></a>
|
33 |
+
<input type="hidden" name="<%= name %>[]" value="<%= post_id %>" />
|
34 |
+
</li>
|
35 |
+
'
|
36 |
);
|
37 |
|
38 |
|
shared/assets/plugins/advanced-custom-fields/core/fields/select.php
CHANGED
@@ -54,7 +54,7 @@ class acf_field_select extends acf_field
|
|
54 |
$optgroup = false;
|
55 |
|
56 |
|
57 |
-
//
|
58 |
if( is_array($field['choices']) )
|
59 |
{
|
60 |
foreach( $field['choices'] as $k => $v )
|
54 |
$optgroup = false;
|
55 |
|
56 |
|
57 |
+
// determin if choices are grouped (2 levels of array)
|
58 |
if( is_array($field['choices']) )
|
59 |
{
|
60 |
foreach( $field['choices'] as $k => $v )
|
shared/assets/plugins/advanced-custom-fields/core/fields/text.php
CHANGED
@@ -174,7 +174,7 @@ class acf_field_text extends acf_field
|
|
174 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
175 |
<td class="label">
|
176 |
<label><?php _e("Formatting",'acf'); ?></label>
|
177 |
-
<p><?php _e("
|
178 |
</td>
|
179 |
<td>
|
180 |
<?php
|
174 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
175 |
<td class="label">
|
176 |
<label><?php _e("Formatting",'acf'); ?></label>
|
177 |
+
<p><?php _e("Effects value on front end",'acf') ?></p>
|
178 |
</td>
|
179 |
<td>
|
180 |
<?php
|
shared/assets/plugins/advanced-custom-fields/core/fields/textarea.php
CHANGED
@@ -162,7 +162,7 @@ class acf_field_textarea extends acf_field
|
|
162 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
163 |
<td class="label">
|
164 |
<label><?php _e("Formatting",'acf'); ?></label>
|
165 |
-
<p><?php _e("
|
166 |
</td>
|
167 |
<td>
|
168 |
<?php
|
162 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
163 |
<td class="label">
|
164 |
<label><?php _e("Formatting",'acf'); ?></label>
|
165 |
+
<p><?php _e("Effects value on front end",'acf') ?></p>
|
166 |
</td>
|
167 |
<td>
|
168 |
<?php
|
shared/assets/plugins/advanced-custom-fields/core/fields/wysiwyg.php
CHANGED
@@ -215,7 +215,6 @@ class acf_field_wysiwyg extends acf_field
|
|
215 |
|
216 |
|
217 |
// vars
|
218 |
-
//$id = uniqid('acf-editor-');
|
219 |
$id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
|
220 |
$default_editor = 'tinymce';
|
221 |
|
@@ -246,7 +245,7 @@ class acf_field_wysiwyg extends acf_field
|
|
246 |
$field['value'] = apply_filters( 'acf_the_editor_content', $field['value'], $default_editor );
|
247 |
|
248 |
?>
|
249 |
-
<div id="wp-<?php echo $id; ?>-wrap" class="acf_wysiwyg wp-core-ui wp-editor-wrap
|
250 |
<div id="wp-<?php echo $id; ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
|
251 |
<?php if( user_can_richedit() && $field['media_upload'] == 'yes' ): ?>
|
252 |
<div id="wp-<?php echo $id; ?>-media-buttons" class="wp-media-buttons">
|
215 |
|
216 |
|
217 |
// vars
|
|
|
218 |
$id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
|
219 |
$default_editor = 'tinymce';
|
220 |
|
245 |
$field['value'] = apply_filters( 'acf_the_editor_content', $field['value'], $default_editor );
|
246 |
|
247 |
?>
|
248 |
+
<div id="wp-<?php echo $id; ?>-wrap" class="acf_wysiwyg wp-core-ui wp-editor-wrap" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>">
|
249 |
<div id="wp-<?php echo $id; ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
|
250 |
<?php if( user_can_richedit() && $field['media_upload'] == 'yes' ): ?>
|
251 |
<div id="wp-<?php echo $id; ?>-media-buttons" class="wp-media-buttons">
|
shared/assets/plugins/advanced-custom-fields/css/field-group.css
CHANGED
@@ -64,7 +64,7 @@
|
|
64 |
display: none;
|
65 |
}
|
66 |
|
67 |
-
.postbox#acf_fields
|
68 |
display: none;
|
69 |
}
|
70 |
|
@@ -75,8 +75,6 @@
|
|
75 |
|
76 |
.postbox#acf_fields a {
|
77 |
text-decoration: none;
|
78 |
-
box-shadow: none;
|
79 |
-
transition: none;
|
80 |
}
|
81 |
|
82 |
|
64 |
display: none;
|
65 |
}
|
66 |
|
67 |
+
.postbox#acf_fields h3.hndle {
|
68 |
display: none;
|
69 |
}
|
70 |
|
75 |
|
76 |
.postbox#acf_fields a {
|
77 |
text-decoration: none;
|
|
|
|
|
78 |
}
|
79 |
|
80 |
|
shared/assets/plugins/advanced-custom-fields/css/input.css
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
box-shadow: none;
|
25 |
}
|
26 |
|
27 |
-
.acf_postbox.no_box >
|
28 |
.acf_postbox.no_box > .handlediv {
|
29 |
display: none;
|
30 |
}
|
@@ -508,21 +508,17 @@ not needed in WP 3.8
|
|
508 |
|
509 |
.media-modal.acf-media-modal .media-frame-router,
|
510 |
.media-modal.acf-media-modal .attachments,
|
511 |
-
.media-modal.acf-media-modal .media-frame-content .media-toolbar
|
512 |
-
.media-modal.acf-media-modal .media-frame-menu {
|
513 |
display: none;
|
514 |
}
|
515 |
|
516 |
.media-modal.acf-media-modal .media-frame-content {
|
517 |
-
top:
|
518 |
-
left: 0;
|
519 |
}
|
520 |
|
521 |
-
|
522 |
.media-modal.acf-media-modal .media-frame-title {
|
523 |
border-bottom: 1px solid #DFDFDF;
|
524 |
box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1);
|
525 |
-
left: 0;
|
526 |
}
|
527 |
|
528 |
.media-modal.acf-media-modal .media-frame-content .media-sidebar {
|
@@ -532,7 +528,6 @@ not needed in WP 3.8
|
|
532 |
|
533 |
.media-modal.acf-media-modal .media-toolbar {
|
534 |
right: 0;
|
535 |
-
left: 0;
|
536 |
}
|
537 |
|
538 |
|
24 |
box-shadow: none;
|
25 |
}
|
26 |
|
27 |
+
.acf_postbox.no_box > h3,
|
28 |
.acf_postbox.no_box > .handlediv {
|
29 |
display: none;
|
30 |
}
|
508 |
|
509 |
.media-modal.acf-media-modal .media-frame-router,
|
510 |
.media-modal.acf-media-modal .attachments,
|
511 |
+
.media-modal.acf-media-modal .media-frame-content .media-toolbar {
|
|
|
512 |
display: none;
|
513 |
}
|
514 |
|
515 |
.media-modal.acf-media-modal .media-frame-content {
|
516 |
+
top: 56px;
|
|
|
517 |
}
|
518 |
|
|
|
519 |
.media-modal.acf-media-modal .media-frame-title {
|
520 |
border-bottom: 1px solid #DFDFDF;
|
521 |
box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1);
|
|
|
522 |
}
|
523 |
|
524 |
.media-modal.acf-media-modal .media-frame-content .media-sidebar {
|
528 |
|
529 |
.media-modal.acf-media-modal .media-toolbar {
|
530 |
right: 0;
|
|
|
531 |
}
|
532 |
|
533 |
|
shared/assets/plugins/advanced-custom-fields/js/field-group.js
CHANGED
@@ -135,90 +135,22 @@ var acf = {
|
|
135 |
* @return N/A
|
136 |
*/
|
137 |
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
// events
|
143 |
-
$(document).on('submit', '#post', this.submit);
|
144 |
-
|
145 |
-
|
146 |
-
// return
|
147 |
-
return this;
|
148 |
-
|
149 |
-
|
150 |
-
},
|
151 |
-
|
152 |
-
submit: function( e ){
|
153 |
-
|
154 |
-
// validate post title
|
155 |
-
var $title = $('#titlewrap #title'),
|
156 |
-
$spinner = $('#submitdiv .spinner').last(),
|
157 |
-
$submit = $('#submitdiv input[type="submit"]').last();
|
158 |
-
|
159 |
-
|
160 |
-
// title empty
|
161 |
-
if( !$title.val() ) {
|
162 |
-
|
163 |
-
// prevent default
|
164 |
-
e.preventDefault();
|
165 |
-
|
166 |
-
|
167 |
-
// hide spinner
|
168 |
-
acf_submit.hide_spinner( $spinner );
|
169 |
-
acf_submit.enable_submit( $submit );
|
170 |
-
|
171 |
-
|
172 |
-
// alert
|
173 |
-
alert( acf.l10n.title );
|
174 |
-
|
175 |
-
|
176 |
-
// focus
|
177 |
-
$title.focus();
|
178 |
-
|
179 |
-
}
|
180 |
-
|
181 |
-
},
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
if( !$spinner.exists() ) return;
|
187 |
-
|
188 |
-
|
189 |
-
// vars
|
190 |
-
var wp_version = acf.wp_version;
|
191 |
-
|
192 |
-
|
193 |
-
// hide
|
194 |
-
if( parseFloat(wp_version) >= 4.2 ) {
|
195 |
-
|
196 |
-
$spinner.removeClass('is-active');
|
197 |
-
|
198 |
-
} else {
|
199 |
-
|
200 |
-
$spinner.css('display', 'none');
|
201 |
-
|
202 |
-
}
|
203 |
|
204 |
-
|
205 |
|
206 |
-
|
207 |
-
|
208 |
-
// bail early if no submit
|
209 |
-
if( !$submit.exists() ) {
|
210 |
-
|
211 |
-
return;
|
212 |
-
|
213 |
-
}
|
214 |
-
|
215 |
-
|
216 |
-
// remove class
|
217 |
-
$submit.removeClass('disabled button-disabled button-primary-disabled');
|
218 |
-
|
219 |
}
|
|
|
220 |
|
221 |
-
}
|
222 |
|
223 |
|
224 |
/*
|
135 |
* @return N/A
|
136 |
*/
|
137 |
|
138 |
+
$(document).on('submit', '#post', function(){
|
139 |
|
140 |
+
// validate post title
|
141 |
+
var title = $('#titlewrap #title');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
+
if( !title.val() )
|
144 |
+
{
|
145 |
+
alert( acf.l10n.title );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
+
title.focus();
|
148 |
|
149 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
+
|
152 |
|
153 |
+
});
|
154 |
|
155 |
|
156 |
/*
|
shared/assets/plugins/advanced-custom-fields/js/field-group.min.js
CHANGED
@@ -1 +1,8 @@
|
|
1 |
-
var acf={ajaxurl:"",admin_url:"",post_id:0,nonce:"",l10n:{},text:{},helpers:{uniqid:null,sortable:null,create_field:null},conditional_logic:null,location:null};!function($){function e(){$("#acf_fields .fields").each(function(){$(this).children(".field").each(function(e){$(this).find("td.field_order .circle").first().html(e+1)})})}$.fn.exists=function(){return $(this).length>0},acf.helpers.sortable=function(e,t){return t.children().each(function(){$(this).width($(this).width())}),t},acf.helpers.uniqid=function(e,t){"undefined"==typeof e&&(e="");var i,a=function(e,t){return e=parseInt(e,10).toString(16),t<e.length?e.slice(e.length-t):t>e.length?Array(1+(t-e.length)).join("0")+e:e};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,i=e,i+=a(parseInt((new Date).getTime()/1e3,10),8),i+=a(this.php_js.uniqidSeed,5),t&&(i+=(10*Math.random()).toFixed(8).toString()),i};var t={init:function(){return $(document).on("submit","#post",this.submit),this},submit:function(e){var i=$("#titlewrap #title"),a=$("#submitdiv .spinner").last(),n=$('#submitdiv input[type="submit"]').last();i.val()||(e.preventDefault(),t.hide_spinner(a),t.enable_submit(n),alert(acf.l10n.title),i.focus())},hide_spinner:function(e){if(e.exists()){var t=acf.wp_version;parseFloat(t)>=4.2?e.removeClass("is-active"):e.css("display","none")}},enable_submit:function(e){e.exists()&&e.removeClass("disabled button-disabled button-primary-disabled")}}.init();$(document).on("click","#submit-delete",function(){var e=confirm(acf.l10n.move_to_trash);return e?void 0:!1}),$(document).on("change","#acf_fields tr.field_type select",function(){var e=$(this),t=e.closest("tbody"),i=t.closest(".field"),a=i.attr("data-type"),n=i.attr("data-id"),l=e.val();if(i.removeClass("field_type-"+a).addClass("field_type-"+l),i.attr("data-type",l),("tab"==l||"message"==l)&&t.find('tr.field_name input[type="text"]').val("").trigger("keyup"),t.children("tr.field_option_"+l).exists())t.children("tr.field_option").hide().find("[name]").attr("disabled","true"),t.children("tr.field_option_"+l).show().find("[name]").removeAttr("disabled");else{var o=$('<tr"><td class="label"></td><td><div class="acf-loading"></div></td></tr>');t.children("tr.field_option").hide().find("[name]").attr("disabled","true"),t.children("tr.conditional-logic").exists()?t.children("tr.conditional-logic").before(o):t.children("tr.field_save").before(o);var c={action:"acf/field_group/render_options",post_id:acf.post_id,field_key:e.attr("name"),field_type:l,nonce:acf.nonce};$.ajax({url:ajaxurl,data:c,type:"post",dataType:"html",success:function(e){return e?void o.replaceWith(e):void o.remove()}})}}),$.fn.update_names=function(){var e=$(this),t=e.attr("data-id"),i="field_"+acf.helpers.uniqid();e.attr("data-id",i),e.attr("class",e.attr("class").replace(t,i)),e.find(".field_meta td.field_key").text(i),e.find('[id*="'+t+'"]').each(function(){$(this).attr("id",$(this).attr("id").replace(t,i))}),e.find('[name*="'+t+'"]').each(function(){$(this).attr("name",$(this).attr("name").replace(t,i))})},$(document).on("click","#acf_fields a.acf_edit_field",function(){var e=$(this).closest(".field");e.hasClass("form_open")?(e.removeClass("form_open"),$(document).trigger("acf/field_form-close",[e])):(e.addClass("form_open"),$(document).trigger("acf/field_form-open",[e])),e.children(".field_form_mask").animate({height:"toggle"},250)}),$(document).on("click","#acf_fields a.acf_delete_field",function(){var t=$(this),i=t.closest(".field"),a=i.closest(".fields"),n=$('<div style="height:'+i.height()+'px"></div>');i.animate({left:"50px",opacity:0},250,function(){i.before(n),i.remove(),a.children(".field").length<=1?(n.remove(),a.children(".no_fields_message").show()):n.animate({height:0},250,function(){n.remove()}),e()})}),$(document).on("click","#acf_fields a.acf_duplicate_field",function(){var t=$(this),i=t.closest(".field"),a=null;i.find("select").each(function(){$(this).attr("data-val",$(this).val())}),a=i.clone(),a.update_names(),a.find(".field:not(.field_key-field_clone)").each(function(){$(this).update_names()}),i.after(a),a.find("select").each(function(){$(this).val($(this).attr("data-val")).trigger("change")}),i.hasClass("form_open")?i.find(".acf_edit_field").first().trigger("click"):a.find(".acf_edit_field").first().trigger("click");var n=a.find('tr.field_label:first input[type="text"]'),l=a.find('tr.field_name:first input[type="text"]');l.val(""),n.val(n.val()+" ("+acf.l10n.copy+")"),n.trigger("blur").trigger("keyup"),e()}),$(document).on("click","#acf_fields #add_field",function(){var t=$(this).closest(".table_footer").siblings(".fields"),i=t.children(".field_key-field_clone").clone();return i.update_names(),i.show(),t.children(".field_key-field_clone").before(i),t.children(".no_fields_message").exists()&&t.children(".no_fields_message").hide(),i.find("tr.field_type select").trigger("change"),i.find('.field_form input[type="text"]').val(""),setTimeout(function(){i.find('.field_form input[type="text"]').first().focus()},500),i.find("a.acf_edit_field").first().trigger("click"),e(),!1}),$(document).on("blur","#acf_fields tr.field_label input.label",function(){var e=$(this),t=e.closest(".field"),i=t.find('tr.field_name:first input[type="text"]'),a=t.attr("data-type");if("tab"==a||"message"==a)return void i.val("").trigger("keyup");if(""==i.val()){var n=e.val(),l={"ä":"a","æ":"a","å":"a","ö":"o","ø":"o","é":"e","ë":"e","ü":"u","ó":"o","ő":"o","ú":"u","é":"e","á":"a","ű":"u","í":"i"," ":"_","'":"","\\?":""};$.each(l,function(e,t){var i=new RegExp(e,"g");n=n.replace(i,t)}),n=n.toLowerCase(),i.val(n),i.trigger("keyup")}}),$(document).on("keyup","#acf_fields .field_form tr.field_label input.label",function(){var e=$(this).val(),t=$(this).closest(".field").find("td.field_label strong a").first().html(e)}),$(document).on("keyup","#acf_fields .field_form tr.field_name input.name",function(){var e=$(this).val(),t=$(this).closest(".field").find("td.field_name").first().html(e)}),$(document).on("change","#acf_fields .field_form tr.field_type select",function(){var e=$(this).val(),t=$(this).find('option[value="'+e+'"]').html();$(this).closest(".field").find("td.field_type").first().html(t)}),$(document).on("mouseover","#acf_fields td.field_order",function(){var t=$(this).closest(".fields");return t.hasClass("sortable")?!1:void t.addClass("sortable").sortable({update:function(t,i){e()},handle:"td.field_order"})}),$(document).ready(function(){acf.location.init(),acf.conditional_logic.init()}),acf.location={$el:null,init:function(){var e=this;e.$el=$("#acf_location"),e.$el.on("click",".location-add-rule",function(){return e.add_rule($(this).closest("tr")),!1}),e.$el.on("click",".location-remove-rule",function(){return e.remove_rule($(this).closest("tr")),!1}),e.$el.on("click",".location-add-group",function(){return e.add_group(),!1}),e.$el.on("change",".param select",function(){var e=$(this).closest("tr"),t=e.attr("data-id"),i=e.closest(".location-group"),a=i.attr("data-id"),n={action:"acf/field_group/render_location",nonce:acf.nonce,rule_id:t,group_id:a,value:"",param:$(this).val()},l=$('<div class="acf-loading"></div>');e.find("td.value").html(l),$.ajax({url:acf.ajaxurl,data:n,type:"post",dataType:"html",success:function(e){l.replaceWith(e)}})})},add_rule:function(e){var t=e.clone(),i=t.attr("data-id"),a=acf.helpers.uniqid();return t.find("[name]").each(function(){$(this).attr("name",$(this).attr("name").replace(i,a)),$(this).attr("id",$(this).attr("id").replace(i,a))}),t.attr("data-id",a),e.after(t),!1},remove_rule:function(e){var t=e.siblings("tr").length;0==t?this.remove_group(e.closest(".location-group")):e.remove()},add_group:function(){var e=this.$el.find(".location-group:last"),t=e.clone(),i=t.attr("data-id"),a=acf.helpers.uniqid();t.find("[name]").each(function(){$(this).attr("name",$(this).attr("name").replace(i,a)),$(this).attr("id",$(this).attr("id").replace(i,a))}),t.attr("data-id",a),t.find("h4").text(acf.l10n.or),t.find("tr:not(:first)").remove(),e.after(t)},remove_group:function(e){e.remove()}},$(document).ready(function(){$("#submitdiv #publish").attr("class","acf-button large"),$("#submitdiv a.submitdelete").attr("class","delete-field-group").attr("id","submit-delete");var e=$("#hide-on-screen ul.acf-checkbox-list"),t=$('<li><label><input type="checkbox" value="" name="" >'+acf.l10n.hide_show_all+"</label></li>");0==e.find("input:not(:checked)").length&&t.find("input").attr("checked","checked"),t.on("change","input",function(){var t=$(this).is(":checked");e.find("input").attr("checked",t)}),e.prepend(t)}),$(document).on("change",'#adv-settings input[name="show-field_key"]',function(){"1"==$(this).val()?$("#acf_fields table.acf").addClass("show-field_key"):$("#acf_fields table.acf").removeClass("show-field_key")}),acf.helpers.create_field=function(e){var t={type:"text",classname:"",name:"",value:""};e=$.extend(!0,t,e);var i="";if("text"==e.type)i+='<input class="text '+e.classname+'" type="text" id="'+e.name+'" name="'+e.name+'" value="'+e.value+'" />';else if("select"==e.type){var a={};$.each(e.choices,function(e,t){void 0===t.group&&(t.group=0),void 0===a[t.group]&&(a[t.group]=[]),a[t.group].push(t)}),i+='<select class="select '+e.classname+'" id="'+e.name+'" name="'+e.name+'">',$.each(a,function(t,a){0!=t&&(i+='<optgroup label="'+t+'">'),$.each(a,function(t,a){var n="";a.value==e.value&&(n='selected="selected"'),i+="<option "+n+' value="'+a.value+'">'+a.label+"</option>"}),0!=t&&(i+="</optgroup>")}),i+="</select>"}return i=$(i)},acf.conditional_logic={triggers:null,init:function(){var e=this;$(document).on("acf/field_form-open",function(t,i){e.render(i)}),$(document).on("change","#acf_fields tr.field_label input.label",function(){$("#acf_fields .field.form_open").each(function(){e.render($(this))})}),$(document).on("change",'tr.conditional-logic input[type="radio"]',function(t){t.preventDefault(),e.change_toggle($(this))}),$(document).on("change","select.conditional-logic-field",function(t){t.preventDefault(),e.change_trigger($(this))}),$(document).on("click","tr.conditional-logic .acf-button-add",function(t){t.preventDefault(),e.add($(this).closest("tr"))}),$(document).on("click","tr.conditional-logic .acf-button-remove",function(t){t.preventDefault(),e.remove($(this).closest("tr"))})},render:function(e){var t=this,i=[],a=e.attr("data-id"),n=e.parents(".fields"),l=e.find("> .field_form_mask > .field_form > table > tbody > tr.conditional-logic");$.each(n,function(e){var t=0==e?acf.l10n.sibling_fields:acf.l10n.parent_fields;$(this).children(".field").each(function(){var e=$(this),n=e.attr("data-id"),l=e.attr("data-type"),o=e.find("tr.field_label input").val();"field_clone"!=n&&n!=a&&("select"==l||"checkbox"==l||"true_false"==l||"radio"==l)&&i.push({value:n,label:o,group:t})})}),0==i.length&&i.push({value:"null",label:acf.l10n.no_fields}),l.find(".conditional-logic-field").each(function(){var e=$(this).val(),t=$(this).attr("name"),a=acf.helpers.create_field({type:"select",classname:"conditional-logic-field",name:t,value:e,choices:i});$(this).replaceWith(a),a.trigger("change")})},change_toggle:function(e){var t=e.val(),i=e.closest("tr.conditional-logic");"1"==t?i.find(".contional-logic-rules-wrapper").show():i.find(".contional-logic-rules-wrapper").hide()},change_trigger:function(e){var t=e.val(),i=$(".field_key-"+t),a=i.attr("data-type"),n=e.closest("tr").find(".conditional-logic-value"),l=[];if("true_false"==a)l=[{value:1,label:acf.l10n.checked}];else if("select"==a||"checkbox"==a||"radio"==a){var o=i.find(".field_option-choices").val().split("\n");if(o)for(var c=0;c<o.length;c++){var r=o[c].split(":"),d=r[0];r[1]&&(d=r[1]),l.push({value:$.trim(r[0]),label:$.trim(d)})}}var e=acf.helpers.create_field({type:"select",classname:"conditional-logic-value",name:n.attr("name"),value:n.val(),choices:l});n.replaceWith(e),e.trigger("change")},add:function(e){var t=e.clone(),i=parseFloat(e.attr("data-i")),a=acf.helpers.uniqid();t.find("[name]").each(function(){var e="[conditional_logic][rules]["+i+"]",t="[conditional_logic][rules]["+a+"]";$(this).attr("name",$(this).attr("name").replace(e,t)),$(this).attr("id",$(this).attr("id").replace(e,t))}),t.attr("data-i",a),e.after(t),e.closest("table").removeClass("remove-disabled")},remove:function(e){var t=e.closest("table");return t.hasClass("remove-disabled")?!1:(e.remove(),void(t.find("tr").length<=1&&t.addClass("remove-disabled")))}},$(document).on("change",".radio-option-other_choice input",function(){var e=$(this),t=e.closest("td");e.is(":checked")?t.find(".radio-option-save_other_choice").show():(t.find(".radio-option-save_other_choice").hide(),t.find(".radio-option-save_other_choice input").removeAttr("checked"))})}(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* field-group.js
|
3 |
+
*
|
4 |
+
* All javascript needed to create a field group
|
5 |
+
*
|
6 |
+
* @type JS
|
7 |
+
* @date 1/08/13
|
8 |
+
*/var acf={ajaxurl:"",admin_url:"",post_id:0,nonce:"",l10n:{},text:{},helpers:{uniqid:null,sortable:null,create_field:null},conditional_logic:null,location:null};(function(e){function t(){e("#acf_fields .fields").each(function(){e(this).children(".field").each(function(t){e(this).find("td.field_order .circle").first().html(t+1)})})}e.fn.exists=function(){return e(this).length>0};acf.helpers.sortable=function(t,n){n.children().each(function(){e(this).width(e(this).width())});return n};acf.helpers.uniqid=function(e,t){typeof e=="undefined"&&(e="");var n,r=function(e,t){e=parseInt(e,10).toString(16);return t<e.length?e.slice(e.length-t):t>e.length?Array(1+(t-e.length)).join("0")+e:e};this.php_js||(this.php_js={});this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(Math.random()*123456789));this.php_js.uniqidSeed++;n=e;n+=r(parseInt((new Date).getTime()/1e3,10),8);n+=r(this.php_js.uniqidSeed,5);t&&(n+=(Math.random()*10).toFixed(8).toString());return n};e(document).on("submit","#post",function(){var t=e("#titlewrap #title");if(!t.val()){alert(acf.l10n.title);t.focus();return!1}});e(document).on("click","#submit-delete",function(){var e=confirm(acf.l10n.move_to_trash);if(!e)return!1});e(document).on("change","#acf_fields tr.field_type select",function(){var t=e(this),n=t.closest("tbody"),r=n.closest(".field"),i=r.attr("data-type"),s=r.attr("data-id"),o=t.val();r.removeClass("field_type-"+i).addClass("field_type-"+o);r.attr("data-type",o);(o=="tab"||o=="message")&&n.find('tr.field_name input[type="text"]').val("").trigger("keyup");if(n.children("tr.field_option_"+o).exists()){n.children("tr.field_option").hide().find("[name]").attr("disabled","true");n.children("tr.field_option_"+o).show().find("[name]").removeAttr("disabled")}else{var u=e('<tr"><td class="label"></td><td><div class="acf-loading"></div></td></tr>');n.children("tr.field_option").hide().find("[name]").attr("disabled","true");n.children("tr.conditional-logic").exists()?n.children("tr.conditional-logic").before(u):n.children("tr.field_save").before(u);var a={action:"acf/field_group/render_options",post_id:acf.post_id,field_key:t.attr("name"),field_type:o,nonce:acf.nonce};e.ajax({url:ajaxurl,data:a,type:"post",dataType:"html",success:function(e){if(!e){u.remove();return}u.replaceWith(e)}})}});e.fn.update_names=function(){var t=e(this),n=t.attr("data-id"),r="field_"+acf.helpers.uniqid();t.attr("data-id",r);t.attr("class",t.attr("class").replace(n,r));t.find(".field_meta td.field_key").text(r);t.find('[id*="'+n+'"]').each(function(){e(this).attr("id",e(this).attr("id").replace(n,r))});t.find('[name*="'+n+'"]').each(function(){e(this).attr("name",e(this).attr("name").replace(n,r))})};e(document).on("click","#acf_fields a.acf_edit_field",function(){var t=e(this).closest(".field");if(t.hasClass("form_open")){t.removeClass("form_open");e(document).trigger("acf/field_form-close",[t])}else{t.addClass("form_open");e(document).trigger("acf/field_form-open",[t])}t.children(".field_form_mask").animate({height:"toggle"},250)});e(document).on("click","#acf_fields a.acf_delete_field",function(){var n=e(this),r=n.closest(".field"),i=r.closest(".fields"),s=e('<div style="height:'+r.height()+'px"></div>');r.animate({left:"50px",opacity:0},250,function(){r.before(s);r.remove();if(i.children(".field").length<=1){s.remove();i.children(".no_fields_message").show()}else s.animate({height:0},250,function(){s.remove()});t()})});e(document).on("click","#acf_fields a.acf_duplicate_field",function(){var n=e(this),r=n.closest(".field"),i=null;r.find("select").each(function(){e(this).attr("data-val",e(this).val())});i=r.clone();i.update_names();i.find(".field:not(.field_key-field_clone)").each(function(){e(this).update_names()});r.after(i);i.find("select").each(function(){e(this).val(e(this).attr("data-val")).trigger("change")});r.hasClass("form_open")?r.find(".acf_edit_field").first().trigger("click"):i.find(".acf_edit_field").first().trigger("click");var s=i.find('tr.field_label:first input[type="text"]'),o=i.find('tr.field_name:first input[type="text"]');o.val("");s.val(s.val()+" ("+acf.l10n.copy+")");s.trigger("blur").trigger("keyup");t()});e(document).on("click","#acf_fields #add_field",function(){var n=e(this).closest(".table_footer").siblings(".fields"),r=n.children(".field_key-field_clone").clone();r.update_names();r.show();n.children(".field_key-field_clone").before(r);n.children(".no_fields_message").exists()&&n.children(".no_fields_message").hide();r.find("tr.field_type select").trigger("change");r.find('.field_form input[type="text"]').val("");setTimeout(function(){r.find('.field_form input[type="text"]').first().focus()},500);r.find("a.acf_edit_field").first().trigger("click");t();return!1});e(document).on("blur","#acf_fields tr.field_label input.label",function(){var t=e(this),n=t.closest(".field"),r=n.find('tr.field_name:first input[type="text"]'),i=n.attr("data-type");if(i=="tab"||i=="message"){r.val("").trigger("keyup");return}if(r.val()==""){var s=t.val(),o={"ä":"a","æ":"a","å":"a","ö":"o","ø":"o","é":"e","ë":"e","ü":"u","ó":"o","ő":"o","ú":"u","é":"e","á":"a","ű":"u","í":"i"," ":"_","'":"","\\?":""};e.each(o,function(e,t){var n=new RegExp(e,"g");s=s.replace(n,t)});s=s.toLowerCase();r.val(s);r.trigger("keyup")}});e(document).on("keyup","#acf_fields .field_form tr.field_label input.label",function(){var t=e(this).val(),n=e(this).closest(".field").find("td.field_label strong a").first().html(t)});e(document).on("keyup","#acf_fields .field_form tr.field_name input.name",function(){var t=e(this).val(),n=e(this).closest(".field").find("td.field_name").first().html(t)});e(document).on("change","#acf_fields .field_form tr.field_type select",function(){var t=e(this).val(),n=e(this).find('option[value="'+t+'"]').html();e(this).closest(".field").find("td.field_type").first().html(n)});e(document).on("mouseover","#acf_fields td.field_order",function(){var n=e(this).closest(".fields");if(n.hasClass("sortable"))return!1;n.addClass("sortable").sortable({update:function(e,n){t()},handle:"td.field_order"})});e(document).ready(function(){acf.location.init();acf.conditional_logic.init()});acf.location={$el:null,init:function(){var t=this;t.$el=e("#acf_location");t.$el.on("click",".location-add-rule",function(){t.add_rule(e(this).closest("tr"));return!1});t.$el.on("click",".location-remove-rule",function(){t.remove_rule(e(this).closest("tr"));return!1});t.$el.on("click",".location-add-group",function(){t.add_group();return!1});t.$el.on("change",".param select",function(){var t=e(this).closest("tr"),n=t.attr("data-id"),r=t.closest(".location-group"),i=r.attr("data-id"),s={action:"acf/field_group/render_location",nonce:acf.nonce,rule_id:n,group_id:i,value:"",param:e(this).val()},o=e('<div class="acf-loading"></div>');t.find("td.value").html(o);e.ajax({url:acf.ajaxurl,data:s,type:"post",dataType:"html",success:function(e){o.replaceWith(e)}})})},add_rule:function(t){var n=t.clone(),r=n.attr("data-id"),i=acf.helpers.uniqid();n.find("[name]").each(function(){e(this).attr("name",e(this).attr("name").replace(r,i));e(this).attr("id",e(this).attr("id").replace(r,i))});n.attr("data-id",i);t.after(n);return!1},remove_rule:function(e){var t=e.siblings("tr").length;t==0?this.remove_group(e.closest(".location-group")):e.remove()},add_group:function(){var t=this.$el.find(".location-group:last"),n=t.clone(),r=n.attr("data-id"),i=acf.helpers.uniqid();n.find("[name]").each(function(){e(this).attr("name",e(this).attr("name").replace(r,i));e(this).attr("id",e(this).attr("id").replace(r,i))});n.attr("data-id",i);n.find("h4").text(acf.l10n.or);n.find("tr:not(:first)").remove();t.after(n)},remove_group:function(e){e.remove()}};e(document).ready(function(){e("#submitdiv #publish").attr("class","acf-button large");e("#submitdiv a.submitdelete").attr("class","delete-field-group").attr("id","submit-delete");var t=e("#hide-on-screen ul.acf-checkbox-list"),n=e('<li><label><input type="checkbox" value="" name="" >'+acf.l10n.hide_show_all+"</label></li>");t.find("input:not(:checked)").length==0&&n.find("input").attr("checked","checked");n.on("change","input",function(){var n=e(this).is(":checked");t.find("input").attr("checked",n)});t.prepend(n)});e(document).on("change",'#adv-settings input[name="show-field_key"]',function(){e(this).val()=="1"?e("#acf_fields table.acf").addClass("show-field_key"):e("#acf_fields table.acf").removeClass("show-field_key")});acf.helpers.create_field=function(t){var n={type:"text",classname:"",name:"",value:""};t=e.extend(!0,n,t);var r="";if(t.type=="text")r+='<input class="text '+t.classname+'" type="text" id="'+t.name+'" name="'+t.name+'" value="'+t.value+'" />';else if(t.type=="select"){var i={};e.each(t.choices,function(e,t){t.group===undefined&&(t.group=0);i[t.group]===undefined&&(i[t.group]=[]);i[t.group].push(t)});r+='<select class="select '+t.classname+'" id="'+t.name+'" name="'+t.name+'">';e.each(i,function(n,i){n!=0&&(r+='<optgroup label="'+n+'">');e.each(i,function(e,n){var i="";n.value==t.value&&(i='selected="selected"');r+="<option "+i+' value="'+n.value+'">'+n.label+"</option>"});n!=0&&(r+="</optgroup>")});r+="</select>"}r=e(r);return r};acf.conditional_logic={triggers:null,init:function(){var t=this;e(document).on("acf/field_form-open",function(e,n){t.render(n)});e(document).on("change","#acf_fields tr.field_label input.label",function(){e("#acf_fields .field.form_open").each(function(){t.render(e(this))})});e(document).on("change",'tr.conditional-logic input[type="radio"]',function(n){n.preventDefault();t.change_toggle(e(this))});e(document).on("change","select.conditional-logic-field",function(n){n.preventDefault();t.change_trigger(e(this))});e(document).on("click","tr.conditional-logic .acf-button-add",function(n){n.preventDefault();t.add(e(this).closest("tr"))});e(document).on("click","tr.conditional-logic .acf-button-remove",function(n){n.preventDefault();t.remove(e(this).closest("tr"))})},render:function(t){var n=this,r=[],i=t.attr("data-id"),s=t.parents(".fields"),o=t.find("> .field_form_mask > .field_form > table > tbody > tr.conditional-logic");e.each(s,function(t){var n=t==0?acf.l10n.sibling_fields:acf.l10n.parent_fields;e(this).children(".field").each(function(){var t=e(this),s=t.attr("data-id"),o=t.attr("data-type"),u=t.find("tr.field_label input").val();if(s=="field_clone")return;if(s==i)return;(o=="select"||o=="checkbox"||o=="true_false"||o=="radio")&&r.push({value:s,label:u,group:n})})});r.length==0&&r.push({value:"null",label:acf.l10n.no_fields});o.find(".conditional-logic-field").each(function(){var t=e(this).val(),n=e(this).attr("name"),i=acf.helpers.create_field({type:"select",classname:"conditional-logic-field",name:n,value:t,choices:r});e(this).replaceWith(i);i.trigger("change")})},change_toggle:function(e){var t=e.val(),n=e.closest("tr.conditional-logic");t=="1"?n.find(".contional-logic-rules-wrapper").show():n.find(".contional-logic-rules-wrapper").hide()},change_trigger:function(t){var n=t.val(),r=e(".field_key-"+n),i=r.attr("data-type"),s=t.closest("tr").find(".conditional-logic-value"),o=[];if(i=="true_false")o=[{value:1,label:acf.l10n.checked}];else if(i=="select"||i=="checkbox"||i=="radio"){var u=r.find(".field_option-choices").val().split("\n");if(u)for(var a=0;a<u.length;a++){var f=u[a].split(":"),l=f[0];f[1]&&(l=f[1]);o.push({value:e.trim(f[0]),label:e.trim(l)})}}var t=acf.helpers.create_field({type:"select",classname:"conditional-logic-value",name:s.attr("name"),value:s.val(),choices:o});s.replaceWith(t);t.trigger("change")},add:function(t){var n=t.clone(),r=parseFloat(t.attr("data-i")),i=acf.helpers.uniqid();n.find("[name]").each(function(){var t="[conditional_logic][rules]["+r+"]",n="[conditional_logic][rules]["+i+"]";e(this).attr("name",e(this).attr("name").replace(t,n));e(this).attr("id",e(this).attr("id").replace(t,n))});n.attr("data-i",i);t.after(n);t.closest("table").removeClass("remove-disabled")},remove:function(e){var t=e.closest("table");if(t.hasClass("remove-disabled"))return!1;e.remove();t.find("tr").length<=1&&t.addClass("remove-disabled")}};e(document).on("change",".radio-option-other_choice input",function(){var t=e(this),n=t.closest("td");if(t.is(":checked"))n.find(".radio-option-save_other_choice").show();else{n.find(".radio-option-save_other_choice").hide();n.find(".radio-option-save_other_choice input").removeAttr("checked")}})})(jQuery);
|
shared/assets/plugins/advanced-custom-fields/js/input.js
CHANGED
@@ -884,7 +884,7 @@ var acf = {
|
|
884 |
* @created: 22/12/12
|
885 |
*/
|
886 |
|
887 |
-
$(window).
|
888 |
|
889 |
// init
|
890 |
acf.media.init();
|
@@ -1573,8 +1573,11 @@ var acf = {
|
|
1573 |
div.closest('.field').removeClass('error');
|
1574 |
|
1575 |
},
|
1576 |
-
|
1577 |
-
|
|
|
|
|
|
|
1578 |
|
1579 |
// set global var
|
1580 |
_media.div = this.$el;
|
@@ -1584,77 +1587,23 @@ var acf = {
|
|
1584 |
_media.clear_frame();
|
1585 |
|
1586 |
|
1587 |
-
//
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
library : wp.media.query( this.o.query ),
|
1594 |
-
multiple : attributes.multiple,
|
1595 |
-
title : attributes.title,
|
1596 |
-
priority : 20,
|
1597 |
-
filterable : 'all'
|
1598 |
-
})
|
1599 |
-
);
|
1600 |
-
|
1601 |
-
|
1602 |
-
// edit image functionality (added in WP 3.9)
|
1603 |
-
if( acf.helpers.isset(wp, 'media', 'controller', 'EditImage') ) {
|
1604 |
-
|
1605 |
-
attributes.states.push( new wp.media.controller.EditImage() );
|
1606 |
-
|
1607 |
-
}
|
1608 |
-
|
1609 |
-
|
1610 |
-
// Create the media frame
|
1611 |
-
_media.frame = wp.media( attributes );
|
1612 |
-
|
1613 |
-
|
1614 |
-
// edit image view
|
1615 |
-
// source: media-views.js:2410 editImageContent()
|
1616 |
-
_media.frame.on('content:render:edit-image', function(){
|
1617 |
-
|
1618 |
-
var image = this.state().get('image'),
|
1619 |
-
view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
|
1620 |
-
|
1621 |
-
this.content.set( view );
|
1622 |
-
|
1623 |
-
// after creating the wrapper view, load the actual editor via an ajax call
|
1624 |
-
view.loadEditor();
|
1625 |
-
|
1626 |
-
}, _media.frame);
|
1627 |
|
1628 |
|
1629 |
-
//
|
1630 |
-
|
|
|
1631 |
|
1632 |
-
|
1633 |
-
text: attributes.button.text,
|
1634 |
-
controller: this
|
1635 |
-
});
|
1636 |
|
1637 |
-
}, _media.frame );
|
1638 |
-
|
1639 |
-
|
1640 |
-
// return
|
1641 |
-
return _media.frame;
|
1642 |
-
|
1643 |
-
},
|
1644 |
-
|
1645 |
-
edit : function(){
|
1646 |
-
|
1647 |
-
// vars
|
1648 |
-
var id = this.$input.val();
|
1649 |
-
|
1650 |
-
|
1651 |
-
// create frame
|
1652 |
-
this.new_frame({
|
1653 |
-
title : acf.l10n.file.edit,
|
1654 |
-
multiple : false,
|
1655 |
-
button : { text : acf.l10n.file.update }
|
1656 |
});
|
1657 |
-
|
|
|
1658 |
|
1659 |
// open
|
1660 |
_media.frame.on('open',function() {
|
@@ -1721,11 +1670,25 @@ var acf = {
|
|
1721 |
var t = this;
|
1722 |
|
1723 |
|
1724 |
-
//
|
1725 |
-
this
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1729 |
});
|
1730 |
|
1731 |
|
@@ -1913,10 +1876,6 @@ var acf = {
|
|
1913 |
$input : null,
|
1914 |
|
1915 |
o : {},
|
1916 |
-
api: {
|
1917 |
-
sensor: false,
|
1918 |
-
libraries: 'places'
|
1919 |
-
},
|
1920 |
|
1921 |
ready : false,
|
1922 |
geocoder : false,
|
@@ -1930,7 +1889,7 @@ var acf = {
|
|
1930 |
|
1931 |
|
1932 |
// find input
|
1933 |
-
this.$input = this.$el.find('.
|
1934 |
|
1935 |
|
1936 |
// get options
|
@@ -2308,46 +2267,37 @@ var acf = {
|
|
2308 |
|
2309 |
$(document).on('acf/setup_fields', function(e, el){
|
2310 |
|
2311 |
-
// reference
|
2312 |
-
var self = acf.fields.google_map;
|
2313 |
-
|
2314 |
-
|
2315 |
// vars
|
2316 |
-
|
2317 |
|
2318 |
|
2319 |
// validate
|
2320 |
-
if( ! $fields.exists() )
|
|
|
|
|
|
|
2321 |
|
2322 |
|
2323 |
-
//
|
2324 |
-
if(
|
2325 |
-
|
2326 |
-
// load API
|
2327 |
$.getScript('https://www.google.com/jsapi', function(){
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
$fields.each(function(){
|
2333 |
|
2334 |
acf.fields.google_map.set({ $el : $(this) }).init();
|
2335 |
|
2336 |
});
|
2337 |
|
2338 |
}});
|
2339 |
-
|
2340 |
});
|
2341 |
|
2342 |
-
return false;
|
2343 |
-
|
2344 |
}
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
if( !acf.helpers.isset(window, 'google', 'maps', 'places') ) {
|
2349 |
-
|
2350 |
-
google.load('maps', '3', { other_params: $.param(self.api), callback: function(){
|
2351 |
|
2352 |
$fields.each(function(){
|
2353 |
|
@@ -2356,23 +2306,9 @@ var acf = {
|
|
2356 |
});
|
2357 |
|
2358 |
}});
|
2359 |
-
|
2360 |
-
return false;
|
2361 |
|
2362 |
}
|
2363 |
|
2364 |
-
|
2365 |
-
// google exists
|
2366 |
-
$fields.each(function(){
|
2367 |
-
|
2368 |
-
acf.fields.google_map.set({ $el : $(this) }).init();
|
2369 |
-
|
2370 |
-
});
|
2371 |
-
|
2372 |
-
|
2373 |
-
// return
|
2374 |
-
return true;
|
2375 |
-
|
2376 |
});
|
2377 |
|
2378 |
|
@@ -2550,8 +2486,11 @@ var acf = {
|
|
2550 |
div.closest('.field').removeClass('error');
|
2551 |
|
2552 |
},
|
2553 |
-
|
2554 |
-
|
|
|
|
|
|
|
2555 |
|
2556 |
// set global var
|
2557 |
_media.div = this.$el;
|
@@ -2561,78 +2500,23 @@ var acf = {
|
|
2561 |
_media.clear_frame();
|
2562 |
|
2563 |
|
2564 |
-
//
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
new wp.media.controller.Library({
|
2571 |
-
library : wp.media.query( this.o.query ),
|
2572 |
-
multiple : attributes.multiple,
|
2573 |
-
title : attributes.title,
|
2574 |
-
priority : 20,
|
2575 |
-
filterable : 'all'
|
2576 |
-
})
|
2577 |
-
);
|
2578 |
-
|
2579 |
-
|
2580 |
-
// edit image functionality (added in WP 3.9)
|
2581 |
-
if( acf.helpers.isset(wp, 'media', 'controller', 'EditImage') ) {
|
2582 |
-
|
2583 |
-
attributes.states.push( new wp.media.controller.EditImage() );
|
2584 |
-
|
2585 |
-
}
|
2586 |
-
|
2587 |
-
|
2588 |
-
// Create the media frame
|
2589 |
-
_media.frame = wp.media( attributes );
|
2590 |
|
2591 |
|
2592 |
-
//
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
var image = this.state().get('image'),
|
2597 |
-
view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
|
2598 |
-
|
2599 |
-
this.content.set( view );
|
2600 |
-
|
2601 |
-
// after creating the wrapper view, load the actual editor via an ajax call
|
2602 |
-
view.loadEditor();
|
2603 |
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
// update toolbar button
|
2608 |
-
_media.frame.on( 'toolbar:create:select', function( toolbar ) {
|
2609 |
|
2610 |
-
toolbar.view = new wp.media.view.Toolbar.Select({
|
2611 |
-
text: attributes.button.text,
|
2612 |
-
controller: this
|
2613 |
-
});
|
2614 |
-
|
2615 |
-
}, _media.frame );
|
2616 |
-
|
2617 |
-
|
2618 |
-
// return
|
2619 |
-
return _media.frame;
|
2620 |
-
|
2621 |
-
},
|
2622 |
-
|
2623 |
-
edit : function(){
|
2624 |
-
|
2625 |
-
// vars
|
2626 |
-
var id = this.$input.val();
|
2627 |
-
|
2628 |
-
|
2629 |
-
// create frame
|
2630 |
-
this.new_frame({
|
2631 |
-
title : acf.l10n.image.edit,
|
2632 |
-
multiple : false,
|
2633 |
-
button : { text : acf.l10n.image.update }
|
2634 |
});
|
2635 |
-
|
|
|
2636 |
|
2637 |
// open
|
2638 |
_media.frame.on('open',function() {
|
@@ -2675,7 +2559,7 @@ var acf = {
|
|
2675 |
|
2676 |
|
2677 |
// Finally, open the modal
|
2678 |
-
|
2679 |
|
2680 |
},
|
2681 |
remove : function()
|
@@ -2696,16 +2580,37 @@ var acf = {
|
|
2696 |
var t = this;
|
2697 |
|
2698 |
|
2699 |
-
//
|
2700 |
-
this
|
2701 |
-
|
2702 |
-
|
2703 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2704 |
});
|
2705 |
|
2706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2707 |
// customize model / view
|
2708 |
-
|
2709 |
|
2710 |
// vars
|
2711 |
var toolbar = null,
|
@@ -3194,17 +3099,17 @@ var acf = {
|
|
3194 |
|
3195 |
|
3196 |
// template
|
3197 |
-
var
|
3198 |
-
|
3199 |
-
|
3200 |
-
|
3201 |
-
|
3202 |
-
|
3203 |
-
|
3204 |
|
3205 |
|
3206 |
// add new li
|
3207 |
-
this.$right.find('.relationship_list').append(
|
3208 |
|
3209 |
|
3210 |
// trigger change on new_li
|
@@ -4073,12 +3978,12 @@ var acf = {
|
|
4073 |
|
4074 |
var _wysiwyg = acf.fields.wysiwyg = {
|
4075 |
|
4076 |
-
$el: null,
|
4077 |
-
$textarea: null,
|
4078 |
|
4079 |
-
o: {},
|
4080 |
|
4081 |
-
set: function( o ){
|
4082 |
|
4083 |
// merge in new option
|
4084 |
$.extend( this, o );
|
@@ -4090,6 +3995,9 @@ var acf = {
|
|
4090 |
|
4091 |
// get options
|
4092 |
this.o = acf.helpers.get_atts( this.$el );
|
|
|
|
|
|
|
4093 |
this.o.id = this.$textarea.attr('id');
|
4094 |
|
4095 |
|
@@ -4097,7 +4005,6 @@ var acf = {
|
|
4097 |
return this;
|
4098 |
|
4099 |
},
|
4100 |
-
|
4101 |
has_tinymce : function(){
|
4102 |
|
4103 |
var r = false;
|
@@ -4136,8 +4043,7 @@ var acf = {
|
|
4136 |
|
4137 |
|
4138 |
// vars
|
4139 |
-
var
|
4140 |
-
toolbar = this.get_toolbar(),
|
4141 |
command = 'mceAddControl',
|
4142 |
setting = 'theme_advanced_buttons{i}';
|
4143 |
|
@@ -4181,19 +4087,15 @@ var acf = {
|
|
4181 |
|
4182 |
|
4183 |
// add editor
|
4184 |
-
tinyMCE.execCommand( command, false, id);
|
4185 |
|
4186 |
|
4187 |
// events - load
|
4188 |
-
$(document).trigger('acf/wysiwyg/load', id);
|
4189 |
|
4190 |
|
4191 |
// add events (click, focus, blur) for inserting image into correct editor
|
4192 |
-
|
4193 |
-
|
4194 |
-
_wysiwyg.add_events( id );
|
4195 |
-
|
4196 |
-
}, 100);
|
4197 |
|
4198 |
|
4199 |
// restore tinyMCE.settings
|
@@ -4204,15 +4106,18 @@ var acf = {
|
|
4204 |
wpActiveEditor = null;
|
4205 |
|
4206 |
},
|
|
|
4207 |
|
4208 |
-
add_events: function( id ){
|
4209 |
-
|
4210 |
// vars
|
4211 |
-
var
|
|
|
4212 |
|
4213 |
|
4214 |
// validate
|
4215 |
-
if( !editor )
|
|
|
|
|
|
|
4216 |
|
4217 |
|
4218 |
// vars
|
@@ -4532,7 +4437,7 @@ var acf = {
|
|
4532 |
* @created: 22/12/12
|
4533 |
*/
|
4534 |
|
4535 |
-
$(window).
|
4536 |
|
4537 |
// validate
|
4538 |
if( ! _wysiwyg.has_tinymce() )
|
@@ -4580,7 +4485,7 @@ var acf = {
|
|
4580 |
// Add events to content editor
|
4581 |
if( wp_content )
|
4582 |
{
|
4583 |
-
_wysiwyg.
|
4584 |
}
|
4585 |
|
4586 |
|
884 |
* @created: 22/12/12
|
885 |
*/
|
886 |
|
887 |
+
$(window).load(function(){
|
888 |
|
889 |
// init
|
890 |
acf.media.init();
|
1573 |
div.closest('.field').removeClass('error');
|
1574 |
|
1575 |
},
|
1576 |
+
edit : function(){
|
1577 |
+
|
1578 |
+
// vars
|
1579 |
+
var id = this.$input.val();
|
1580 |
+
|
1581 |
|
1582 |
// set global var
|
1583 |
_media.div = this.$el;
|
1587 |
_media.clear_frame();
|
1588 |
|
1589 |
|
1590 |
+
// create the media frame
|
1591 |
+
_media.frame = wp.media({
|
1592 |
+
title : acf.l10n.file.edit,
|
1593 |
+
multiple : false,
|
1594 |
+
button : { text : acf.l10n.file.update }
|
1595 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1596 |
|
1597 |
|
1598 |
+
// log events
|
1599 |
+
/*
|
1600 |
+
acf.media.frame.on('all', function(e){
|
1601 |
|
1602 |
+
console.log( e );
|
|
|
|
|
|
|
1603 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1604 |
});
|
1605 |
+
*/
|
1606 |
+
|
1607 |
|
1608 |
// open
|
1609 |
_media.frame.on('open',function() {
|
1670 |
var t = this;
|
1671 |
|
1672 |
|
1673 |
+
// set global var
|
1674 |
+
_media.div = this.$el;
|
1675 |
+
|
1676 |
+
|
1677 |
+
// clear the frame
|
1678 |
+
_media.clear_frame();
|
1679 |
+
|
1680 |
+
|
1681 |
+
// Create the media frame
|
1682 |
+
_media.frame = wp.media({
|
1683 |
+
states : [
|
1684 |
+
new wp.media.controller.Library({
|
1685 |
+
library : wp.media.query( t.o.query ),
|
1686 |
+
multiple : t.o.multiple,
|
1687 |
+
title : acf.l10n.file.select,
|
1688 |
+
priority : 20,
|
1689 |
+
filterable : 'all'
|
1690 |
+
})
|
1691 |
+
]
|
1692 |
});
|
1693 |
|
1694 |
|
1876 |
$input : null,
|
1877 |
|
1878 |
o : {},
|
|
|
|
|
|
|
|
|
1879 |
|
1880 |
ready : false,
|
1881 |
geocoder : false,
|
1889 |
|
1890 |
|
1891 |
// find input
|
1892 |
+
this.$input = this.$el.find('.value');
|
1893 |
|
1894 |
|
1895 |
// get options
|
2267 |
|
2268 |
$(document).on('acf/setup_fields', function(e, el){
|
2269 |
|
|
|
|
|
|
|
|
|
2270 |
// vars
|
2271 |
+
$fields = $(el).find('.acf-google-map');
|
2272 |
|
2273 |
|
2274 |
// validate
|
2275 |
+
if( ! $fields.exists() )
|
2276 |
+
{
|
2277 |
+
return;
|
2278 |
+
}
|
2279 |
|
2280 |
|
2281 |
+
// validate google
|
2282 |
+
if( typeof google === 'undefined' )
|
2283 |
+
{
|
|
|
2284 |
$.getScript('https://www.google.com/jsapi', function(){
|
2285 |
+
|
2286 |
+
google.load('maps', '3', { other_params: 'sensor=false&libraries=places', callback: function(){
|
2287 |
+
|
2288 |
+
$fields.each(function(){
|
|
|
2289 |
|
2290 |
acf.fields.google_map.set({ $el : $(this) }).init();
|
2291 |
|
2292 |
});
|
2293 |
|
2294 |
}});
|
|
|
2295 |
});
|
2296 |
|
|
|
|
|
2297 |
}
|
2298 |
+
else
|
2299 |
+
{
|
2300 |
+
google.load('maps', '3', { other_params: 'sensor=false&libraries=places', callback: function(){
|
|
|
|
|
|
|
2301 |
|
2302 |
$fields.each(function(){
|
2303 |
|
2306 |
});
|
2307 |
|
2308 |
}});
|
|
|
|
|
2309 |
|
2310 |
}
|
2311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2312 |
});
|
2313 |
|
2314 |
|
2486 |
div.closest('.field').removeClass('error');
|
2487 |
|
2488 |
},
|
2489 |
+
edit : function(){
|
2490 |
+
|
2491 |
+
// vars
|
2492 |
+
var id = this.$input.val();
|
2493 |
+
|
2494 |
|
2495 |
// set global var
|
2496 |
_media.div = this.$el;
|
2500 |
_media.clear_frame();
|
2501 |
|
2502 |
|
2503 |
+
// create the media frame
|
2504 |
+
_media.frame = wp.media({
|
2505 |
+
title : acf.l10n.image.edit,
|
2506 |
+
multiple : false,
|
2507 |
+
button : { text : acf.l10n.image.update }
|
2508 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2509 |
|
2510 |
|
2511 |
+
// log events
|
2512 |
+
/*
|
2513 |
+
acf.media.frame.on('all', function(e){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2514 |
|
2515 |
+
console.log( e );
|
|
|
|
|
|
|
|
|
2516 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2517 |
});
|
2518 |
+
*/
|
2519 |
+
|
2520 |
|
2521 |
// open
|
2522 |
_media.frame.on('open',function() {
|
2559 |
|
2560 |
|
2561 |
// Finally, open the modal
|
2562 |
+
acf.media.frame.open();
|
2563 |
|
2564 |
},
|
2565 |
remove : function()
|
2580 |
var t = this;
|
2581 |
|
2582 |
|
2583 |
+
// set global var
|
2584 |
+
_media.div = this.$el;
|
2585 |
+
|
2586 |
+
|
2587 |
+
// clear the frame
|
2588 |
+
_media.clear_frame();
|
2589 |
+
|
2590 |
+
|
2591 |
+
// Create the media frame
|
2592 |
+
_media.frame = wp.media({
|
2593 |
+
states : [
|
2594 |
+
new wp.media.controller.Library({
|
2595 |
+
library : wp.media.query( t.o.query ),
|
2596 |
+
multiple : t.o.multiple,
|
2597 |
+
title : acf.l10n.image.select,
|
2598 |
+
priority : 20,
|
2599 |
+
filterable : 'all'
|
2600 |
+
})
|
2601 |
+
]
|
2602 |
});
|
2603 |
|
2604 |
|
2605 |
+
/*acf.media.frame.on('all', function(e){
|
2606 |
+
|
2607 |
+
console.log( e );
|
2608 |
+
|
2609 |
+
});*/
|
2610 |
+
|
2611 |
+
|
2612 |
// customize model / view
|
2613 |
+
acf.media.frame.on('content:activate', function(){
|
2614 |
|
2615 |
// vars
|
2616 |
var toolbar = null,
|
3099 |
|
3100 |
|
3101 |
// template
|
3102 |
+
var data = {
|
3103 |
+
post_id : $a.attr('data-post_id'),
|
3104 |
+
title : $a.html(),
|
3105 |
+
name : this.$input.attr('name')
|
3106 |
+
},
|
3107 |
+
tmpl = _.template(acf.l10n.relationship.tmpl_li, data);
|
3108 |
+
|
3109 |
|
3110 |
|
3111 |
// add new li
|
3112 |
+
this.$right.find('.relationship_list').append( tmpl )
|
3113 |
|
3114 |
|
3115 |
// trigger change on new_li
|
3978 |
|
3979 |
var _wysiwyg = acf.fields.wysiwyg = {
|
3980 |
|
3981 |
+
$el : null,
|
3982 |
+
$textarea : null,
|
3983 |
|
3984 |
+
o : {},
|
3985 |
|
3986 |
+
set : function( o ){
|
3987 |
|
3988 |
// merge in new option
|
3989 |
$.extend( this, o );
|
3995 |
|
3996 |
// get options
|
3997 |
this.o = acf.helpers.get_atts( this.$el );
|
3998 |
+
|
3999 |
+
|
4000 |
+
// add ID
|
4001 |
this.o.id = this.$textarea.attr('id');
|
4002 |
|
4003 |
|
4005 |
return this;
|
4006 |
|
4007 |
},
|
|
|
4008 |
has_tinymce : function(){
|
4009 |
|
4010 |
var r = false;
|
4043 |
|
4044 |
|
4045 |
// vars
|
4046 |
+
var toolbar = this.get_toolbar(),
|
|
|
4047 |
command = 'mceAddControl',
|
4048 |
setting = 'theme_advanced_buttons{i}';
|
4049 |
|
4087 |
|
4088 |
|
4089 |
// add editor
|
4090 |
+
tinyMCE.execCommand( command, false, this.o.id);
|
4091 |
|
4092 |
|
4093 |
// events - load
|
4094 |
+
$(document).trigger('acf/wysiwyg/load', this.o.id);
|
4095 |
|
4096 |
|
4097 |
// add events (click, focus, blur) for inserting image into correct editor
|
4098 |
+
this.add_events();
|
|
|
|
|
|
|
|
|
4099 |
|
4100 |
|
4101 |
// restore tinyMCE.settings
|
4106 |
wpActiveEditor = null;
|
4107 |
|
4108 |
},
|
4109 |
+
add_events : function(){
|
4110 |
|
|
|
|
|
4111 |
// vars
|
4112 |
+
var id = this.o.id,
|
4113 |
+
editor = tinyMCE.get( id );
|
4114 |
|
4115 |
|
4116 |
// validate
|
4117 |
+
if( !editor )
|
4118 |
+
{
|
4119 |
+
return;
|
4120 |
+
}
|
4121 |
|
4122 |
|
4123 |
// vars
|
4437 |
* @created: 22/12/12
|
4438 |
*/
|
4439 |
|
4440 |
+
$(window).load(function(){
|
4441 |
|
4442 |
// validate
|
4443 |
if( ! _wysiwyg.has_tinymce() )
|
4485 |
// Add events to content editor
|
4486 |
if( wp_content )
|
4487 |
{
|
4488 |
+
_wysiwyg.set({ $el : $('#wp-content-wrap') }).add_events();
|
4489 |
}
|
4490 |
|
4491 |
|
shared/assets/plugins/advanced-custom-fields/js/input.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
var acf={ajaxurl:"",admin_url:"",wp_version:"",post_id:0,nonce:"",l10n:null,o:null,helpers:{get_atts:null,version_compare:null,uniqid:null,sortable:null,add_message:null,is_clone_field:null,url_to_object:null},validation:null,conditional_logic:null,media:null,fields:{date_picker:null,color_picker:null,Image:null,file:null,wysiwyg:null,gallery:null,relationship:null}};!function($){acf.helpers.isset=function(){var e=arguments,t=e.length,a=null,n;if(0===t)throw new Error("Empty isset");for(a=e[0],i=1;i<t;i++){if(e[i]===n||a[e[i]]===n)return!1;a=a[e[i]]}return!0},acf.helpers.get_atts=function(e){var t={};return $.each(e[0].attributes,function(e,i){"data-"==i.name.substr(0,5)&&(t[i.name.replace("data-","")]=i.value)}),t},acf.helpers.version_compare=function(e,t){if(typeof e+typeof t!="stringstring")return!1;for(var i=e.split("."),a=t.split("."),n=0,s=Math.max(i.length,a.length);s>n;n++){if(i[n]&&!a[n]&&parseInt(i[n])>0||parseInt(i[n])>parseInt(a[n]))return 1;if(a[n]&&!i[n]&&parseInt(a[n])>0||parseInt(i[n])<parseInt(a[n]))return-1}return 0},acf.helpers.uniqid=function(){var e=new Date;return e.getTime()},acf.helpers.url_to_object=function(e){var t={},a=e.split("&");for(i in a){var n=a[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t},acf.helpers.sortable=function(e,t){return t.children().each(function(){$(this).width($(this).width())}),t},acf.helpers.is_clone_field=function(e){return!(!e.attr("name")||-1==e.attr("name").indexOf("[acfcloneindex]"))},acf.helpers.add_message=function(e,t){var e=$('<div class="acf-message-wrapper"><div class="message updated"><p>'+e+"</p></div></div>");t.prepend(e),setTimeout(function(){e.animate({opacity:0},250,function(){e.remove()})},1500)},$.fn.exists=function(){return $(this).length>0},acf.media={div:null,frame:null,render_timout:null,clear_frame:function(){this.frame&&(this.frame.detach(),this.frame.dispose(),this.frame=null)},type:function(){var e="thickbox";return"undefined"!=typeof wp&&(e="backbone"),e},init:function(){if("backbone"!==this.type())return!1;if(!acf.helpers.isset(wp,"media","view","AttachmentCompat","prototype"))return!1;var e=wp.media.view.AttachmentCompat.prototype;e.orig_render=e.render,e.orig_dispose=e.dispose,e.className="compat-item acf_postbox no_box",e.render=function(){var e=this;return e.ignore_render?this:(this.orig_render(),setTimeout(function(){var t=e.$el.closest(".media-modal");if(!t.hasClass("acf-media-modal")&&!t.find(".media-frame-router .acf-expand-details").exists()){var i=$(['<a href="#" class="acf-expand-details">','<span class="icon"></span>','<span class="is-closed">'+acf.l10n.core.expand_details+"</span>",'<span class="is-open">'+acf.l10n.core.collapse_details+"</span>","</a>"].join(""));i.on("click",function(e){e.preventDefault(),t.hasClass("acf-expanded")?t.removeClass("acf-expanded"):t.addClass("acf-expanded")}),t.find(".media-frame-router").append(i)}},0),clearTimeout(acf.media.render_timout),acf.media.render_timout=setTimeout(function(){$(document).trigger("acf/setup_fields",[e.$el])},50),this)},e.dispose=function(){$(document).trigger("acf/remove_fields",[this.$el]),this.orig_dispose()},e.save=function(e){var t={},i={};e&&e.preventDefault(),_.each(this.$el.serializeArray(),function(e){"[]"===e.name.slice(-2)&&(e.name=e.name.replace("[]",""),"undefined"==typeof i[e.name]&&(i[e.name]=-1),i[e.name]++,e.name+="["+i[e.name]+"]"),t[e.name]=e.value}),this.ignore_render=!0,this.model.saveCompat(t)}}},acf.conditional_logic={items:[],init:function(){var e=this;$(document).on("change",".field input, .field textarea, .field select",function(){$("#acf-has-changed").exists()&&$("#acf-has-changed").val(1),e.change($(this))}),$(document).on("acf/setup_fields",function(t,i){e.refresh($(i))}),e.refresh()},change:function(e){var t=this,i=e.closest(".field"),a=i.attr("data-field_key");$.each(this.items,function(e,i){$.each(i.rules,function(e,n){n.field==a&&t.refresh_field(i)})})},refresh_field:function(e){var t=this,i=$(".field_key-"+e.field);i.each(function(){var i=!0;"any"==e.allorany&&(i=!1);var a=$(this),n=!0;$.each(e.rules,function(s,o){var l=$(".field_key-"+o.field);l.hasClass("sub_field")&&(l=a.siblings(".field_key-"+o.field),n=!1,l.exists()||(a.parents("tr").each(function(){return l=$(this).find(".field_key-"+o.field),l.exists()?!1:void 0}),n=!0));var r=a.parent("tr").parent().parent("table").parent(".layout");r.exists()&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest(".layout").find("td.field_key-"+o.field)));var r=a.parent("tr").parent().parent("table").parent(".repeater");r.exists()&&"1"==r.attr("data-max_rows")&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest("table").find("td.field_key-"+o.field)));var c=t.calculate(o,l,a);if("all"==e.allorany){if(0==c)return i=!1,!1}else if(1==c)return i=!0,!1}),a.removeClass("acf-conditional_logic-hide acf-conditional_logic-show acf-show-blank"),i?(a.find("input, textarea, select").removeAttr("disabled"),a.addClass("acf-conditional_logic-show"),$(document).trigger("acf/conditional_logic/show",[a,e])):(a.find("input, textarea, select").attr("disabled","disabled"),a.addClass("acf-conditional_logic-hide"),n||a.addClass("acf-show-blank"),$(document).trigger("acf/conditional_logic/hide",[a,e]))})},refresh:function(e){e=e||$("body");var t=this;$.each(this.items,function(i,a){$.each(a.rules,function(i,n){e.find('.field[data-field_key="'+a.field+'"]').exists()&&t.refresh_field(a)})})},calculate:function(e,t,i){var a=!1;if(t.hasClass("field_type-true_false")||t.hasClass("field_type-checkbox")||t.hasClass("field_type-radio")){var n=t.find('input[value="'+e.value+'"]:checked').exists();"=="==e.operator?n&&(a=!0):n||(a=!0)}else{var s=t.find("input, textarea, select").last().val();$.isArray(s)||(s=[s]),"=="==e.operator?$.inArray(e.value,s)>-1&&(a=!0):$.inArray(e.value,s)<0&&(a=!0)}return a}},$(document).ready(function(){acf.conditional_logic.init(),$(".acf_postbox > .inside > .options").each(function(){$(this).closest(".acf_postbox").addClass($(this).attr("data-layout"))}),$('#metakeyselect option[value^="field_"]').remove()}),$(window).on("load",function(){acf.media.init(),setTimeout(function(){try{$.isNumeric(acf.o.post_id)&&(wp.media.view.settings.post.id=acf.o.post_id)}catch(e){}$(document).trigger("acf/setup_fields",[$("#poststuff")])},10)}),acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}}(jQuery),function($){function e(){var e=[];$(".categorychecklist input:checked, .acf-taxonomy-field input:checked, .acf-taxonomy-field option:selected").each(function(){$(this).is(":hidden")||$(this).is(":disabled")||$(this).closest(".media-frame").exists()||$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-load_save")||-1===e.indexOf($(this).val())&&e.push($(this).val())}),acf.screen.post_category=e,acf.screen.taxonomy=e,$(document).trigger("acf/update_field_groups")}acf.screen={action:"acf/location/match_field_groups_ajax",post_id:0,page_template:0,page_parent:0,page_type:0,post_category:0,post_format:0,taxonomy:0,lang:0,nonce:0},$(document).ready(function(){if(acf.screen.post_id=acf.o.post_id,acf.screen.nonce=acf.o.nonce,$("#icl-als-first").length>0){var e=$("#icl-als-first").children("a").attr("href"),t=new RegExp("lang=([^&#]*)"),i=t.exec(e);acf.screen.lang=i[1]}}),$(document).on("acf/update_field_groups",function(){return acf.screen.post_id&&$.isNumeric(acf.screen.post_id)?void $.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(e){return e?($(".acf_postbox").addClass("acf-hidden"),$(".acf_postbox-toggle").addClass("acf-hidden"),0==e.length?!1:($.each(e,function(e,t){var i=$("#acf_"+t),a=$('#adv-settings .acf_postbox-toggle[for="acf_'+t+'-hide"]');i.removeClass("acf-hidden hide-if-js"),a.removeClass("acf-hidden"),a.find('input[type="checkbox"]').attr("checked","checked"),i.find(".acf-replace-with-fields").each(function(){var e=$(this);$.ajax({url:ajaxurl,data:{action:"acf/post/render_fields",acf_id:t,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e.replaceWith(t),$(document).trigger("acf/setup_fields",i)}})})}),void $.ajax({url:ajaxurl,data:{action:"acf/post/get_style",acf_id:e[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(e){$("#acf_style").html(e)}}))):!1}}):!1}),$(document).on("change","#page_template",function(){acf.screen.page_template=$(this).val(),$(document).trigger("acf/update_field_groups")}),$(document).on("change","#parent_id",function(){var e=$(this).val();""!=e?(acf.screen.page_type="child",acf.screen.page_parent=e):(acf.screen.page_type="parent",acf.screen.page_parent=0),$(document).trigger("acf/update_field_groups")}),$(document).on("change",'#post-formats-select input[type="radio"]',function(){var e=$(this).val();"0"==e&&(e="standard"),acf.screen.post_format=e,$(document).trigger("acf/update_field_groups")}),$(document).on("change",".categorychecklist input, .acf-taxonomy-field input, .acf-taxonomy-field select",function(){$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-save")||$(this).closest(".media-frame").exists()||setTimeout(function(){e()},1)})}(jQuery),function($){var e=acf.fields.color_picker={$el:null,$input:null,set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="text"]'),this},init:function(){var e=this.$input;acf.helpers.is_clone_field(e)||this.$input.wpColorPicker()}};$(document).on("acf/setup_fields",function(t,i){$(i).find(".acf-color_picker").each(function(){e.set({$el:$(this)}).init()})})}(jQuery),function($){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="text"]'),this.$hidden=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this},init:function(){if(!acf.helpers.is_clone_field(this.$hidden)){this.$input.val(this.$hidden.val());var e=$.extend({},acf.l10n.date_picker,{dateFormat:this.o.save_format,altField:this.$hidden,altFormat:this.o.save_format,changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day});this.$input.addClass("active").datepicker(e),this.$input.datepicker("option","dateFormat",this.o.display_format),$("body > #ui-datepicker-div").length>0&&$("#ui-datepicker-div").wrap('<div class="ui-acf" />')}},blur:function(){this.$input.val()||this.$hidden.val("")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:$(this)}).init()})}),$(document).on("blur",'.acf-date_picker input[type="text"]',function(e){acf.fields.date_picker.set({$el:$(this).parent()}).blur()})}(jQuery),function($){var e=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=!!this.$el.closest(".repeater").exists(),this.o.query={},"uploadedTo"==this.o.library&&(this.o.query.uploadedTo=acf.o.post_id),this},init:function(){acf.helpers.is_clone_field(this.$input)},add:function(t){var i=e.div;i.find(".acf-file-icon").attr("src",t.icon),i.find(".acf-file-title").text(t.title),i.find(".acf-file-name").text(t.name).attr("href",t.url),i.find(".acf-file-size").text(t.size),i.find(".acf-file-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},new_frame:function(t){return e.div=this.$el,e.clear_frame(),t.states=[],t.states.push(new wp.media.controller.Library({library:wp.media.query(this.o.query),multiple:t.multiple,title:t.title,priority:20,filterable:"all"})),acf.helpers.isset(wp,"media","controller","EditImage")&&t.states.push(new wp.media.controller.EditImage),e.frame=wp.media(t),e.frame.on("content:render:edit-image",function(){var e=this.state().get("image"),t=new wp.media.view.EditImage({model:e,controller:this}).render();this.content.set(t),t.loadEditor()},e.frame),e.frame.on("toolbar:create:select",function(e){e.view=new wp.media.view.Toolbar.Select({text:t.button.text,controller:this})},e.frame),e.frame},edit:function(){var t=this.$input.val();this.new_frame({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.frame.$el.closest(".media-modal").removeClass("acf-media-modal")}),acf.media.frame.open()},remove:function(){this.$el.find(".acf-file-icon").attr("src",""),this.$el.find(".acf-file-title").text(""),this.$el.find(".acf-file-name").text("").attr("href",""),this.$el.find(".acf-file-size").text(""),this.$el.find(".acf-file-value").val("").trigger("change"),this.$el.removeClass("active")},popup:function(){var t=this;return this.new_frame({title:acf.l10n.file.select,multiple:t.o.multiple,button:{text:acf.l10n.file.select}}),acf.media.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?void("uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id}))):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var t=0;selection.each(function(i){if(t++,t>1){var a=e.div.closest("td"),n=a.closest(".row"),s=n.closest(".repeater"),o=a.attr("data-field_key"),l="td .acf-file-uploader:first";o&&(l='td[data-field_key="'+o+'"] .acf-file-uploader'),n.next(".row").exists()||s.find(".add-row-end").trigger("click"),e.div=n.next(".row").find(l)}var r={id:i.id,title:i.attributes.title,name:i.attributes.filename,url:i.attributes.url,icon:i.attributes.icon,size:i.attributes.filesize};acf.fields.file.add(r)})}}),acf.media.frame.open(),!1}},$(document).on("click",".acf-file-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).edit()}),$(document).on("click",".acf-file-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).remove()}),$(document).on("click",".acf-file-uploader .add-file",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).popup()})}(jQuery),function($){acf.fields.google_map={$el:null,$input:null,o:{},api:{sensor:!1,libraries:"places"},ready:!1,geocoder:!1,map:!1,maps:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find(".input-address"),this.o=acf.helpers.get_atts(this.$el),this.maps[this.o.id]&&(this.map=this.maps[this.o.id]),this},init:function(){this.geocoder||(this.geocoder=new google.maps.Geocoder),this.ready=!0,acf.helpers.is_clone_field(this.$input)||this.render()},render:function(){var e=this,t=this.$el,i={zoom:parseInt(this.o.zoom),center:new google.maps.LatLng(this.o.lat,this.o.lng),mapTypeId:google.maps.MapTypeId.ROADMAP};this.map=new google.maps.Map(this.$el.find(".canvas")[0],i);var a=new google.maps.places.Autocomplete(this.$el.find(".search")[0]);a.map=this.map,a.bindTo("bounds",this.map),this.map.marker=new google.maps.Marker({draggable:!0,raiseOnDrag:!0,map:this.map}),this.map.$el=this.$el;var n=this.$el.find(".input-lat").val(),s=this.$el.find(".input-lng").val();n&&s&&this.update(n,s).center(),google.maps.event.addListener(a,"place_changed",function(t){var i=this.map.$el,a=i.find(".search").val();i.find(".input-address").val(a),i.find(".title h4").text(a);var n=this.getPlace();if(n.geometry){var s=n.geometry.location.lat(),o=n.geometry.location.lng();e.set({$el:i}).update(s,o).center()}else e.geocoder.geocode({address:a},function(t,a){if(a!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+a);if(!t[0])return void console.log("No results found");n=t[0];var s=n.geometry.location.lat(),o=n.geometry.location.lng();e.set({$el:i}).update(s,o).center()})}),google.maps.event.addListener(this.map.marker,"dragend",function(){var t=this.map.$el,i=this.map.marker.getPosition(),a=i.lat(),n=i.lng();e.set({$el:t}).update(a,n).sync()}),google.maps.event.addListener(this.map,"click",function(t){var i=this.$el,a=t.latLng.lat(),n=t.latLng.lng();e.set({$el:i}).update(a,n).sync()}),this.maps[this.o.id]=this.map},update:function(e,t){var i=new google.maps.LatLng(e,t);return this.$el.find(".input-lat").val(e),this.$el.find(".input-lng").val(t).trigger("change"),this.map.marker.setPosition(i),this.map.marker.setVisible(!0),this.$el.addClass("active"),this.$el.closest(".field").removeClass("error"),this},center:function(){var e=this.map.marker.getPosition(),t=this.o.lat,i=this.o.lng;e&&(t=e.lat(),i=e.lng());var a=new google.maps.LatLng(t,i);this.map.setCenter(a)},sync:function(){var e=this.$el,t=this.map.marker.getPosition(),i=new google.maps.LatLng(t.lat(),t.lng());return this.geocoder.geocode({latLng:i},function(t,i){if(i!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+i);if(!t[0])return void console.log("No results found");var a=t[0];e.find(".title h4").text(a.formatted_address),e.find(".input-address").val(a.formatted_address).trigger("change")}),this},locate:function(){var e=this,t=this.$el;return navigator.geolocation?(t.find(".title h4").text(acf.l10n.google_map.locating+"..."),t.addClass("active"),void navigator.geolocation.getCurrentPosition(function(i){var a=i.coords.latitude,n=i.coords.longitude;e.set({$el:t}).update(a,n).sync().center()})):(alert(acf.l10n.google_map.browser_support),this)},clear:function(){this.$el.removeClass("active"),this.$el.find(".search").val(""),this.$el.find(".input-address").val(""),this.$el.find(".input-lat").val(""),this.$el.find(".input-lng").val(""),this.map.marker.setVisible(!1)},edit:function(){this.$el.removeClass("active");var e=this.$el.find(".title h4").text();this.$el.find(".search").val(e).focus()},refresh:function(){google.maps.event.trigger(this.map,"resize"),this.center()}},$(document).on("acf/setup_fields",function(e,t){var i=acf.fields.google_map,a=$(t).find(".acf-google-map");return a.exists()?acf.helpers.isset(window,"google","load")?acf.helpers.isset(window,"google","maps","places")?(a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()}),!0):(google.load("maps","3",{other_params:$.param(i.api),callback:function(){a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}}),!1):($.getScript("https://www.google.com/jsapi",function(){google.load("maps","3",{other_params:$.param(i.api),callback:function(){a.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}})}),!1):!1}),$(document).on("click",".acf-google-map .acf-sprite-remove",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).clear(),$(this).blur()}),$(document).on("click",".acf-google-map .acf-sprite-locate",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).locate(),$(this).blur()}),$(document).on("click",".acf-google-map .title h4",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).edit()}),$(document).on("keydown",".acf-google-map .search",function(e){return 13==e.which?!1:void 0}),$(document).on("blur",".acf-google-map .search",function(e){var t=$(this).closest(".acf-google-map");t.find(".input-lat").val()&&t.addClass("active")}),$(document).on("acf/fields/tab/show acf/conditional_logic/show",function(e,t){acf.fields.google_map.ready&&"google_map"==t.attr("data-field_type")&&acf.fields.google_map.set({$el:t.find(".acf-google-map")}).refresh()})}(jQuery),function($){var e=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=!!this.$el.closest(".repeater").exists(),this.o.query={type:"image"},"uploadedTo"==this.o.library&&(this.o.query.uploadedTo=acf.o.post_id),this},init:function(){acf.helpers.is_clone_field(this.$input)},add:function(t){var i=e.div;i.find(".acf-image-image").attr("src",t.url),i.find(".acf-image-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},new_frame:function(t){return e.div=this.$el,e.clear_frame(),t.states=[],t.states.push(new wp.media.controller.Library({library:wp.media.query(this.o.query),multiple:t.multiple,title:t.title,priority:20,filterable:"all"})),acf.helpers.isset(wp,"media","controller","EditImage")&&t.states.push(new wp.media.controller.EditImage),e.frame=wp.media(t),e.frame.on("content:render:edit-image",function(){var e=this.state().get("image"),t=new wp.media.view.EditImage({model:e,controller:this}).render();this.content.set(t),t.loadEditor()},e.frame),e.frame.on("toolbar:create:select",function(e){e.view=new wp.media.view.Toolbar.Select({text:t.button.text,controller:this})},e.frame),e.frame},edit:function(){var t=this.$input.val();this.new_frame({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.frame.$el.closest(".media-modal").removeClass("acf-media-modal")}),e.frame.open()},remove:function(){this.$el.find(".acf-image-image").attr("src",""),this.$el.find(".acf-image-value").val("").trigger("change"),this.$el.removeClass("active")},popup:function(){var t=this;return this.new_frame({title:acf.l10n.image.select,multiple:t.o.multiple,button:{text:acf.l10n.image.select}}),e.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?($.each(i.filters,function(e,t){t.props.type="image"}),"uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})),i.$el.find("option").each(function(){var e=$(this).attr("value");"uploaded"==e&&"all"==t.o.library||-1===e.indexOf("image")&&$(this).remove()}),void i.$el.val("image").trigger("change")):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var i=0;selection.each(function(a){if(i++,i>1){var n=e.div.closest("td"),s=n.closest(".row"),o=s.closest(".repeater"),l=n.attr("data-field_key"),r="td .acf-image-uploader:first";l&&(r='td[data-field_key="'+l+'"] .acf-image-uploader'),s.next(".row").exists()||o.find(".add-row-end").trigger("click"),e.div=s.next(".row").find(r)}var c={id:a.id,url:a.attributes.url};a.attributes.sizes&&a.attributes.sizes[t.o.preview_size]&&(c.url=a.attributes.sizes[t.o.preview_size].url),acf.fields.image.add(c)})}}),acf.media.frame.open(),!1},text:{title_add:"Select Image",title_edit:"Edit Image"}},$(document).on("click",".acf-image-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).edit()}),$(document).on("click",".acf-image-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).remove()}),$(document).on("click",".acf-image-uploader .add-image",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).popup()})}(jQuery),function($){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="radio"]:checked'),this.$other=this.$el.find('input[type="text"]'),this},change:function(){"other"==this.$input.val()?(this.$other.attr("name",this.$input.attr("name")),this.$other.show()):(this.$other.attr("name",""),this.$other.hide())}},$(document).on("change",'.acf-radio-list input[type="radio"]',function(e){acf.fields.radio.set({$el:$(this).closest(".acf-radio-list")}).change()})}(jQuery),function($){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(e){return $.extend(this,e),this.$input=this.$el.children('input[type="hidden"]'),this.$left=this.$el.find(".relationship_left"),this.$right=this.$el.find(".relationship_right"),this.o=acf.helpers.get_atts(this.$el),this},init:function(){var e=this;if(!acf.helpers.is_clone_field(this.$input)){this.$right.find(".relationship_list").height(this.$left.height()-2),this.$right.find(".relationship_list").sortable({axis:"y",items:"> li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){e.$input.trigger("change")}});var t=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(i){if(!t.hasClass("loading")&&!t.hasClass("no-results")&&$(this).scrollTop()+$(this).innerHeight()>=$(this).get(0).scrollHeight){var a=parseInt(t.attr("data-paged"));t.attr("data-paged",a+1),e.set({$el:t}).fetch()}}),this.fetch()}},fetch:function(){var e=this,t=this.$el;t.addClass("loading"),$.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:$.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(i){e.set({$el:t}).render(i)}})},render:function(e){var t=this;return this.$el.removeClass("no-results").removeClass("loading"),1==this.o.paged&&this.$el.find(".relationship_left li:not(.load-more)").remove(),e&&e.html?(this.$el.find(".relationship_left .load-more").before(e.html),e.next_page_exists||this.$el.addClass("no-results"),void this.$left.find("a").each(function(){var e=$(this).attr("data-post_id");t.$right.find('a[data-post_id="'+e+'"]').exists()&&$(this).parent().addClass("hide")})):void this.$el.addClass("no-results")},add:function(e){var t=e.attr("data-post_id"),i=e.html();if(this.$right.find("a").length>=this.o.max)return alert(acf.l10n.relationship.max.replace("{max}",this.o.max)),!1;if(e.parent().hasClass("hide"))return!1;e.parent().addClass("hide");var a=["<li>",'<a href="#" data-post_id="'+e.attr("data-post_id")+'">',e.html()+'<span class="acf-button-remove"></span>',"</a>",'<input type="hidden" name="'+this.$input.attr("name")+'[]" value="'+e.attr("data-post_id")+'" />',"</li>"].join("");this.$right.find(".relationship_list").append(a),this.$input.trigger("change"),this.$el.closest(".field").removeClass("error")},remove:function(e){e.parent().remove(),this.$left.find('a[data-post_id="'+e.attr("data-post_id")+'"]').parent("li").removeClass("hide"),this.$input.trigger("change")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:$(this)}).init()})}),$(document).on("change",".acf_relationship .select-post_type",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-post_type",t),i.attr("data-paged",1),acf.fields.relationship.set({$el:i}).fetch()}),$(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).add($(this)),$(this).blur()}),$(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).remove($(this)),$(this).blur()}),$(document).on("keyup",".acf_relationship input.relationship_search",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-s",t),i.attr("data-paged",1),clearTimeout(acf.fields.relationship.timeout),acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:i}).fetch()},500)}),$(document).on("keypress",".acf_relationship input.relationship_search",function(e){13==e.which&&e.preventDefault()})}(jQuery),function($){acf.fields.tab={add_group:function(e){var t="";t=e.is("tbody")?'<tr class="acf-tab-wrap"><td colspan="2"><ul class="hl clearfix acf-tab-group"></ul></td></tr>':'<div class="acf-tab-wrap"><ul class="hl clearfix acf-tab-group"></ul></div>',e.children(".field_type-tab:first").before(t)},add_tab:function(e){var t=e.closest(".field"),i=t.parent(),a=t.attr("data-field_key"),n=e.text();i.children(".acf-tab-wrap").exists()||this.add_group(i),i.children(".acf-tab-wrap").find(".acf-tab-group").append('<li><a class="acf-tab-button" href="#" data-key="'+a+'">'+n+"</a></li>")},toggle:function(e){var t=this,i=e.closest(".acf-tab-wrap").parent(),a=e.attr("data-key");e.parent("li").addClass("active").siblings("li").removeClass("active"),i.children(".field_type-tab").each(function(){var e=$(this);e.attr("data-field_key")==a?t.show_tab_fields($(this)):t.hide_tab_fields($(this))})},show_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-hide").addClass("acf-tab_group-show"),$(document).trigger("acf/fields/tab/show",[$(this)])})},hide_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-show").addClass("acf-tab_group-hide"),$(document).trigger("acf/fields/tab/hide",[$(this)])})},refresh:function(e){var t=this;e.find(".acf-tab-group").each(function(){$(this).find(".acf-tab-button:first").each(function(){t.toggle($(this))})})}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-tab").each(function(){acf.fields.tab.add_tab($(this))}),acf.fields.tab.refresh($(t))}),$(document).on("click",".acf-tab-button",function(e){e.preventDefault(),acf.fields.tab.toggle($(this)),$(this).trigger("blur")}),$(document).on("acf/conditional_logic/hide",function(e,t,i){if("tab"==t.attr("data-field_type")){var a=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');a.is(":hidden")||(a.parent().hide(),a.parent().siblings(":visible").exists()?a.parent().siblings(":visible").first().children("a").trigger("click"):acf.fields.tab.hide_tab_fields(t))}}),$(document).on("acf/conditional_logic/show",function(e,t,i){if("tab"==t.attr("data-field_type")){var a=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');if(!a.is(":visible"))return a.parent().show(),a.parent().hasClass("active")?void a.trigger("click"):a.parent().siblings(".active").is(":hidden")?void a.trigger("click"):void 0}})}(jQuery),function($){acf.validation={status:!0,disabled:!1,run:function(){var e=this;e.status=!0,$(".field.required, .form-field.required").each(function(){e.validate($(this))})},show_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.addClass("is-active"):e.css("display","inline-block")}},hide_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.removeClass("is-active"):e.css("display","none")}},validate:function(e){var t=!1,i=null;if(e.data("validation",!0),e.is(":hidden")&&(t=!0,e.hasClass("acf-tab_group-hide"))){t=!1;var a=e.prevAll(".field_type-tab:first"),n=e.prevAll(".acf-tab-wrap:first");a.hasClass("acf-conditional_logic-hide")?t=!0:i=n.find('.acf-tab-button[data-key="'+a.attr("data-field_key")+'"]')}if(e.hasClass("acf-conditional_logic-hide")&&(t=!0),e.closest(".postbox.acf-hidden").exists()&&(t=!0),!t){if(""==e.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()&&e.data("validation",!1),e.find(".acf_wysiwyg").exists()&&"object"==typeof tinyMCE){e.data("validation",!0);var s=e.find(".wp-editor-area").attr("id"),o=tinyMCE.get(s);o&&!o.getContent()&&e.data("validation",!1)}if(e.find("select").exists()&&(e.data("validation",!0),"null"!=e.find("select").val()&&e.find("select").val()||e.data("validation",!1)),e.find('input[type="radio"]').exists()&&(e.data("validation",!1),
|
2 |
-
|
1 |
+
var acf={ajaxurl:"",admin_url:"",wp_version:"",post_id:0,nonce:"",l10n:null,o:null,helpers:{get_atts:null,version_compare:null,uniqid:null,sortable:null,add_message:null,is_clone_field:null,url_to_object:null},validation:null,conditional_logic:null,media:null,fields:{date_picker:null,color_picker:null,Image:null,file:null,wysiwyg:null,gallery:null,relationship:null}};!function($){acf.helpers.isset=function(){var e=arguments,t=e.length,a=null,n;if(0===t)throw new Error("Empty isset");for(a=e[0],i=1;i<t;i++){if(e[i]===n||a[e[i]]===n)return!1;a=a[e[i]]}return!0},acf.helpers.get_atts=function(e){var t={};return $.each(e[0].attributes,function(e,i){"data-"==i.name.substr(0,5)&&(t[i.name.replace("data-","")]=i.value)}),t},acf.helpers.version_compare=function(e,t){if(typeof e+typeof t!="stringstring")return!1;for(var i=e.split("."),a=t.split("."),n=0,s=Math.max(i.length,a.length);s>n;n++){if(i[n]&&!a[n]&&parseInt(i[n])>0||parseInt(i[n])>parseInt(a[n]))return 1;if(a[n]&&!i[n]&&parseInt(a[n])>0||parseInt(i[n])<parseInt(a[n]))return-1}return 0},acf.helpers.uniqid=function(){var e=new Date;return e.getTime()},acf.helpers.url_to_object=function(e){var t={},a=e.split("&");for(i in a){var n=a[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t},acf.helpers.sortable=function(e,t){return t.children().each(function(){$(this).width($(this).width())}),t},acf.helpers.is_clone_field=function(e){return e.attr("name")&&-1!=e.attr("name").indexOf("[acfcloneindex]")?!0:!1},acf.helpers.add_message=function(e,t){var e=$('<div class="acf-message-wrapper"><div class="message updated"><p>'+e+"</p></div></div>");t.prepend(e),setTimeout(function(){e.animate({opacity:0},250,function(){e.remove()})},1500)},$.fn.exists=function(){return $(this).length>0},acf.media={div:null,frame:null,render_timout:null,clear_frame:function(){this.frame&&(this.frame.detach(),this.frame.dispose(),this.frame=null)},type:function(){var e="thickbox";return"undefined"!=typeof wp&&(e="backbone"),e},init:function(){if("backbone"!==this.type())return!1;if(!acf.helpers.isset(wp,"media","view","AttachmentCompat","prototype"))return!1;var e=wp.media.view.AttachmentCompat.prototype;e.orig_render=e.render,e.orig_dispose=e.dispose,e.className="compat-item acf_postbox no_box",e.render=function(){var e=this;return e.ignore_render?this:(this.orig_render(),setTimeout(function(){var t=e.$el.closest(".media-modal");if(!t.hasClass("acf-media-modal")&&!t.find(".media-frame-router .acf-expand-details").exists()){var i=$(['<a href="#" class="acf-expand-details">','<span class="icon"></span>','<span class="is-closed">'+acf.l10n.core.expand_details+"</span>",'<span class="is-open">'+acf.l10n.core.collapse_details+"</span>","</a>"].join(""));i.on("click",function(e){e.preventDefault(),t.hasClass("acf-expanded")?t.removeClass("acf-expanded"):t.addClass("acf-expanded")}),t.find(".media-frame-router").append(i)}},0),clearTimeout(acf.media.render_timout),acf.media.render_timout=setTimeout(function(){$(document).trigger("acf/setup_fields",[e.$el])},50),this)},e.dispose=function(){$(document).trigger("acf/remove_fields",[this.$el]),this.orig_dispose()},e.save=function(e){var t={},i={};e&&e.preventDefault(),_.each(this.$el.serializeArray(),function(e){"[]"===e.name.slice(-2)&&(e.name=e.name.replace("[]",""),"undefined"==typeof i[e.name]&&(i[e.name]=-1),i[e.name]++,e.name+="["+i[e.name]+"]"),t[e.name]=e.value}),this.ignore_render=!0,this.model.saveCompat(t)}}},acf.conditional_logic={items:[],init:function(){var e=this;$(document).on("change",".field input, .field textarea, .field select",function(){$("#acf-has-changed").exists()&&$("#acf-has-changed").val(1),e.change($(this))}),$(document).on("acf/setup_fields",function(t,i){e.refresh($(i))}),e.refresh()},change:function(e){var t=this,i=e.closest(".field"),a=i.attr("data-field_key");$.each(this.items,function(e,i){$.each(i.rules,function(e,n){n.field==a&&t.refresh_field(i)})})},refresh_field:function(e){var t=this,i=$(".field_key-"+e.field);i.each(function(){var i=!0;"any"==e.allorany&&(i=!1);var a=$(this),n=!0;$.each(e.rules,function(s,o){var l=$(".field_key-"+o.field);l.hasClass("sub_field")&&(l=a.siblings(".field_key-"+o.field),n=!1,l.exists()||(a.parents("tr").each(function(){return l=$(this).find(".field_key-"+o.field),l.exists()?!1:void 0}),n=!0));var r=a.parent("tr").parent().parent("table").parent(".layout");r.exists()&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest(".layout").find("td.field_key-"+o.field)));var r=a.parent("tr").parent().parent("table").parent(".repeater");r.exists()&&"1"==r.attr("data-max_rows")&&(n=!0,a.is("th")&&l.is("th")&&(l=a.closest("table").find("td.field_key-"+o.field)));var c=t.calculate(o,l,a);if("all"==e.allorany){if(0==c)return i=!1,!1}else if(1==c)return i=!0,!1}),a.removeClass("acf-conditional_logic-hide acf-conditional_logic-show acf-show-blank"),i?(a.find("input, textarea, select").removeAttr("disabled"),a.addClass("acf-conditional_logic-show"),$(document).trigger("acf/conditional_logic/show",[a,e])):(a.find("input, textarea, select").attr("disabled","disabled"),a.addClass("acf-conditional_logic-hide"),n||a.addClass("acf-show-blank"),$(document).trigger("acf/conditional_logic/hide",[a,e]))})},refresh:function(e){e=e||$("body");var t=this;$.each(this.items,function(i,a){$.each(a.rules,function(i,n){e.find('.field[data-field_key="'+a.field+'"]').exists()&&t.refresh_field(a)})})},calculate:function(e,t,i){var a=!1;if(t.hasClass("field_type-true_false")||t.hasClass("field_type-checkbox")||t.hasClass("field_type-radio")){var n=t.find('input[value="'+e.value+'"]:checked').exists();"=="==e.operator?n&&(a=!0):n||(a=!0)}else{var s=t.find("input, textarea, select").last().val();$.isArray(s)||(s=[s]),"=="==e.operator?$.inArray(e.value,s)>-1&&(a=!0):$.inArray(e.value,s)<0&&(a=!0)}return a}},$(document).ready(function(){acf.conditional_logic.init(),$(".acf_postbox > .inside > .options").each(function(){$(this).closest(".acf_postbox").addClass($(this).attr("data-layout"))}),$('#metakeyselect option[value^="field_"]').remove()}),$(window).load(function(){acf.media.init(),setTimeout(function(){try{$.isNumeric(acf.o.post_id)&&(wp.media.view.settings.post.id=acf.o.post_id)}catch(e){}$(document).trigger("acf/setup_fields",[$("#poststuff")])},10)}),acf.fields.gallery={add:function(){},edit:function(){},update_count:function(){},hide_selected_items:function(){},text:{title_add:"Select Images"}}}(jQuery),function($){function e(){var e=[];$(".categorychecklist input:checked, .acf-taxonomy-field input:checked, .acf-taxonomy-field option:selected").each(function(){$(this).is(":hidden")||$(this).is(":disabled")||$(this).closest(".media-frame").exists()||$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-load_save")||-1===e.indexOf($(this).val())&&e.push($(this).val())}),acf.screen.post_category=e,acf.screen.taxonomy=e,$(document).trigger("acf/update_field_groups")}acf.screen={action:"acf/location/match_field_groups_ajax",post_id:0,page_template:0,page_parent:0,page_type:0,post_category:0,post_format:0,taxonomy:0,lang:0,nonce:0},$(document).ready(function(){if(acf.screen.post_id=acf.o.post_id,acf.screen.nonce=acf.o.nonce,$("#icl-als-first").length>0){var e=$("#icl-als-first").children("a").attr("href"),t=new RegExp("lang=([^&#]*)"),i=t.exec(e);acf.screen.lang=i[1]}}),$(document).on("acf/update_field_groups",function(){return acf.screen.post_id&&$.isNumeric(acf.screen.post_id)?void $.ajax({url:ajaxurl,data:acf.screen,type:"post",dataType:"json",success:function(e){return e?($(".acf_postbox").addClass("acf-hidden"),$(".acf_postbox-toggle").addClass("acf-hidden"),0==e.length?!1:($.each(e,function(e,t){var i=$("#acf_"+t),a=$('#adv-settings .acf_postbox-toggle[for="acf_'+t+'-hide"]');i.removeClass("acf-hidden hide-if-js"),a.removeClass("acf-hidden"),a.find('input[type="checkbox"]').attr("checked","checked"),i.find(".acf-replace-with-fields").each(function(){var e=$(this);$.ajax({url:ajaxurl,data:{action:"acf/post/render_fields",acf_id:t,post_id:acf.o.post_id,nonce:acf.o.nonce},type:"post",dataType:"html",success:function(t){e.replaceWith(t),$(document).trigger("acf/setup_fields",i)}})})}),void $.ajax({url:ajaxurl,data:{action:"acf/post/get_style",acf_id:e[0],nonce:acf.o.nonce},type:"post",dataType:"html",success:function(e){$("#acf_style").html(e)}}))):!1}}):!1}),$(document).on("change","#page_template",function(){acf.screen.page_template=$(this).val(),$(document).trigger("acf/update_field_groups")}),$(document).on("change","#parent_id",function(){var e=$(this).val();""!=e?(acf.screen.page_type="child",acf.screen.page_parent=e):(acf.screen.page_type="parent",acf.screen.page_parent=0),$(document).trigger("acf/update_field_groups")}),$(document).on("change",'#post-formats-select input[type="radio"]',function(){var e=$(this).val();"0"==e&&(e="standard"),acf.screen.post_format=e,$(document).trigger("acf/update_field_groups")}),$(document).on("change",".categorychecklist input, .acf-taxonomy-field input, .acf-taxonomy-field select",function(){$(this).closest(".acf-taxonomy-field").exists()&&"0"==$(this).closest(".acf-taxonomy-field").attr("data-save")||$(this).closest(".media-frame").exists()||setTimeout(function(){e()},1)})}(jQuery),function($){var e=acf.fields.color_picker={$el:null,$input:null,set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="text"]'),this},init:function(){var e=this.$input;acf.helpers.is_clone_field(e)||this.$input.wpColorPicker()}};$(document).on("acf/setup_fields",function(t,i){$(i).find(".acf-color_picker").each(function(){e.set({$el:$(this)}).init()})})}(jQuery),function($){acf.fields.date_picker={$el:null,$input:null,$hidden:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="text"]'),this.$hidden=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this},init:function(){if(!acf.helpers.is_clone_field(this.$hidden)){this.$input.val(this.$hidden.val());var e=$.extend({},acf.l10n.date_picker,{dateFormat:this.o.save_format,altField:this.$hidden,altFormat:this.o.save_format,changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.o.first_day});this.$input.addClass("active").datepicker(e),this.$input.datepicker("option","dateFormat",this.o.display_format),$("body > #ui-datepicker-div").length>0&&$("#ui-datepicker-div").wrap('<div class="ui-acf" />')}},blur:function(){this.$input.val()||this.$hidden.val("")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-date_picker").each(function(){acf.fields.date_picker.set({$el:$(this)}).init()})}),$(document).on("blur",'.acf-date_picker input[type="text"]',function(e){acf.fields.date_picker.set({$el:$(this).parent()}).blur()})}(jQuery),function($){var e=acf.media;acf.fields.file={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1,this.o.query={},"uploadedTo"==this.o.library&&(this.o.query.uploadedTo=acf.o.post_id),this},init:function(){acf.helpers.is_clone_field(this.$input)},add:function(t){var i=e.div;i.find(".acf-file-icon").attr("src",t.icon),i.find(".acf-file-title").text(t.title),i.find(".acf-file-name").text(t.name).attr("href",t.url),i.find(".acf-file-size").text(t.size),i.find(".acf-file-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},edit:function(){var t=this.$input.val();e.div=this.$el,e.clear_frame(),e.frame=wp.media({title:acf.l10n.file.edit,multiple:!1,button:{text:acf.l10n.file.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.frame.$el.closest(".media-modal").removeClass("acf-media-modal")}),acf.media.frame.open()},remove:function(){this.$el.find(".acf-file-icon").attr("src",""),this.$el.find(".acf-file-title").text(""),this.$el.find(".acf-file-name").text("").attr("href",""),this.$el.find(".acf-file-size").text(""),this.$el.find(".acf-file-value").val("").trigger("change"),this.$el.removeClass("active")},popup:function(){var t=this;return e.div=this.$el,e.clear_frame(),e.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(t.o.query),multiple:t.o.multiple,title:acf.l10n.file.select,priority:20,filterable:"all"})]}),acf.media.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?void("uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.file.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id}))):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var t=0;selection.each(function(i){if(t++,t>1){var a=e.div.closest("td"),n=a.closest(".row"),s=n.closest(".repeater"),o=a.attr("data-field_key"),l="td .acf-file-uploader:first";o&&(l='td[data-field_key="'+o+'"] .acf-file-uploader'),n.next(".row").exists()||s.find(".add-row-end").trigger("click"),e.div=n.next(".row").find(l)}var r={id:i.id,title:i.attributes.title,name:i.attributes.filename,url:i.attributes.url,icon:i.attributes.icon,size:i.attributes.filesize};acf.fields.file.add(r)})}}),acf.media.frame.open(),!1}},$(document).on("click",".acf-file-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).edit()}),$(document).on("click",".acf-file-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).remove()}),$(document).on("click",".acf-file-uploader .add-file",function(e){e.preventDefault(),acf.fields.file.set({$el:$(this).closest(".acf-file-uploader")}).popup()})}(jQuery),function($){acf.fields.google_map={$el:null,$input:null,o:{},ready:!1,geocoder:!1,map:!1,maps:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find(".value"),this.o=acf.helpers.get_atts(this.$el),this.maps[this.o.id]&&(this.map=this.maps[this.o.id]),this},init:function(){this.geocoder||(this.geocoder=new google.maps.Geocoder),this.ready=!0,acf.helpers.is_clone_field(this.$input)||this.render()},render:function(){var e=this,t=this.$el,i={zoom:parseInt(this.o.zoom),center:new google.maps.LatLng(this.o.lat,this.o.lng),mapTypeId:google.maps.MapTypeId.ROADMAP};this.map=new google.maps.Map(this.$el.find(".canvas")[0],i);var a=new google.maps.places.Autocomplete(this.$el.find(".search")[0]);a.map=this.map,a.bindTo("bounds",this.map),this.map.marker=new google.maps.Marker({draggable:!0,raiseOnDrag:!0,map:this.map}),this.map.$el=this.$el;var n=this.$el.find(".input-lat").val(),s=this.$el.find(".input-lng").val();n&&s&&this.update(n,s).center(),google.maps.event.addListener(a,"place_changed",function(t){var i=this.map.$el,a=i.find(".search").val();i.find(".input-address").val(a),i.find(".title h4").text(a);var n=this.getPlace();if(n.geometry){var s=n.geometry.location.lat(),o=n.geometry.location.lng();e.set({$el:i}).update(s,o).center()}else e.geocoder.geocode({address:a},function(t,a){if(a!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+a);if(!t[0])return void console.log("No results found");n=t[0];var s=n.geometry.location.lat(),o=n.geometry.location.lng();e.set({$el:i}).update(s,o).center()})}),google.maps.event.addListener(this.map.marker,"dragend",function(){var t=this.map.$el,i=this.map.marker.getPosition(),a=i.lat(),n=i.lng();e.set({$el:t}).update(a,n).sync()}),google.maps.event.addListener(this.map,"click",function(t){var i=this.$el,a=t.latLng.lat(),n=t.latLng.lng();e.set({$el:i}).update(a,n).sync()}),this.maps[this.o.id]=this.map},update:function(e,t){var i=new google.maps.LatLng(e,t);return this.$el.find(".input-lat").val(e),this.$el.find(".input-lng").val(t).trigger("change"),this.map.marker.setPosition(i),this.map.marker.setVisible(!0),this.$el.addClass("active"),this.$el.closest(".field").removeClass("error"),this},center:function(){var e=this.map.marker.getPosition(),t=this.o.lat,i=this.o.lng;e&&(t=e.lat(),i=e.lng());var a=new google.maps.LatLng(t,i);this.map.setCenter(a)},sync:function(){var e=this.$el,t=this.map.marker.getPosition(),i=new google.maps.LatLng(t.lat(),t.lng());return this.geocoder.geocode({latLng:i},function(t,i){if(i!=google.maps.GeocoderStatus.OK)return void console.log("Geocoder failed due to: "+i);if(!t[0])return void console.log("No results found");var a=t[0];e.find(".title h4").text(a.formatted_address),e.find(".input-address").val(a.formatted_address).trigger("change")}),this},locate:function(){var e=this,t=this.$el;return navigator.geolocation?(t.find(".title h4").text(acf.l10n.google_map.locating+"..."),t.addClass("active"),void navigator.geolocation.getCurrentPosition(function(i){var a=i.coords.latitude,n=i.coords.longitude;e.set({$el:t}).update(a,n).sync().center()})):(alert(acf.l10n.google_map.browser_support),this)},clear:function(){this.$el.removeClass("active"),this.$el.find(".search").val(""),this.$el.find(".input-address").val(""),this.$el.find(".input-lat").val(""),this.$el.find(".input-lng").val(""),this.map.marker.setVisible(!1)},edit:function(){this.$el.removeClass("active");var e=this.$el.find(".title h4").text();this.$el.find(".search").val(e).focus()},refresh:function(){google.maps.event.trigger(this.map,"resize"),this.center()}},$(document).on("acf/setup_fields",function(e,t){$fields=$(t).find(".acf-google-map"),$fields.exists()&&("undefined"==typeof google?$.getScript("https://www.google.com/jsapi",function(){google.load("maps","3",{other_params:"sensor=false&libraries=places",callback:function(){$fields.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}})}):google.load("maps","3",{other_params:"sensor=false&libraries=places",callback:function(){$fields.each(function(){acf.fields.google_map.set({$el:$(this)}).init()})}}))}),$(document).on("click",".acf-google-map .acf-sprite-remove",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).clear(),$(this).blur()}),$(document).on("click",".acf-google-map .acf-sprite-locate",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).locate(),$(this).blur()}),$(document).on("click",".acf-google-map .title h4",function(e){e.preventDefault(),acf.fields.google_map.set({$el:$(this).closest(".acf-google-map")}).edit()}),$(document).on("keydown",".acf-google-map .search",function(e){return 13==e.which?!1:void 0}),$(document).on("blur",".acf-google-map .search",function(e){var t=$(this).closest(".acf-google-map");t.find(".input-lat").val()&&t.addClass("active")}),$(document).on("acf/fields/tab/show acf/conditional_logic/show",function(e,t){acf.fields.google_map.ready&&"google_map"==t.attr("data-field_type")&&acf.fields.google_map.set({$el:t.find(".acf-google-map")}).refresh()})}(jQuery),function($){var e=acf.media;acf.fields.image={$el:null,$input:null,o:{},set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="hidden"]'),this.o=acf.helpers.get_atts(this.$el),this.o.multiple=this.$el.closest(".repeater").exists()?!0:!1,this.o.query={type:"image"},"uploadedTo"==this.o.library&&(this.o.query.uploadedTo=acf.o.post_id),this},init:function(){acf.helpers.is_clone_field(this.$input)},add:function(t){var i=e.div;i.find(".acf-image-image").attr("src",t.url),i.find(".acf-image-value").val(t.id).trigger("change"),i.addClass("active"),i.closest(".field").removeClass("error")},edit:function(){var t=this.$input.val();e.div=this.$el,e.clear_frame(),e.frame=wp.media({title:acf.l10n.image.edit,multiple:!1,button:{text:acf.l10n.image.update}}),e.frame.on("open",function(){"browse"!=e.frame.content._mode&&e.frame.content.mode("browse"),e.frame.$el.closest(".media-modal").addClass("acf-media-modal acf-expanded");var i=e.frame.state().get("selection"),a=wp.media.attachment(t);$.isEmptyObject(a.changed)&&a.fetch(),i.add(a)}),e.frame.on("close",function(){e.frame.$el.closest(".media-modal").removeClass("acf-media-modal")}),acf.media.frame.open()},remove:function(){this.$el.find(".acf-image-image").attr("src",""),this.$el.find(".acf-image-value").val("").trigger("change"),this.$el.removeClass("active")},popup:function(){var t=this;return e.div=this.$el,e.clear_frame(),e.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query(t.o.query),multiple:t.o.multiple,title:acf.l10n.image.select,priority:20,filterable:"all"})]}),acf.media.frame.on("content:activate",function(){var e=null,i=null;try{e=acf.media.frame.content.get().toolbar,i=e.get("filters")}catch(a){}return i?($.each(i.filters,function(e,t){t.props.type="image"}),"uploadedTo"==t.o.library&&(i.$el.find('option[value="uploaded"]').remove(),i.$el.after("<span>"+acf.l10n.image.uploadedTo+"</span>"),$.each(i.filters,function(e,t){t.props.uploadedTo=acf.o.post_id})),i.$el.find("option").each(function(){var e=$(this).attr("value");("uploaded"!=e||"all"!=t.o.library)&&-1===e.indexOf("image")&&$(this).remove()}),void i.$el.val("image").trigger("change")):!1}),acf.media.frame.on("select",function(){if(selection=e.frame.state().get("selection"),selection){var i=0;selection.each(function(a){if(i++,i>1){var n=e.div.closest("td"),s=n.closest(".row"),o=s.closest(".repeater"),l=n.attr("data-field_key"),r="td .acf-image-uploader:first";l&&(r='td[data-field_key="'+l+'"] .acf-image-uploader'),s.next(".row").exists()||o.find(".add-row-end").trigger("click"),e.div=s.next(".row").find(r)}var c={id:a.id,url:a.attributes.url};a.attributes.sizes&&a.attributes.sizes[t.o.preview_size]&&(c.url=a.attributes.sizes[t.o.preview_size].url),acf.fields.image.add(c)})}}),acf.media.frame.open(),!1},text:{title_add:"Select Image",title_edit:"Edit Image"}},$(document).on("click",".acf-image-uploader .acf-button-edit",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).edit()}),$(document).on("click",".acf-image-uploader .acf-button-delete",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).remove()}),$(document).on("click",".acf-image-uploader .add-image",function(e){e.preventDefault(),acf.fields.image.set({$el:$(this).closest(".acf-image-uploader")}).popup()})}(jQuery),function($){acf.fields.radio={$el:null,$input:null,$other:null,farbtastic:null,set:function(e){return $.extend(this,e),this.$input=this.$el.find('input[type="radio"]:checked'),this.$other=this.$el.find('input[type="text"]'),this},change:function(){"other"==this.$input.val()?(this.$other.attr("name",this.$input.attr("name")),this.$other.show()):(this.$other.attr("name",""),this.$other.hide())}},$(document).on("change",'.acf-radio-list input[type="radio"]',function(e){acf.fields.radio.set({$el:$(this).closest(".acf-radio-list")}).change()})}(jQuery),function($){acf.fields.relationship={$el:null,$input:null,$left:null,$right:null,o:{},timeout:null,set:function(e){return $.extend(this,e),this.$input=this.$el.children('input[type="hidden"]'),this.$left=this.$el.find(".relationship_left"),this.$right=this.$el.find(".relationship_right"),this.o=acf.helpers.get_atts(this.$el),this},init:function(){var e=this;if(!acf.helpers.is_clone_field(this.$input)){this.$right.find(".relationship_list").height(this.$left.height()-2),this.$right.find(".relationship_list").sortable({axis:"y",items:"> li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){e.$input.trigger("change")}});var t=this.$el;this.$left.find(".relationship_list").scrollTop(0).on("scroll",function(i){if(!t.hasClass("loading")&&!t.hasClass("no-results")&&$(this).scrollTop()+$(this).innerHeight()>=$(this).get(0).scrollHeight){var a=parseInt(t.attr("data-paged"));t.attr("data-paged",a+1),e.set({$el:t}).fetch()}}),this.fetch()}},fetch:function(){var e=this,t=this.$el;t.addClass("loading"),$.ajax({url:acf.o.ajaxurl,type:"post",dataType:"json",data:$.extend({action:"acf/fields/relationship/query_posts",post_id:acf.o.post_id,nonce:acf.o.nonce},this.o),success:function(i){e.set({$el:t}).render(i)}})},render:function(e){var t=this;return this.$el.removeClass("no-results").removeClass("loading"),1==this.o.paged&&this.$el.find(".relationship_left li:not(.load-more)").remove(),e&&e.html?(this.$el.find(".relationship_left .load-more").before(e.html),e.next_page_exists||this.$el.addClass("no-results"),void this.$left.find("a").each(function(){var e=$(this).attr("data-post_id");t.$right.find('a[data-post_id="'+e+'"]').exists()&&$(this).parent().addClass("hide")})):void this.$el.addClass("no-results")},add:function(e){var t=e.attr("data-post_id"),i=e.html();if(this.$right.find("a").length>=this.o.max)return alert(acf.l10n.relationship.max.replace("{max}",this.o.max)),!1;if(e.parent().hasClass("hide"))return!1;e.parent().addClass("hide");var a={post_id:e.attr("data-post_id"),title:e.html(),name:this.$input.attr("name")},n=_.template(acf.l10n.relationship.tmpl_li,a);this.$right.find(".relationship_list").append(n),this.$input.trigger("change"),this.$el.closest(".field").removeClass("error")},remove:function(e){e.parent().remove(),this.$left.find('a[data-post_id="'+e.attr("data-post_id")+'"]').parent("li").removeClass("hide"),this.$input.trigger("change")}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf_relationship").each(function(){acf.fields.relationship.set({$el:$(this)}).init()})}),$(document).on("change",".acf_relationship .select-post_type",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-post_type",t),i.attr("data-paged",1),acf.fields.relationship.set({$el:i}).fetch()}),$(document).on("click",".acf_relationship .relationship_left .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).add($(this)),$(this).blur()}),$(document).on("click",".acf_relationship .relationship_right .relationship_list a",function(e){e.preventDefault(),acf.fields.relationship.set({$el:$(this).closest(".acf_relationship")}).remove($(this)),$(this).blur()}),$(document).on("keyup",".acf_relationship input.relationship_search",function(e){var t=$(this).val(),i=$(this).closest(".acf_relationship");i.attr("data-s",t),i.attr("data-paged",1),clearTimeout(acf.fields.relationship.timeout),acf.fields.relationship.timeout=setTimeout(function(){acf.fields.relationship.set({$el:i}).fetch()},500)}),$(document).on("keypress",".acf_relationship input.relationship_search",function(e){13==e.which&&e.preventDefault()})}(jQuery),function($){acf.fields.tab={add_group:function(e){var t="";t=e.is("tbody")?'<tr class="acf-tab-wrap"><td colspan="2"><ul class="hl clearfix acf-tab-group"></ul></td></tr>':'<div class="acf-tab-wrap"><ul class="hl clearfix acf-tab-group"></ul></div>',e.children(".field_type-tab:first").before(t)},add_tab:function(e){var t=e.closest(".field"),i=t.parent(),a=t.attr("data-field_key"),n=e.text();i.children(".acf-tab-wrap").exists()||this.add_group(i),i.children(".acf-tab-wrap").find(".acf-tab-group").append('<li><a class="acf-tab-button" href="#" data-key="'+a+'">'+n+"</a></li>")},toggle:function(e){var t=this,i=e.closest(".acf-tab-wrap").parent(),a=e.attr("data-key");e.parent("li").addClass("active").siblings("li").removeClass("active"),i.children(".field_type-tab").each(function(){var e=$(this);e.attr("data-field_key")==a?t.show_tab_fields($(this)):t.hide_tab_fields($(this))})},show_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-hide").addClass("acf-tab_group-show"),$(document).trigger("acf/fields/tab/show",[$(this)])})},hide_tab_fields:function(e){e.nextUntil(".field_type-tab").each(function(){$(this).removeClass("acf-tab_group-show").addClass("acf-tab_group-hide"),$(document).trigger("acf/fields/tab/hide",[$(this)])})},refresh:function(e){var t=this;e.find(".acf-tab-group").each(function(){$(this).find(".acf-tab-button:first").each(function(){t.toggle($(this))})})}},$(document).on("acf/setup_fields",function(e,t){$(t).find(".acf-tab").each(function(){acf.fields.tab.add_tab($(this))}),acf.fields.tab.refresh($(t))}),$(document).on("click",".acf-tab-button",function(e){e.preventDefault(),acf.fields.tab.toggle($(this)),$(this).trigger("blur")}),$(document).on("acf/conditional_logic/hide",function(e,t,i){if("tab"==t.attr("data-field_type")){var a=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');a.is(":hidden")||(a.parent().hide(),a.parent().siblings(":visible").exists()?a.parent().siblings(":visible").first().children("a").trigger("click"):acf.fields.tab.hide_tab_fields(t))}}),$(document).on("acf/conditional_logic/show",function(e,t,i){if("tab"==t.attr("data-field_type")){var a=t.siblings(".acf-tab-wrap").find('a[data-key="'+t.attr("data-field_key")+'"]');if(!a.is(":visible"))return a.parent().show(),a.parent().hasClass("active")?void a.trigger("click"):a.parent().siblings(".active").is(":hidden")?void a.trigger("click"):void 0}})}(jQuery),function($){acf.validation={status:!0,disabled:!1,run:function(){var e=this;e.status=!0,$(".field.required, .form-field.required").each(function(){e.validate($(this))})},show_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.addClass("is-active"):e.css("display","inline-block")}},hide_spinner:function(e){if(e.exists()){var t=acf.o.wp_version;parseFloat(t)>=4.2?e.removeClass("is-active"):e.css("display","none")}},validate:function(e){var t=!1,i=null;if(e.data("validation",!0),e.is(":hidden")&&(t=!0,e.hasClass("acf-tab_group-hide"))){t=!1;var a=e.prevAll(".field_type-tab:first"),n=e.prevAll(".acf-tab-wrap:first");a.hasClass("acf-conditional_logic-hide")?t=!0:i=n.find('.acf-tab-button[data-key="'+a.attr("data-field_key")+'"]')}if(e.hasClass("acf-conditional_logic-hide")&&(t=!0),e.closest(".postbox.acf-hidden").exists()&&(t=!0),!t){if(""==e.find('input[type="text"], input[type="email"], input[type="number"], input[type="hidden"], textarea').val()&&e.data("validation",!1),e.find(".acf_wysiwyg").exists()&&"object"==typeof tinyMCE){e.data("validation",!0);var s=e.find(".wp-editor-area").attr("id"),o=tinyMCE.get(s);o&&!o.getContent()&&e.data("validation",!1)}if(e.find("select").exists()&&(e.data("validation",!0),"null"!=e.find("select").val()&&e.find("select").val()||e.data("validation",!1)),e.find('input[type="radio"]').exists()&&(e.data("validation",!1),e.find('input[type="radio"]:checked').exists()&&e.data("validation",!0)),e.find('input[type="checkbox"]').exists()&&(e.data("validation",!1),e.find('input[type="checkbox"]:checked').exists()&&e.data("validation",!0)),e.find(".acf_relationship").exists()&&(e.data("validation",!1),e.find(".acf_relationship .relationship_right input").exists()&&e.data("validation",!0)),e.find(".repeater").exists()&&(e.data("validation",!1),e.find(".repeater tr.row").exists()&&e.data("validation",!0)),e.find(".acf-gallery").exists()&&(e.data("validation",!1),e.find(".acf-gallery .thumbnail").exists()&&e.data("validation",!0)),$(document).trigger("acf/validate_field",[e]),!e.data("validation")){if(this.status=!1,e.closest(".field").addClass("error"),e.data("validation_message")){var l=e.find("p.label:first"),r=null;l.children(".acf-error-message").remove(),l.append('<span class="acf-error-message"><i class="bit"></i>'+e.data("validation_message")+"</span>")}i&&i.trigger("click")}}}},$(document).on("focus click",".field.required input, .field.required textarea, .field.required select",function(e){$(this).closest(".field").removeClass("error")}),$(document).on("click","#save-post",function(){acf.validation.disabled=!0}),$(document).on("submit","#post",function(){if(acf.validation.disabled)return!0;if(acf.validation.run(),
|
2 |
+
!acf.validation.status){var e=$(this);return e.siblings("#message").remove(),e.before('<div id="message" class="error"><p>'+acf.l10n.validation.error+"</p></div>"),$("#submitdiv").exists()&&($("#submitdiv").find(".disabled").removeClass("disabled"),$("#submitdiv").find(".button-disabled").removeClass("button-disabled"),$("#submitdiv").find(".button-primary-disabled").removeClass("button-primary-disabled"),acf.validation.hide_spinner($("#submitdiv .spinner"))),!1}return $(".acf_postbox.acf-hidden").remove(),!0})}(jQuery),function($){var e=acf.fields.wysiwyg={$el:null,$textarea:null,o:{},set:function(e){return $.extend(this,e),this.$textarea=this.$el.find("textarea"),this.o=acf.helpers.get_atts(this.$el),this.o.id=this.$textarea.attr("id"),this},has_tinymce:function(){var e=!1;return"object"==typeof tinyMCE&&(e=!0),e},get_toolbar:function(){return acf.helpers.isset(this,"toolbars",this.o.toolbar)?this.toolbars[this.o.toolbar]:!1},init:function(){if(!acf.helpers.is_clone_field(this.$textarea)){var e=this.get_toolbar(),t="mceAddControl",i="theme_advanced_buttons{i}",a=$.extend({},tinyMCE.settings);if(4==tinymce.majorVersion&&(t="mceAddEditor",i="toolbar{i}"),e)for(var n=1;5>n;n++){var s="";acf.helpers.isset(e,"theme_advanced_buttons"+n)&&(s=e["theme_advanced_buttons"+n]),tinyMCE.settings[i.replace("{i}",n)]=s}tinyMCE.execCommand(t,!1,this.o.id),$(document).trigger("acf/wysiwyg/load",this.o.id),this.add_events(),tinyMCE.settings=a,wpActiveEditor=null}},add_events:function(){var e=this.o.id,t=tinyMCE.get(e);if(t){var i=$("#wp-"+e+"-wrap"),a=$(t.getBody());i.on("click",function(){$(document).trigger("acf/wysiwyg/click",e)}),a.on("focus",function(){$(document).trigger("acf/wysiwyg/focus",e)}),a.on("blur",function(){$(document).trigger("acf/wysiwyg/blur",e)})}},destroy:function(){var e=this.o.id,t="mceRemoveControl";try{var i=tinyMCE.get(e);if(!i)return;4==tinymce.majorVersion&&(t="mceRemoveEditor");var a=i.getContent();tinyMCE.execCommand(t,!1,e),this.$textarea.val(a)}catch(n){}wpActiveEditor=null}};$(document).on("acf/setup_fields",function(t,i){e.has_tinymce()&&($(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()}),setTimeout(function(){$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).init()})},0))}),$(document).on("acf/remove_fields",function(t,i){e.has_tinymce()&&i.find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()})}),$(document).on("acf/wysiwyg/click",function(e,t){wpActiveEditor=t,container=$("#wp-"+t+"-wrap").closest(".field").removeClass("error")}),$(document).on("acf/wysiwyg/focus",function(e,t){wpActiveEditor=t,container=$("#wp-"+t+"-wrap").closest(".field").removeClass("error")}),$(document).on("acf/wysiwyg/blur",function(e,t){wpActiveEditor=null;var i=tinyMCE.get(t);if(i){var a=i.getElement();i.save(),$(a).trigger("change")}}),$(document).on("acf/sortable_start",function(t,i){e.has_tinymce()&&$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).destroy()})}),$(document).on("acf/sortable_stop",function(t,i){e.has_tinymce()&&$(i).find(".acf_wysiwyg").each(function(){e.set({$el:$(this)}).init()})}),$(window).load(function(){if(e.has_tinymce()){var t=$("#wp-content-wrap").exists(),i=$("#wp-acf_settings-wrap").exists();mode="tmce",i&&$("#wp-acf_settings-wrap").hasClass("html-active")&&(mode="html"),setTimeout(function(){i&&"html"==mode&&$("#acf_settings-tmce").trigger("click")},1),setTimeout(function(){i&&"html"==mode&&$("#acf_settings-html").trigger("click"),t&&e.set({$el:$("#wp-content-wrap")}).add_events()},11)}}),$(document).on("click",".acf_wysiwyg a.mce_fullscreen",function(){var e=$(this).closest(".acf_wysiwyg"),t=e.attr("data-upload");"no"==t&&$("#mce_fullscreen_container td.mceToolbar .mce_add_media").remove()})}(jQuery);
|
shared/classes/class.form.php
CHANGED
@@ -725,7 +725,7 @@ if (!class_exists('Inbound_Forms')) {
|
|
725 |
static function do_actions() {
|
726 |
|
727 |
/* only process actions when told to */
|
728 |
-
if (!isset($_POST['inbound_submitted']) || !$_POST['inbound_submitted']) {
|
729 |
return;
|
730 |
}
|
731 |
|
725 |
static function do_actions() {
|
726 |
|
727 |
/* only process actions when told to */
|
728 |
+
if (!isset($_POST['inbound_submitted']) || (!$_POST['inbound_submitted'] || $_POST['inbound_submitted'] =='false' ) ) {
|
729 |
return;
|
730 |
}
|
731 |
|
shared/shortcodes/shortcodes/button.php
CHANGED
@@ -101,7 +101,7 @@
|
|
101 |
),
|
102 |
),
|
103 |
// style="{{style}}"
|
104 |
-
'shortcode' => '[inbound_button font_size="{{font-size}}" color="{{color}}" text_color="{{text-color}}" icon="{{icon}}" url="{{url}}" width="{{width}}" target="{{target}}"]{{content}}[/
|
105 |
'popup_title' =>'Insert Button Shortcode'
|
106 |
);
|
107 |
|
101 |
),
|
102 |
),
|
103 |
// style="{{style}}"
|
104 |
+
'shortcode' => '[inbound_button font_size="{{font-size}}" color="{{color}}" text_color="{{text-color}}" icon="{{icon}}" url="{{url}}" width="{{width}}" target="{{target}}"]{{content}}[/inbound_button]',
|
105 |
'popup_title' =>'Insert Button Shortcode'
|
106 |
);
|
107 |
|