Version Description
- April 3rd 2020 =
New Features & Enhancements
- Added: Add is_required() helper method for fields objects to abstract some logic. #5657 (@JoryHogeveen)
- Updated: Removed duplicate code from pods_list_filter() that is now in wp_list_filter(). #5644 (@JoryHogeveen)
- Updated: Now prefixing the Templates and Pages component menu items with "Pod" so they aren't as easily confused with normal WordPress menu items. #5647 (@JoryHogeveen)
Bug Fixes
- Fixed: Compatibility layer for ACF so it won't conflict anymore. #5667 (@sc0ttkclark)
- Fixed: Remove PHP 5.6+ only code that was causing issues for those running older PHP versions. #5659 (@JoryHogeveen)
- Fixed: Prevent PHP errors when enforcing numeric values during validation of number fields. #5666 (@JoryHogeveen)
- Fixed: Prevent deprecated warnings with special magic tags usage like
{@user.id}
instead of{@user.ID}
. #5642 (@JoryHogeveen) - Fixed: Fix the decimal/thousands separator logic used for number and currency field validation and saving. #5653 (@JoryHogeveen)
- Fixed: Resolve issues with
[if]
and[else]
logic for boolean fields that was causing it to always evaluate to true. #5656 (@JoryHogeveen) - Fixed: Only load Freemius on Pods Admin, Plugins, or the Updates screens. (@sc0ttkclark)
Download this release
Release Info
Developer | sc0ttkclark |
Plugin | Pods – Custom Content Types and Fields |
Version | 2.7.18 |
Comparing to | |
See all releases |
Code changes from version 2.7.17.1 to 2.7.18
- classes/PodsAPI.php +4 -4
- classes/PodsField.php +13 -0
- classes/PodsInit.php +22 -4
- classes/fields/boolean.php +21 -24
- classes/fields/color.php +1 -1
- classes/fields/currency.php +3 -0
- classes/fields/email.php +1 -1
- classes/fields/link.php +1 -1
- classes/fields/number.php +9 -9
- classes/fields/oembed.php +1 -1
- classes/fields/password.php +1 -1
- classes/fields/phone.php +1 -1
- classes/fields/text.php +1 -1
- classes/fields/website.php +1 -1
- components/Pages.php +2 -0
- components/Templates/Templates.php +2 -0
- includes/data.php +6 -31
- init.php +2 -2
- readme.txt +19 -1
classes/PodsAPI.php
CHANGED
@@ -2930,13 +2930,13 @@ class PodsAPI {
|
|
2930 |
* @type null|array $old_options The old field options (if preexisting).
|
2931 |
* }
|
2932 |
*/
|
2933 |
-
do_action( 'pods_api_save_field_table_pre_alter', $definition_mode, $pod, $field['type'], $field,
|
2934 |
'simple' => $simple,
|
2935 |
'definition' => $definition,
|
2936 |
'old_name' => $old_name,
|
2937 |
'old_definition' => $old_definition,
|
2938 |
'old_options' => $old_options,
|
2939 |
-
|
2940 |
|
2941 |
if ( 'drop' === $definition_mode ) {
|
2942 |
// Drop field column.
|
@@ -2978,13 +2978,13 @@ class PodsAPI {
|
|
2978 |
* @type null|array $old_options The old field options (if preexisting).
|
2979 |
* }
|
2980 |
*/
|
2981 |
-
do_action( 'pods_api_save_field_table_altered', $definition_mode, $pod, $field['type'], $field,
|
2982 |
'simple' => $simple,
|
2983 |
'definition' => $definition,
|
2984 |
'old_name' => $old_name,
|
2985 |
'old_definition' => $old_definition,
|
2986 |
'old_options' => $old_options,
|
2987 |
-
|
2988 |
}
|
2989 |
}
|
2990 |
|
2930 |
* @type null|array $old_options The old field options (if preexisting).
|
2931 |
* }
|
2932 |
*/
|
2933 |
+
do_action( 'pods_api_save_field_table_pre_alter', $definition_mode, $pod, $field['type'], $field, array(
|
2934 |
'simple' => $simple,
|
2935 |
'definition' => $definition,
|
2936 |
'old_name' => $old_name,
|
2937 |
'old_definition' => $old_definition,
|
2938 |
'old_options' => $old_options,
|
2939 |
+
) );
|
2940 |
|
2941 |
if ( 'drop' === $definition_mode ) {
|
2942 |
// Drop field column.
|
2978 |
* @type null|array $old_options The old field options (if preexisting).
|
2979 |
* }
|
2980 |
*/
|
2981 |
+
do_action( 'pods_api_save_field_table_altered', $definition_mode, $pod, $field['type'], $field, array(
|
2982 |
'simple' => $simple,
|
2983 |
'definition' => $definition,
|
2984 |
'old_name' => $old_name,
|
2985 |
'old_definition' => $old_definition,
|
2986 |
'old_options' => $old_options,
|
2987 |
+
) );
|
2988 |
}
|
2989 |
}
|
2990 |
|
classes/PodsField.php
CHANGED
@@ -732,6 +732,19 @@ class PodsField {
|
|
732 |
|
733 |
}
|
734 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
/**
|
736 |
* Strip HTML based on options.
|
737 |
*
|
732 |
|
733 |
}
|
734 |
|
735 |
+
/**
|
736 |
+
* Check if the field is required.
|
737 |
+
*
|
738 |
+
* @param array $options Field options.
|
739 |
+
*
|
740 |
+
* @return bool
|
741 |
+
*
|
742 |
+
* @since 2.7.18
|
743 |
+
*/
|
744 |
+
public function is_required( $options ) {
|
745 |
+
return filter_var( pods_v( 'required', $options, false ), FILTER_VALIDATE_BOOLEAN );
|
746 |
+
}
|
747 |
+
|
748 |
/**
|
749 |
* Strip HTML based on options.
|
750 |
*
|
classes/PodsInit.php
CHANGED
@@ -172,6 +172,23 @@ class PodsInit {
|
|
172 |
* @return \Freemius
|
173 |
*/
|
174 |
public function freemius() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
if ( $this->freemius ) {
|
176 |
return $this->freemius;
|
177 |
}
|
@@ -224,9 +241,10 @@ class PodsInit {
|
|
224 |
*/
|
225 |
public function override_freemius_strings() {
|
226 |
$override_text = array(
|
227 |
-
'free' => 'Free (WordPress.org)',
|
228 |
-
'install-free-version-now' => 'Install Now',
|
229 |
-
'download-latest' => 'Donate',
|
|
|
230 |
);
|
231 |
|
232 |
$freemius_addons = $this->get_freemius_addons();
|
@@ -343,7 +361,7 @@ class PodsInit {
|
|
343 |
define( 'PODS_COMPATIBILITY', true );
|
344 |
}
|
345 |
|
346 |
-
if ( ! PODS_COMPATIBILITY ) {
|
347 |
return;
|
348 |
}
|
349 |
|
172 |
* @return \Freemius
|
173 |
*/
|
174 |
public function freemius() {
|
175 |
+
// Admin only.
|
176 |
+
if ( ! is_admin() ) {
|
177 |
+
return;
|
178 |
+
}
|
179 |
+
|
180 |
+
global $pagenow;
|
181 |
+
|
182 |
+
// Pods admin pages or plugins/update page only.
|
183 |
+
if (
|
184 |
+
'plugins.php' !== $pagenow
|
185 |
+
&& 'update-core.php' !== $pagenow
|
186 |
+
&& 'update.php' !== $pagenow
|
187 |
+
&& ( ! isset( $_GET['page'] ) || 0 !== strpos( $_GET['page'], 'pods' ) )
|
188 |
+
) {
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
|
192 |
if ( $this->freemius ) {
|
193 |
return $this->freemius;
|
194 |
}
|
241 |
*/
|
242 |
public function override_freemius_strings() {
|
243 |
$override_text = array(
|
244 |
+
'free' => __( 'Free (WordPress.org)', 'pods' ),
|
245 |
+
'install-free-version-now' => __( 'Install Now', 'pods' ),
|
246 |
+
'download-latest' => __( 'Donate', 'pods' ),
|
247 |
+
'complete-the-install' => __( 'complete the process', 'pods' ),
|
248 |
);
|
249 |
|
250 |
$freemius_addons = $this->get_freemius_addons();
|
361 |
define( 'PODS_COMPATIBILITY', true );
|
362 |
}
|
363 |
|
364 |
+
if ( ! PODS_COMPATIBILITY || is_admin() ) {
|
365 |
return;
|
366 |
}
|
367 |
|
classes/fields/boolean.php
CHANGED
@@ -79,9 +79,11 @@ class PodsField_Boolean extends PodsField {
|
|
79 |
|
80 |
$is_empty = false;
|
81 |
|
82 |
-
//
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
}
|
86 |
|
87 |
return $is_empty;
|
@@ -173,21 +175,18 @@ class PodsField_Boolean extends PodsField {
|
|
173 |
*/
|
174 |
public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
|
175 |
|
|
|
|
|
|
|
|
|
|
|
176 |
$errors = array();
|
177 |
$check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params );
|
178 |
|
179 |
$yes_required = ( 'checkbox' === pods_v( static::$type . '_format_type', $options ) );
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
if ( 1 === $required ) {
|
184 |
-
if ( $yes_required ) {
|
185 |
-
if ( 0 === $check ) {
|
186 |
-
$errors[] = __( 'This field is required.', 'pods' );
|
187 |
-
}
|
188 |
-
} elseif ( $this->is_empty( $value ) ) {
|
189 |
-
$errors[] = __( 'This field is required.', 'pods' );
|
190 |
-
}
|
191 |
}
|
192 |
|
193 |
if ( ! empty( $errors ) ) {
|
@@ -198,6 +197,8 @@ class PodsField_Boolean extends PodsField {
|
|
198 |
}
|
199 |
|
200 |
/**
|
|
|
|
|
201 |
* {@inheritdoc}
|
202 |
*/
|
203 |
public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
|
@@ -205,19 +206,15 @@ class PodsField_Boolean extends PodsField {
|
|
205 |
$yes = strtolower( pods_v( static::$type . '_yes_label', $options, __( 'Yes', 'pods' ), true ) );
|
206 |
$no = strtolower( pods_v( static::$type . '_no_label', $options, __( 'No', 'pods' ), true ) );
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
} elseif ( strtolower( $value ) === $yes ) {
|
214 |
-
$value = 1;
|
215 |
-
} elseif ( strtolower( $value ) === $no ) {
|
216 |
-
$value = 0;
|
217 |
-
} elseif ( 0 !== (int) $value ) {
|
218 |
$value = 1;
|
219 |
} else {
|
220 |
-
|
|
|
221 |
}
|
222 |
|
223 |
return $value;
|
79 |
|
80 |
$is_empty = false;
|
81 |
|
82 |
+
// is_empty() is used for if/else statements. Value should be true to pass.
|
83 |
+
$value = $this->pre_save( $value );
|
84 |
+
|
85 |
+
if ( ! $value ) {
|
86 |
+
$is_empty = true;
|
87 |
}
|
88 |
|
89 |
return $is_empty;
|
175 |
*/
|
176 |
public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
|
177 |
|
178 |
+
if ( ! $this->is_required( $options ) ) {
|
179 |
+
// Any value can be parsed to boolean.
|
180 |
+
return true;
|
181 |
+
}
|
182 |
+
|
183 |
$errors = array();
|
184 |
$check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params );
|
185 |
|
186 |
$yes_required = ( 'checkbox' === pods_v( static::$type . '_format_type', $options ) );
|
187 |
|
188 |
+
if ( $yes_required && ! $check ) {
|
189 |
+
$errors[] = __( 'This field is required.', 'pods' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
|
192 |
if ( ! empty( $errors ) ) {
|
197 |
}
|
198 |
|
199 |
/**
|
200 |
+
* Replicates filter_var() with `FILTER_VALIDATE_BOOLEAN` and adds custom input for yes/no values.
|
201 |
+
*
|
202 |
* {@inheritdoc}
|
203 |
*/
|
204 |
public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
|
206 |
$yes = strtolower( pods_v( static::$type . '_yes_label', $options, __( 'Yes', 'pods' ), true ) );
|
207 |
$no = strtolower( pods_v( static::$type . '_no_label', $options, __( 'No', 'pods' ), true ) );
|
208 |
|
209 |
+
if ( is_string( $value ) ) {
|
210 |
+
$value = strtolower( $value );
|
211 |
+
}
|
212 |
+
|
213 |
+
if ( $yes === $value ) {
|
|
|
|
|
|
|
|
|
|
|
214 |
$value = 1;
|
215 |
} else {
|
216 |
+
// Validate: 1, "1", true, "true", "on", and "yes" as 1, all others are 0.
|
217 |
+
$value = (int) filter_var( $value, FILTER_VALIDATE_BOOLEAN );
|
218 |
}
|
219 |
|
220 |
return $value;
|
classes/fields/color.php
CHANGED
@@ -105,7 +105,7 @@ class PodsField_Color extends PodsField {
|
|
105 |
$color = str_replace( '#', '', $check );
|
106 |
|
107 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
108 |
-
if (
|
109 |
$errors[] = __( 'This field is required.', 'pods' );
|
110 |
} else {
|
111 |
// @todo Ask for a specific format in error message
|
105 |
$color = str_replace( '#', '', $check );
|
106 |
|
107 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
108 |
+
if ( $this->is_required( $options ) ) {
|
109 |
$errors[] = __( 'This field is required.', 'pods' );
|
110 |
} else {
|
111 |
// @todo Ask for a specific format in error message
|
classes/fields/currency.php
CHANGED
@@ -291,6 +291,9 @@ class PodsField_Currency extends PodsField_Number {
|
|
291 |
$value
|
292 |
);
|
293 |
|
|
|
|
|
|
|
294 |
return parent::pre_save( $value, $id, $name, $options, $fields, $pod, $params );
|
295 |
|
296 |
}
|
291 |
$value
|
292 |
);
|
293 |
|
294 |
+
// Remove trailing dash only from the end of the string.
|
295 |
+
$value = rtrim( $value, '-' );
|
296 |
+
|
297 |
return parent::pre_save( $value, $id, $name, $options, $fields, $pod, $params );
|
298 |
|
299 |
}
|
classes/fields/email.php
CHANGED
@@ -135,7 +135,7 @@ class PodsField_Email extends PodsField {
|
|
135 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
136 |
$label = pods_v( 'label', $options, ucwords( str_replace( '_', ' ', $name ) ) );
|
137 |
|
138 |
-
if (
|
139 |
$errors[] = sprintf( __( '%s is required', 'pods' ), $label );
|
140 |
} else {
|
141 |
$errors[] = sprintf( __( 'Invalid e-mail provided for %s', 'pods' ), $label );
|
135 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
136 |
$label = pods_v( 'label', $options, ucwords( str_replace( '_', ' ', $name ) ) );
|
137 |
|
138 |
+
if ( $this->is_required( $options ) ) {
|
139 |
$errors[] = sprintf( __( '%s is required', 'pods' ), $label );
|
140 |
} else {
|
141 |
$errors[] = sprintf( __( 'Invalid e-mail provided for %s', 'pods' ), $label );
|
classes/fields/link.php
CHANGED
@@ -219,7 +219,7 @@ class PodsField_Link extends PodsField_Website {
|
|
219 |
$errors = $check;
|
220 |
} else {
|
221 |
if ( ! empty( $value['url'] ) && 0 < strlen( $value['url'] ) && '' === $check ) {
|
222 |
-
if (
|
223 |
$errors[] = sprintf( __( 'The %s field is required.', 'pods' ), $label );
|
224 |
} else {
|
225 |
$errors[] = sprintf( __( 'Invalid link provided for the field %s.', 'pods' ), $label );
|
219 |
$errors = $check;
|
220 |
} else {
|
221 |
if ( ! empty( $value['url'] ) && 0 < strlen( $value['url'] ) && '' === $check ) {
|
222 |
+
if ( $this->is_required( $options ) ) {
|
223 |
$errors[] = sprintf( __( 'The %s field is required.', 'pods' ), $label );
|
224 |
} else {
|
225 |
$errors[] = sprintf( __( 'Invalid link provided for the field %s.', 'pods' ), $label );
|
classes/fields/number.php
CHANGED
@@ -162,14 +162,14 @@ class PodsField_Number extends PodsField {
|
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
-
* @todo 2.8 Centralize the usage of this
|
166 |
* {@inheritdoc}
|
167 |
*/
|
168 |
public function is_empty( $value = null ) {
|
169 |
|
170 |
$is_empty = false;
|
171 |
|
172 |
-
$value
|
173 |
|
174 |
if ( empty( $value ) ) {
|
175 |
$is_empty = true;
|
@@ -274,11 +274,6 @@ class PodsField_Number extends PodsField {
|
|
274 |
*/
|
275 |
public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
|
276 |
|
277 |
-
if ( $this->is_empty( $value ) && ( ! is_numeric( $value ) || 0.0 !== (float) $value ) ) {
|
278 |
-
// Don't enforce a default value here.
|
279 |
-
return null;
|
280 |
-
}
|
281 |
-
|
282 |
$format_args = $this->get_number_format_args( $options );
|
283 |
$thousands = $format_args['thousands'];
|
284 |
$dot = $format_args['dot'];
|
@@ -287,8 +282,8 @@ class PodsField_Number extends PodsField {
|
|
287 |
if ( 'slider' !== pods_v( static::$type . '_format_type', $options ) ) {
|
288 |
// Slider only supports `1234.00` format so no need for replacing characters.
|
289 |
$value = str_replace(
|
290 |
-
array( $thousands, $dot, html_entity_decode( $
|
291 |
-
array( '', '.', '' ),
|
292 |
$value
|
293 |
);
|
294 |
}
|
@@ -297,6 +292,11 @@ class PodsField_Number extends PodsField {
|
|
297 |
|
298 |
$value = preg_replace( '/[^0-9\.\-]/', '', $value );
|
299 |
|
|
|
|
|
|
|
|
|
|
|
300 |
$value = number_format( (float) $value, $decimals, '.', '' );
|
301 |
|
302 |
// Optionally remove trailing decimal zero's.
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
+
* @todo 2.8 Centralize the usage of this method. See PR #5540.
|
166 |
* {@inheritdoc}
|
167 |
*/
|
168 |
public function is_empty( $value = null ) {
|
169 |
|
170 |
$is_empty = false;
|
171 |
|
172 |
+
$value = (float) $value;
|
173 |
|
174 |
if ( empty( $value ) ) {
|
175 |
$is_empty = true;
|
274 |
*/
|
275 |
public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
|
276 |
|
|
|
|
|
|
|
|
|
|
|
277 |
$format_args = $this->get_number_format_args( $options );
|
278 |
$thousands = $format_args['thousands'];
|
279 |
$dot = $format_args['dot'];
|
282 |
if ( 'slider' !== pods_v( static::$type . '_format_type', $options ) ) {
|
283 |
// Slider only supports `1234.00` format so no need for replacing characters.
|
284 |
$value = str_replace(
|
285 |
+
array( $thousands, html_entity_decode( $thousands ), $dot, html_entity_decode( $dot ) ),
|
286 |
+
array( '', '', '.', '.' ),
|
287 |
$value
|
288 |
);
|
289 |
}
|
292 |
|
293 |
$value = preg_replace( '/[^0-9\.\-]/', '', $value );
|
294 |
|
295 |
+
if ( $this->is_empty( $value ) && ( ! is_numeric( $value ) || 0.0 !== (float) $value ) ) {
|
296 |
+
// Don't enforce a default value here.
|
297 |
+
return null;
|
298 |
+
}
|
299 |
+
|
300 |
$value = number_format( (float) $value, $decimals, '.', '' );
|
301 |
|
302 |
// Optionally remove trailing decimal zero's.
|
classes/fields/oembed.php
CHANGED
@@ -206,7 +206,7 @@ class PodsField_OEmbed extends PodsField {
|
|
206 |
$errors = $check;
|
207 |
} else {
|
208 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
209 |
-
if (
|
210 |
$errors[] = __( 'This field is required.', 'pods' );
|
211 |
}
|
212 |
}
|
206 |
$errors = $check;
|
207 |
} else {
|
208 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
209 |
+
if ( $this->is_required( $options ) ) {
|
210 |
$errors[] = __( 'This field is required.', 'pods' );
|
211 |
}
|
212 |
}
|
classes/fields/password.php
CHANGED
@@ -113,7 +113,7 @@ class PodsField_Password extends PodsField {
|
|
113 |
$errors = $check;
|
114 |
} else {
|
115 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
116 |
-
if (
|
117 |
$errors[] = __( 'This field is required.', 'pods' );
|
118 |
}
|
119 |
}
|
113 |
$errors = $check;
|
114 |
} else {
|
115 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
116 |
+
if ( $this->is_required( $options ) ) {
|
117 |
$errors[] = __( 'This field is required.', 'pods' );
|
118 |
}
|
119 |
}
|
classes/fields/phone.php
CHANGED
@@ -160,7 +160,7 @@ class PodsField_Phone extends PodsField {
|
|
160 |
$errors = $check;
|
161 |
} else {
|
162 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
163 |
-
if (
|
164 |
$errors[] = sprintf( __( 'The %s field is required.', 'pods' ), $label );
|
165 |
} else {
|
166 |
$errors[] = sprintf( __( 'Invalid phone number provided for the field %s.', 'pods' ), $label );
|
160 |
$errors = $check;
|
161 |
} else {
|
162 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
163 |
+
if ( $this->is_required( $options ) ) {
|
164 |
$errors[] = sprintf( __( 'The %s field is required.', 'pods' ), $label );
|
165 |
} else {
|
166 |
$errors[] = sprintf( __( 'Invalid phone number provided for the field %s.', 'pods' ), $label );
|
classes/fields/text.php
CHANGED
@@ -161,7 +161,7 @@ class PodsField_Text extends PodsField {
|
|
161 |
$errors = $check;
|
162 |
} else {
|
163 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
164 |
-
if (
|
165 |
$errors[] = __( 'This field is required.', 'pods' );
|
166 |
}
|
167 |
}
|
161 |
$errors = $check;
|
162 |
} else {
|
163 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
164 |
+
if ( $this->is_required( $options ) ) {
|
165 |
$errors[] = __( 'This field is required.', 'pods' );
|
166 |
}
|
167 |
}
|
classes/fields/website.php
CHANGED
@@ -185,7 +185,7 @@ class PodsField_Website extends PodsField {
|
|
185 |
$errors = $check;
|
186 |
} else {
|
187 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
188 |
-
if (
|
189 |
$errors[] = sprintf( __( 'The %s field is required.', 'pods' ), $label );
|
190 |
} else {
|
191 |
$errors[] = sprintf( __( 'Invalid website provided for the field %s.', 'pods' ), $label );
|
185 |
$errors = $check;
|
186 |
} else {
|
187 |
if ( 0 < strlen( $value ) && '' === $check ) {
|
188 |
+
if ( $this->is_required( $options ) ) {
|
189 |
$errors[] = sprintf( __( 'The %s field is required.', 'pods' ), $label );
|
190 |
} else {
|
191 |
$errors[] = sprintf( __( 'Invalid website provided for the field %s.', 'pods' ), $label );
|
components/Pages.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
/**
|
3 |
* Name: Pages
|
4 |
*
|
|
|
|
|
5 |
* Description: Creates advanced URL structures using wildcards in order to enable the front-end display of Pods Advanced Content Types. Not recommended for use with other content types.
|
6 |
*
|
7 |
* Version: 2.3
|
2 |
/**
|
3 |
* Name: Pages
|
4 |
*
|
5 |
+
* Menu Name: Pod Pages
|
6 |
+
*
|
7 |
* Description: Creates advanced URL structures using wildcards in order to enable the front-end display of Pods Advanced Content Types. Not recommended for use with other content types.
|
8 |
*
|
9 |
* Version: 2.3
|
components/Templates/Templates.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
/**
|
3 |
* Name: Templates
|
4 |
*
|
|
|
|
|
5 |
* Description: An easy to use templating engine for Pods. Use {@field_name} magic tags to output values, within your HTML markup.
|
6 |
*
|
7 |
* Version: 2.3
|
2 |
/**
|
3 |
* Name: Templates
|
4 |
*
|
5 |
+
* Menu Name: Pod Templates
|
6 |
+
*
|
7 |
* Description: An easy to use templating engine for Pods. Use {@field_name} magic tags to output values, within your HTML markup.
|
8 |
*
|
9 |
* Version: 2.3
|
includes/data.php
CHANGED
@@ -589,6 +589,11 @@ function pods_v( $var = null, $type = 'get', $default = null, $strict = false, $
|
|
589 |
if ( is_user_logged_in() ) {
|
590 |
$user = get_userdata( get_current_user_id() );
|
591 |
|
|
|
|
|
|
|
|
|
|
|
592 |
if ( isset( $user->{$var} ) ) {
|
593 |
$value = $user->{$var};
|
594 |
} elseif ( 'role' === $var ) {
|
@@ -2148,37 +2153,7 @@ function pods_list_filter( $list, $args = array(), $operator = 'AND' ) {
|
|
2148 |
$data = get_object_vars( $data );
|
2149 |
}
|
2150 |
|
2151 |
-
$
|
2152 |
-
$count = count( $args );
|
2153 |
-
$filtered = array();
|
2154 |
-
|
2155 |
-
foreach ( $data as $key => $obj ) {
|
2156 |
-
$to_match = $obj;
|
2157 |
-
|
2158 |
-
if ( is_object( $to_match ) ) {
|
2159 |
-
$to_match = get_object_vars( $to_match );
|
2160 |
-
} elseif ( ! is_array( $to_match ) ) {
|
2161 |
-
continue;
|
2162 |
-
}
|
2163 |
-
|
2164 |
-
$matched = 0;
|
2165 |
-
|
2166 |
-
foreach ( $args as $m_key => $m_value ) {
|
2167 |
-
if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] ) {
|
2168 |
-
$matched ++;
|
2169 |
-
}
|
2170 |
-
}
|
2171 |
-
|
2172 |
-
if ( 'AND' === $operator && $matched == $count ) {
|
2173 |
-
$filtered[ $key ] = $obj;
|
2174 |
-
} elseif ( 'OR' === $operator && $matched > 0 ) {
|
2175 |
-
$filtered[ $key ] = $obj;
|
2176 |
-
} elseif ( 'NOT' === $operator && 0 == $matched ) {
|
2177 |
-
$filtered[ $key ] = $obj;
|
2178 |
-
} else {
|
2179 |
-
continue;
|
2180 |
-
}
|
2181 |
-
}//end foreach
|
2182 |
|
2183 |
if ( $object ) {
|
2184 |
$filtered = (object) $filtered;
|
589 |
if ( is_user_logged_in() ) {
|
590 |
$user = get_userdata( get_current_user_id() );
|
591 |
|
592 |
+
// Prevent deprecation notice from WP.
|
593 |
+
if ( 'id' === $var ) {
|
594 |
+
$var = 'ID';
|
595 |
+
}
|
596 |
+
|
597 |
if ( isset( $user->{$var} ) ) {
|
598 |
$value = $user->{$var};
|
599 |
} elseif ( 'role' === $var ) {
|
2153 |
$data = get_object_vars( $data );
|
2154 |
}
|
2155 |
|
2156 |
+
$filtered = wp_list_filter( $data, $args, $operator );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2157 |
|
2158 |
if ( $object ) {
|
2159 |
$filtered = (object) $filtered;
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Pods - Custom Content Types and Fields
|
4 |
Plugin URI: https://pods.io/
|
5 |
Description: Pods is a framework for creating, managing, and deploying customized content types and fields
|
6 |
-
Version: 2.7.
|
7 |
Author: Pods Framework Team
|
8 |
Author URI: https://pods.io/about/
|
9 |
Text Domain: pods
|
@@ -36,7 +36,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
|
|
36 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
37 |
} else {
|
38 |
// Current version
|
39 |
-
define( 'PODS_VERSION', '2.7.
|
40 |
|
41 |
// Version tracking between DB updates themselves
|
42 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
3 |
Plugin Name: Pods - Custom Content Types and Fields
|
4 |
Plugin URI: https://pods.io/
|
5 |
Description: Pods is a framework for creating, managing, and deploying customized content types and fields
|
6 |
+
Version: 2.7.18
|
7 |
Author: Pods Framework Team
|
8 |
Author URI: https://pods.io/about/
|
9 |
Text Domain: pods
|
36 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
37 |
} else {
|
38 |
// Current version
|
39 |
+
define( 'PODS_VERSION', '2.7.18' );
|
40 |
|
41 |
// Version tracking between DB updates themselves
|
42 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: pods, custom post types, custom taxonomies, content types, custom fields,
|
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.7.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -190,6 +190,24 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he
|
|
190 |
|
191 |
== Changelog ==
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
= 2.7.17.1 - March 27th 2020 =
|
194 |
|
195 |
**Bug Fixes**
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.7.18
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
190 |
|
191 |
== Changelog ==
|
192 |
|
193 |
+
= 2.7.18 - April 3rd 2020 =
|
194 |
+
|
195 |
+
**New Features & Enhancements**
|
196 |
+
|
197 |
+
* Added: Add is_required() helper method for fields objects to abstract some logic. #5657 (@JoryHogeveen)
|
198 |
+
* Updated: Removed duplicate code from pods_list_filter() that is now in wp_list_filter(). #5644 (@JoryHogeveen)
|
199 |
+
* Updated: Now prefixing the Templates and Pages component menu items with "Pod" so they aren't as easily confused with normal WordPress menu items. #5647 (@JoryHogeveen)
|
200 |
+
|
201 |
+
**Bug Fixes**
|
202 |
+
|
203 |
+
* Fixed: Compatibility layer for ACF so it won't conflict anymore. #5667 (@sc0ttkclark)
|
204 |
+
* Fixed: Remove PHP 5.6+ only code that was causing issues for those running older PHP versions. #5659 (@JoryHogeveen)
|
205 |
+
* Fixed: Prevent PHP errors when enforcing numeric values during validation of number fields. #5666 (@JoryHogeveen)
|
206 |
+
* Fixed: Prevent deprecated warnings with special magic tags usage like `{@user.id}` instead of `{@user.ID}`. #5642 (@JoryHogeveen)
|
207 |
+
* Fixed: Fix the decimal/thousands separator logic used for number and currency field validation and saving. #5653 (@JoryHogeveen)
|
208 |
+
* Fixed: Resolve issues with `[if]` and `[else]` logic for boolean fields that was causing it to always evaluate to true. #5656 (@JoryHogeveen)
|
209 |
+
* Fixed: Only load Freemius on Pods Admin, Plugins, or the Updates screens. (@sc0ttkclark)
|
210 |
+
|
211 |
= 2.7.17.1 - March 27th 2020 =
|
212 |
|
213 |
**Bug Fixes**
|