Version Description
- Updating ACF4
- Adding support for Inbound Forms without redirect URLs (no ajax)
Download this release
Release Info
Developer | adbox |
Plugin | ![]() |
Version | 2.3.3 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.3
- landing-pages.php +2 -2
- readme.txt +3 -2
- shared/assets/plugins/advanced-custom-fields/acf.php +58 -34
- 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 +30 -13
- shared/assets/plugins/advanced-custom-fields/core/controllers/field_group.php +3 -1
- 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 +46 -0
- shared/assets/plugins/advanced-custom-fields/core/fields/image.php +1 -1
- shared/assets/plugins/advanced-custom-fields/core/fields/relationship.php +1 -7
- 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 +2 -1
- shared/assets/plugins/advanced-custom-fields/css/field-group.css +3 -1
- shared/assets/plugins/advanced-custom-fields/css/input.css +8 -3
- shared/assets/plugins/advanced-custom-fields/images/add-ons/cf7-field-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/images/add-ons/date-time-field-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/images/add-ons/flexible-content-field-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/images/add-ons/gallery-field-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/images/add-ons/google-maps-field-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/images/add-ons/gravity-forms-field-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/images/add-ons/options-page-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/images/add-ons/repeater-field-thumb.jpg +0 -0
- shared/assets/plugins/advanced-custom-fields/js/field-group.js +78 -10
- shared/assets/plugins/advanced-custom-fields/js/field-group.min.js +1 -8
- shared/assets/plugins/advanced-custom-fields/js/input.js +221 -126
- shared/assets/plugins/advanced-custom-fields/js/input.min.js +2 -2
- shared/assets/plugins/advanced-custom-fields/js/input/_listener.js +0 -0
- shared/assets/plugins/advanced-custom-fields/js/input/_listener.min.js +0 -0
- shared/assets/plugins/advanced-custom-fields/js/input/acf.js +942 -0
- shared/assets/plugins/advanced-custom-fields/js/input/ajax.js +325 -0
- shared/assets/plugins/advanced-custom-fields/js/input/color-picker.js +79 -0
- shared/assets/plugins/advanced-custom-fields/js/input/date-picker.js +134 -0
- shared/assets/plugins/advanced-custom-fields/js/input/file.js +410 -0
- shared/assets/plugins/advanced-custom-fields/js/input/google-map.js +566 -0
- shared/assets/plugins/advanced-custom-fields/js/input/image.js +447 -0
- shared/assets/plugins/advanced-custom-fields/js/input/radio.js +70 -0
- shared/assets/plugins/advanced-custom-fields/js/input/relationship.js +361 -0
- shared/assets/plugins/advanced-custom-fields/js/input/tab.js +280 -0
- shared/assets/plugins/advanced-custom-fields/js/input/validation.js +432 -0
- shared/assets/plugins/advanced-custom-fields/js/input/wysiwyg.js +556 -0
- templates/simple-solid-lite/config.php +0 -18
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.3
|
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.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' );
|
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,7 +70,8 @@ The plugin is also fully extendable and has a number of actions, filters, and ho
|
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
-
= 2.3.
|
|
|
74 |
* Adding support for Inbound Forms without redirect URLs (no ajax)
|
75 |
|
76 |
= 2.2.9 =
|
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.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 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 2.3.3 =
|
74 |
+
* Updating ACF4
|
75 |
* Adding support for Inbound Forms without redirect URLs (no ajax)
|
76 |
|
77 |
= 2.2.9 =
|
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,42 +159,63 @@ class acf
|
|
159 |
* @return {mixed} $post_id
|
160 |
*/
|
161 |
|
162 |
-
function get_post_id( $post_id )
|
163 |
-
|
164 |
-
//
|
165 |
-
if( !$post_id )
|
166 |
-
{
|
167 |
-
global $post;
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
|
|
173 |
}
|
174 |
|
175 |
|
176 |
-
//
|
177 |
-
if(
|
178 |
-
|
179 |
-
|
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 |
-
|
191 |
-
{
|
|
|
192 |
$post_id = $post_id->taxonomy . '_' . $post_id->term_id;
|
193 |
-
|
194 |
-
|
195 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
$post_id = $post_id->ID;
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
|
200 |
|
@@ -209,13 +230,16 @@ class acf
|
|
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 |
-
|
216 |
-
{
|
217 |
-
|
|
|
|
|
218 |
}
|
|
|
219 |
}
|
220 |
|
221 |
|
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.10
|
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.10',
|
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 |
+
// if not $post_id, load queried object
|
165 |
+
if( !$post_id ) {
|
|
|
|
|
166 |
|
167 |
+
// try for global post (needed for setup_postdata)
|
168 |
+
$post_id = (int) get_the_ID();
|
169 |
+
|
170 |
+
|
171 |
+
// try for current screen
|
172 |
+
if( !$post_id ) {
|
173 |
+
|
174 |
+
$post_id = get_queried_object();
|
175 |
+
|
176 |
}
|
177 |
+
|
178 |
}
|
179 |
|
180 |
|
181 |
+
// $post_id may be an object
|
182 |
+
if( is_object($post_id) ) {
|
183 |
+
|
184 |
+
// user
|
185 |
+
if( isset($post_id->roles, $post_id->ID) ) {
|
186 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
$post_id = 'user_' . $post_id->ID;
|
188 |
+
|
189 |
+
// term
|
190 |
+
} elseif( isset($post_id->taxonomy, $post_id->term_id) ) {
|
191 |
+
|
192 |
$post_id = $post_id->taxonomy . '_' . $post_id->term_id;
|
193 |
+
|
194 |
+
// comment
|
195 |
+
} elseif( isset($post_id->comment_ID) ) {
|
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 |
* 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 |
+
if( $autosave && $autosave->post_parent == $post_id ) {
|
238 |
+
|
239 |
+
$post_id = (int) $autosave->ID;
|
240 |
+
|
241 |
}
|
242 |
+
|
243 |
}
|
244 |
|
245 |
|
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 =
|
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 determine 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 = $acf['options'];
|
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).load
|
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' => __("Google Map Extended",'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_google_map_extended'),
|
179 |
+
'url' => 'https://wordpress.org/plugins/advanced-custom-fields-google-map-extended/'
|
180 |
);
|
181 |
$free[] = array(
|
182 |
'title' => __("Contact Form 7 Field",'acf'),
|
253 |
<script type="text/javascript">
|
254 |
(function($) {
|
255 |
|
256 |
+
$(window).on('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', 'profile.php', 'user-new.php', 'user-edit.php', 'media.php' ) ) )
|
213 |
{
|
214 |
$return = true;
|
215 |
}
|
@@ -275,26 +275,43 @@ 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 |
-
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'] = $
|
|
|
298 |
}
|
299 |
|
300 |
}
|
209 |
|
210 |
|
211 |
// validate page
|
212 |
+
if( in_array( $pagenow, array( 'edit-tags.php', 'term.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 |
+
} elseif( $pagenow == "edit-tags.php" || $pagenow == "term.php" ) {
|
|
|
|
|
|
|
|
|
279 |
|
280 |
+
// vars
|
281 |
+
$taxonomy = 'post_tag';
|
282 |
+
$term_id = 0;
|
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 . "_" . $term_id;
|
314 |
+
|
315 |
}
|
316 |
|
317 |
}
|
shared/assets/plugins/advanced-custom-fields/core/controllers/field_group.php
CHANGED
@@ -350,7 +350,8 @@ class acf_field_group
|
|
350 |
|
351 |
function admin_head()
|
352 |
{
|
353 |
-
global
|
|
|
354 |
|
355 |
|
356 |
// l10n
|
@@ -378,6 +379,7 @@ class acf_field_group
|
|
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
|
350 |
|
351 |
function admin_head()
|
352 |
{
|
353 |
+
// global
|
354 |
+
global $wp_version, $post;
|
355 |
|
356 |
|
357 |
// l10n
|
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
|
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 surrounding 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 |
+
// determine $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 determine 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 |
+
// determine $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 determine 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,6 +265,52 @@ class acf_field_google_map extends acf_field
|
|
265 |
return $value;
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
269 |
|
270 |
new acf_field_google_map();
|
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();
|
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,13 +26,7 @@ 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 |
-
'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 |
|
26 |
'return_format' => 'object'
|
27 |
);
|
28 |
$this->l10n = array(
|
29 |
+
'max' => __("Maximum values reached ( {max} values )",'acf')
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
);
|
31 |
|
32 |
|
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 |
+
// determine 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("Affects 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("Affects value on front end",'acf') ?></p>
|
166 |
</td>
|
167 |
<td>
|
168 |
<?php
|
shared/assets/plugins/advanced-custom-fields/core/fields/wysiwyg.php
CHANGED
@@ -215,6 +215,7 @@ class acf_field_wysiwyg extends acf_field
|
|
215 |
|
216 |
|
217 |
// vars
|
|
|
218 |
$id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
|
219 |
$default_editor = 'tinymce';
|
220 |
|
@@ -245,7 +246,7 @@ class acf_field_wysiwyg extends acf_field
|
|
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">
|
215 |
|
216 |
|
217 |
// vars
|
218 |
+
//$id = uniqid('acf-editor-');
|
219 |
$id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
|
220 |
$default_editor = 'tinymce';
|
221 |
|
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 tmce-active" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>">
|
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">
|
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,6 +75,8 @@
|
|
75 |
|
76 |
.postbox#acf_fields a {
|
77 |
text-decoration: none;
|
|
|
|
|
78 |
}
|
79 |
|
80 |
|
64 |
display: none;
|
65 |
}
|
66 |
|
67 |
+
.postbox#acf_fields > .hndle {
|
68 |
display: none;
|
69 |
}
|
70 |
|
75 |
|
76 |
.postbox#acf_fields a {
|
77 |
text-decoration: none;
|
78 |
+
box-shadow: none;
|
79 |
+
transition: none;
|
80 |
}
|
81 |
|
82 |
|
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,17 +508,21 @@ 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 |
display: none;
|
513 |
}
|
514 |
|
515 |
.media-modal.acf-media-modal .media-frame-content {
|
516 |
-
top:
|
|
|
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,6 +532,7 @@ not needed in WP 3.8
|
|
528 |
|
529 |
.media-modal.acf-media-modal .media-toolbar {
|
530 |
right: 0;
|
|
|
531 |
}
|
532 |
|
533 |
|
24 |
box-shadow: none;
|
25 |
}
|
26 |
|
27 |
+
.acf_postbox.no_box > .hndle,
|
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 |
+
.media-modal.acf-media-modal .media-frame-menu {
|
513 |
display: none;
|
514 |
}
|
515 |
|
516 |
.media-modal.acf-media-modal .media-frame-content {
|
517 |
+
top: 50px;
|
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 |
|
533 |
.media-modal.acf-media-modal .media-toolbar {
|
534 |
right: 0;
|
535 |
+
left: 0;
|
536 |
}
|
537 |
|
538 |
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/cf7-field-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/date-time-field-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/flexible-content-field-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/gallery-field-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/google-maps-field-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/gravity-forms-field-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/options-page-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/images/add-ons/repeater-field-thumb.jpg
ADDED
Binary file
|
shared/assets/plugins/advanced-custom-fields/js/field-group.js
CHANGED
@@ -135,22 +135,90 @@ var acf = {
|
|
135 |
* @return N/A
|
136 |
*/
|
137 |
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
-
|
152 |
|
153 |
-
|
154 |
|
155 |
|
156 |
/*
|
135 |
* @return N/A
|
136 |
*/
|
137 |
|
138 |
+
var acf_submit = {
|
139 |
|
140 |
+
init: function(){
|
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 |
+
hide_spinner: function( $spinner ){
|
184 |
+
|
185 |
+
// bail early if no spinner
|
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 |
+
|