Version Description
June 10th, 2022 =
Added: New helper functions
pods_clean_memory()
andpods_maybe_clean_memory()
introduced to provide WP-CLI commands in Pods core and add-ons the ability to help reduce memory usage in long running processes. (@sc0ttkclark)Added: New function
Pods::is_defined()
determines whether a Pod was defined or if it was generated adhoc when calling a non-defined Pod. (@sc0ttkclark, @JoryHogeveen)Added: New function
Pods::is_valid()
replaces the logic inPods::valid()
to better follow the naming pattern used elsewhere in Pods.Pods::valid()
is not deprecated yet. (@sc0ttkclark)Added: New functions
pods_static_cache_get()
,pods_static_cache_set()
, andpods_static_cache_clear()
abstract the static cache handling that would sometimes fail if the class was not available. (@sc0ttkclark)Added: New filter
pods_init_register_assets_load_pods_dfv_on_front
which allows you to force loading Pods DFV scripts on the front of the site when needed. Normally they will be included but some plugins/themes may need them enqueued sooner. (@sc0ttkclark)Tweak: Improved performance when using TranslatePress by optimizing how settings and blocks are handled to avoid extra
__()
translation calls. (@sc0ttkclark)Tweak: Improved performance with Block configurations. (@sc0ttkclark)
Tweak: Improved performance with existing content type checks. (@sc0ttkclark)
Tweak: Improved performance by offering a new setting to enable/disable tracking changed fields. (@sc0ttkclark)
Tweak: Improved performance by offering a new setting to enable/disable metadata integration. (@sc0ttkclark)
Tweak: Improved performance and third party plugin compatibility by offering a new setting to enable/disable metadata display overrides for Relationship/File fields. (@sc0ttkclark)
Tweak: Improved file types help text on the File field to describe how limiting file types works more clearly. (@sc0ttkclark)
Tweak: Default input type for Relationships multiple-select is now List View. (@sc0ttkclark)
Fixed: File path checks are now more strict and consistent across all Pods Views loading. (@sybrew from The SEO Framework team, @sc0ttkclark)
Fixed: SVG and other file types would not properly match up when certain plugins add additional mime types to be supported. (@sc0ttkclark)
Fixed: Improved fallback handling for DB table schema errors when trying to add a column that may already exist in the table. (@sc0ttkclark)
Fixed: Support labels for HTML field types in more form areas. (@sc0ttkclark)
Fixed:
PodsUI
now filters all field values instead of circumventing that when it's pulled from the table row already. (@sc0ttkclark)
Release Info
Developer | sc0ttkclark |
Plugin | Pods – Custom Content Types and Fields |
Version | 2.8.18 |
Comparing to | |
See all releases |
Code changes from version 2.8.17 to 2.8.18
- classes/Pods.php +28 -4
- classes/PodsAPI.php +66 -50
- classes/PodsForm.php +14 -15
- classes/PodsInit.php +33 -15
- classes/PodsMeta.php +54 -17
- classes/PodsUI.php +4 -6
- classes/PodsView.php +85 -122
- classes/fields/datetime.php +1 -3
- classes/fields/file.php +3 -3
- classes/fields/link.php +2 -4
- classes/fields/pick.php +10 -20
- components/Templates/class-pods_templates.php +4 -0
- includes/data.php +152 -0
- includes/general.php +112 -39
- init.php +2 -2
- readme.txt +25 -4
- src/Pods/Admin/Settings.php +60 -4
- src/Pods/Blocks/API.php +16 -0
- src/Pods/Blocks/Types/Item_List.php +1 -1
- src/Pods/Blocks/Types/Item_Single.php +1 -1
- ui/forms/div-row.php +1 -1
- ui/forms/form.php +2 -4
- ui/forms/list-row.php +1 -1
- ui/forms/p-row.php +1 -1
- ui/forms/table-row.php +1 -1
@@ -183,13 +183,24 @@ class Pods implements Iterator {
|
|
183 |
}
|
184 |
|
185 |
/**
|
186 |
-
*
|
187 |
*
|
188 |
-
* @
|
189 |
*
|
190 |
-
* @
|
191 |
*/
|
192 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
if ( empty( $this->pod_data ) ) {
|
194 |
return false;
|
195 |
}
|
@@ -201,6 +212,19 @@ class Pods implements Iterator {
|
|
201 |
return true;
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
/**
|
205 |
* Check if in Iterator mode
|
206 |
*
|
183 |
}
|
184 |
|
185 |
/**
|
186 |
+
* Determine whether this Pod object was defined or was built adhoc.
|
187 |
*
|
188 |
+
* @since 2.8.18
|
189 |
*
|
190 |
+
* @return bool Whether this Pod object was defined or was built adhoc.
|
191 |
*/
|
192 |
+
public function is_defined() {
|
193 |
+
return $this->pod_data && empty( $this->pod_data['adhoc'] );
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Determine whether this Pod object is valid or not.
|
198 |
+
*
|
199 |
+
* @since 2.8.18
|
200 |
+
*
|
201 |
+
* @return bool Whether this Pod object is valid or not.
|
202 |
+
*/
|
203 |
+
public function is_valid() {
|
204 |
if ( empty( $this->pod_data ) ) {
|
205 |
return false;
|
206 |
}
|
212 |
return true;
|
213 |
}
|
214 |
|
215 |
+
/**
|
216 |
+
* Whether this Pod object is valid or not
|
217 |
+
*
|
218 |
+
* @return bool
|
219 |
+
*
|
220 |
+
* @since 2.0.0
|
221 |
+
*
|
222 |
+
* @see Pods::is_valid()
|
223 |
+
*/
|
224 |
+
public function valid() {
|
225 |
+
return $this->is_valid();
|
226 |
+
}
|
227 |
+
|
228 |
/**
|
229 |
* Check if in Iterator mode
|
230 |
*
|
@@ -1848,6 +1848,7 @@ class PodsAPI {
|
|
1848 |
|
1849 |
$options_ignore = array(
|
1850 |
'_locale',
|
|
|
1851 |
'attributes',
|
1852 |
'dependency',
|
1853 |
'depends-on',
|
@@ -3307,6 +3308,7 @@ class PodsAPI {
|
|
3307 |
|
3308 |
$options_ignore = [
|
3309 |
'_locale',
|
|
|
3310 |
'attributes',
|
3311 |
'dependency',
|
3312 |
'depends-on',
|
@@ -3782,7 +3784,11 @@ class PodsAPI {
|
|
3782 |
|
3783 |
// If the old field doesn't exist, continue to add a new field
|
3784 |
if ( 'add' === $definition_mode ) {
|
3785 |
-
pods_query( "ALTER TABLE `@wp_pods_{$params->pod}` ADD COLUMN {$definition}",
|
|
|
|
|
|
|
|
|
3786 |
}
|
3787 |
|
3788 |
/**
|
@@ -4181,6 +4187,7 @@ class PodsAPI {
|
|
4181 |
$options = get_object_vars( $params );
|
4182 |
|
4183 |
$options_ignore = [
|
|
|
4184 |
'method',
|
4185 |
'table_info',
|
4186 |
'attributes',
|
@@ -5323,8 +5330,6 @@ class PodsAPI {
|
|
5323 |
pods_no_conflict_on( $pod['type'] );
|
5324 |
}
|
5325 |
|
5326 |
-
$static_cache = pods_container( Static_Cache::class );
|
5327 |
-
|
5328 |
// Save relationship / file data
|
5329 |
if ( ! empty( $rel_fields ) ) {
|
5330 |
foreach ( $rel_fields as $type => $data ) {
|
@@ -5492,7 +5497,7 @@ class PodsAPI {
|
|
5492 |
$values = array_slice( $values, 0, $related_limit );
|
5493 |
}
|
5494 |
|
5495 |
-
$related_data =
|
5496 |
|
5497 |
// Get current values
|
5498 |
if ( 'pick' === $type && isset( $related_data[ 'current_ids_' . $params->id ] ) ) {
|
@@ -5529,14 +5534,14 @@ class PodsAPI {
|
|
5529 |
// Unset data no longer needed
|
5530 |
if ( 'pick' === $type ) {
|
5531 |
foreach ( $data as $field => $values ) {
|
5532 |
-
$related_data =
|
5533 |
|
5534 |
if ( ! empty( $related_data ) ) {
|
5535 |
if ( ! empty( $related_data['related_field'] ) ) {
|
5536 |
-
|
5537 |
}
|
5538 |
|
5539 |
-
|
5540 |
}
|
5541 |
}
|
5542 |
}
|
@@ -5644,11 +5649,16 @@ class PodsAPI {
|
|
5644 |
* @return array List of changed fields (if $mode = 'get')
|
5645 |
*/
|
5646 |
public static function handle_changed_fields( $pod, $id, $mode = 'set' ) {
|
5647 |
-
$
|
5648 |
|
5649 |
-
|
5650 |
-
|
5651 |
-
|
|
|
|
|
|
|
|
|
|
|
5652 |
|
5653 |
$cache_key = $pod . '|' . $id;
|
5654 |
|
@@ -5662,17 +5672,23 @@ class PodsAPI {
|
|
5662 |
}
|
5663 |
|
5664 |
if ( empty( $old_fields_cache[ $cache_key ] ) || 'reset' === $mode ) {
|
5665 |
-
$old_fields_cache[ $cache_key ] =
|
5666 |
|
5667 |
if ( ! empty( $id ) ) {
|
5668 |
if ( ! isset( $changed_pods_cache[ $pod ] ) ) {
|
5669 |
-
$
|
5670 |
-
}
|
5671 |
|
5672 |
-
|
5673 |
-
|
|
|
5674 |
|
5675 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
5676 |
}
|
5677 |
}
|
5678 |
}
|
@@ -5690,7 +5706,11 @@ class PodsAPI {
|
|
5690 |
|
5691 |
if ( ! empty( $changed_pods_cache[ $pod ] ) ) {
|
5692 |
if ( $id != $changed_pods_cache[ $pod ]->id() ) {
|
5693 |
-
$changed_pods_cache[ $pod ]->fetch( $id );
|
|
|
|
|
|
|
|
|
5694 |
}
|
5695 |
|
5696 |
$new_fields = $changed_pods_cache[ $pod ]->export( $export_params );
|
@@ -5706,9 +5726,9 @@ class PodsAPI {
|
|
5706 |
}
|
5707 |
}
|
5708 |
|
5709 |
-
|
5710 |
-
|
5711 |
-
|
5712 |
|
5713 |
return $changed_fields;
|
5714 |
|
@@ -5740,9 +5760,7 @@ class PodsAPI {
|
|
5740 |
* @return array List of ID(s) that were setup for saving.
|
5741 |
*/
|
5742 |
public function save_relationships( $id, $related_ids, $pod, $field ) {
|
5743 |
-
$
|
5744 |
-
|
5745 |
-
$related_data = $static_cache->get( $field['name'] . '/' . $field['id'], 'PodsField_Pick/related_data' ) ?: [];
|
5746 |
|
5747 |
// Get current values
|
5748 |
if ( 'pick' === $field['type'] && isset( $related_data[ 'current_ids_' . $id ] ) ) {
|
@@ -5751,12 +5769,10 @@ class PodsAPI {
|
|
5751 |
$current_ids = $this->lookup_related_items( $field['id'], $pod['id'], $id, $field, $pod );
|
5752 |
}
|
5753 |
|
5754 |
-
$static_cache = pods_container( Static_Cache::class );
|
5755 |
-
|
5756 |
$cache_key = $pod['id'] . '|' . $field['id'];
|
5757 |
|
5758 |
// Delete relationship from cache.
|
5759 |
-
|
5760 |
|
5761 |
if ( ! is_array( $related_ids ) ) {
|
5762 |
$related_ids = implode( ',', $related_ids );
|
@@ -7586,12 +7602,10 @@ class PodsAPI {
|
|
7586 |
}
|
7587 |
}
|
7588 |
|
7589 |
-
$static_cache = pods_container( Static_Cache::class );
|
7590 |
-
|
7591 |
$cache_key = $related_pod['id'] . '|' . $related_field['id'];
|
7592 |
|
7593 |
// Delete relationship from cache.
|
7594 |
-
|
7595 |
|
7596 |
// @codingStandardsIgnoreLine
|
7597 |
$key = array_search( $id, $related_ids );
|
@@ -9052,13 +9066,11 @@ class PodsAPI {
|
|
9052 |
|
9053 |
$idstring = implode( ',', $params->ids );
|
9054 |
|
9055 |
-
$static_cache = pods_container( Static_Cache::class );
|
9056 |
-
|
9057 |
$cache_key = $params->pod_id . '|' . $params->field_id;
|
9058 |
|
9059 |
// Check cache first, no point in running the same query multiple times
|
9060 |
if ( $params->pod_id && $params->field_id ) {
|
9061 |
-
$cache_value =
|
9062 |
|
9063 |
if ( isset( $cache_value[ $idstring ] ) && is_array( $cache_value[ $idstring ] ) ) {
|
9064 |
return $cache_value[ $idstring ];
|
@@ -9267,11 +9279,11 @@ class PodsAPI {
|
|
9267 |
|
9268 |
if ( 0 != $params->pod_id && 0 != $params->field_id && ! empty( $related_ids ) ) {
|
9269 |
// Only cache if $params->pod_id and $params->field_id were passed
|
9270 |
-
$cache_value =
|
9271 |
|
9272 |
$cache_value[ $idstring ] = $related_ids;
|
9273 |
|
9274 |
-
|
9275 |
}
|
9276 |
|
9277 |
return $related_ids;
|
@@ -9676,9 +9688,7 @@ class PodsAPI {
|
|
9676 |
|
9677 |
$_info = false;
|
9678 |
|
9679 |
-
$
|
9680 |
-
|
9681 |
-
$table_info_cache = $static_cache->get( $cache_key, __CLASS__ . '/table_info_cache' ) ?: [];
|
9682 |
|
9683 |
if ( $table_info_cache ) {
|
9684 |
// Prefer info from the object internal cache
|
@@ -10106,7 +10116,7 @@ class PodsAPI {
|
|
10106 |
$info['type'] = $object_type;
|
10107 |
$info['object_name'] = $object;
|
10108 |
|
10109 |
-
|
10110 |
|
10111 |
if ( pods_api_cache() ) {
|
10112 |
if ( ! did_action( 'init' ) || doing_action( 'init' ) ) {
|
@@ -10494,6 +10504,9 @@ class PodsAPI {
|
|
10494 |
pods_transient_clear( 'pods_pfat_auto_pods' );
|
10495 |
pods_transient_clear( 'pods_pfat_archive_test' );
|
10496 |
|
|
|
|
|
|
|
10497 |
if ( is_array( $pod ) || $pod instanceof Pod ) {
|
10498 |
pods_transient_clear( 'pods_pod_' . $pod['name'] );
|
10499 |
pods_cache_clear( $pod['name'], 'pods-class' );
|
@@ -10506,17 +10519,15 @@ class PodsAPI {
|
|
10506 |
pods_transient_clear( 'pods_wp_cpt_ct' );
|
10507 |
}
|
10508 |
|
10509 |
-
|
10510 |
-
|
10511 |
-
|
10512 |
-
|
10513 |
-
|
10514 |
-
|
10515 |
-
|
10516 |
-
|
10517 |
-
|
10518 |
-
$static_cache->flush( 'pods_svg_icon/base64' );
|
10519 |
-
$static_cache->flush( 'pods_svg_icon/svg' );
|
10520 |
|
10521 |
pods_init()->refresh_existing_content_types_cache( true );
|
10522 |
|
@@ -10920,6 +10931,7 @@ class PodsAPI {
|
|
10920 |
'name' => $type,
|
10921 |
'label' => __( 'User', 'pods' ),
|
10922 |
'storage' => 'meta',
|
|
|
10923 |
];
|
10924 |
} elseif ( 'comment' === $params['name'] ) {
|
10925 |
// Detect comment.
|
@@ -10931,6 +10943,7 @@ class PodsAPI {
|
|
10931 |
'name' => $type,
|
10932 |
'label' => __( 'Comment', 'pods' ),
|
10933 |
'storage' => 'meta',
|
|
|
10934 |
];
|
10935 |
} elseif ( 'media' === $params['name'] || 'attachment' === $params['name'] ) {
|
10936 |
// Detect media.
|
@@ -10942,6 +10955,7 @@ class PodsAPI {
|
|
10942 |
'name' => $type,
|
10943 |
'label' => __( 'Media', 'pods' ),
|
10944 |
'storage' => 'meta',
|
|
|
10945 |
];
|
10946 |
}
|
10947 |
|
@@ -10959,6 +10973,7 @@ class PodsAPI {
|
|
10959 |
'label' => $post_type->label,
|
10960 |
'description' => $post_type->description,
|
10961 |
'storage' => 'meta',
|
|
|
10962 |
];
|
10963 |
}
|
10964 |
}
|
@@ -10977,6 +10992,7 @@ class PodsAPI {
|
|
10977 |
'label' => $taxonomy->label,
|
10978 |
'description' => $taxonomy->description,
|
10979 |
'storage' => 'meta',
|
|
|
10980 |
];
|
10981 |
}
|
10982 |
}
|
1848 |
|
1849 |
$options_ignore = array(
|
1850 |
'_locale',
|
1851 |
+
'adhoc',
|
1852 |
'attributes',
|
1853 |
'dependency',
|
1854 |
'depends-on',
|
3308 |
|
3309 |
$options_ignore = [
|
3310 |
'_locale',
|
3311 |
+
'adhoc',
|
3312 |
'attributes',
|
3313 |
'dependency',
|
3314 |
'depends-on',
|
3784 |
|
3785 |
// If the old field doesn't exist, continue to add a new field
|
3786 |
if ( 'add' === $definition_mode ) {
|
3787 |
+
$test = pods_query( "ALTER TABLE `@wp_pods_{$params->pod}` ADD COLUMN {$definition}", false );
|
3788 |
+
|
3789 |
+
if ( false === $test ) {
|
3790 |
+
pods_query( "ALTER TABLE `@wp_pods_{$params->pod}` MODIFY {$definition}", __( 'Cannot create or update new field', 'pods' ) );
|
3791 |
+
}
|
3792 |
}
|
3793 |
|
3794 |
/**
|
4187 |
$options = get_object_vars( $params );
|
4188 |
|
4189 |
$options_ignore = [
|
4190 |
+
'adhoc',
|
4191 |
'method',
|
4192 |
'table_info',
|
4193 |
'attributes',
|
5330 |
pods_no_conflict_on( $pod['type'] );
|
5331 |
}
|
5332 |
|
|
|
|
|
5333 |
// Save relationship / file data
|
5334 |
if ( ! empty( $rel_fields ) ) {
|
5335 |
foreach ( $rel_fields as $type => $data ) {
|
5497 |
$values = array_slice( $values, 0, $related_limit );
|
5498 |
}
|
5499 |
|
5500 |
+
$related_data = pods_static_cache_get( $fields[ $field ]['name'] . '/' . $fields[ $field ]['id'], 'PodsField_Pick/related_data' ) ?: [];
|
5501 |
|
5502 |
// Get current values
|
5503 |
if ( 'pick' === $type && isset( $related_data[ 'current_ids_' . $params->id ] ) ) {
|
5534 |
// Unset data no longer needed
|
5535 |
if ( 'pick' === $type ) {
|
5536 |
foreach ( $data as $field => $values ) {
|
5537 |
+
$related_data = pods_static_cache_get( $fields[ $field ]['name'] . '/' . $fields[ $field ]['id'], 'PodsField_Pick/related_data' ) ?: [];
|
5538 |
|
5539 |
if ( ! empty( $related_data ) ) {
|
5540 |
if ( ! empty( $related_data['related_field'] ) ) {
|
5541 |
+
pods_static_cache_clear( $related_data['related_field']['name'] . '/' . $related_data['related_field']['id'], 'PodsField_Pick/related_data' );
|
5542 |
}
|
5543 |
|
5544 |
+
pods_static_cache_clear( $fields[ $field ]['name'] . '/' . $fields[ $field ]['id'], 'PodsField_Pick/related_data' );
|
5545 |
}
|
5546 |
}
|
5547 |
}
|
5649 |
* @return array List of changed fields (if $mode = 'get')
|
5650 |
*/
|
5651 |
public static function handle_changed_fields( $pod, $id, $mode = 'set' ) {
|
5652 |
+
$watch_changed_fields = (int) pods_get_setting( 'watch_changed_fields' );
|
5653 |
|
5654 |
+
// Only continue if changed fields are watched.
|
5655 |
+
if ( 0 === $watch_changed_fields ) {
|
5656 |
+
return [];
|
5657 |
+
}
|
5658 |
+
|
5659 |
+
$changed_pods_cache = pods_static_cache_get( 'changed_pods_cache', __CLASS__ ) ?: [];
|
5660 |
+
$old_fields_cache = pods_static_cache_get( 'old_fields_cache', __CLASS__ ) ?: [];
|
5661 |
+
$changed_fields_cache = pods_static_cache_get( 'changed_fields_cache', __CLASS__ ) ?: [];
|
5662 |
|
5663 |
$cache_key = $pod . '|' . $id;
|
5664 |
|
5672 |
}
|
5673 |
|
5674 |
if ( empty( $old_fields_cache[ $cache_key ] ) || 'reset' === $mode ) {
|
5675 |
+
$old_fields_cache[ $cache_key ] = [];
|
5676 |
|
5677 |
if ( ! empty( $id ) ) {
|
5678 |
if ( ! isset( $changed_pods_cache[ $pod ] ) ) {
|
5679 |
+
$pod_object = pods( $pod );
|
|
|
5680 |
|
5681 |
+
if ( ! $pod_object || ! $pod_object->is_defined() ) {
|
5682 |
+
return [];
|
5683 |
+
}
|
5684 |
|
5685 |
+
$changed_pods_cache[ $pod ] = $pod_object;
|
5686 |
+
}
|
5687 |
+
|
5688 |
+
if ( $changed_pods_cache[ $pod ] ) {
|
5689 |
+
if ( $changed_pods_cache[ $pod ]->fetch( $id ) ) {
|
5690 |
+
$old_fields_cache[ $cache_key ] = $changed_pods_cache[ $pod ]->export( $export_params );
|
5691 |
+
}
|
5692 |
}
|
5693 |
}
|
5694 |
}
|
5706 |
|
5707 |
if ( ! empty( $changed_pods_cache[ $pod ] ) ) {
|
5708 |
if ( $id != $changed_pods_cache[ $pod ]->id() ) {
|
5709 |
+
$found = $changed_pods_cache[ $pod ]->fetch( $id );
|
5710 |
+
|
5711 |
+
if ( ! $found ) {
|
5712 |
+
return [];
|
5713 |
+
}
|
5714 |
}
|
5715 |
|
5716 |
$new_fields = $changed_pods_cache[ $pod ]->export( $export_params );
|
5726 |
}
|
5727 |
}
|
5728 |
|
5729 |
+
pods_static_cache_set( 'changed_pods_cache', $changed_pods_cache, __CLASS__ );
|
5730 |
+
pods_static_cache_set( 'old_fields_cache', $old_fields_cache, __CLASS__ );
|
5731 |
+
pods_static_cache_set( 'changed_fields_cache', $changed_fields_cache, __CLASS__ );
|
5732 |
|
5733 |
return $changed_fields;
|
5734 |
|
5760 |
* @return array List of ID(s) that were setup for saving.
|
5761 |
*/
|
5762 |
public function save_relationships( $id, $related_ids, $pod, $field ) {
|
5763 |
+
$related_data = pods_static_cache_get( $field['name'] . '/' . $field['id'], 'PodsField_Pick/related_data' ) ?: [];
|
|
|
|
|
5764 |
|
5765 |
// Get current values
|
5766 |
if ( 'pick' === $field['type'] && isset( $related_data[ 'current_ids_' . $id ] ) ) {
|
5769 |
$current_ids = $this->lookup_related_items( $field['id'], $pod['id'], $id, $field, $pod );
|
5770 |
}
|
5771 |
|
|
|
|
|
5772 |
$cache_key = $pod['id'] . '|' . $field['id'];
|
5773 |
|
5774 |
// Delete relationship from cache.
|
5775 |
+
pods_static_cache_clear( $cache_key, __CLASS__ . '/related_item_cache' );
|
5776 |
|
5777 |
if ( ! is_array( $related_ids ) ) {
|
5778 |
$related_ids = implode( ',', $related_ids );
|
7602 |
}
|
7603 |
}
|
7604 |
|
|
|
|
|
7605 |
$cache_key = $related_pod['id'] . '|' . $related_field['id'];
|
7606 |
|
7607 |
// Delete relationship from cache.
|
7608 |
+
pods_static_cache_clear( $cache_key, __CLASS__ . '/related_item_cache' );
|
7609 |
|
7610 |
// @codingStandardsIgnoreLine
|
7611 |
$key = array_search( $id, $related_ids );
|
9066 |
|
9067 |
$idstring = implode( ',', $params->ids );
|
9068 |
|
|
|
|
|
9069 |
$cache_key = $params->pod_id . '|' . $params->field_id;
|
9070 |
|
9071 |
// Check cache first, no point in running the same query multiple times
|
9072 |
if ( $params->pod_id && $params->field_id ) {
|
9073 |
+
$cache_value = pods_static_cache_get( $cache_key, __CLASS__ . '/related_item_cache' ) ?: [];
|
9074 |
|
9075 |
if ( isset( $cache_value[ $idstring ] ) && is_array( $cache_value[ $idstring ] ) ) {
|
9076 |
return $cache_value[ $idstring ];
|
9279 |
|
9280 |
if ( 0 != $params->pod_id && 0 != $params->field_id && ! empty( $related_ids ) ) {
|
9281 |
// Only cache if $params->pod_id and $params->field_id were passed
|
9282 |
+
$cache_value = pods_static_cache_get( $cache_key, __CLASS__ . '/related_item_cache' ) ?: [];
|
9283 |
|
9284 |
$cache_value[ $idstring ] = $related_ids;
|
9285 |
|
9286 |
+
pods_static_cache_set( $cache_key, $cache_value, __CLASS__ . '/related_item_cache' );
|
9287 |
}
|
9288 |
|
9289 |
return $related_ids;
|
9688 |
|
9689 |
$_info = false;
|
9690 |
|
9691 |
+
$table_info_cache = pods_static_cache_get( $cache_key, __CLASS__ . '/table_info_cache' ) ?: [];
|
|
|
|
|
9692 |
|
9693 |
if ( $table_info_cache ) {
|
9694 |
// Prefer info from the object internal cache
|
10116 |
$info['type'] = $object_type;
|
10117 |
$info['object_name'] = $object;
|
10118 |
|
10119 |
+
pods_static_cache_set( $cache_key, $info, __CLASS__ . '/table_info_cache' );
|
10120 |
|
10121 |
if ( pods_api_cache() ) {
|
10122 |
if ( ! did_action( 'init' ) || doing_action( 'init' ) ) {
|
10504 |
pods_transient_clear( 'pods_pfat_auto_pods' );
|
10505 |
pods_transient_clear( 'pods_pfat_archive_test' );
|
10506 |
|
10507 |
+
pods_transient_clear( 'pods_blocks' );
|
10508 |
+
pods_transient_clear( 'pods_blocks_js' );
|
10509 |
+
|
10510 |
if ( is_array( $pod ) || $pod instanceof Pod ) {
|
10511 |
pods_transient_clear( 'pods_pod_' . $pod['name'] );
|
10512 |
pods_cache_clear( $pod['name'], 'pods-class' );
|
10519 |
pods_transient_clear( 'pods_wp_cpt_ct' );
|
10520 |
}
|
10521 |
|
10522 |
+
pods_static_cache_clear( true, __CLASS__ );
|
10523 |
+
pods_static_cache_clear( true, __CLASS__ . '/table_info_cache' );
|
10524 |
+
pods_static_cache_clear( true, __CLASS__ . '/related_item_cache' );
|
10525 |
+
pods_static_cache_clear( true, PodsInit::class . '/existing_content_types' );
|
10526 |
+
pods_static_cache_clear( true, PodsView::class );
|
10527 |
+
pods_static_cache_clear( true, PodsField_Pick::class . '/related_data' );
|
10528 |
+
pods_static_cache_clear( true, PodsField_Pick::class . '/field_data' );
|
10529 |
+
pods_static_cache_clear( true, 'pods_svg_icon/base64' );
|
10530 |
+
pods_static_cache_clear( true, 'pods_svg_icon/svg' );
|
|
|
|
|
10531 |
|
10532 |
pods_init()->refresh_existing_content_types_cache( true );
|
10533 |
|
10931 |
'name' => $type,
|
10932 |
'label' => __( 'User', 'pods' ),
|
10933 |
'storage' => 'meta',
|
10934 |
+
'adhoc' => true,
|
10935 |
];
|
10936 |
} elseif ( 'comment' === $params['name'] ) {
|
10937 |
// Detect comment.
|
10943 |
'name' => $type,
|
10944 |
'label' => __( 'Comment', 'pods' ),
|
10945 |
'storage' => 'meta',
|
10946 |
+
'adhoc' => true,
|
10947 |
];
|
10948 |
} elseif ( 'media' === $params['name'] || 'attachment' === $params['name'] ) {
|
10949 |
// Detect media.
|
10955 |
'name' => $type,
|
10956 |
'label' => __( 'Media', 'pods' ),
|
10957 |
'storage' => 'meta',
|
10958 |
+
'adhoc' => true,
|
10959 |
];
|
10960 |
}
|
10961 |
|
10973 |
'label' => $post_type->label,
|
10974 |
'description' => $post_type->description,
|
10975 |
'storage' => 'meta',
|
10976 |
+
'adhoc' => true,
|
10977 |
];
|
10978 |
}
|
10979 |
}
|
10992 |
'label' => $taxonomy->label,
|
10993 |
'description' => $taxonomy->description,
|
10994 |
'storage' => 'meta',
|
10995 |
+
'adhoc' => true,
|
10996 |
];
|
10997 |
}
|
10998 |
}
|
@@ -1454,28 +1454,27 @@ class PodsForm {
|
|
1454 |
$class_name = ucfirst( $field_type );
|
1455 |
$class_name = "PodsField_{$class_name}";
|
1456 |
|
1457 |
-
$content_dir = realpath( WP_CONTENT_DIR );
|
1458 |
-
$plugins_dir = realpath( WP_PLUGIN_DIR );
|
1459 |
-
$muplugins_dir = realpath( WPMU_PLUGIN_DIR );
|
1460 |
-
$abspath_dir = realpath( ABSPATH );
|
1461 |
-
$pods_dir = realpath( PODS_DIR );
|
1462 |
-
|
1463 |
if ( ! class_exists( $class_name ) ) {
|
1464 |
if ( isset( self::$field_types[ $field_type ] ) && ! empty( self::$field_types[ $field_type ]['file'] ) ) {
|
1465 |
$file = realpath( self::$field_types[ $field_type ]['file'] );
|
1466 |
}
|
1467 |
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
|
|
|
|
|
|
|
|
1472 |
|
1473 |
-
|
1474 |
-
$file = realpath( $file );
|
1475 |
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
|
|
|
|
1479 |
}
|
1480 |
}
|
1481 |
}
|
1454 |
$class_name = ucfirst( $field_type );
|
1455 |
$class_name = "PodsField_{$class_name}";
|
1456 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1457 |
if ( ! class_exists( $class_name ) ) {
|
1458 |
if ( isset( self::$field_types[ $field_type ] ) && ! empty( self::$field_types[ $field_type ]['file'] ) ) {
|
1459 |
$file = realpath( self::$field_types[ $field_type ]['file'] );
|
1460 |
}
|
1461 |
|
1462 |
+
/**
|
1463 |
+
* The field type include path.
|
1464 |
+
*
|
1465 |
+
* @since unknown
|
1466 |
+
*
|
1467 |
+
* @param string $file The file path to include for the field type.
|
1468 |
+
*/
|
1469 |
+
$file = apply_filters( 'pods_form_field_include', $file, $field_type );
|
1470 |
|
1471 |
+
$file = trim( $file );
|
|
|
1472 |
|
1473 |
+
if ( '' !== $file ) {
|
1474 |
+
$located = pods_validate_safe_path( $file, 'all' );
|
1475 |
+
|
1476 |
+
if ( $located ) {
|
1477 |
+
include_once $located;
|
1478 |
}
|
1479 |
}
|
1480 |
}
|
@@ -1034,12 +1034,22 @@ class PodsInit {
|
|
1034 |
|
1035 |
wp_localize_script( 'pods-dfv', 'podsDFVConfig', $config );
|
1036 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1037 |
// Page builders.
|
1038 |
if (
|
1039 |
// @todo Finish Elementor & Divi support.
|
1040 |
// doing_action( 'elementor/editor/before_enqueue_scripts' ) || // Elementor.
|
1041 |
// null !== pods_v( 'et_fb', 'get' ) // Divi.
|
1042 |
null !== pods_v( 'fl_builder', 'get' ) // Beaver Builder.
|
|
|
1043 |
) {
|
1044 |
wp_enqueue_script( 'pods-dfv' );
|
1045 |
wp_enqueue_style( 'pods-form' );
|
@@ -1213,17 +1223,19 @@ class PodsInit {
|
|
1213 |
$force = true;
|
1214 |
}
|
1215 |
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
|
1224 |
-
if (
|
1225 |
$existing_post_types_cached = [];
|
1226 |
|
|
|
|
|
1227 |
foreach ( $existing_post_types as $post_type ) {
|
1228 |
// Skip Pods types.
|
1229 |
if ( ! empty( $post_type->_provider ) && 'pods' === $post_type->_provider ) {
|
@@ -1233,14 +1245,14 @@ class PodsInit {
|
|
1233 |
$existing_post_types_cached[ $post_type->name ] = $post_type->name;
|
1234 |
}
|
1235 |
|
1236 |
-
|
1237 |
}
|
1238 |
|
1239 |
-
$existing_taxonomies_cached
|
1240 |
-
|
1241 |
-
if ( $force || empty( $existing_taxonomies_cached ) || ! is_array( $existing_taxonomies_cached ) ) {
|
1242 |
$existing_taxonomies_cached = [];
|
1243 |
|
|
|
|
|
1244 |
foreach ( $existing_taxonomies as $taxonomy ) {
|
1245 |
// Skip Pods types.
|
1246 |
if ( ! empty( $taxonomy->_provider ) && 'pods' === $taxonomy->_provider ) {
|
@@ -1250,7 +1262,7 @@ class PodsInit {
|
|
1250 |
$existing_taxonomies_cached[ $taxonomy->name ] = $taxonomy->name;
|
1251 |
}
|
1252 |
|
1253 |
-
|
1254 |
}
|
1255 |
|
1256 |
if ( 1 === (int) pods_v( 'pods_debug_register', 'get', 0 ) && pods_is_admin( array( 'pods' ) ) ) {
|
@@ -2340,8 +2352,14 @@ class PodsInit {
|
|
2340 |
}
|
2341 |
|
2342 |
// Setup DB tables
|
2343 |
-
$pods_version
|
2344 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
2345 |
|
2346 |
if ( empty( $pods_version ) ) {
|
2347 |
// Install Pods
|
1034 |
|
1035 |
wp_localize_script( 'pods-dfv', 'podsDFVConfig', $config );
|
1036 |
|
1037 |
+
/**
|
1038 |
+
* Allow filtering whether to load Pods DFV on the front of the site.
|
1039 |
+
*
|
1040 |
+
* @since 2.8.18
|
1041 |
+
*
|
1042 |
+
* @param bool $load_pods_dfv_on_front Whether to load Pods DFV on the front of the site.
|
1043 |
+
*/
|
1044 |
+
$load_pods_dfv_on_front = (bool) apply_filters( 'pods_init_register_assets_load_pods_dfv_on_front', false );
|
1045 |
+
|
1046 |
// Page builders.
|
1047 |
if (
|
1048 |
// @todo Finish Elementor & Divi support.
|
1049 |
// doing_action( 'elementor/editor/before_enqueue_scripts' ) || // Elementor.
|
1050 |
// null !== pods_v( 'et_fb', 'get' ) // Divi.
|
1051 |
null !== pods_v( 'fl_builder', 'get' ) // Beaver Builder.
|
1052 |
+
|| ( $load_pods_dfv_on_front && ! is_admin() )
|
1053 |
) {
|
1054 |
wp_enqueue_script( 'pods-dfv' );
|
1055 |
wp_enqueue_style( 'pods-form' );
|
1223 |
$force = true;
|
1224 |
}
|
1225 |
|
1226 |
+
if ( $force ) {
|
1227 |
+
$existing_post_types_cached = null;
|
1228 |
+
$existing_taxonomies_cached = null;
|
1229 |
+
} else {
|
1230 |
+
$existing_post_types_cached = pods_static_cache_get( 'post_type', __CLASS__ . '/existing_content_types' );
|
1231 |
+
$existing_taxonomies_cached = pods_static_cache_get( 'taxonomy', __CLASS__ . '/existing_content_types' );
|
1232 |
+
}
|
1233 |
|
1234 |
+
if ( empty( $existing_post_types_cached ) || ! is_array( $existing_post_types_cached ) ) {
|
1235 |
$existing_post_types_cached = [];
|
1236 |
|
1237 |
+
$existing_post_types = get_post_types( [], 'objects' );
|
1238 |
+
|
1239 |
foreach ( $existing_post_types as $post_type ) {
|
1240 |
// Skip Pods types.
|
1241 |
if ( ! empty( $post_type->_provider ) && 'pods' === $post_type->_provider ) {
|
1245 |
$existing_post_types_cached[ $post_type->name ] = $post_type->name;
|
1246 |
}
|
1247 |
|
1248 |
+
pods_static_cache_set( 'post_type', $existing_post_types_cached, __CLASS__ . '/existing_content_types' );
|
1249 |
}
|
1250 |
|
1251 |
+
if ( empty( $existing_taxonomies_cached ) || ! is_array( $existing_taxonomies_cached ) ) {
|
|
|
|
|
1252 |
$existing_taxonomies_cached = [];
|
1253 |
|
1254 |
+
$existing_taxonomies = get_taxonomies( [], 'objects' );
|
1255 |
+
|
1256 |
foreach ( $existing_taxonomies as $taxonomy ) {
|
1257 |
// Skip Pods types.
|
1258 |
if ( ! empty( $taxonomy->_provider ) && 'pods' === $taxonomy->_provider ) {
|
1262 |
$existing_taxonomies_cached[ $taxonomy->name ] = $taxonomy->name;
|
1263 |
}
|
1264 |
|
1265 |
+
pods_static_cache_set( 'taxonomy', $existing_taxonomies_cached, __CLASS__ . '/existing_content_types' );
|
1266 |
}
|
1267 |
|
1268 |
if ( 1 === (int) pods_v( 'pods_debug_register', 'get', 0 ) && pods_is_admin( array( 'pods' ) ) ) {
|
2352 |
}
|
2353 |
|
2354 |
// Setup DB tables
|
2355 |
+
$pods_version = get_option( 'pods_framework_version' );
|
2356 |
+
$pods_version_first = get_option( 'pods_framework_version_first' );
|
2357 |
+
$pods_version_last = get_option( 'pods_framework_version_last' );
|
2358 |
+
|
2359 |
+
if ( empty( $pods_version_first ) ) {
|
2360 |
+
delete_option( 'pods_framework_version_first' );
|
2361 |
+
add_option( 'pods_framework_version_first', PODS_VERSION );
|
2362 |
+
}
|
2363 |
|
2364 |
if ( empty( $pods_version ) ) {
|
2365 |
// Install Pods
|
@@ -2827,10 +2827,8 @@ class PodsMeta {
|
|
2827 |
$cached_is_key_covered = pods_cache_get( $type . '/' . $object_name, __CLASS__ . '/is_key_covered' );
|
2828 |
|
2829 |
if ( '404' !== $cached_is_key_covered ) {
|
2830 |
-
$static_cache = pods_container( Static_Cache::class );
|
2831 |
-
|
2832 |
// Check if object type/name/key is not covered.
|
2833 |
-
$cached_is_key_covered =
|
2834 |
}
|
2835 |
|
2836 |
if ( '404' === $cached_is_key_covered ) {
|
@@ -3640,6 +3638,20 @@ class PodsMeta {
|
|
3640 |
* @return array|bool|int|mixed|null|string|void
|
3641 |
*/
|
3642 |
public function get_meta( $object_type, $_null = null, $object_id = 0, $meta_key = '', $single = false ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3643 |
// Enforce boolean as it can be a string sometimes
|
3644 |
$single = filter_var( $single, FILTER_VALIDATE_BOOLEAN );
|
3645 |
|
@@ -3733,8 +3745,7 @@ class PodsMeta {
|
|
3733 |
}
|
3734 |
|
3735 |
if ( $meta_key ) {
|
3736 |
-
$
|
3737 |
-
$static_cache->set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
3738 |
}
|
3739 |
|
3740 |
if ( ! $no_conflict ) {
|
@@ -3879,6 +3890,13 @@ class PodsMeta {
|
|
3879 |
return $_null;
|
3880 |
}
|
3881 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3882 |
if ( in_array( $object_type, array( 'post', 'post_type', 'media' ) ) ) {
|
3883 |
$object_name = get_post_type( $object_id );
|
3884 |
} elseif ( 'taxonomy' == $object_type ) {
|
@@ -3932,8 +3950,7 @@ class PodsMeta {
|
|
3932 |
}
|
3933 |
|
3934 |
if ( $meta_key ) {
|
3935 |
-
$
|
3936 |
-
$static_cache->set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
3937 |
}
|
3938 |
|
3939 |
return $_null;
|
@@ -3994,6 +4011,13 @@ class PodsMeta {
|
|
3994 |
return $_null;
|
3995 |
}
|
3996 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3997 |
if ( in_array( $object_type, array( 'post', 'post_type', 'media' ) ) ) {
|
3998 |
$object_name = get_post_type( $object_id );
|
3999 |
} elseif ( 'taxonomy' == $object_type ) {
|
@@ -4047,8 +4071,7 @@ class PodsMeta {
|
|
4047 |
}
|
4048 |
|
4049 |
if ( $meta_key ) {
|
4050 |
-
$
|
4051 |
-
$static_cache->set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
4052 |
}
|
4053 |
|
4054 |
return $_null;
|
@@ -4108,6 +4131,13 @@ class PodsMeta {
|
|
4108 |
* @return bool|int|null
|
4109 |
*/
|
4110 |
public function update_meta_by_id( $object_type, $_null = null, $meta_id = 0, $meta_key = '', $meta_value = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4111 |
$meta_type = 'post_type' === $object_type ? 'post' : $object_type;
|
4112 |
|
4113 |
// Get the original meta record.
|
@@ -4141,6 +4171,13 @@ class PodsMeta {
|
|
4141 |
return $_null;
|
4142 |
}
|
4143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4144 |
if ( in_array( $object_type, array( 'post', 'post_type', 'media' ) ) ) {
|
4145 |
$object_name = get_post_type( $object_id );
|
4146 |
} elseif ( 'taxonomy' == $object_type ) {
|
@@ -4194,8 +4231,7 @@ class PodsMeta {
|
|
4194 |
}
|
4195 |
|
4196 |
if ( $meta_key ) {
|
4197 |
-
$
|
4198 |
-
$static_cache->set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
4199 |
}
|
4200 |
|
4201 |
return $_null;
|
@@ -4254,6 +4290,13 @@ class PodsMeta {
|
|
4254 |
* @return bool|int|null
|
4255 |
*/
|
4256 |
public function delete_meta_by_id( $object_type, $_null = null, $meta_id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4257 |
$meta_type = 'post_type' === $object_type ? 'post' : $object_type;
|
4258 |
|
4259 |
// Get the original meta record.
|
@@ -4324,11 +4367,8 @@ class PodsMeta {
|
|
4324 |
* @param string $taxonomy Taxonomy for the split term.
|
4325 |
*/
|
4326 |
public static function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
|
4327 |
-
|
4328 |
-
|
4329 |
$term_splitting = new Pods_Term_Splitting( $term_id, $new_term_id, $taxonomy );
|
4330 |
$term_splitting->split_shared_term();
|
4331 |
-
|
4332 |
}
|
4333 |
|
4334 |
/**
|
@@ -4337,7 +4377,6 @@ class PodsMeta {
|
|
4337 |
* @return bool
|
4338 |
*/
|
4339 |
public function delete_user( $id ) {
|
4340 |
-
|
4341 |
return $this->delete_object( 'user', $id );
|
4342 |
}
|
4343 |
|
@@ -4347,7 +4386,6 @@ class PodsMeta {
|
|
4347 |
* @return bool
|
4348 |
*/
|
4349 |
public function delete_comment( $id ) {
|
4350 |
-
|
4351 |
return $this->delete_object( 'comment', $id );
|
4352 |
}
|
4353 |
|
@@ -4369,7 +4407,6 @@ class PodsMeta {
|
|
4369 |
* @return bool
|
4370 |
*/
|
4371 |
public function delete_object( $type, $id, $name = null ) {
|
4372 |
-
|
4373 |
if ( empty( $name ) ) {
|
4374 |
$name = $type;
|
4375 |
}
|
2827 |
$cached_is_key_covered = pods_cache_get( $type . '/' . $object_name, __CLASS__ . '/is_key_covered' );
|
2828 |
|
2829 |
if ( '404' !== $cached_is_key_covered ) {
|
|
|
|
|
2830 |
// Check if object type/name/key is not covered.
|
2831 |
+
$cached_is_key_covered = pods_static_cache_get( $type . '/' . $object_name . '/' . $key, __CLASS__ . '/is_key_covered' );
|
2832 |
}
|
2833 |
|
2834 |
if ( '404' === $cached_is_key_covered ) {
|
3638 |
* @return array|bool|int|mixed|null|string|void
|
3639 |
*/
|
3640 |
public function get_meta( $object_type, $_null = null, $object_id = 0, $meta_key = '', $single = false ) {
|
3641 |
+
$metadata_integration = (int) pods_get_setting( 'metadata_integration' );
|
3642 |
+
|
3643 |
+
// Only continue if metadata is integrated with.
|
3644 |
+
if ( 0 === $metadata_integration ) {
|
3645 |
+
return $_null;
|
3646 |
+
}
|
3647 |
+
|
3648 |
+
$metadata_override_get = (int) pods_get_setting( 'metadata_override_get' );
|
3649 |
+
|
3650 |
+
// Only continue if metadata is overridden.
|
3651 |
+
if ( 0 === $metadata_override_get ) {
|
3652 |
+
return $_null;
|
3653 |
+
}
|
3654 |
+
|
3655 |
// Enforce boolean as it can be a string sometimes
|
3656 |
$single = filter_var( $single, FILTER_VALIDATE_BOOLEAN );
|
3657 |
|
3745 |
}
|
3746 |
|
3747 |
if ( $meta_key ) {
|
3748 |
+
pods_static_cache_set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
|
|
3749 |
}
|
3750 |
|
3751 |
if ( ! $no_conflict ) {
|
3890 |
return $_null;
|
3891 |
}
|
3892 |
|
3893 |
+
$metadata_integration = (int) pods_get_setting( 'metadata_integration' );
|
3894 |
+
|
3895 |
+
// Only continue if metadata is integrated with.
|
3896 |
+
if ( 0 === $metadata_integration ) {
|
3897 |
+
return $_null;
|
3898 |
+
}
|
3899 |
+
|
3900 |
if ( in_array( $object_type, array( 'post', 'post_type', 'media' ) ) ) {
|
3901 |
$object_name = get_post_type( $object_id );
|
3902 |
} elseif ( 'taxonomy' == $object_type ) {
|
3950 |
}
|
3951 |
|
3952 |
if ( $meta_key ) {
|
3953 |
+
pods_static_cache_set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
|
|
3954 |
}
|
3955 |
|
3956 |
return $_null;
|
4011 |
return $_null;
|
4012 |
}
|
4013 |
|
4014 |
+
$metadata_integration = (int) pods_get_setting( 'metadata_integration' );
|
4015 |
+
|
4016 |
+
// Only continue if metadata is integrated with.
|
4017 |
+
if ( 0 === $metadata_integration ) {
|
4018 |
+
return $_null;
|
4019 |
+
}
|
4020 |
+
|
4021 |
if ( in_array( $object_type, array( 'post', 'post_type', 'media' ) ) ) {
|
4022 |
$object_name = get_post_type( $object_id );
|
4023 |
} elseif ( 'taxonomy' == $object_type ) {
|
4071 |
}
|
4072 |
|
4073 |
if ( $meta_key ) {
|
4074 |
+
pods_static_cache_set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
|
|
4075 |
}
|
4076 |
|
4077 |
return $_null;
|
4131 |
* @return bool|int|null
|
4132 |
*/
|
4133 |
public function update_meta_by_id( $object_type, $_null = null, $meta_id = 0, $meta_key = '', $meta_value = '' ) {
|
4134 |
+
$metadata_integration = (int) pods_get_setting( 'metadata_integration' );
|
4135 |
+
|
4136 |
+
// Only continue if metadata is integrated with.
|
4137 |
+
if ( 0 === $metadata_integration ) {
|
4138 |
+
return $_null;
|
4139 |
+
}
|
4140 |
+
|
4141 |
$meta_type = 'post_type' === $object_type ? 'post' : $object_type;
|
4142 |
|
4143 |
// Get the original meta record.
|
4171 |
return $_null;
|
4172 |
}
|
4173 |
|
4174 |
+
$metadata_integration = (int) pods_get_setting( 'metadata_integration' );
|
4175 |
+
|
4176 |
+
// Only continue if metadata is integrated with.
|
4177 |
+
if ( 0 === $metadata_integration ) {
|
4178 |
+
return $_null;
|
4179 |
+
}
|
4180 |
+
|
4181 |
if ( in_array( $object_type, array( 'post', 'post_type', 'media' ) ) ) {
|
4182 |
$object_name = get_post_type( $object_id );
|
4183 |
} elseif ( 'taxonomy' == $object_type ) {
|
4231 |
}
|
4232 |
|
4233 |
if ( $meta_key ) {
|
4234 |
+
pods_static_cache_set( $object_type . '/' . $object_name . '/' . $meta_key, '404', __CLASS__ . '/is_key_covered' );
|
|
|
4235 |
}
|
4236 |
|
4237 |
return $_null;
|
4290 |
* @return bool|int|null
|
4291 |
*/
|
4292 |
public function delete_meta_by_id( $object_type, $_null = null, $meta_id = 0 ) {
|
4293 |
+
$metadata_integration = (int) pods_get_setting( 'metadata_integration' );
|
4294 |
+
|
4295 |
+
// Only continue if metadata is integrated with.
|
4296 |
+
if ( 0 === $metadata_integration ) {
|
4297 |
+
return $_null;
|
4298 |
+
}
|
4299 |
+
|
4300 |
$meta_type = 'post_type' === $object_type ? 'post' : $object_type;
|
4301 |
|
4302 |
// Get the original meta record.
|
4367 |
* @param string $taxonomy Taxonomy for the split term.
|
4368 |
*/
|
4369 |
public static function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
|
|
|
|
|
4370 |
$term_splitting = new Pods_Term_Splitting( $term_id, $new_term_id, $taxonomy );
|
4371 |
$term_splitting->split_shared_term();
|
|
|
4372 |
}
|
4373 |
|
4374 |
/**
|
4377 |
* @return bool
|
4378 |
*/
|
4379 |
public function delete_user( $id ) {
|
|
|
4380 |
return $this->delete_object( 'user', $id );
|
4381 |
}
|
4382 |
|
4386 |
* @return bool
|
4387 |
*/
|
4388 |
public function delete_comment( $id ) {
|
|
|
4389 |
return $this->delete_object( 'comment', $id );
|
4390 |
}
|
4391 |
|
4407 |
* @return bool
|
4408 |
*/
|
4409 |
public function delete_object( $type, $id, $name = null ) {
|
|
|
4410 |
if ( empty( $name ) ) {
|
4411 |
$name = $type;
|
4412 |
}
|
@@ -2259,14 +2259,14 @@ class PodsUI {
|
|
2259 |
return $callback;
|
2260 |
}
|
2261 |
|
2262 |
-
if (
|
2263 |
-
$value = $this->row[ $field ];
|
2264 |
-
} elseif ( false !== $this->pod && is_object( $this->pod ) && ( 'Pods' == get_class( $this->pod ) || 'Pod' == get_class( $this->pod ) ) ) {
|
2265 |
if ( 'Pod' == get_class( $this->pod ) ) {
|
2266 |
$value = $this->pod->get_field( $field );
|
2267 |
} else {
|
2268 |
$value = $this->pod->field( $field );
|
2269 |
}
|
|
|
|
|
2270 |
}
|
2271 |
|
2272 |
return $this->do_hook( 'get_field', $value, $field );
|
@@ -3977,9 +3977,7 @@ class PodsUI {
|
|
3977 |
continue;
|
3978 |
}
|
3979 |
|
3980 |
-
|
3981 |
-
$row[ $field ] = $this->get_field( $field );
|
3982 |
-
}
|
3983 |
|
3984 |
$row_value = $row[ $field ];
|
3985 |
|
2259 |
return $callback;
|
2260 |
}
|
2261 |
|
2262 |
+
if ( false !== $this->pod && is_object( $this->pod ) && ( 'Pods' == get_class( $this->pod ) || 'Pod' == get_class( $this->pod ) ) ) {
|
|
|
|
|
2263 |
if ( 'Pod' == get_class( $this->pod ) ) {
|
2264 |
$value = $this->pod->get_field( $field );
|
2265 |
} else {
|
2266 |
$value = $this->pod->field( $field );
|
2267 |
}
|
2268 |
+
} elseif ( isset( $this->row[ $field ] ) ) {
|
2269 |
+
$value = $this->row[ $field ];
|
2270 |
}
|
2271 |
|
2272 |
return $this->do_hook( 'get_field', $value, $field );
|
3977 |
continue;
|
3978 |
}
|
3979 |
|
3980 |
+
$row[ $field ] = $this->get_field( $field );
|
|
|
|
|
3981 |
|
3982 |
$row_value = $row[ $field ];
|
3983 |
|
@@ -202,71 +202,81 @@ class PodsView {
|
|
202 |
}
|
203 |
}
|
204 |
|
|
|
|
|
205 |
if ( apply_filters( 'pods_view_cache_alt_get', false, $cache_mode, $group_key . $key, $original_key, $group ) ) {
|
206 |
$value = apply_filters( 'pods_view_cache_alt_get_value', $value, $cache_mode, $group_key . $key, $original_key, $group );
|
207 |
-
} elseif (
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
-
|
|
|
217 |
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
|
223 |
-
|
|
|
|
|
224 |
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
$callback_value = call_user_func( $callback, $original_key, $group, $cache_mode );
|
229 |
|
230 |
-
|
231 |
-
$
|
232 |
}
|
233 |
-
|
234 |
-
$called = true;
|
235 |
}
|
236 |
-
}
|
237 |
-
} else {
|
238 |
-
$transient_option = '_pods_option_' . $key;
|
239 |
-
$transient_timeout = '_pods_option_timeout_' . $key;
|
240 |
-
|
241 |
-
$value = get_option( $transient_option );
|
242 |
-
$timeout = get_option( $transient_timeout );
|
243 |
|
244 |
-
if (
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
if ( null !== $callback_value && false !== $callback_value ) {
|
250 |
-
$value = $callback_value;
|
251 |
-
}
|
252 |
-
|
253 |
-
$called = true;
|
254 |
-
} else {
|
255 |
-
$value = false;
|
256 |
|
257 |
-
|
258 |
-
|
259 |
-
|
|
|
260 |
}
|
|
|
|
|
261 |
}//end if
|
262 |
-
|
263 |
-
if ( false !== $value ) {
|
264 |
-
$value = apply_filters( "transient_{$key}", $value );
|
265 |
-
}
|
266 |
-
} elseif ( 'static-cache' === $cache_mode && ! in_array( $cache_mode, $nocache ) ) {
|
267 |
-
$static_cache = pods_container( Static_Cache::class );
|
268 |
-
|
269 |
-
$value = $static_cache->get( $key, ( empty( $group ) ? 'pods_view' : $group ) );
|
270 |
} else {
|
271 |
$value = false;
|
272 |
}//end if
|
@@ -367,7 +377,9 @@ class PodsView {
|
|
367 |
} elseif ( 'static-cache' === $cache_mode ) {
|
368 |
$static_cache = pods_container( Static_Cache::class );
|
369 |
|
370 |
-
|
|
|
|
|
371 |
}//end if
|
372 |
|
373 |
do_action( "pods_view_set_{$cache_mode}", $original_key, $value, $expires, $group );
|
@@ -476,10 +488,12 @@ class PodsView {
|
|
476 |
} elseif ( 'static-cache' === $cache_mode ) {
|
477 |
$static_cache = pods_container( Static_Cache::class );
|
478 |
|
479 |
-
if (
|
480 |
-
|
481 |
-
|
482 |
-
|
|
|
|
|
483 |
}
|
484 |
}//end if
|
485 |
|
@@ -538,9 +552,8 @@ class PodsView {
|
|
538 |
* @return bool|mixed|string|void
|
539 |
*/
|
540 |
private static function locate_template( $_view ) {
|
541 |
-
|
542 |
if ( is_array( $_view ) ) {
|
543 |
-
$_views =
|
544 |
|
545 |
if ( isset( $_view[0] ) && false === strpos( $_view[0], '.php' ) ) {
|
546 |
$_view_count = count( $_view );
|
@@ -567,74 +580,24 @@ class PodsView {
|
|
567 |
return $_view;
|
568 |
}//end if
|
569 |
|
570 |
-
// Keep it safe
|
571 |
-
$_view = trim( str_replace( array( '../', '\\' ), array( '', '/' ), (string) $_view ) );
|
572 |
-
|
573 |
-
if ( empty( $_view ) ) {
|
574 |
-
return false;
|
575 |
-
}
|
576 |
-
|
577 |
-
$_real_view = realpath( $_view );
|
578 |
-
|
579 |
-
if ( empty( $_real_view ) ) {
|
580 |
-
$_real_view = $_view;
|
581 |
-
}
|
582 |
-
|
583 |
-
$located = false;
|
584 |
-
|
585 |
// Is the view's file somewhere within the plugin directory tree?
|
586 |
-
// Note: we
|
587 |
-
$
|
588 |
-
realpath( WP_PLUGIN_DIR ),
|
589 |
-
realpath( WPMU_PLUGIN_DIR ),
|
590 |
-
realpath( PODS_DIR ),
|
591 |
-
];
|
592 |
-
|
593 |
-
$path_checks = array_filter( $path_checks );
|
594 |
-
|
595 |
-
$path_match = false;
|
596 |
|
597 |
-
|
598 |
-
|
599 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
600 |
|
601 |
-
|
602 |
-
|
603 |
}
|
604 |
|
605 |
-
if ( $path_match ) {
|
606 |
-
if ( file_exists( $_view ) ) {
|
607 |
-
$located = $_view;
|
608 |
-
} else {
|
609 |
-
$located = apply_filters( 'pods_view_locate_template', $located, $_view );
|
610 |
-
}
|
611 |
-
} else {
|
612 |
-
// The view's file is outside the plugin directory
|
613 |
-
$_real_view = trim( $_real_view, '/' );
|
614 |
-
|
615 |
-
if ( empty( $_real_view ) ) {
|
616 |
-
return false;
|
617 |
-
}
|
618 |
-
|
619 |
-
// Allow views in the theme or child theme.
|
620 |
-
$path_checks = [
|
621 |
-
realpath( get_stylesheet_directory() . DIRECTORY_SEPARATOR . $_real_view ),
|
622 |
-
realpath( get_template_directory() . DIRECTORY_SEPARATOR . $_real_view ),
|
623 |
-
];
|
624 |
-
|
625 |
-
$path_checks = array_filter( $path_checks );
|
626 |
-
|
627 |
-
$path_match = false;
|
628 |
-
|
629 |
-
foreach ( $path_checks as $path_check ) {
|
630 |
-
if ( file_exists( $path_check ) ) {
|
631 |
-
$located = $path_check;
|
632 |
-
|
633 |
-
break;
|
634 |
-
}
|
635 |
-
}
|
636 |
-
}//end if
|
637 |
-
|
638 |
return $located;
|
639 |
|
640 |
}
|
202 |
}
|
203 |
}
|
204 |
|
205 |
+
$cache_enabled = ! in_array( $cache_mode, $nocache, true );
|
206 |
+
|
207 |
if ( apply_filters( 'pods_view_cache_alt_get', false, $cache_mode, $group_key . $key, $original_key, $group ) ) {
|
208 |
$value = apply_filters( 'pods_view_cache_alt_get_value', $value, $cache_mode, $group_key . $key, $original_key, $group );
|
209 |
+
} elseif ( $cache_enabled ) {
|
210 |
+
if ( 'transient' === $cache_mode ) {
|
211 |
+
$value = get_transient( $group_key . $key );
|
212 |
+
} elseif ( 'site-transient' === $cache_mode ) {
|
213 |
+
$value = get_site_transient( $group_key . $key );
|
214 |
+
} elseif ( 'cache' === $cache_mode && $object_cache ) {
|
215 |
+
$value = wp_cache_get( $key, ( empty( $group ) ? 'pods_view' : $group ) );
|
216 |
+
} elseif ( 'option-cache' === $cache_mode ) {
|
217 |
+
global $_wp_using_ext_object_cache;
|
218 |
+
|
219 |
+
$pre = apply_filters( "pre_transient_{$key}", false );
|
220 |
+
|
221 |
+
if ( false !== $pre ) {
|
222 |
+
$value = $pre;
|
223 |
+
} elseif ( $_wp_using_ext_object_cache ) {
|
224 |
+
$cache_found = false;
|
225 |
+
|
226 |
+
$value = wp_cache_get( $key, ( empty( $group ) ? 'pods_option_cache' : $group ), false, $cache_found );
|
227 |
+
|
228 |
+
if ( false === $value || ! $cache_found ) {
|
229 |
+
if ( is_callable( $callback ) ) {
|
230 |
+
// Callback function should do it's own set/update for cache
|
231 |
+
$callback_value = call_user_func( $callback, $original_key, $group, $cache_mode );
|
232 |
+
|
233 |
+
if ( null !== $callback_value && false !== $callback_value ) {
|
234 |
+
$value = $callback_value;
|
235 |
+
}
|
236 |
+
|
237 |
+
$called = true;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
} else {
|
241 |
+
$transient_option = '_pods_option_' . $key;
|
242 |
+
$transient_timeout = '_pods_option_timeout_' . $key;
|
243 |
|
244 |
+
$value = get_option( $transient_option );
|
245 |
+
$timeout = get_option( $transient_timeout );
|
246 |
|
247 |
+
if ( ! empty( $timeout ) && $timeout < time() ) {
|
248 |
+
if ( is_callable( $callback ) ) {
|
249 |
+
// Callback function should do it's own set/update for cache
|
250 |
+
$callback_value = call_user_func( $callback, $original_key, $group, $cache_mode );
|
251 |
|
252 |
+
if ( null !== $callback_value && false !== $callback_value ) {
|
253 |
+
$value = $callback_value;
|
254 |
+
}
|
255 |
|
256 |
+
$called = true;
|
257 |
+
} else {
|
258 |
+
$value = false;
|
|
|
259 |
|
260 |
+
delete_option( $transient_option );
|
261 |
+
delete_option( $transient_timeout );
|
262 |
}
|
|
|
|
|
263 |
}
|
264 |
+
}//end if
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
|
266 |
+
if ( false !== $value ) {
|
267 |
+
$value = apply_filters( "transient_{$key}", $value );
|
268 |
+
}
|
269 |
+
} elseif ( 'static-cache' === $cache_mode ) {
|
270 |
+
$static_cache = pods_container( Static_Cache::class );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
+
if ( $static_cache ) {
|
273 |
+
$value = $static_cache->get( $key, ( empty( $group ) ? 'pods_view' : $group ) );
|
274 |
+
} else {
|
275 |
+
$value = false;
|
276 |
}
|
277 |
+
} else {
|
278 |
+
$value = false;
|
279 |
}//end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
} else {
|
281 |
$value = false;
|
282 |
}//end if
|
377 |
} elseif ( 'static-cache' === $cache_mode ) {
|
378 |
$static_cache = pods_container( Static_Cache::class );
|
379 |
|
380 |
+
if ( $static_cache ) {
|
381 |
+
$static_cache->set( $key, $value, ( empty( $group ) ? __CLASS__ : $group ) );
|
382 |
+
}
|
383 |
}//end if
|
384 |
|
385 |
do_action( "pods_view_set_{$cache_mode}", $original_key, $value, $expires, $group );
|
488 |
} elseif ( 'static-cache' === $cache_mode ) {
|
489 |
$static_cache = pods_container( Static_Cache::class );
|
490 |
|
491 |
+
if ( $static_cache ) {
|
492 |
+
if ( true === $key ) {
|
493 |
+
$static_cache->flush( ( empty( $group ) ? 'pods_view' : $group ) );
|
494 |
+
} else {
|
495 |
+
$static_cache->delete( ( empty( $key ) ? 'pods_view' : $key ), ( empty( $group ) ? 'pods_view' : $group ) );
|
496 |
+
}
|
497 |
}
|
498 |
}//end if
|
499 |
|
552 |
* @return bool|mixed|string|void
|
553 |
*/
|
554 |
private static function locate_template( $_view ) {
|
|
|
555 |
if ( is_array( $_view ) ) {
|
556 |
+
$_views = [];
|
557 |
|
558 |
if ( isset( $_view[0] ) && false === strpos( $_view[0], '.php' ) ) {
|
559 |
$_view_count = count( $_view );
|
580 |
return $_view;
|
581 |
}//end if
|
582 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
// Is the view's file somewhere within the plugin directory tree?
|
584 |
+
// Note: we include PODS_DIR for the case of symlinks (see issue #2945).
|
585 |
+
$located = pods_validate_safe_path( $_view, [ 'plugins', 'pods', 'theme' ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
|
587 |
+
/**
|
588 |
+
* Allow filtering the validated view file path to use.
|
589 |
+
*
|
590 |
+
* @since unknown
|
591 |
+
*
|
592 |
+
* @param string|false $located The validated view file path to use, or false if it was not valid.
|
593 |
+
* @param string $_view The original view file path to use.
|
594 |
+
*/
|
595 |
+
$located = apply_filters( 'pods_view_locate_template', $located, $_view );
|
596 |
|
597 |
+
if ( ! $located ) {
|
598 |
+
return false;
|
599 |
}
|
600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
return $located;
|
602 |
|
603 |
}
|
@@ -1272,9 +1272,7 @@ class PodsField_DateTime extends PodsField {
|
|
1272 |
* @since 2.7.0
|
1273 |
*/
|
1274 |
public function enqueue_jquery_ui_i18n() {
|
1275 |
-
$
|
1276 |
-
|
1277 |
-
$done = (array) $static_cache->get( 'done', __METHOD__ );
|
1278 |
|
1279 |
$types = array();
|
1280 |
|
1272 |
* @since 2.7.0
|
1273 |
*/
|
1274 |
public function enqueue_jquery_ui_i18n() {
|
1275 |
+
$done = (array) pods_static_cache_get( 'done', __METHOD__ );
|
|
|
|
|
1276 |
|
1277 |
$types = array();
|
1278 |
|
@@ -189,7 +189,7 @@ class PodsField_File extends PodsField {
|
|
189 |
),
|
190 |
static::$type . '_allowed_extensions' => array(
|
191 |
'label' => __( 'Allowed File Extensions', 'pods' ),
|
192 |
-
'description' => __( 'Separate file extensions with a comma (ex. jpg,png,mp4,mov)', 'pods' ),
|
193 |
'depends-on' => array( static::$type . '_type' => 'other' ),
|
194 |
'default' => apply_filters( "pods_form_ui_field_{$type}_extensions_default", '' ),
|
195 |
'text_placeholder' => 'jpg,png,mp4,mov',
|
@@ -477,7 +477,7 @@ class PodsField_File extends PodsField {
|
|
477 |
|
478 |
$limit_types = trim( str_replace( $find, $replace, $limit_types ), ',' );
|
479 |
$limit_extensions = trim( str_replace( $find, $replace, $limit_extensions ), ',' );
|
480 |
-
$mime_types =
|
481 |
|
482 |
if ( ! in_array( $limit_file_type, array( 'images', 'video', 'audio', 'text', 'any' ), true ) ) {
|
483 |
$new_limit_types = array();
|
@@ -1144,7 +1144,7 @@ class PodsField_File extends PodsField {
|
|
1144 |
), ','
|
1145 |
);
|
1146 |
|
1147 |
-
$mime_types =
|
1148 |
|
1149 |
if ( in_array( $limit_file_type, array( 'images', 'audio', 'video' ), true ) ) {
|
1150 |
$new_limit_types = array();
|
189 |
),
|
190 |
static::$type . '_allowed_extensions' => array(
|
191 |
'label' => __( 'Allowed File Extensions', 'pods' ),
|
192 |
+
'description' => __( 'Separate file extensions with a comma (ex. jpg,png,mp4,mov). This only applies to the file uploader, media library selection will continue to fallback to the mime-type group like Images, Video, etc.', 'pods' ),
|
193 |
'depends-on' => array( static::$type . '_type' => 'other' ),
|
194 |
'default' => apply_filters( "pods_form_ui_field_{$type}_extensions_default", '' ),
|
195 |
'text_placeholder' => 'jpg,png,mp4,mov',
|
477 |
|
478 |
$limit_types = trim( str_replace( $find, $replace, $limit_types ), ',' );
|
479 |
$limit_extensions = trim( str_replace( $find, $replace, $limit_extensions ), ',' );
|
480 |
+
$mime_types = get_allowed_mime_types();
|
481 |
|
482 |
if ( ! in_array( $limit_file_type, array( 'images', 'video', 'audio', 'text', 'any' ), true ) ) {
|
483 |
$new_limit_types = array();
|
1144 |
), ','
|
1145 |
);
|
1146 |
|
1147 |
+
$mime_types = get_allowed_mime_types();
|
1148 |
|
1149 |
if ( in_array( $limit_file_type, array( 'images', 'audio', 'video' ), true ) ) {
|
1150 |
$new_limit_types = array();
|
@@ -289,9 +289,7 @@ class PodsField_Link extends PodsField_Website {
|
|
289 |
* Init the editor needed for WP Link modal to work
|
290 |
*/
|
291 |
public function validate_link_modal() {
|
292 |
-
$
|
293 |
-
|
294 |
-
$init = (boolean) $static_cache->get( 'init', __METHOD__ );
|
295 |
|
296 |
if ( $init ) {
|
297 |
return;
|
@@ -301,7 +299,7 @@ class PodsField_Link extends PodsField_Website {
|
|
301 |
add_action( 'shutdown', [ $this, 'add_link_modal' ] );
|
302 |
}
|
303 |
|
304 |
-
|
305 |
}
|
306 |
|
307 |
/**
|
289 |
* Init the editor needed for WP Link modal to work
|
290 |
*/
|
291 |
public function validate_link_modal() {
|
292 |
+
$init = (boolean) pods_static_cache_get( 'init', __METHOD__ );
|
|
|
|
|
293 |
|
294 |
if ( $init ) {
|
295 |
return;
|
299 |
add_action( 'shutdown', [ $this, 'add_link_modal' ] );
|
300 |
}
|
301 |
|
302 |
+
pods_static_cache_set( 'init', 1, __METHOD__ );
|
303 |
}
|
304 |
|
305 |
/**
|
@@ -176,7 +176,7 @@ class PodsField_Pick extends PodsField {
|
|
176 |
'dropdown' => __( 'Drop Down', 'pods' ),
|
177 |
'radio' => __( 'Radio Buttons', 'pods' ),
|
178 |
'autocomplete' => __( 'Autocomplete', 'pods' ),
|
179 |
-
'list' => __( 'List View (
|
180 |
] ),
|
181 |
'pick_show_select_text' => 0,
|
182 |
'dependency' => true,
|
@@ -187,7 +187,7 @@ class PodsField_Pick extends PodsField {
|
|
187 |
'depends-on' => [
|
188 |
static::$type . '_format_type' => 'multi',
|
189 |
],
|
190 |
-
'default' => '
|
191 |
'required' => true,
|
192 |
'type' => 'pick',
|
193 |
'data' => apply_filters( 'pods_form_ui_field_pick_format_multi_options', [
|
@@ -968,9 +968,7 @@ class PodsField_Pick extends PodsField {
|
|
968 |
if ( $this->can_ajax( $args->type, $field_options ) ) {
|
969 |
$ajax = true;
|
970 |
|
971 |
-
$
|
972 |
-
|
973 |
-
$field_data = $static_cache->get( $field_options['name'] . '/' . $field_options['id'], __CLASS__ . '/field_data' ) ?: [];
|
974 |
|
975 |
if ( isset( $field_data['autocomplete'] ) ) {
|
976 |
$ajax = (boolean) $field_data['autocomplete'];
|
@@ -1620,9 +1618,7 @@ class PodsField_Pick extends PodsField {
|
|
1620 |
|
1621 |
$options['id'] = (int) $options['id'];
|
1622 |
|
1623 |
-
$
|
1624 |
-
|
1625 |
-
$related_data = $static_cache->get( $options['name'] . '/' . $options['id'], __CLASS__ . '/related_data' ) ?: [];
|
1626 |
|
1627 |
if ( ! empty( $related_sister_id ) && ! in_array( $related_object, $simple_tableless_objects, true ) ) {
|
1628 |
$related_pod = self::$api->load_pod( [
|
@@ -1695,7 +1691,7 @@ class PodsField_Pick extends PodsField {
|
|
1695 |
$related_data['related_field'] = $related_field;
|
1696 |
$related_data['related_pick_limit'] = $related_pick_limit;
|
1697 |
|
1698 |
-
|
1699 |
|
1700 |
$pick_limit = (int) pods_v( static::$type . '_limit', $options, 0 );
|
1701 |
|
@@ -1705,7 +1701,7 @@ class PodsField_Pick extends PodsField {
|
|
1705 |
|
1706 |
$related_field['id'] = (int) $related_field['id'];
|
1707 |
|
1708 |
-
$bidirectional_related_data =
|
1709 |
|
1710 |
if ( empty( $bidirectional_related_data ) ) {
|
1711 |
$bidirectional_related_data = [
|
@@ -1714,7 +1710,7 @@ class PodsField_Pick extends PodsField {
|
|
1714 |
'related_pick_limit' => $pick_limit,
|
1715 |
];
|
1716 |
|
1717 |
-
|
1718 |
}
|
1719 |
}//end if
|
1720 |
|
@@ -1745,9 +1741,7 @@ class PodsField_Pick extends PodsField {
|
|
1745 |
|
1746 |
$value_ids = array_unique( array_filter( $value ) );
|
1747 |
|
1748 |
-
$
|
1749 |
-
|
1750 |
-
$related_data = $static_cache->get( $options['name'] . '/' . $options['id'], __CLASS__ . '/related_data' ) ?: [];
|
1751 |
|
1752 |
if ( ! empty( $related_data ) && isset( $related_data['current_ids_' . $id ], $related_data['remove_ids_' . $id ] ) ) {
|
1753 |
$related_pod = $related_data['related_pod'];
|
@@ -2370,9 +2364,7 @@ class PodsField_Pick extends PodsField {
|
|
2370 |
);
|
2371 |
|
2372 |
if ( 'data' === $context ) {
|
2373 |
-
$
|
2374 |
-
|
2375 |
-
$static_cache->set( $name . '/' . $options['id'], [
|
2376 |
'autocomplete' => false,
|
2377 |
], __CLASS__ . '/field_data' );
|
2378 |
}
|
@@ -2725,9 +2717,7 @@ class PodsField_Pick extends PodsField {
|
|
2725 |
}//end if
|
2726 |
|
2727 |
if ( 'data' === $context ) {
|
2728 |
-
$
|
2729 |
-
|
2730 |
-
$static_cache->set( $name . '/' . $options['id'], [
|
2731 |
'autocomplete' => $autocomplete,
|
2732 |
], __CLASS__ . '/field_data' );
|
2733 |
}
|
176 |
'dropdown' => __( 'Drop Down', 'pods' ),
|
177 |
'radio' => __( 'Radio Buttons', 'pods' ),
|
178 |
'autocomplete' => __( 'Autocomplete', 'pods' ),
|
179 |
+
'list' => __( 'List View (single value)', 'pods' ),
|
180 |
] ),
|
181 |
'pick_show_select_text' => 0,
|
182 |
'dependency' => true,
|
187 |
'depends-on' => [
|
188 |
static::$type . '_format_type' => 'multi',
|
189 |
],
|
190 |
+
'default' => 'list',
|
191 |
'required' => true,
|
192 |
'type' => 'pick',
|
193 |
'data' => apply_filters( 'pods_form_ui_field_pick_format_multi_options', [
|
968 |
if ( $this->can_ajax( $args->type, $field_options ) ) {
|
969 |
$ajax = true;
|
970 |
|
971 |
+
$field_data = pods_static_cache_get( $field_options['name'] . '/' . $field_options['id'], __CLASS__ . '/field_data' ) ?: [];
|
|
|
|
|
972 |
|
973 |
if ( isset( $field_data['autocomplete'] ) ) {
|
974 |
$ajax = (boolean) $field_data['autocomplete'];
|
1618 |
|
1619 |
$options['id'] = (int) $options['id'];
|
1620 |
|
1621 |
+
$related_data = pods_static_cache_get( $options['name'] . '/' . $options['id'], __CLASS__ . '/related_data' ) ?: [];
|
|
|
|
|
1622 |
|
1623 |
if ( ! empty( $related_sister_id ) && ! in_array( $related_object, $simple_tableless_objects, true ) ) {
|
1624 |
$related_pod = self::$api->load_pod( [
|
1691 |
$related_data['related_field'] = $related_field;
|
1692 |
$related_data['related_pick_limit'] = $related_pick_limit;
|
1693 |
|
1694 |
+
pods_static_cache_set( $options['name'] . '/' . $options['id'], $related_data, __CLASS__ . '/related_data' );
|
1695 |
|
1696 |
$pick_limit = (int) pods_v( static::$type . '_limit', $options, 0 );
|
1697 |
|
1701 |
|
1702 |
$related_field['id'] = (int) $related_field['id'];
|
1703 |
|
1704 |
+
$bidirectional_related_data = pods_static_cache_get( $related_field['name'] . '/' . $related_field['id'], __CLASS__ . '/related_data' ) ?: [];
|
1705 |
|
1706 |
if ( empty( $bidirectional_related_data ) ) {
|
1707 |
$bidirectional_related_data = [
|
1710 |
'related_pick_limit' => $pick_limit,
|
1711 |
];
|
1712 |
|
1713 |
+
pods_static_cache_set( $related_field['name'] . '/' . $related_field['id'], $bidirectional_related_data, __CLASS__ . '/related_data' );
|
1714 |
}
|
1715 |
}//end if
|
1716 |
|
1741 |
|
1742 |
$value_ids = array_unique( array_filter( $value ) );
|
1743 |
|
1744 |
+
$related_data = pods_static_cache_get( $options['name'] . '/' . $options['id'], __CLASS__ . '/related_data' ) ?: [];
|
|
|
|
|
1745 |
|
1746 |
if ( ! empty( $related_data ) && isset( $related_data['current_ids_' . $id ], $related_data['remove_ids_' . $id ] ) ) {
|
1747 |
$related_pod = $related_data['related_pod'];
|
2364 |
);
|
2365 |
|
2366 |
if ( 'data' === $context ) {
|
2367 |
+
pods_static_cache_set( $name . '/' . $options['id'], [
|
|
|
|
|
2368 |
'autocomplete' => false,
|
2369 |
], __CLASS__ . '/field_data' );
|
2370 |
}
|
2717 |
}//end if
|
2718 |
|
2719 |
if ( 'data' === $context ) {
|
2720 |
+
pods_static_cache_set( $name . '/' . $options['id'], [
|
|
|
|
|
2721 |
'autocomplete' => $autocomplete,
|
2722 |
], __CLASS__ . '/field_data' );
|
2723 |
}
|
@@ -296,6 +296,10 @@ class Pods_Templates_Frontier {
|
|
296 |
delete_post_meta( $post->ID, $prefix );
|
297 |
add_post_meta( $post->ID, $prefix, $_POST[ $prefix ] );
|
298 |
}
|
|
|
|
|
|
|
|
|
299 |
}
|
300 |
|
301 |
/**
|
296 |
delete_post_meta( $post->ID, $prefix );
|
297 |
add_post_meta( $post->ID, $prefix, $_POST[ $prefix ] );
|
298 |
}
|
299 |
+
|
300 |
+
// Clean the Pods Blocks cache so that any new/updated templates show up.
|
301 |
+
pods_transient_clear( 'pods_blocks' );
|
302 |
+
pods_transient_clear( 'pods_blocks_js' );
|
303 |
}
|
304 |
|
305 |
/**
|
@@ -2420,3 +2420,155 @@ function pods_replace_keys_to_values( $value, $replacements ) {
|
|
2420 |
$value
|
2421 |
);
|
2422 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2420 |
$value
|
2421 |
);
|
2422 |
}
|
2423 |
+
|
2424 |
+
/**
|
2425 |
+
* Validate that a file path is safe and within the expected path(s).
|
2426 |
+
*
|
2427 |
+
* @since 2.8.18
|
2428 |
+
*
|
2429 |
+
* @param string $path The file path.
|
2430 |
+
* @param null|array|string $paths_to_check The list of path types to check, defaults to just checking 'pods'.
|
2431 |
+
* Available: 'pods', 'plugins', 'content', 'theme', 'abspath',
|
2432 |
+
* or 'all' to check all supported paths.
|
2433 |
+
*
|
2434 |
+
* @return false|string False if the path was not allowed or did not exist, otherwise it returns the normalized path.
|
2435 |
+
*/
|
2436 |
+
function pods_validate_safe_path( $path, $paths_to_check = null ) {
|
2437 |
+
static $available_checks;
|
2438 |
+
|
2439 |
+
if ( null === $paths_to_check ) {
|
2440 |
+
$paths_to_check = [
|
2441 |
+
'pods',
|
2442 |
+
];
|
2443 |
+
}
|
2444 |
+
|
2445 |
+
if ( ! $available_checks ) {
|
2446 |
+
$available_checks = [
|
2447 |
+
'pods' => realpath( PODS_DIR ),
|
2448 |
+
'plugins' => [
|
2449 |
+
realpath( WP_PLUGIN_DIR ),
|
2450 |
+
realpath( WPMU_PLUGIN_DIR ),
|
2451 |
+
],
|
2452 |
+
'content' => realpath( WP_CONTENT_DIR ),
|
2453 |
+
'theme' => [
|
2454 |
+
realpath( get_stylesheet_directory() ),
|
2455 |
+
realpath( get_template_directory() ),
|
2456 |
+
],
|
2457 |
+
'abspath' => realpath( ABSPATH ),
|
2458 |
+
];
|
2459 |
+
|
2460 |
+
$available_checks['plugins'] = array_unique( array_filter( $available_checks['plugins'] ) );
|
2461 |
+
$available_checks['theme'] = array_unique( array_filter( $available_checks['theme'] ) );
|
2462 |
+
$available_checks = array_filter( $available_checks );
|
2463 |
+
}
|
2464 |
+
|
2465 |
+
if ( 'all' === $paths_to_check ) {
|
2466 |
+
$paths_to_check = array_keys( $available_checks );
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
if ( empty( $paths_to_check ) ) {
|
2470 |
+
return false;
|
2471 |
+
}
|
2472 |
+
|
2473 |
+
$path = trim( str_replace( '\\', '/', (string) $path ) );
|
2474 |
+
|
2475 |
+
$match_count = 1;
|
2476 |
+
|
2477 |
+
// Replace the ../ usage as many times as it may need to be replaced.
|
2478 |
+
while ( $match_count ) {
|
2479 |
+
$path = str_replace( '../', '', $path, $match_count );
|
2480 |
+
}
|
2481 |
+
|
2482 |
+
$path = realpath( $path );
|
2483 |
+
|
2484 |
+
if ( ! $path ) {
|
2485 |
+
return false;
|
2486 |
+
}
|
2487 |
+
|
2488 |
+
$path_match = false;
|
2489 |
+
|
2490 |
+
foreach ( $paths_to_check as $check_type ) {
|
2491 |
+
if ( ! isset( $available_checks[ $check_type ] ) ) {
|
2492 |
+
continue;
|
2493 |
+
}
|
2494 |
+
|
2495 |
+
$check_type_paths = (array) $available_checks[ $check_type ];
|
2496 |
+
|
2497 |
+
$is_theme = 'theme' === $check_type;
|
2498 |
+
|
2499 |
+
foreach ( $check_type_paths as $path_to_check ) {
|
2500 |
+
if ( 0 === strpos( $path, $path_to_check ) && file_exists( $path ) ) {
|
2501 |
+
// Check the path starts with the one we are checking for and that the file exists.
|
2502 |
+
$path_match = true;
|
2503 |
+
|
2504 |
+
break;
|
2505 |
+
} elseif ( $is_theme ) {
|
2506 |
+
// Check the theme directories.
|
2507 |
+
$path_localized_for_theme = trim( $path, PATH_SEPARATOR );
|
2508 |
+
|
2509 |
+
// Confirm the file exists.
|
2510 |
+
if ( file_exists( $path_to_check . $path_localized_for_theme ) ) {
|
2511 |
+
$path_match = true;
|
2512 |
+
|
2513 |
+
break;
|
2514 |
+
}
|
2515 |
+
}
|
2516 |
+
}
|
2517 |
+
}
|
2518 |
+
|
2519 |
+
if ( ! $path_match ) {
|
2520 |
+
return false;
|
2521 |
+
}
|
2522 |
+
|
2523 |
+
return $path;
|
2524 |
+
}
|
2525 |
+
|
2526 |
+
/**
|
2527 |
+
* Maybe sleep and help avoid hitting memory limit.
|
2528 |
+
*
|
2529 |
+
* @since 2.8.18
|
2530 |
+
*
|
2531 |
+
* @param int $sleep_time The amount of seconds to sleep (if sleep is needed).
|
2532 |
+
* @param int $after The number of triggers needed to run the logic.
|
2533 |
+
*/
|
2534 |
+
function pods_maybe_clean_memory( $sleep_time = 0, $after = 100 ) {
|
2535 |
+
static $counter = 0;
|
2536 |
+
|
2537 |
+
$counter++;
|
2538 |
+
|
2539 |
+
if ( $after === $counter ) {
|
2540 |
+
$counter = 0;
|
2541 |
+
|
2542 |
+
pods_clean_memory( $sleep_time );
|
2543 |
+
}
|
2544 |
+
}
|
2545 |
+
|
2546 |
+
/**
|
2547 |
+
* Sleep and help avoid hitting memory limit.
|
2548 |
+
*
|
2549 |
+
* @since 2.8.18
|
2550 |
+
*
|
2551 |
+
* @param int $sleep_time The amount of seconds to sleep (if sleep is needed).
|
2552 |
+
*/
|
2553 |
+
function pods_clean_memory( $sleep_time = 0 ) {
|
2554 |
+
if ( 0 < $sleep_time ) {
|
2555 |
+
sleep( $sleep_time );
|
2556 |
+
}
|
2557 |
+
|
2558 |
+
global $wpdb, $wp_object_cache;
|
2559 |
+
|
2560 |
+
$wpdb->queries = [];
|
2561 |
+
|
2562 |
+
if ( ! is_object( $wp_object_cache ) ) {
|
2563 |
+
return;
|
2564 |
+
}
|
2565 |
+
|
2566 |
+
$wp_object_cache->group_ops = [];
|
2567 |
+
$wp_object_cache->stats = [];
|
2568 |
+
$wp_object_cache->memcache_debug = [];
|
2569 |
+
$wp_object_cache->cache = [];
|
2570 |
+
|
2571 |
+
if ( is_callable( $wp_object_cache, '__remoteset' ) ) {
|
2572 |
+
call_user_func( [ $wp_object_cache, '__remoteset' ] ); // important
|
2573 |
+
}
|
2574 |
+
}
|
@@ -2404,6 +2404,56 @@ function pods_option_cache_clear( $key = true, $group = '' ) {
|
|
2404 |
return pods_view_clear( $key, 'option-cache', $group );
|
2405 |
}
|
2406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2407 |
/**
|
2408 |
* Scope variables and include a template like get_template_part that's child-theme aware
|
2409 |
*
|
@@ -2767,16 +2817,21 @@ function pods_meta_hook_list( $object_type = 'post', $object = null ) {
|
|
2767 |
return $hooks;
|
2768 |
}
|
2769 |
|
|
|
|
|
|
|
|
|
|
|
2770 |
// Filters = Usually get/update/delete meta functions
|
2771 |
// Actions = Usually insert/update/save/delete object functions
|
2772 |
if ( 'post' === $object_type || 'media' === $object_type || 'all' === $object_type ) {
|
2773 |
// Handle *_post_meta
|
2774 |
-
if ( apply_filters( 'pods_meta_handler', true, 'post' ) ) {
|
2775 |
if ( apply_filters( 'pods_meta_handler_get', true, 'post' ) ) {
|
2776 |
$hooks['filter']['get_post_metadata'] = [ 'get_post_metadata', [ PodsInit::$meta, 'get_post_meta' ], 10, 4 ];
|
2777 |
}
|
2778 |
|
2779 |
-
if ( !
|
2780 |
$hooks['filter']['add_post_metadata'] = [ 'add_post_metadata', [ PodsInit::$meta, 'add_post_meta' ], 10, 5 ];
|
2781 |
$hooks['filter']['update_post_metadata'] = [ 'update_post_metadata', [ PodsInit::$meta, 'update_post_meta' ], 10, 5 ];
|
2782 |
$hooks['filter']['update_post_metadata_by_id'] = [ 'update_post_metadata_by_id', [ PodsInit::$meta, 'update_post_meta_by_id' ], 10, 4 ];
|
@@ -2802,24 +2857,26 @@ function pods_meta_hook_list( $object_type = 'post', $object = null ) {
|
|
2802 |
// Handle delete from relationships.
|
2803 |
$hooks['action'][] = [ 'delete_post', [ PodsInit::$meta, 'delete_post' ], 10, 1 ];
|
2804 |
|
2805 |
-
|
2806 |
-
|
2807 |
-
'
|
2808 |
-
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
|
|
|
|
2812 |
}
|
2813 |
}
|
2814 |
|
2815 |
if ( 'taxonomy' === $object_type || 'all' === $object_type ) {
|
2816 |
// Handle *_term_meta
|
2817 |
-
if ( apply_filters( 'pods_meta_handler', true, 'term' ) ) {
|
2818 |
if ( apply_filters( 'pods_meta_handler_get', true, 'term' ) ) {
|
2819 |
$hooks['filter'][] = [ 'get_term_metadata', [ PodsInit::$meta, 'get_term_meta' ], 10, 4 ];
|
2820 |
}
|
2821 |
|
2822 |
-
if ( !
|
2823 |
$hooks['filter']['add_term_metadata'] = [ 'add_term_metadata', [ PodsInit::$meta, 'add_term_meta' ], 10, 5 ];
|
2824 |
$hooks['filter']['update_term_metadata'] = [ 'update_term_metadata', [ PodsInit::$meta, 'update_term_meta' ], 10, 5 ];
|
2825 |
$hooks['filter']['update_term_metadata_by_id'] = [ 'update_term_metadata_by_id', [ PodsInit::$meta, 'update_term_meta_by_id' ], 10, 4 ];
|
@@ -2841,13 +2898,15 @@ function pods_meta_hook_list( $object_type = 'post', $object = null ) {
|
|
2841 |
$hooks['action'][] = [ $object . '_add_form_fields', [ PodsInit::$meta, 'meta_taxonomy' ], 10, 1 ];
|
2842 |
}
|
2843 |
|
2844 |
-
|
2845 |
-
|
2846 |
-
'
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
|
|
|
|
2851 |
|
2852 |
/**
|
2853 |
* Fires after a previously shared taxonomy term is split into two separate terms.
|
@@ -2878,23 +2937,25 @@ function pods_meta_hook_list( $object_type = 'post', $object = null ) {
|
|
2878 |
// Handle delete.
|
2879 |
$hooks['action'][] = [ 'delete_attachment', [ PodsInit::$meta, 'delete_media' ], 10, 1 ];
|
2880 |
|
2881 |
-
|
2882 |
-
|
2883 |
-
'
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
|
|
|
|
2888 |
}
|
2889 |
|
2890 |
if ( 'user' === $object_type || 'all' === $object_type ) {
|
2891 |
// Handle *_user_meta.
|
2892 |
-
if ( apply_filters( 'pods_meta_handler', true, 'user' ) ) {
|
2893 |
if ( apply_filters( 'pods_meta_handler_get', true, 'user' ) ) {
|
2894 |
$hooks['filter'][] = [ 'get_user_metadata', [ PodsInit::$meta, 'get_user_meta' ], 10, 4 ];
|
2895 |
}
|
2896 |
|
2897 |
-
if ( !
|
2898 |
$hooks['filter']['add_user_metadata'] = [ 'add_user_metadata', [ PodsInit::$meta, 'add_user_meta' ], 10, 5 ];
|
2899 |
$hooks['filter']['update_user_metadata'] = [ 'update_user_metadata', [ PodsInit::$meta, 'update_user_meta' ], 10, 5 ];
|
2900 |
$hooks['filter']['update_user_metadata_by_id'] = [ 'update_user_metadata_by_id', [ PodsInit::$meta, 'update_user_meta_by_id' ], 10, 4 ];
|
@@ -2913,18 +2974,25 @@ function pods_meta_hook_list( $object_type = 'post', $object = null ) {
|
|
2913 |
// Handle saving from profile update.
|
2914 |
$hooks['action'][] = [ 'profile_update', [ PodsInit::$meta, 'save_user' ], 10, 2 ];
|
2915 |
|
2916 |
-
|
2917 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2918 |
}
|
2919 |
|
2920 |
if ( 'comment' === $object_type || 'all' === $object_type ) {
|
2921 |
-
if ( apply_filters( 'pods_meta_handler', true, 'comment' ) ) {
|
2922 |
// Handle *_comment_meta
|
2923 |
if ( apply_filters( 'pods_meta_handler_get', true, 'comment' ) ) {
|
2924 |
$hooks['filter'][] = [ 'get_comment_metadata', [ PodsInit::$meta, 'get_comment_meta' ], 10, 4 ];
|
2925 |
}
|
2926 |
|
2927 |
-
if ( !
|
2928 |
$hooks['filter']['add_comment_metadata'] = [ 'add_comment_metadata', [ PodsInit::$meta, 'add_comment_meta' ], 10, 5 ];
|
2929 |
$hooks['filter']['update_comment_metadata'] = [ 'update_comment_metadata', [ PodsInit::$meta, 'update_comment_meta' ], 10, 5 ];
|
2930 |
$hooks['filter']['update_comment_metadata_by_id'] = [ 'update_comment_metadata_by_id', [ PodsInit::$meta, 'update_comment_meta_by_id' ], 10, 4 ];
|
@@ -2948,8 +3016,15 @@ function pods_meta_hook_list( $object_type = 'post', $object = null ) {
|
|
2948 |
// Handle saving comment from admin.
|
2949 |
$hooks['action'][] = [ 'edit_comment', [ PodsInit::$meta, 'save_comment' ], 10, 1 ];
|
2950 |
|
2951 |
-
|
2952 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2953 |
}
|
2954 |
|
2955 |
if ( 'settings' === $object_type || 'all' === $object_type ) {
|
@@ -3757,9 +3832,7 @@ function pods_svg_icon( $icon_path, $default = 'dashicons-database', $mode = 'ba
|
|
3757 |
$icon_path = PODS_DIR . '/ui/images/icon-menu.svg';
|
3758 |
}
|
3759 |
|
3760 |
-
$
|
3761 |
-
|
3762 |
-
$icon = $static_cache->get( $icon_path, __FUNCTION__ . '/' . $mode );
|
3763 |
|
3764 |
// If the cached icon did not exist, use default.
|
3765 |
if ( '404-not-exists' === $icon ) {
|
@@ -3788,7 +3861,7 @@ function pods_svg_icon( $icon_path, $default = 'dashicons-database', $mode = 'ba
|
|
3788 |
}
|
3789 |
|
3790 |
if ( ! file_exists( $icon_path ) ) {
|
3791 |
-
|
3792 |
|
3793 |
return $default;
|
3794 |
}
|
@@ -3796,12 +3869,12 @@ function pods_svg_icon( $icon_path, $default = 'dashicons-database', $mode = 'ba
|
|
3796 |
$svg_data = file_get_contents( $icon_path );
|
3797 |
|
3798 |
if ( ! $svg_data ) {
|
3799 |
-
|
3800 |
|
3801 |
return $default;
|
3802 |
}
|
3803 |
|
3804 |
-
|
3805 |
|
3806 |
// If mode is SVG data, return that.
|
3807 |
if ( 'svg' === $mode ) {
|
2404 |
return pods_view_clear( $key, 'option-cache', $group );
|
2405 |
}
|
2406 |
|
2407 |
+
/**
|
2408 |
+
* Set a cached value in the Pods Static Cache.
|
2409 |
+
*
|
2410 |
+
* @see PodsView::set
|
2411 |
+
*
|
2412 |
+
* @param string $key Key for the cache.
|
2413 |
+
* @param mixed $value Value to add to the cache.
|
2414 |
+
* @param string $group (optional) Key for the group.
|
2415 |
+
*
|
2416 |
+
* @return bool|mixed|null|string|void
|
2417 |
+
*
|
2418 |
+
* @since 2.8.18
|
2419 |
+
*/
|
2420 |
+
function pods_static_cache_set( $key, $value, $group = '' ) {
|
2421 |
+
return pods_view_set( $key, $value, 0, 'static-cache', $group );
|
2422 |
+
}
|
2423 |
+
|
2424 |
+
/**
|
2425 |
+
* Get a cached value in the Pods Static Cache.
|
2426 |
+
*
|
2427 |
+
* @see PodsView::get
|
2428 |
+
*
|
2429 |
+
* @param string $key Key for the cache.
|
2430 |
+
* @param string $group (optional) Key for the group.
|
2431 |
+
* @param string $callback (optional) Callback function to run to set the value if not cached.
|
2432 |
+
*
|
2433 |
+
* @return bool
|
2434 |
+
*
|
2435 |
+
* @since 2.8.18
|
2436 |
+
*/
|
2437 |
+
function pods_static_cache_get( $key, $group = '', $callback = null ) {
|
2438 |
+
return pods_view_get( $key, 'static-cache', $group, $callback );
|
2439 |
+
}
|
2440 |
+
|
2441 |
+
/**
|
2442 |
+
* Clear a cached value in the Pods Static Cache.
|
2443 |
+
*
|
2444 |
+
* @see PodsView::clear
|
2445 |
+
*
|
2446 |
+
* @param string|bool $key Key for the cache.
|
2447 |
+
* @param string $group (optional) Key for the group.
|
2448 |
+
*
|
2449 |
+
* @return bool|mixed|null|void
|
2450 |
+
*
|
2451 |
+
* @since 2.8.18
|
2452 |
+
*/
|
2453 |
+
function pods_static_cache_clear( $key = true, $group = '' ) {
|
2454 |
+
return pods_view_clear( $key, 'static-cache', $group );
|
2455 |
+
}
|
2456 |
+
|
2457 |
/**
|
2458 |
* Scope variables and include a template like get_template_part that's child-theme aware
|
2459 |
*
|
2817 |
return $hooks;
|
2818 |
}
|
2819 |
|
2820 |
+
$metadata_integration = 1 === (int) pods_get_setting( 'metadata_integration' );
|
2821 |
+
$watch_changed_fields = 1 === (int) pods_get_setting( 'watch_changed_fields' );
|
2822 |
+
|
2823 |
+
$is_tableless = pods_tableless();
|
2824 |
+
|
2825 |
// Filters = Usually get/update/delete meta functions
|
2826 |
// Actions = Usually insert/update/save/delete object functions
|
2827 |
if ( 'post' === $object_type || 'media' === $object_type || 'all' === $object_type ) {
|
2828 |
// Handle *_post_meta
|
2829 |
+
if ( $metadata_integration && apply_filters( 'pods_meta_handler', true, 'post' ) ) {
|
2830 |
if ( apply_filters( 'pods_meta_handler_get', true, 'post' ) ) {
|
2831 |
$hooks['filter']['get_post_metadata'] = [ 'get_post_metadata', [ PodsInit::$meta, 'get_post_meta' ], 10, 4 ];
|
2832 |
}
|
2833 |
|
2834 |
+
if ( ! $is_tableless ) {
|
2835 |
$hooks['filter']['add_post_metadata'] = [ 'add_post_metadata', [ PodsInit::$meta, 'add_post_meta' ], 10, 5 ];
|
2836 |
$hooks['filter']['update_post_metadata'] = [ 'update_post_metadata', [ PodsInit::$meta, 'update_post_meta' ], 10, 5 ];
|
2837 |
$hooks['filter']['update_post_metadata_by_id'] = [ 'update_post_metadata_by_id', [ PodsInit::$meta, 'update_post_meta_by_id' ], 10, 4 ];
|
2857 |
// Handle delete from relationships.
|
2858 |
$hooks['action'][] = [ 'delete_post', [ PodsInit::$meta, 'delete_post' ], 10, 1 ];
|
2859 |
|
2860 |
+
if ( $watch_changed_fields ) {
|
2861 |
+
// Track changed fields.
|
2862 |
+
$hooks['action'][] = [
|
2863 |
+
'wp_insert_post_data',
|
2864 |
+
[ PodsInit::$meta, 'save_post_track_changed_fields' ],
|
2865 |
+
10,
|
2866 |
+
2,
|
2867 |
+
];
|
2868 |
+
}
|
2869 |
}
|
2870 |
}
|
2871 |
|
2872 |
if ( 'taxonomy' === $object_type || 'all' === $object_type ) {
|
2873 |
// Handle *_term_meta
|
2874 |
+
if ( $metadata_integration && apply_filters( 'pods_meta_handler', true, 'term' ) ) {
|
2875 |
if ( apply_filters( 'pods_meta_handler_get', true, 'term' ) ) {
|
2876 |
$hooks['filter'][] = [ 'get_term_metadata', [ PodsInit::$meta, 'get_term_meta' ], 10, 4 ];
|
2877 |
}
|
2878 |
|
2879 |
+
if ( ! $is_tableless ) {
|
2880 |
$hooks['filter']['add_term_metadata'] = [ 'add_term_metadata', [ PodsInit::$meta, 'add_term_meta' ], 10, 5 ];
|
2881 |
$hooks['filter']['update_term_metadata'] = [ 'update_term_metadata', [ PodsInit::$meta, 'update_term_meta' ], 10, 5 ];
|
2882 |
$hooks['filter']['update_term_metadata_by_id'] = [ 'update_term_metadata_by_id', [ PodsInit::$meta, 'update_term_meta_by_id' ], 10, 4 ];
|
2898 |
$hooks['action'][] = [ $object . '_add_form_fields', [ PodsInit::$meta, 'meta_taxonomy' ], 10, 1 ];
|
2899 |
}
|
2900 |
|
2901 |
+
if ( $watch_changed_fields ) {
|
2902 |
+
// Track changed fields.
|
2903 |
+
$hooks['action'][] = [
|
2904 |
+
'edit_terms',
|
2905 |
+
[ PodsInit::$meta, 'save_taxonomy_track_changed_fields' ],
|
2906 |
+
10,
|
2907 |
+
2,
|
2908 |
+
];
|
2909 |
+
}
|
2910 |
|
2911 |
/**
|
2912 |
* Fires after a previously shared taxonomy term is split into two separate terms.
|
2937 |
// Handle delete.
|
2938 |
$hooks['action'][] = [ 'delete_attachment', [ PodsInit::$meta, 'delete_media' ], 10, 1 ];
|
2939 |
|
2940 |
+
if ( $watch_changed_fields ) {
|
2941 |
+
// Track changed fields.
|
2942 |
+
$hooks['filter'][] = [
|
2943 |
+
'wp_insert_attachment_data',
|
2944 |
+
[ PodsInit::$meta, 'save_post_track_changed_fields' ],
|
2945 |
+
10,
|
2946 |
+
2,
|
2947 |
+
];
|
2948 |
+
}
|
2949 |
}
|
2950 |
|
2951 |
if ( 'user' === $object_type || 'all' === $object_type ) {
|
2952 |
// Handle *_user_meta.
|
2953 |
+
if ( $metadata_integration && apply_filters( 'pods_meta_handler', true, 'user' ) ) {
|
2954 |
if ( apply_filters( 'pods_meta_handler_get', true, 'user' ) ) {
|
2955 |
$hooks['filter'][] = [ 'get_user_metadata', [ PodsInit::$meta, 'get_user_meta' ], 10, 4 ];
|
2956 |
}
|
2957 |
|
2958 |
+
if ( ! $is_tableless ) {
|
2959 |
$hooks['filter']['add_user_metadata'] = [ 'add_user_metadata', [ PodsInit::$meta, 'add_user_meta' ], 10, 5 ];
|
2960 |
$hooks['filter']['update_user_metadata'] = [ 'update_user_metadata', [ PodsInit::$meta, 'update_user_meta' ], 10, 5 ];
|
2961 |
$hooks['filter']['update_user_metadata_by_id'] = [ 'update_user_metadata_by_id', [ PodsInit::$meta, 'update_user_meta_by_id' ], 10, 4 ];
|
2974 |
// Handle saving from profile update.
|
2975 |
$hooks['action'][] = [ 'profile_update', [ PodsInit::$meta, 'save_user' ], 10, 2 ];
|
2976 |
|
2977 |
+
if ( $watch_changed_fields ) {
|
2978 |
+
// Track changed fields.
|
2979 |
+
$hooks['filter'][] = [
|
2980 |
+
'pre_user_login',
|
2981 |
+
[ PodsInit::$meta, 'save_user_track_changed_fields' ],
|
2982 |
+
10,
|
2983 |
+
1,
|
2984 |
+
];
|
2985 |
+
}
|
2986 |
}
|
2987 |
|
2988 |
if ( 'comment' === $object_type || 'all' === $object_type ) {
|
2989 |
+
if ( $metadata_integration && apply_filters( 'pods_meta_handler', true, 'comment' ) ) {
|
2990 |
// Handle *_comment_meta
|
2991 |
if ( apply_filters( 'pods_meta_handler_get', true, 'comment' ) ) {
|
2992 |
$hooks['filter'][] = [ 'get_comment_metadata', [ PodsInit::$meta, 'get_comment_meta' ], 10, 4 ];
|
2993 |
}
|
2994 |
|
2995 |
+
if ( ! $is_tableless ) {
|
2996 |
$hooks['filter']['add_comment_metadata'] = [ 'add_comment_metadata', [ PodsInit::$meta, 'add_comment_meta' ], 10, 5 ];
|
2997 |
$hooks['filter']['update_comment_metadata'] = [ 'update_comment_metadata', [ PodsInit::$meta, 'update_comment_meta' ], 10, 5 ];
|
2998 |
$hooks['filter']['update_comment_metadata_by_id'] = [ 'update_comment_metadata_by_id', [ PodsInit::$meta, 'update_comment_meta_by_id' ], 10, 4 ];
|
3016 |
// Handle saving comment from admin.
|
3017 |
$hooks['action'][] = [ 'edit_comment', [ PodsInit::$meta, 'save_comment' ], 10, 1 ];
|
3018 |
|
3019 |
+
if ( $watch_changed_fields ) {
|
3020 |
+
// Track changed fields.
|
3021 |
+
$hooks['action'][] = [
|
3022 |
+
'wp_update_comment_data',
|
3023 |
+
[ PodsInit::$meta, 'save_comment_track_changed_fields' ],
|
3024 |
+
10,
|
3025 |
+
3,
|
3026 |
+
];
|
3027 |
+
}
|
3028 |
}
|
3029 |
|
3030 |
if ( 'settings' === $object_type || 'all' === $object_type ) {
|
3832 |
$icon_path = PODS_DIR . '/ui/images/icon-menu.svg';
|
3833 |
}
|
3834 |
|
3835 |
+
$icon = pods_static_cache_get( $icon_path, __FUNCTION__ . '/' . $mode );
|
|
|
|
|
3836 |
|
3837 |
// If the cached icon did not exist, use default.
|
3838 |
if ( '404-not-exists' === $icon ) {
|
3861 |
}
|
3862 |
|
3863 |
if ( ! file_exists( $icon_path ) ) {
|
3864 |
+
pods_static_cache_set( '404-not-exists', $icon, __FUNCTION__ . '/' . $mode );
|
3865 |
|
3866 |
return $default;
|
3867 |
}
|
3869 |
$svg_data = file_get_contents( $icon_path );
|
3870 |
|
3871 |
if ( ! $svg_data ) {
|
3872 |
+
pods_static_cache_set( '404-not-exists', $icon, __FUNCTION__ . '/' . $mode );
|
3873 |
|
3874 |
return $default;
|
3875 |
}
|
3876 |
|
3877 |
+
pods_static_cache_set( $icon_path, $icon, __FUNCTION__ . '/' . $mode );
|
3878 |
|
3879 |
// If mode is SVG data, return that.
|
3880 |
if ( 'svg' === $mode ) {
|
@@ -10,7 +10,7 @@
|
|
10 |
* Plugin Name: Pods - Custom Content Types and Fields
|
11 |
* Plugin URI: https://pods.io/
|
12 |
* Description: Pods is a framework for creating, managing, and deploying customized content types and fields
|
13 |
-
* Version: 2.8.
|
14 |
* Author: Pods Framework Team
|
15 |
* Author URI: https://pods.io/about/
|
16 |
* Text Domain: pods
|
@@ -43,7 +43,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
|
|
43 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
44 |
} else {
|
45 |
// Current version.
|
46 |
-
define( 'PODS_VERSION', '2.8.
|
47 |
|
48 |
// Current database version, this is the last version the database changed.
|
49 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
10 |
* Plugin Name: Pods - Custom Content Types and Fields
|
11 |
* Plugin URI: https://pods.io/
|
12 |
* Description: Pods is a framework for creating, managing, and deploying customized content types and fields
|
13 |
+
* Version: 2.8.18
|
14 |
* Author: Pods Framework Team
|
15 |
* Author URI: https://pods.io/about/
|
16 |
* Text Domain: pods
|
43 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
44 |
} else {
|
45 |
// Current version.
|
46 |
+
define( 'PODS_VERSION', '2.8.18' );
|
47 |
|
48 |
// Current database version, this is the last version the database changed.
|
49 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
@@ -5,7 +5,7 @@ Tags: pods, custom post types, custom taxonomies, content types, custom fields,
|
|
5 |
Requires at least: 5.5
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.8.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -156,16 +156,37 @@ Pods really wouldn't be where it is without all the contributions from our [dono
|
|
156 |
|
157 |
== Changelog ==
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
= 2.8.17 - May 11th, 2022 =
|
160 |
|
161 |
* Fixed: Attempting to catch potential issues where an issue is detected with loading the Tribe Common library by introducing a wrapper function `pods_container()` to be used before calling `tribe()`. (@sc0ttkclark)
|
162 |
|
163 |
= 2.8.16 - May 6th, 2022 =
|
164 |
|
165 |
-
* Added: More
|
166 |
* Fixed: Booleans when saving to the database now prepare as `%d` instead of the generic `%s`. (@sc0ttkclark)
|
167 |
* Fixed: Additional SV file escaping on exports to prevent formulas from evaluating in certain spreadsheet apps unexpectedly. (@sc0ttkclark)
|
168 |
-
* Fixed: The old Pods / Pods API CLI commands were
|
169 |
* Fixed: Improved the text / link for registering connections on Post Types and Taxonomies so they reference the correct object type. (@sc0ttkclark)
|
170 |
* Fixed: Multi-select fields were not saving properly in certain forms. #6498 #6216 (@zrothauser)
|
171 |
* Confirmed compatibility with WordPress 6.0.
|
@@ -173,7 +194,7 @@ Pods really wouldn't be where it is without all the contributions from our [dono
|
|
173 |
= 2.8.15 - April 16th, 2022 =
|
174 |
|
175 |
* Added: New `pods_callback` support in `Pods::find()` so that you can pass a callback function to use for `pods()` usage with relationships using the `output` as "pods". This allows for using shared instances across large data sets to reduce time. (@sc0ttkclark)
|
176 |
-
* Added: New property `$data->fetch_full` added to `PodsData` which can be used to turn off additional fetch requests when all
|
177 |
* Fixed: When using table-based fields and a non-simple relationship has a field in the table, it will still be expanded like a normal relationship field when requesting it by name with no traversal. (@sc0ttkclark)
|
178 |
* Fixed: Call `PodsField_Pick::simple_objects()` using the object instead of statically to prevent PHP notices. (@sc0ttkclark)
|
179 |
* Fixed: Adjust the `Pods\REST\V1\Endpoints\Base::check_permission()` method so that it references the correct `\Pods` object. (@sc0ttkclark)
|
5 |
Requires at least: 5.5
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.8.18
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
156 |
|
157 |
== Changelog ==
|
158 |
|
159 |
+
= 2.8.18 - June 10th, 2022 =
|
160 |
+
|
161 |
+
* Added: New helper functions `pods_clean_memory()` and `pods_maybe_clean_memory()` introduced to provide WP-CLI commands in Pods core and add-ons the ability to help reduce memory usage in long running processes. (@sc0ttkclark)
|
162 |
+
* Added: New function `Pods::is_defined()` determines whether a Pod was defined or if it was generated adhoc when calling a non-defined Pod. (@sc0ttkclark, @JoryHogeveen)
|
163 |
+
* Added: New function `Pods::is_valid()` replaces the logic in `Pods::valid()` to better follow the naming pattern used elsewhere in Pods. `Pods::valid()` is not deprecated yet. (@sc0ttkclark)
|
164 |
+
* Added: New functions `pods_static_cache_get()`, `pods_static_cache_set()`, and `pods_static_cache_clear()` abstract the static cache handling that would sometimes fail if the class was not available. (@sc0ttkclark)
|
165 |
+
* Added: New filter `pods_init_register_assets_load_pods_dfv_on_front` which allows you to force loading Pods DFV scripts on the front of the site when needed. Normally they will be included but some plugins/themes may need them enqueued sooner. (@sc0ttkclark)
|
166 |
+
* Tweak: Improved performance when using TranslatePress by optimizing how settings and blocks are handled to avoid extra `__()` translation calls. (@sc0ttkclark)
|
167 |
+
* Tweak: Improved performance with Block configurations. (@sc0ttkclark)
|
168 |
+
* Tweak: Improved performance with existing content type checks. (@sc0ttkclark)
|
169 |
+
* Tweak: Improved performance by offering a new setting to enable/disable tracking changed fields. (@sc0ttkclark)
|
170 |
+
* Tweak: Improved performance by offering a new setting to enable/disable metadata integration. (@sc0ttkclark)
|
171 |
+
* Tweak: Improved performance and third party plugin compatibility by offering a new setting to enable/disable metadata display overrides for Relationship/File fields. (@sc0ttkclark)
|
172 |
+
* Tweak: Improved file types help text on the File field to describe how limiting file types works more clearly. (@sc0ttkclark)
|
173 |
+
* Tweak: Default input type for Relationships multiple-select is now List View. (@sc0ttkclark)
|
174 |
+
* Fixed: File path checks are now more strict and consistent across all Pods Views loading. (@sybrew from The SEO Framework team, @sc0ttkclark)
|
175 |
+
* Fixed: SVG and other file types would not properly match up when certain plugins add additional mime types to be supported. (@sc0ttkclark)
|
176 |
+
* Fixed: Improved fallback handling for DB table schema errors when trying to add a column that may already exist in the table. (@sc0ttkclark)
|
177 |
+
* Fixed: Support labels for HTML field types in more form areas. (@sc0ttkclark)
|
178 |
+
* Fixed: `PodsUI` now filters all field values instead of circumventing that when it's pulled from the table row already. (@sc0ttkclark)
|
179 |
+
|
180 |
= 2.8.17 - May 11th, 2022 =
|
181 |
|
182 |
* Fixed: Attempting to catch potential issues where an issue is detected with loading the Tribe Common library by introducing a wrapper function `pods_container()` to be used before calling `tribe()`. (@sc0ttkclark)
|
183 |
|
184 |
= 2.8.16 - May 6th, 2022 =
|
185 |
|
186 |
+
* Added: More compatibility with Advanced Relationship Storage Add-On from Pods Pro by SKCDEV which allows for saving table-based relationship fields during the normal save process. (@sc0ttkclark)
|
187 |
* Fixed: Booleans when saving to the database now prepare as `%d` instead of the generic `%s`. (@sc0ttkclark)
|
188 |
* Fixed: Additional SV file escaping on exports to prevent formulas from evaluating in certain spreadsheet apps unexpectedly. (@sc0ttkclark)
|
189 |
+
* Fixed: The old Pods / Pods API CLI commands were unintentionally removed in Pods 2.8 and they have now been brought back as `wp pods-legacy` and `wp pods-legacy-api`. (@sc0ttkclark)
|
190 |
* Fixed: Improved the text / link for registering connections on Post Types and Taxonomies so they reference the correct object type. (@sc0ttkclark)
|
191 |
* Fixed: Multi-select fields were not saving properly in certain forms. #6498 #6216 (@zrothauser)
|
192 |
* Confirmed compatibility with WordPress 6.0.
|
194 |
= 2.8.15 - April 16th, 2022 =
|
195 |
|
196 |
* Added: New `pods_callback` support in `Pods::find()` so that you can pass a callback function to use for `pods()` usage with relationships using the `output` as "pods". This allows for using shared instances across large data sets to reduce time. (@sc0ttkclark)
|
197 |
+
* Added: New property `$data->fetch_full` added to `PodsData` which can be used to turn off additional fetch requests when all table data was already returned by the query with `t.*`. (@sc0ttkclark)
|
198 |
* Fixed: When using table-based fields and a non-simple relationship has a field in the table, it will still be expanded like a normal relationship field when requesting it by name with no traversal. (@sc0ttkclark)
|
199 |
* Fixed: Call `PodsField_Pick::simple_objects()` using the object instead of statically to prevent PHP notices. (@sc0ttkclark)
|
200 |
* Fixed: Adjust the `Pods\REST\V1\Endpoints\Base::check_permission()` method so that it references the correct `\Pods` object. (@sc0ttkclark)
|
@@ -64,7 +64,11 @@ class Settings {
|
|
64 |
// Register settings with Wisdom Tracker.
|
65 |
$settings['wisdom_registered_setting'] = 1;
|
66 |
|
67 |
-
$defaults
|
|
|
|
|
|
|
|
|
68 |
|
69 |
$layout_field_types = PodsForm::layout_field_types();
|
70 |
|
@@ -178,9 +182,61 @@ class Settings {
|
|
178 |
'pick_format' => 'single',
|
179 |
'pick_format_single' => 'radio',
|
180 |
'data' => [
|
181 |
-
'0'
|
182 |
-
'1'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
],
|
|
|
184 |
];
|
185 |
|
186 |
$session_auto_start = pods_session_auto_start( true );
|
@@ -210,7 +266,7 @@ class Settings {
|
|
210 |
'pick_format_single' => 'radio',
|
211 |
'data' => [
|
212 |
'auto' => __( 'Auto-detect sessions (enable on first anonymous submission)', 'pods' ),
|
213 |
-
'1' => __( 'Enable sessions', 'pods' ),
|
214 |
'0' => __( 'Disable sessions', 'pods' ),
|
215 |
],
|
216 |
];
|
64 |
// Register settings with Wisdom Tracker.
|
65 |
$settings['wisdom_registered_setting'] = 1;
|
66 |
|
67 |
+
static $defaults;
|
68 |
+
|
69 |
+
if ( null === $defaults ) {
|
70 |
+
$defaults = $this->get_setting_fields();
|
71 |
+
}
|
72 |
|
73 |
$layout_field_types = PodsForm::layout_field_types();
|
74 |
|
182 |
'pick_format' => 'single',
|
183 |
'pick_format_single' => 'radio',
|
184 |
'data' => [
|
185 |
+
'0' => __( 'Enable creating custom fields with Pods', 'pods' ),
|
186 |
+
'1' => __( 'Disable creating custom fields with Pods (for when using Pods only for content types)', 'pods' ),
|
187 |
+
],
|
188 |
+
];
|
189 |
+
|
190 |
+
$fields['performance'] = [
|
191 |
+
'label' => __( 'Performance', 'pods' ),
|
192 |
+
'type' => 'heading',
|
193 |
+
];
|
194 |
+
|
195 |
+
$first_pods_version = get_option( 'pods_framework_version_first' );
|
196 |
+
$first_pods_version = '' === $first_pods_version ? PODS_VERSION : $first_pods_version;
|
197 |
+
|
198 |
+
$fields['watch_changed_fields'] = [
|
199 |
+
'name' => 'watch_changed_fields',
|
200 |
+
'label' => __( 'Watch changed fields for use in hooks', 'pods' ),
|
201 |
+
'help' => __( 'By default, Pods does not watch changed fields when a post, term, user, or other Pods items are saved. Enabling this will allow you to use PHP hooks to reference the previous values of those fields after the save has happened.', 'pods' ),
|
202 |
+
'type' => 'pick',
|
203 |
+
'default' => version_compare( $first_pods_version, '2.8.18', '<=' ) ? '1' : '0',
|
204 |
+
'pick_format' => 'single',
|
205 |
+
'pick_format_single' => 'radio',
|
206 |
+
'data' => [
|
207 |
+
'1' => __( 'Enable watching changed fields (may reduce performance with large processes)', 'pods' ),
|
208 |
+
'0' => __( 'Disable watching changed fields', 'pods' ),
|
209 |
+
],
|
210 |
+
];
|
211 |
+
|
212 |
+
$fields['metadata_integration'] = [
|
213 |
+
'name' => 'metadata_integration',
|
214 |
+
'label' => __( 'Watch WP Metadata calls', 'pods' ),
|
215 |
+
'help' => __( 'By default, Pods will watch Metadata calls and send any values to table-based fields as well as index relationship IDs when they are saved. You can disable this if you do not use table-based Pods and you only want to query meta-based Pods or settings.', 'pods' ),
|
216 |
+
'type' => 'pick',
|
217 |
+
'default' => '1',
|
218 |
+
'pick_format' => 'single',
|
219 |
+
'pick_format_single' => 'radio',
|
220 |
+
'data' => [
|
221 |
+
'1' => __( 'Enable watching WP Metadata calls (may reduce performance with large processes)', 'pods' ),
|
222 |
+
'0' => __( 'Disable watching WP Metadata calls', 'pods' ),
|
223 |
+
],
|
224 |
+
'dependency' => true,
|
225 |
+
];
|
226 |
+
|
227 |
+
$fields['metadata_override_get'] = [
|
228 |
+
'name' => 'metadata_override_get',
|
229 |
+
'label' => __( 'Override WP Metadata values', 'pods' ),
|
230 |
+
'help' => __( 'By default, Pods will override Metadata values when calling functions like get_post_meta() so that it can provide more Relationship / File field context.', 'pods' ),
|
231 |
+
'type' => 'pick',
|
232 |
+
'default' => version_compare( $first_pods_version, '2.8.18', '<=' ) ? '1' : '0',
|
233 |
+
'pick_format' => 'single',
|
234 |
+
'pick_format_single' => 'radio',
|
235 |
+
'data' => [
|
236 |
+
'1' => __( 'Enable overriding WP Metadata values (may conflict with certain plugins and decrease performance with large processes)', 'pods' ),
|
237 |
+
'0' => __( 'Disable overriding WP Metadata values', 'pods' ),
|
238 |
],
|
239 |
+
'depends-on' => [ 'pods_field_metadata_integration' => '1' ],
|
240 |
];
|
241 |
|
242 |
$session_auto_start = pods_session_auto_start( true );
|
266 |
'pick_format_single' => 'radio',
|
267 |
'data' => [
|
268 |
'auto' => __( 'Auto-detect sessions (enable on first anonymous submission)', 'pods' ),
|
269 |
+
'1' => __( 'Enable sessions (may decrease performance)', 'pods' ),
|
270 |
'0' => __( 'Disable sessions', 'pods' ),
|
271 |
],
|
272 |
];
|
@@ -109,6 +109,12 @@ class API {
|
|
109 |
return $blocks;
|
110 |
}
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
$this->setup_core_blocks();
|
113 |
|
114 |
$api = pods_api();
|
@@ -127,6 +133,8 @@ class API {
|
|
127 |
return $block->get_block_args();
|
128 |
}, $blocks );
|
129 |
|
|
|
|
|
130 |
return $blocks;
|
131 |
}
|
132 |
|
@@ -144,6 +152,12 @@ class API {
|
|
144 |
return $js_blocks;
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
$blocks = $this->get_blocks();
|
148 |
|
149 |
foreach ( $blocks as $block_key => $block ) {
|
@@ -174,6 +188,8 @@ class API {
|
|
174 |
$js_blocks[ $block_key ] = $js_block;
|
175 |
}
|
176 |
|
|
|
|
|
177 |
return $js_blocks;
|
178 |
}
|
179 |
|
109 |
return $blocks;
|
110 |
}
|
111 |
|
112 |
+
$cached = pods_transient_get( 'pods_blocks' );
|
113 |
+
|
114 |
+
if ( is_array( $cached ) ) {
|
115 |
+
return $cached;
|
116 |
+
}
|
117 |
+
|
118 |
$this->setup_core_blocks();
|
119 |
|
120 |
$api = pods_api();
|
133 |
return $block->get_block_args();
|
134 |
}, $blocks );
|
135 |
|
136 |
+
pods_transient_set( 'pods_blocks', $blocks, DAY_IN_SECONDS * 7 );
|
137 |
+
|
138 |
return $blocks;
|
139 |
}
|
140 |
|
152 |
return $js_blocks;
|
153 |
}
|
154 |
|
155 |
+
$cached = pods_transient_get( 'pods_blocks_js' );
|
156 |
+
|
157 |
+
if ( is_array( $cached ) ) {
|
158 |
+
return $cached;
|
159 |
+
}
|
160 |
+
|
161 |
$blocks = $this->get_blocks();
|
162 |
|
163 |
foreach ( $blocks as $block_key => $block ) {
|
188 |
$js_blocks[ $block_key ] = $js_block;
|
189 |
}
|
190 |
|
191 |
+
pods_transient_set( 'pods_blocks_js', $js_blocks, DAY_IN_SECONDS * 7 );
|
192 |
+
|
193 |
return $js_blocks;
|
194 |
}
|
195 |
|
@@ -5,7 +5,7 @@ namespace Pods\Blocks\Types;
|
|
5 |
use WP_Block;
|
6 |
|
7 |
/**
|
8 |
-
*
|
9 |
*
|
10 |
* @since 2.8.0
|
11 |
*/
|
5 |
use WP_Block;
|
6 |
|
7 |
/**
|
8 |
+
* Item List block functionality class.
|
9 |
*
|
10 |
* @since 2.8.0
|
11 |
*/
|
@@ -5,7 +5,7 @@ namespace Pods\Blocks\Types;
|
|
5 |
use WP_Block;
|
6 |
|
7 |
/**
|
8 |
-
*
|
9 |
*
|
10 |
* @since 2.8.0
|
11 |
*/
|
5 |
use WP_Block;
|
6 |
|
7 |
/**
|
8 |
+
* Item Single block functionality class.
|
9 |
*
|
10 |
* @since 2.8.0
|
11 |
*/
|
@@ -18,7 +18,7 @@
|
|
18 |
<?php echo esc_html( $field['label'] ); ?>
|
19 |
</<?php echo esc_html( $heading_tag ); ?>>
|
20 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
21 |
-
<?php elseif ( 'html' === $field['type'] ) : ?>
|
22 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
23 |
<?php else : ?>
|
24 |
<?php
|
18 |
<?php echo esc_html( $field['label'] ); ?>
|
19 |
</<?php echo esc_html( $heading_tag ); ?>>
|
20 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
21 |
+
<?php elseif ( 'html' === $field['type'] && 1 === (int) $field['html_no_label'] ) : ?>
|
22 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
23 |
<?php else : ?>
|
24 |
<?php
|
@@ -174,13 +174,11 @@ if ( 0 < $pod->id() ) {
|
|
174 |
}
|
175 |
}
|
176 |
|
177 |
-
$
|
178 |
-
|
179 |
-
$counter = (int) $static_cache->get( $pod->pod . '-counter', 'pods-forms' );
|
180 |
|
181 |
$counter ++;
|
182 |
|
183 |
-
|
184 |
?>
|
185 |
|
186 |
<form action="" method="post"
|
174 |
}
|
175 |
}
|
176 |
|
177 |
+
$counter = (int) pods_static_cache_get( $pod->pod . '-counter', 'pods-forms' );
|
|
|
|
|
178 |
|
179 |
$counter ++;
|
180 |
|
181 |
+
pods_static_cache_set( $pod->pod . '-counter', $counter, 'pods-forms' );
|
182 |
?>
|
183 |
|
184 |
<form action="" method="post"
|
@@ -18,7 +18,7 @@
|
|
18 |
<?php echo esc_html( $field['label'] ); ?>
|
19 |
</<?php echo esc_html( $heading_tag ); ?>>
|
20 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
21 |
-
<?php elseif ( 'html' === $field['type'] ) : ?>
|
22 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
23 |
<?php else : ?>
|
24 |
<div class="pods-field-label">
|
18 |
<?php echo esc_html( $field['label'] ); ?>
|
19 |
</<?php echo esc_html( $heading_tag ); ?>>
|
20 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
21 |
+
<?php elseif ( 'html' === $field['type'] && 1 === (int) $field['html_no_label'] ) : ?>
|
22 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
23 |
<?php else : ?>
|
24 |
<div class="pods-field-label">
|
@@ -17,7 +17,7 @@
|
|
17 |
<?php echo esc_html( $field['label'] ); ?>
|
18 |
</<?php echo esc_html( $heading_tag ); ?>>
|
19 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
20 |
-
<?php elseif ( 'html' === $field['type'] ) : ?>
|
21 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
22 |
<?php else : ?>
|
23 |
<p<?php if ( ! empty( $row_classes ) ) : ?>
|
17 |
<?php echo esc_html( $field['label'] ); ?>
|
18 |
</<?php echo esc_html( $heading_tag ); ?>>
|
19 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
20 |
+
<?php elseif ( 'html' === $field['type'] && 1 === (int) $field['html_no_label'] ) : ?>
|
21 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
22 |
<?php else : ?>
|
23 |
<p<?php if ( ! empty( $row_classes ) ) : ?>
|
@@ -21,7 +21,7 @@
|
|
21 |
</<?php echo esc_html( $heading_tag ); ?>>
|
22 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
23 |
</td>
|
24 |
-
<?php elseif ( 'html' === $field['type'] ) : ?>
|
25 |
<td colspan="2">
|
26 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
27 |
</td>
|
21 |
</<?php echo esc_html( $heading_tag ); ?>>
|
22 |
<?php echo PodsForm::comment( $field_prefix . $field['name'], pods_v( 'description', $field ), $field ); ?>
|
23 |
</td>
|
24 |
+
<?php elseif ( 'html' === $field['type'] && 1 === (int) $field['html_no_label'] ) : ?>
|
25 |
<td colspan="2">
|
26 |
<?php echo PodsForm::field( $field_prefix . $field['name'], $value, $field['type'], $field, $pod, $id ); ?>
|
27 |
</td>
|