Pods – Custom Content Types and Fields - Version 2.7.16.1

Version Description

  • November 13th 2019 =

  • Fixed: Reverted changes in #5289 to auto templates that introduced breaking changes. We will revisit this in a future maintenance release. #5531

Download this release

Release Info

Developer keraweb
Plugin Icon 128x128 Pods – Custom Content Types and Fields
Version 2.7.16.1
Comparing to
See all releases

Code changes from version 2.7.15 to 2.7.16.1

classes/Pods.php CHANGED
@@ -1843,6 +1843,9 @@ class Pods implements Iterator {
1843
 
1844
  if ( $last_options ) {
1845
  $last_field_data = $last_options;
 
 
 
1846
  }
1847
 
1848
  break;
@@ -1870,7 +1873,6 @@ class Pods implements Iterator {
1870
  $field_data = $last_field_data;
1871
  }
1872
 
1873
- // @todo Expand this into traversed fields too.
1874
  if ( ! empty( $field_data ) && ( $params->display || ! $params->raw ) && ! $params->in_form && ! $params->raw_display ) {
1875
  if ( $params->display || ( ( $params->get_meta || $params->deprecated ) && ! in_array( $field_data['type'], $tableless_field_types, true ) ) ) {
1876
  $field_data['options'] = pods_v( 'options', $field_data, array(), true );
1843
 
1844
  if ( $last_options ) {
1845
  $last_field_data = $last_options;
1846
+ } elseif ( isset( $related_obj, $related_obj->fields, $related_obj->fields[ $field ] ) ) {
1847
+ // Save related field data for later to be used for display formatting
1848
+ $last_field_data = $related_obj->fields[ $field ];
1849
  }
1850
 
1851
  break;
1873
  $field_data = $last_field_data;
1874
  }
1875
 
 
1876
  if ( ! empty( $field_data ) && ( $params->display || ! $params->raw ) && ! $params->in_form && ! $params->raw_display ) {
1877
  if ( $params->display || ( ( $params->get_meta || $params->deprecated ) && ! in_array( $field_data['type'], $tableless_field_types, true ) ) ) {
1878
  $field_data['options'] = pods_v( 'options', $field_data, array(), true );
classes/PodsAPI.php CHANGED
@@ -2890,7 +2890,7 @@ class PodsAPI {
2890
  if ( ( $field['type'] !== $old_type || $old_simple != $simple ) && empty( $definition ) ) {
2891
  pods_query( "ALTER TABLE `@wp_pods_{$params->pod}` DROP COLUMN `{$old_name}`", false );
2892
  } elseif ( 0 < strlen( $definition ) ) {
2893
- if ( $old_name !== $field['name'] || $old_simple != $simple ) {
2894
  $test = false;
2895
 
2896
  if ( 0 < strlen( $old_definition ) ) {
@@ -3774,6 +3774,9 @@ class PodsAPI {
3774
 
3775
  $custom = apply_filters( 'pods_form_ui_field_pick_custom_values', $custom, $field_data['name'], $value, array_merge( $field_data, $options ), $pod, $params->id );
3776
 
 
 
 
3777
  if ( empty( $value ) || empty( $custom ) ) {
3778
  $value = '';
3779
  } elseif ( ! empty( $custom ) ) {
@@ -4891,13 +4894,13 @@ class PodsAPI {
4891
  $field = $pod->fields[ $field['name'] ];
4892
  $field['lookup_name'] = $field['name'];
4893
 
4894
- if ( in_array( $field['type'], $tableless_field_types ) && ! in_array( pods_var( 'pick_object', $field ), $simple_tableless_objects ) ) {
4895
  if ( 'pick' === $field['type'] ) {
4896
  if ( empty( $field['table_info'] ) ) {
4897
- $field['table_info'] = $this->get_table_info( pods_var_raw( 'pick_object', $field ), pods_var_raw( 'pick_val', $field ), null, null, $field );
4898
  }
4899
 
4900
- if ( ! empty( $field['table_info'] ) ) {
4901
  $field['lookup_name'] .= '.' . $field['table_info']['field_id'];
4902
  }
4903
  } elseif ( in_array( $field['type'], PodsForm::file_field_types() ) ) {
@@ -6083,6 +6086,7 @@ class PodsAPI {
6083
  $pod = array(
6084
  'id' => 0,
6085
  'name' => $params->name,
 
6086
  'label' => __( 'Pods', 'pods' ),
6087
  'type' => 'post_type',
6088
  'storage' => 'meta',
@@ -6095,6 +6099,7 @@ class PodsAPI {
6095
  $pod = array(
6096
  'id' => 0,
6097
  'name' => $params->name,
 
6098
  'label' => __( 'Pod Fields', 'pods' ),
6099
  'type' => 'post_type',
6100
  'storage' => 'meta',
@@ -8696,12 +8701,23 @@ class PodsAPI {
8696
  $info['table'] = ( empty( $object ) ? $name : $object );
8697
  $info['pod_table'] = $wpdb->prefix . 'pods_' . $info['table'];
8698
 
8699
- if ( ! empty( $field ) && is_array( $field ) ) {
8700
- $info['table'] = pods_var_raw( 'pick_table', pods_var_raw( 'options', $field, $field ) );
8701
- $info['field_id'] = pods_var_raw( 'pick_table_id', pods_var_raw( 'options', $field, $field ) );
8702
- $info['meta_field_value'] = pods_var_raw( 'pick_table_index', pods_var_raw( 'options', $field, $field ) );
8703
- $info['field_index'] = $info['meta_field_value'];
8704
- $info['meta_field_index'] = $info['meta_field_value'];
 
 
 
 
 
 
 
 
 
 
 
8705
  }
8706
  }
8707
 
2890
  if ( ( $field['type'] !== $old_type || $old_simple != $simple ) && empty( $definition ) ) {
2891
  pods_query( "ALTER TABLE `@wp_pods_{$params->pod}` DROP COLUMN `{$old_name}`", false );
2892
  } elseif ( 0 < strlen( $definition ) ) {
2893
+ if ( $old_name !== $field['name'] || $old_simple !== $simple || $old_definition !== $definition ) {
2894
  $test = false;
2895
 
2896
  if ( 0 < strlen( $old_definition ) ) {
3774
 
3775
  $custom = apply_filters( 'pods_form_ui_field_pick_custom_values', $custom, $field_data['name'], $value, array_merge( $field_data, $options ), $pod, $params->id );
3776
 
3777
+ // Input values are unslashed. Unslash database values as well to ensure correct comparison.
3778
+ $custom = pods_unslash( $custom );
3779
+
3780
  if ( empty( $value ) || empty( $custom ) ) {
3781
  $value = '';
3782
  } elseif ( ! empty( $custom ) ) {
4894
  $field = $pod->fields[ $field['name'] ];
4895
  $field['lookup_name'] = $field['name'];
4896
 
4897
+ if ( in_array( $field['type'], $tableless_field_types, true ) && ! in_array( pods_v( 'pick_object', $field ), $simple_tableless_objects, true ) ) {
4898
  if ( 'pick' === $field['type'] ) {
4899
  if ( empty( $field['table_info'] ) ) {
4900
+ $field['table_info'] = $this->get_table_info( pods_v( 'pick_object', $field ), pods_v( 'pick_val', $field ), null, null, $field );
4901
  }
4902
 
4903
+ if ( ! empty( $field['table_info'] ) && 'table' !== $field['table_info']['object_type'] ) {
4904
  $field['lookup_name'] .= '.' . $field['table_info']['field_id'];
4905
  }
4906
  } elseif ( in_array( $field['type'], PodsForm::file_field_types() ) ) {
6086
  $pod = array(
6087
  'id' => 0,
6088
  'name' => $params->name,
6089
+ 'object' => $params->name,
6090
  'label' => __( 'Pods', 'pods' ),
6091
  'type' => 'post_type',
6092
  'storage' => 'meta',
6099
  $pod = array(
6100
  'id' => 0,
6101
  'name' => $params->name,
6102
+ 'object' => $params->name,
6103
  'label' => __( 'Pod Fields', 'pods' ),
6104
  'type' => 'post_type',
6105
  'storage' => 'meta',
8701
  $info['table'] = ( empty( $object ) ? $name : $object );
8702
  $info['pod_table'] = $wpdb->prefix . 'pods_' . $info['table'];
8703
 
8704
+
8705
+ if ( ! empty( $field ) ) {
8706
+ if ( ! is_array( $field ) ) {
8707
+ if ( is_string( $pod ) ) {
8708
+ $pod = pods( $pod );
8709
+ }
8710
+ if ( $pod && ! empty( $pod->fields[ $field ] ) ) {
8711
+ $field = $pod->fields[ $field ];
8712
+ }
8713
+ }
8714
+ if ( is_array( $field ) ) {
8715
+ $info['table'] = pods_var_raw( 'pick_table', pods_var_raw( 'options', $field, $field ) );
8716
+ $info['field_id'] = pods_var_raw( 'pick_table_id', pods_var_raw( 'options', $field, $field ) );
8717
+ $info['meta_field_value'] = pods_var_raw( 'pick_table_index', pods_var_raw( 'options', $field, $field ) );
8718
+ $info['field_index'] = $info['meta_field_value'];
8719
+ $info['meta_field_index'] = $info['meta_field_value'];
8720
+ }
8721
  }
8722
  }
8723
 
classes/PodsAdmin.php CHANGED
@@ -43,7 +43,7 @@ class PodsAdmin {
43
  add_action( 'admin_init', array( $this, 'admin_init' ), 9 );
44
 
45
  // Menus
46
- add_action( 'admin_menu', array( $this, 'admin_menu' ), 99 );
47
 
48
  // AJAX for Admin
49
  add_action( 'wp_ajax_pods_admin', array( $this, 'admin_ajax' ) );
@@ -3641,106 +3641,110 @@ class PodsAdmin {
3641
  'label' => 'Pods',
3642
  'description' => __( 'Debug information for Pods installations.', 'pods' ),
3643
  'fields' => array(
3644
- 'pods-server-software' => array(
3645
  'label' => __( 'Server Software', 'pods' ),
3646
  'value' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'N/A',
3647
  ),
3648
- 'pods-user-agent' => array(
3649
  'label' => __( 'Your User Agent', 'pods' ),
3650
  'value' => ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'N/A',
3651
  ),
3652
- 'pods-session-save-path' => array(
3653
  'label' => __( 'Session Save Path', 'pods' ),
3654
  'value' => session_save_path(),
3655
  ),
3656
- 'pods-session-save-path-exists' => array(
3657
  'label' => __( 'Session Save Path Exists', 'pods' ),
3658
  'value' => file_exists( session_save_path() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3659
  ),
3660
- 'pods-session-save-path-writable' => array(
3661
  'label' => __( 'Session Save Path Writeable', 'pods' ),
3662
  'value' => is_writable( session_save_path() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3663
  ),
3664
- 'pods-session-max-lifetime' => array(
3665
  'label' => __( 'Session Max Lifetime', 'pods' ),
3666
  'value' => ini_get( 'session.gc_maxlifetime' ),
3667
  ),
3668
- 'pods-opcode-cache-apc' => array(
3669
  'label' => __( 'Opcode Cache: Apc', 'pods' ),
3670
  'value' => function_exists( 'apc_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3671
  ),
3672
- 'pods-opcode-cache-memcached' => array(
3673
  'label' => __( 'Opcode Cache: Memcached', 'pods' ),
3674
  'value' => class_exists( 'eaccelerator_put' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3675
  ),
3676
- 'pods-opcode-cache-opcache' => array(
3677
  'label' => __( 'Opcode Cache: OPcache', 'pods' ),
3678
  'value' => function_exists( 'opcache_get_status' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3679
  ),
3680
- 'pods-opcode-cache-redis' => array(
3681
  'label' => __( 'Opcode Cache: Redis', 'pods' ),
3682
  'value' => class_exists( 'xcache_set' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3683
  ),
3684
- 'pods-object-cache-apc' => array(
3685
  'label' => __( 'Object Cache: APC', 'pods' ),
3686
  'value' => function_exists( 'apc_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3687
  ),
3688
- 'pods-object-cache-apcu' => array(
3689
  'label' => __( 'Object Cache: APCu', 'pods' ),
3690
  'value' => function_exists( 'apcu_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3691
  ),
3692
- 'pods-object-cache-memcache' => array(
3693
  'label' => __( 'Object Cache: Memcache', 'pods' ),
3694
  'value' => class_exists( 'Memcache' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3695
  ),
3696
- 'pods-object-cache-memcached' => array(
3697
  'label' => __( 'Object Cache: Memcached', 'pods' ),
3698
  'value' => class_exists( 'Memcached' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3699
  ),
3700
- 'pods-object-cache-redis' => array(
3701
  'label' => __( 'Object Cache: Redis', 'pods' ),
3702
  'value' => class_exists( 'Redis' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3703
  ),
3704
- 'pods-memory-current-usage' => array(
3705
  'label' => __( 'Current Memory Usage', 'pods' ),
3706
  'value' => number_format_i18n( memory_get_usage() / 1024 / 1024, 3 ) . 'M',
3707
  ),
3708
- 'pods-memory-current-usage-real' => array(
3709
  'label' => __( 'Current Memory Usage (real)', 'pods' ),
3710
  'value' => number_format_i18n( memory_get_usage( true ) / 1024 / 1024, 3 ) . 'M',
3711
  ),
3712
- 'pods-network-wide' => array(
3713
  'label' => __( 'Pods Network-Wide Activated', 'pods' ),
3714
  'value' => is_plugin_active_for_network( basename( PODS_DIR ) . '/init.php' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3715
  ),
3716
- 'pods-install-location' => array(
3717
  'label' => __( 'Pods Install Location', 'pods' ),
3718
  'value' => PODS_DIR,
3719
  ),
3720
- 'pods-developer' => array(
3721
  'label' => __( 'Pods Developer Activated' ),
3722
  'value' => ( pods_developer() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3723
  ),
3724
- 'pods-tableless-mode' => array(
3725
  'label' => __( 'Pods Tableless Mode Activated', 'pods' ),
3726
  'value' => ( pods_tableless() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3727
  ),
3728
- 'pods-light-mode' => array(
3729
  'label' => __( 'Pods Light Mode Activated', 'pods' ),
3730
  'value' => ( pods_light() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3731
  ),
3732
- 'pods-strict' => array(
3733
  'label' => __( 'Pods Strict Activated' ),
3734
  'value' => ( pods_strict() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3735
  ),
3736
- 'pods-allow-deprecated' => array(
3737
  'label' => __( 'Pods Allow Deprecated' ),
3738
  'value' => ( pods_allow_deprecated() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3739
  ),
3740
- 'pods-api-cache' => array(
3741
  'label' => __( 'Pods API Cache Activated' ),
3742
  'value' => ( pods_api_cache() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3743
  ),
 
 
 
 
3744
  ),
3745
  );
3746
 
43
  add_action( 'admin_init', array( $this, 'admin_init' ), 9 );
44
 
45
  // Menus
46
+ add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
47
 
48
  // AJAX for Admin
49
  add_action( 'wp_ajax_pods_admin', array( $this, 'admin_ajax' ) );
3641
  'label' => 'Pods',
3642
  'description' => __( 'Debug information for Pods installations.', 'pods' ),
3643
  'fields' => array(
3644
+ 'pods-server-software' => array(
3645
  'label' => __( 'Server Software', 'pods' ),
3646
  'value' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'N/A',
3647
  ),
3648
+ 'pods-user-agent' => array(
3649
  'label' => __( 'Your User Agent', 'pods' ),
3650
  'value' => ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'N/A',
3651
  ),
3652
+ 'pods-session-save-path' => array(
3653
  'label' => __( 'Session Save Path', 'pods' ),
3654
  'value' => session_save_path(),
3655
  ),
3656
+ 'pods-session-save-path-exists' => array(
3657
  'label' => __( 'Session Save Path Exists', 'pods' ),
3658
  'value' => file_exists( session_save_path() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3659
  ),
3660
+ 'pods-session-save-path-writable' => array(
3661
  'label' => __( 'Session Save Path Writeable', 'pods' ),
3662
  'value' => is_writable( session_save_path() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3663
  ),
3664
+ 'pods-session-max-lifetime' => array(
3665
  'label' => __( 'Session Max Lifetime', 'pods' ),
3666
  'value' => ini_get( 'session.gc_maxlifetime' ),
3667
  ),
3668
+ 'pods-opcode-cache-apc' => array(
3669
  'label' => __( 'Opcode Cache: Apc', 'pods' ),
3670
  'value' => function_exists( 'apc_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3671
  ),
3672
+ 'pods-opcode-cache-memcached' => array(
3673
  'label' => __( 'Opcode Cache: Memcached', 'pods' ),
3674
  'value' => class_exists( 'eaccelerator_put' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3675
  ),
3676
+ 'pods-opcode-cache-opcache' => array(
3677
  'label' => __( 'Opcode Cache: OPcache', 'pods' ),
3678
  'value' => function_exists( 'opcache_get_status' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3679
  ),
3680
+ 'pods-opcode-cache-redis' => array(
3681
  'label' => __( 'Opcode Cache: Redis', 'pods' ),
3682
  'value' => class_exists( 'xcache_set' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3683
  ),
3684
+ 'pods-object-cache-apc' => array(
3685
  'label' => __( 'Object Cache: APC', 'pods' ),
3686
  'value' => function_exists( 'apc_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3687
  ),
3688
+ 'pods-object-cache-apcu' => array(
3689
  'label' => __( 'Object Cache: APCu', 'pods' ),
3690
  'value' => function_exists( 'apcu_cache_info' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3691
  ),
3692
+ 'pods-object-cache-memcache' => array(
3693
  'label' => __( 'Object Cache: Memcache', 'pods' ),
3694
  'value' => class_exists( 'Memcache' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3695
  ),
3696
+ 'pods-object-cache-memcached' => array(
3697
  'label' => __( 'Object Cache: Memcached', 'pods' ),
3698
  'value' => class_exists( 'Memcached' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3699
  ),
3700
+ 'pods-object-cache-redis' => array(
3701
  'label' => __( 'Object Cache: Redis', 'pods' ),
3702
  'value' => class_exists( 'Redis' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3703
  ),
3704
+ 'pods-memory-current-usage' => array(
3705
  'label' => __( 'Current Memory Usage', 'pods' ),
3706
  'value' => number_format_i18n( memory_get_usage() / 1024 / 1024, 3 ) . 'M',
3707
  ),
3708
+ 'pods-memory-current-usage-real' => array(
3709
  'label' => __( 'Current Memory Usage (real)', 'pods' ),
3710
  'value' => number_format_i18n( memory_get_usage( true ) / 1024 / 1024, 3 ) . 'M',
3711
  ),
3712
+ 'pods-network-wide' => array(
3713
  'label' => __( 'Pods Network-Wide Activated', 'pods' ),
3714
  'value' => is_plugin_active_for_network( basename( PODS_DIR ) . '/init.php' ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3715
  ),
3716
+ 'pods-install-location' => array(
3717
  'label' => __( 'Pods Install Location', 'pods' ),
3718
  'value' => PODS_DIR,
3719
  ),
3720
+ 'pods-developer' => array(
3721
  'label' => __( 'Pods Developer Activated' ),
3722
  'value' => ( pods_developer() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3723
  ),
3724
+ 'pods-tableless-mode' => array(
3725
  'label' => __( 'Pods Tableless Mode Activated', 'pods' ),
3726
  'value' => ( pods_tableless() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3727
  ),
3728
+ 'pods-light-mode' => array(
3729
  'label' => __( 'Pods Light Mode Activated', 'pods' ),
3730
  'value' => ( pods_light() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3731
  ),
3732
+ 'pods-strict' => array(
3733
  'label' => __( 'Pods Strict Activated' ),
3734
  'value' => ( pods_strict() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3735
  ),
3736
+ 'pods-allow-deprecated' => array(
3737
  'label' => __( 'Pods Allow Deprecated' ),
3738
  'value' => ( pods_allow_deprecated() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3739
  ),
3740
+ 'pods-api-cache' => array(
3741
  'label' => __( 'Pods API Cache Activated' ),
3742
  'value' => ( pods_api_cache() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3743
  ),
3744
+ 'pods-shortcode-allow-evaluate-tags' => array(
3745
+ 'label' => __( 'Pods Shortcode Allow Evaluate Tags' ),
3746
+ 'value' => ( pods_shortcode_allow_evaluate_tags() ) ? __( 'Yes', 'pods' ) : __( 'No', 'pods' ),
3747
+ ),
3748
  ),
3749
  );
3750
 
classes/PodsInit.php CHANGED
@@ -344,8 +344,8 @@ class PodsInit {
344
 
345
  // Check if Pod is a Modal Window
346
  if ( pods_is_modal_window() ) {
347
- add_filter( 'body_class', array( $this, 'add_classes_to_body_class' ) );
348
- add_filter( 'admin_body_class', array( $this, 'add_classes_to_body_class' ) );
349
  }
350
 
351
  // Deal with specifics on admin pages
@@ -406,13 +406,17 @@ class PodsInit {
406
  }
407
 
408
  /**
409
- * @param string $classes Body classes.
410
  *
411
- * @return string
412
  */
413
- public function add_classes_to_body_class( $classes ) {
414
 
415
- $classes .= 'pods-modal-window';
 
 
 
 
416
 
417
  return $classes;
418
  }
@@ -1872,6 +1876,7 @@ class PodsInit {
1872
  $conditionals[] = 'pods_strict';
1873
  $conditionals[] = 'pods_allow_deprecated';
1874
  $conditionals[] = 'pods_api_cache';
 
1875
  return $conditionals;
1876
  }
1877
  }
344
 
345
  // Check if Pod is a Modal Window
346
  if ( pods_is_modal_window() ) {
347
+ add_filter( 'body_class', array( $this, 'add_classes_to_modal_body' ) );
348
+ add_filter( 'admin_body_class', array( $this, 'add_classes_to_modal_body' ) );
349
  }
350
 
351
  // Deal with specifics on admin pages
406
  }
407
 
408
  /**
409
+ * @param string|array $classes Body classes.
410
  *
411
+ * @return string|array
412
  */
413
+ public function add_classes_to_modal_body( $classes ) {
414
 
415
+ if ( is_array( $classes ) ) {
416
+ $classes[] = 'pods-modal-window';
417
+ } else {
418
+ $classes .= ' pods-modal-window';
419
+ }
420
 
421
  return $classes;
422
  }
1876
  $conditionals[] = 'pods_strict';
1877
  $conditionals[] = 'pods_allow_deprecated';
1878
  $conditionals[] = 'pods_api_cache';
1879
+ $conditionals[] = 'pods_shortcode_allow_evaluate_tags';
1880
  return $conditionals;
1881
  }
1882
  }
classes/PodsUI.php CHANGED
@@ -4634,6 +4634,9 @@ class PodsUI {
4634
  'filter_*',
4635
  'view' . $this->num,
4636
  'page' . $this->num,
 
 
 
4637
  ), $this->exclusion()
4638
  );
4639
 
@@ -4653,9 +4656,21 @@ class PodsUI {
4653
 
4654
  if ( false !== $this->pagination ) {
4655
  if ( 1 < $total_pages ) {
 
 
 
 
 
 
 
 
 
 
 
 
4656
  ?>
4657
- <a class="first-page<?php echo esc_attr( ( 1 < $this->page ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the first page', 'pods' ); ?>" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=1' ); ?>">&laquo;</a>
4658
- <a class="prev-page<?php echo esc_attr( ( 1 < $this->page ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the previous page', 'pods' ); ?>" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . max( $this->page - 1, 1 ) ); ?>">&lsaquo;</a>
4659
  <?php
4660
  if ( true == $header ) {
4661
  ?>
@@ -4680,9 +4695,16 @@ class PodsUI {
4680
  <span class="total-pages"><?php echo number_format_i18n( $total_pages ); ?></span></span>
4681
  <?php
4682
  }//end if
 
 
 
 
 
 
 
4683
  ?>
4684
- <a class="next-page<?php echo esc_attr( ( $this->page < $total_pages ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the next page', 'pods' ); ?>" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . min( $this->page + 1, $total_pages ) ); ?>">&rsaquo;</a>
4685
- <a class="last-page<?php echo esc_attr( ( $this->page < $total_pages ) ? '' : ' disabled' ); ?>" title="<?php esc_attr_e( 'Go to the last page', 'pods' ); ?>'" href="<?php echo esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . $total_pages ); ?>">&raquo;</a>
4686
  <?php
4687
  }//end if
4688
  }//end if
@@ -4914,8 +4936,7 @@ class PodsUI {
4914
  $author_restrict = false;
4915
 
4916
  if ( ! empty( $this->restrict['author_restrict'] ) && $restrict === $this->restrict['author_restrict'] ) {
4917
- $restricted = false;
4918
-
4919
  $author_restrict = true;
4920
 
4921
  if ( is_object( $this->pod ) ) {
@@ -4927,33 +4948,58 @@ class PodsUI {
4927
 
4928
  if ( pods_is_admin( array( 'pods', 'pods_content' ) ) ) {
4929
  $restricted = false;
4930
- } elseif ( 'manage' === $action ) {
4931
- if ( ! in_array( 'edit', $this->actions_disabled ) && ( current_user_can( 'pods_edit_' . $this->pod->pod ) || current_user_can( 'pods_edit_others_' . $this->pod->pod ) ) ) {
4932
- $restricted = false;
4933
- } elseif ( ! in_array( 'delete', $this->actions_disabled ) && ( current_user_can( 'pods_delete_' . $this->pod->pod ) || current_user_can( 'pods_delete_others_' . $this->pod->pod ) ) ) {
4934
- $restricted = false;
4935
- } elseif ( current_user_can( 'pods_' . $action . '_' . $this->pod->pod ) || current_user_can( 'pods_' . $action . '_others_' . $this->pod->pod ) ) {
4936
- $restricted = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4937
  }
4938
- } elseif ( current_user_can( 'pods_' . $action . '_' . $this->pod->pod ) || current_user_can( 'pods_' . $action . '_others_' . $this->pod->pod ) ) {
4939
- $restricted = false;
4940
  }
 
4941
  }//end if
4942
- /*
4943
- @todo determine proper logic for non-pods capabilities
4944
- else {
4945
- $restricted = true;
4946
-
4947
- if ( pods_is_admin( array( 'pods', 'pods_content' ) ) )
4948
- $restricted = false;
4949
- elseif ( current_user_can( 'pods_' . $action . '_others_' . $_tbd ) )
4950
- $restricted = false;
4951
- }
4952
- */
4953
  }//end if
4954
 
4955
  if ( $restricted && ! empty( $restrict ) ) {
4956
- $relation = strtoupper( trim( pods_var( 'relation', $restrict, 'AND', null, true ) ) );
4957
 
4958
  if ( 'AND' !== $relation ) {
4959
  $relation = 'OR';
@@ -4969,7 +5015,7 @@ class PodsUI {
4969
  if ( is_array( $match ) ) {
4970
  $match_okay = true;
4971
 
4972
- $match_relation = strtoupper( trim( pods_var( 'relation', $match, 'OR', null, true ) ) );
4973
 
4974
  if ( 'AND' !== $match_relation ) {
4975
  $match_relation = 'OR';
@@ -5088,42 +5134,28 @@ class PodsUI {
5088
  }//end if
5089
  }//end foreach
5090
 
5091
- if ( ! empty( $author_restrict ) ) {
5092
- if ( is_object( $this->pod ) && 'manage' === $action ) {
5093
- if ( ! in_array( 'edit', $this->actions_disabled ) && ! current_user_can( 'pods_edit_' . $this->pod->pod ) && ! in_array( 'delete', $this->actions_disabled ) && ! current_user_can( 'pods_delete_' . $this->pod->pod ) ) {
5094
- $okay = false;
5095
- }
5096
- }
5097
- if ( is_object( $this->pod ) && ! current_user_can( 'pods_' . $action . '_' . $this->pod->pod ) ) {
5098
- $okay = false;
5099
- }
5100
- /*
5101
- @todo determine proper logic for non-pods capabilities
5102
- elseif ( !current_user_can( 'pods_' . $action . '_' . $_tbd ) )
5103
- $okay = false;
5104
- */
5105
-
5106
- if ( ! $okay && ! empty( $row ) ) {
5107
- foreach ( $this->restrict['author_restrict'] as $key => $val ) {
5108
- $author_restricted = $this->get_field( $key );
5109
-
5110
- if ( ! empty( $author_restricted ) ) {
5111
- if ( ! is_array( $author_restricted ) ) {
5112
- $author_restricted = (array) $author_restricted;
5113
- }
5114
 
5115
- if ( is_array( $val ) ) {
5116
- foreach ( $val as $v ) {
5117
- if ( in_array( $v, $author_restricted ) ) {
5118
- $okay = true;
5119
- }
 
 
 
 
 
5120
  }
5121
- } elseif ( in_array( $val, $author_restricted ) ) {
5122
- $okay = true;
5123
  }
 
 
5124
  }
5125
  }
5126
- }//end if
5127
  }//end if
5128
 
5129
  if ( $okay ) {
@@ -5131,7 +5163,10 @@ class PodsUI {
5131
  }
5132
  }//end if
5133
 
5134
- if ( isset( $this->actions_custom[ $action ] ) && is_array( $this->actions_custom[ $action ] ) && isset( $this->actions_custom[ $action ]['restrict_callback'] ) && is_callable( $this->actions_custom[ $action ]['restrict_callback'] ) ) {
 
 
 
5135
  $restricted = call_user_func( $this->actions_custom[ $action ]['restrict_callback'], $restricted, $restrict, $action, $row, $this );
5136
  }
5137
 
4634
  'filter_*',
4635
  'view' . $this->num,
4636
  'page' . $this->num,
4637
+ 'post_type',
4638
+ 'taxonomy',
4639
+ 'action' . $this->num,
4640
  ), $this->exclusion()
4641
  );
4642
 
4656
 
4657
  if ( false !== $this->pagination ) {
4658
  if ( 1 < $total_pages ) {
4659
+ $first_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=1' );
4660
+ $prev_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . max( $this->page - 1, 1 ) );
4661
+ $next_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . min( $this->page + 1, $total_pages ) );
4662
+ $last_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . $total_pages );
4663
+
4664
+ $classes = '';
4665
+ if ( 1 >= $this->page ) {
4666
+ $classes .= ' disabled';
4667
+ }
4668
+ if ( is_admin() ) {
4669
+ $classes .= ' button';
4670
+ }
4671
  ?>
4672
+ <a class="first-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the first page', 'pods' ); ?>" href="<?php echo $first_link; ?>">&laquo;</a>
4673
+ <a class="prev-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the previous page', 'pods' ); ?>" href="<?php echo $prev_link; ?>">&lsaquo;</a>
4674
  <?php
4675
  if ( true == $header ) {
4676
  ?>
4695
  <span class="total-pages"><?php echo number_format_i18n( $total_pages ); ?></span></span>
4696
  <?php
4697
  }//end if
4698
+ $classes = '';
4699
+ if ( $this->page >= $total_pages ) {
4700
+ $classes .= ' disabled';
4701
+ }
4702
+ if ( is_admin() ) {
4703
+ $classes .= ' button';
4704
+ }
4705
  ?>
4706
+ <a class="next-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the next page', 'pods' ); ?>" href="<?php echo $next_link; ?>">&rsaquo;</a>
4707
+ <a class="last-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the last page', 'pods' ); ?>" href="<?php echo $last_link; ?>">&raquo</a>
4708
  <?php
4709
  }//end if
4710
  }//end if
4936
  $author_restrict = false;
4937
 
4938
  if ( ! empty( $this->restrict['author_restrict'] ) && $restrict === $this->restrict['author_restrict'] ) {
4939
+ $restricted = false;
 
4940
  $author_restrict = true;
4941
 
4942
  if ( is_object( $this->pod ) ) {
4948
 
4949
  if ( pods_is_admin( array( 'pods', 'pods_content' ) ) ) {
4950
  $restricted = false;
4951
+ } else {
4952
+ // Disable legacy check.
4953
+ $author_restrict = false;
4954
+
4955
+ $pod = $this->pod;
4956
+ if ( ! $pod->id() && $row ) {
4957
+ $pod->fetch( $row );
4958
+ }
4959
+
4960
+ // Check if the current user is the author of this item.
4961
+ $author = $pod->field( 'author', true );
4962
+ $is_author = false;
4963
+ if ( $author && (int) wp_get_current_user()->ID === (int) pods_v( 'ID', $author, 0 ) ) {
4964
+ $is_author = true;
4965
+ }
4966
+
4967
+ $cap_actions = array( $action );
4968
+ if ( 'manage' === $action || 'reorder' === $action ) {
4969
+ if ( ! in_array( 'edit', $this->actions_disabled, true ) ) {
4970
+ $cap_actions[] = 'edit';
4971
+ }
4972
+ if ( ! in_array( 'delete', $this->actions_disabled, true ) ) {
4973
+ $cap_actions[] = 'delete';
4974
+ }
4975
+ }
4976
+
4977
+ foreach ( $cap_actions as $cap ) {
4978
+ if ( $is_author ) {
4979
+ // Only need regular capability.
4980
+ if ( current_user_can( 'pods_' . $cap . '_' . $this->pod->pod ) ) {
4981
+ $restricted = false;
4982
+ break;
4983
+ }
4984
+ } else {
4985
+ // This item is created by another user so the "others" capability is required as well.
4986
+ if (
4987
+ current_user_can( 'pods_' . $cap . '_' . $this->pod->pod ) &&
4988
+ current_user_can( 'pods_' . $cap . '_others_' . $this->pod->pod )
4989
+ ) {
4990
+ $restricted = false;
4991
+ break;
4992
+ }
4993
+ }
4994
  }
 
 
4995
  }
4996
+
4997
  }//end if
4998
+
 
 
 
 
 
 
 
 
 
 
4999
  }//end if
5000
 
5001
  if ( $restricted && ! empty( $restrict ) ) {
5002
+ $relation = strtoupper( trim( pods_v( 'relation', $restrict, 'AND', null, true ) ) );
5003
 
5004
  if ( 'AND' !== $relation ) {
5005
  $relation = 'OR';
5015
  if ( is_array( $match ) ) {
5016
  $match_okay = true;
5017
 
5018
+ $match_relation = strtoupper( trim( pods_v( 'relation', $match, 'OR', null, true ) ) );
5019
 
5020
  if ( 'AND' !== $match_relation ) {
5021
  $match_relation = 'OR';
5134
  }//end if
5135
  }//end foreach
5136
 
5137
+ // Legacy author restrict check.
5138
+ if ( $author_restrict && ! $okay && ! empty( $row ) ) {
5139
+ foreach ( $this->restrict['author_restrict'] as $key => $val ) {
5140
+ $author_restricted = $this->get_field( $key );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5141
 
5142
+ if ( ! empty( $author_restricted ) ) {
5143
+ if ( ! is_array( $author_restricted ) ) {
5144
+ $author_restricted = (array) $author_restricted;
5145
+ }
5146
+ $author_restricted = array_map( 'intval', $author_restricted );
5147
+
5148
+ if ( is_array( $val ) ) {
5149
+ foreach ( $val as $v ) {
5150
+ if ( in_array( (int) $v, $author_restricted, true ) ) {
5151
+ $restricted = false;
5152
  }
 
 
5153
  }
5154
+ } elseif ( in_array( (int) $val, $author_restricted, true ) ) {
5155
+ $restricted = false;
5156
  }
5157
  }
5158
+ }//end foreach
5159
  }//end if
5160
 
5161
  if ( $okay ) {
5163
  }
5164
  }//end if
5165
 
5166
+ if (
5167
+ isset( $this->actions_custom[ $action ]['restrict_callback'] )
5168
+ && is_callable( $this->actions_custom[ $action ]['restrict_callback'] )
5169
+ ) {
5170
  $restricted = call_user_func( $this->actions_custom[ $action ]['restrict_callback'], $restricted, $restrict, $action, $row, $this );
5171
  }
5172
 
classes/fields/boolean.php CHANGED
@@ -169,6 +169,25 @@ class PodsField_Boolean extends PodsField {
169
  return $data;
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  /**
173
  * {@inheritdoc}
174
  */
169
  return $data;
170
  }
171
 
172
+ /**
173
+ * {@inheritdoc}
174
+ */
175
+ public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
176
+
177
+ $errors = array();
178
+ $check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params );
179
+
180
+ if ( 1 === (int) pods_v( 'required', $options ) && 0 === $check ) {
181
+ $errors[] = __( 'This field is required.', 'pods' );
182
+ }
183
+
184
+ if ( ! empty( $errors ) ) {
185
+ return $errors;
186
+ }
187
+
188
+ return true;
189
+ }
190
+
191
  /**
192
  * {@inheritdoc}
193
  */
classes/fields/date.php CHANGED
@@ -166,6 +166,19 @@ class PodsField_Date extends PodsField_DateTime {
166
  return $schema;
167
  }
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  /**
170
  * {@inheritdoc}
171
  */
166
  return $schema;
167
  }
168
 
169
+ /**
170
+ * {@inheritdoc}
171
+ */
172
+ public function format_display( $options, $js = false ) {
173
+
174
+ if ( $js && 'custom' === pods_v( static::$type . '_type', $options, 'format' ) ) {
175
+ $format = $this->format_datetime( $options, $js );
176
+ return $this->convert_format( $format, array( 'source' => 'jquery_ui', 'type' => 'date' ) );
177
+ }
178
+
179
+ return parent::format_display( $options, $js );
180
+ }
181
+
182
  /**
183
  * {@inheritdoc}
184
  */
classes/fields/datetime.php CHANGED
@@ -281,8 +281,8 @@ class PodsField_DateTime extends PodsField {
281
  $value = implode( ' ', $value );
282
  }
283
 
284
- // Format Value
285
- $value = $this->format_value_display( $value, $options, true );
286
 
287
  $field_type = static::$type;
288
 
@@ -321,11 +321,8 @@ class PodsField_DateTime extends PodsField {
321
  $js = false;
322
  }
323
 
324
- $format = $this->format_datetime( $options, $js );
325
-
326
- if ( $js ) {
327
- $format = $this->convert_format( $format, array( 'source' => 'jquery_ui' ) );
328
- }
329
 
330
  $check = $this->convert_date( $value, static::$storage_format, $format, true );
331
 
@@ -345,14 +342,8 @@ class PodsField_DateTime extends PodsField {
345
  */
346
  public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
347
 
348
- $js = true;
349
- if ( 'custom' !== pods_v( static::$type . '_type', $options, 'format' ) ) {
350
- $js = false;
351
- }
352
- $format = $this->format_datetime( $options, $js );
353
- if ( $js ) {
354
- $format = $this->convert_format( $format, array( 'source' => 'jquery_ui' ) );
355
- }
356
 
357
  if ( ! empty( $value ) && ( 0 === (int) pods_v( static::$type . '_allow_empty', $options, 1 ) || ! in_array(
358
  $value, array(
@@ -446,12 +437,25 @@ class PodsField_DateTime extends PodsField {
446
  */
447
  public function format_display( $options, $js = false ) {
448
 
449
- if ( 'custom' !== pods_v( static::$type . '_type', $options, 'format' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  $js = false;
451
- }
452
- $format = $this->format_datetime( $options, $js );
453
- if ( $js ) {
454
- $format = $this->convert_format( $format, array( 'source' => 'jquery_ui' ) );
455
  }
456
 
457
  return $format;
@@ -495,24 +499,33 @@ class PodsField_DateTime extends PodsField {
495
  switch ( (string) pods_v( static::$type . '_type', $options, 'format', true ) ) {
496
  case 'wp':
497
  $format = get_option( 'date_format' );
 
498
  if ( $js ) {
499
- $format = $this->convert_format( $format, array( 'source' => 'php' ) );
500
  }
 
501
  break;
502
  case 'custom':
503
  if ( ! $js ) {
504
  $format = pods_v( static::$type . '_format_custom', $options, '' );
505
  } else {
506
  $format = pods_v( static::$type . '_format_custom_js', $options, '' );
 
507
  if ( empty( $format ) ) {
508
  $format = pods_v( static::$type . '_format_custom', $options, '' );
509
- $format = $this->convert_format( $format, array( 'source' => 'php' ) );
 
 
 
510
  }
511
  }
 
512
  break;
513
  default:
514
  $date_format = $this->get_date_formats( $js );
 
515
  $format = $date_format[ pods_v( static::$type . '_format', $options, 'ymd_dash', true ) ];
 
516
  break;
517
  }//end switch
518
 
@@ -549,10 +562,11 @@ class PodsField_DateTime extends PodsField {
549
  $format = pods_v( static::$type . '_time_format_custom', $options, '' );
550
  } else {
551
  $format = pods_v( static::$type . '_time_format_custom_js', $options, '' );
 
552
 
553
  if ( empty( $format ) ) {
554
  $format = pods_v( static::$type . '_time_format_custom', $options, '' );
555
- $format = $this->convert_format( $format, array( 'source' => 'php' ) );
556
  }
557
  }
558
 
@@ -560,10 +574,6 @@ class PodsField_DateTime extends PodsField {
560
  default:
561
  $format = get_option( 'time_format' );
562
 
563
- if ( $js ) {
564
- $format = $this->convert_format( $format, array( 'source' => 'php' ) );
565
- }
566
-
567
  break;
568
  }//end switch
569
 
@@ -601,8 +611,9 @@ class PodsField_DateTime extends PodsField {
601
  $filter = 'pods_form_ui_field_date_formats';
602
 
603
  if ( $js ) {
604
- // @todo Method parameters? (Not supported by array_map)
605
- $date_format = array_map( array( $this, 'convert_format' ), $date_format );
 
606
 
607
  $filter = 'pods_form_ui_field_date_js_formats';
608
  }
@@ -637,8 +648,9 @@ class PodsField_DateTime extends PodsField {
637
  $filter = 'pods_form_ui_field_time_formats';
638
 
639
  if ( $js ) {
640
- // @todo Method parameters? (Not supported by array_map)
641
- $time_format = array_map( array( $this, 'convert_format' ), $time_format );
 
642
 
643
  $filter = 'pods_form_ui_field_time_js_formats';
644
  }
@@ -665,8 +677,9 @@ class PodsField_DateTime extends PodsField {
665
  $filter = 'pods_form_ui_field_time_formats_24';
666
 
667
  if ( $js ) {
668
- // @todo Method parameters? (Not supported by array_map)
669
- $time_format_24 = array_map( array( $this, 'convert_format' ), $time_format_24 );
 
670
 
671
  $filter = 'pods_form_ui_field_time_js_formats_24';
672
  }
@@ -784,55 +797,64 @@ class PodsField_DateTime extends PodsField {
784
  $args = array_merge(
785
  array(
786
  'source' => 'php',
 
787
  // 'jquery_ui' for reverse.
788
  ), $args
789
  );
790
 
791
  // Keep keys and values sorted by string length.
792
- $symbols = array(
793
- // Day
794
- 'd' => 'dd',
795
- 'l' => 'DD',
796
- 'D' => 'D',
797
- 'j' => 'd',
798
- 'N' => '',
799
- 'S' => '',
800
- 'w' => '',
801
- 'z' => 'o',
802
- // Week
803
- 'W' => '',
804
- // Month
805
- 'F' => 'MM',
806
- 'm' => 'mm',
807
- 'M' => 'M',
808
- 'n' => 'm',
809
- 't' => '',
810
- // Year
811
- 'L' => '',
812
- 'o' => '',
813
- 'Y' => 'yy',
814
- 'y' => 'y',
815
- // AM/PM
816
- 'a' => 'tt',
817
- 'A' => 'TT',
818
- // Swatch internet time (not supported)
819
- 'B' => '',
820
- // Hour
821
- 'h' => 'hh',
822
- 'H' => 'HH',
823
- 'g' => 'h',
824
- 'G' => 'H',
825
- // Minute
826
- 'i' => 'mm',
827
- // Second
828
- 's' => 'ss',
829
- // Microsecond
830
- 'u' => 'c',
831
- );
832
 
833
- if ( version_compare( PHP_VERSION, '7.0.0' ) >= 0 ) {
834
- // Millisecond
835
- $symbols['v'] = 'l';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836
  }
837
 
838
  if ( 'jquery_ui' === $args['source'] ) {
281
  $value = implode( ' ', $value );
282
  }
283
 
284
+ // @todo Remove? Format Value (done in field template).
285
+ //$value = $this->format_value_display( $value, $options, true );
286
 
287
  $field_type = static::$type;
288
 
321
  $js = false;
322
  }
323
 
324
+ // Value should always be passed as storage format since 2.7.15.
325
+ $format = static::$storage_format;
 
 
 
326
 
327
  $check = $this->convert_date( $value, static::$storage_format, $format, true );
328
 
342
  */
343
  public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
344
 
345
+ // Value should always be passed as storage format since 2.7.15.
346
+ $format = static::$storage_format;
 
 
 
 
 
 
347
 
348
  if ( ! empty( $value ) && ( 0 === (int) pods_v( static::$type . '_allow_empty', $options, 1 ) || ! in_array(
349
  $value, array(
437
  */
438
  public function format_display( $options, $js = false ) {
439
 
440
+ if ( 'custom' === pods_v( static::$type . '_type', $options, 'format' ) ) {
441
+ if ( $js ) {
442
+
443
+ // Gets format strings in jQuery UI format.
444
+ $date = $this->format_date( $options, $js );
445
+ $time = $this->format_time( $options, $js );
446
+
447
+ // Convert them to PHP date format.
448
+ $date = $this->convert_format( $date, array( 'source' => 'jquery_ui', 'type' => 'date' ) );
449
+ $time = $this->convert_format( $time, array( 'source' => 'jquery_ui', 'type' => 'time' ) );
450
+
451
+ return $date . ' ' . $time;
452
+
453
+ } else {
454
+ $format = $this->format_datetime( $options, $js );
455
+ }
456
+ } else {
457
  $js = false;
458
+ $format = $this->format_datetime( $options, $js );
 
 
 
459
  }
460
 
461
  return $format;
499
  switch ( (string) pods_v( static::$type . '_type', $options, 'format', true ) ) {
500
  case 'wp':
501
  $format = get_option( 'date_format' );
502
+
503
  if ( $js ) {
504
+ $format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'date' ) );
505
  }
506
+
507
  break;
508
  case 'custom':
509
  if ( ! $js ) {
510
  $format = pods_v( static::$type . '_format_custom', $options, '' );
511
  } else {
512
  $format = pods_v( static::$type . '_format_custom_js', $options, '' );
513
+
514
  if ( empty( $format ) ) {
515
  $format = pods_v( static::$type . '_format_custom', $options, '' );
516
+
517
+ if ( $js ) {
518
+ $format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'date' ) );
519
+ }
520
  }
521
  }
522
+
523
  break;
524
  default:
525
  $date_format = $this->get_date_formats( $js );
526
+
527
  $format = $date_format[ pods_v( static::$type . '_format', $options, 'ymd_dash', true ) ];
528
+
529
  break;
530
  }//end switch
531
 
562
  $format = pods_v( static::$type . '_time_format_custom', $options, '' );
563
  } else {
564
  $format = pods_v( static::$type . '_time_format_custom_js', $options, '' );
565
+ $js = false; // Already in JS format.
566
 
567
  if ( empty( $format ) ) {
568
  $format = pods_v( static::$type . '_time_format_custom', $options, '' );
569
+ $js = true;
570
  }
571
  }
572
 
574
  default:
575
  $format = get_option( 'time_format' );
576
 
 
 
 
 
577
  break;
578
  }//end switch
579
 
611
  $filter = 'pods_form_ui_field_date_formats';
612
 
613
  if ( $js ) {
614
+ foreach ( $date_format as $key => $value ) {
615
+ $date_format[ $key ] = $this->convert_format( $value, array( 'type' => 'date' ) );
616
+ }
617
 
618
  $filter = 'pods_form_ui_field_date_js_formats';
619
  }
648
  $filter = 'pods_form_ui_field_time_formats';
649
 
650
  if ( $js ) {
651
+ foreach ( $time_format as $key => $value ) {
652
+ $time_format[ $key ] = $this->convert_format( $value, array( 'type' => 'time' ) );
653
+ }
654
 
655
  $filter = 'pods_form_ui_field_time_js_formats';
656
  }
677
  $filter = 'pods_form_ui_field_time_formats_24';
678
 
679
  if ( $js ) {
680
+ foreach ( $time_format_24 as $key => $value ) {
681
+ $time_format_24[ $key ] = $this->convert_format( $value, array( 'type' => 'time' ) );
682
+ }
683
 
684
  $filter = 'pods_form_ui_field_time_js_formats_24';
685
  }
797
  $args = array_merge(
798
  array(
799
  'source' => 'php',
800
+ 'type' => 'date',
801
  // 'jquery_ui' for reverse.
802
  ), $args
803
  );
804
 
805
  // Keep keys and values sorted by string length.
806
+ if ( 'time' === $args['type'] || 'time' === static::$type ) {
807
+
808
+ $symbols = array(
809
+ // AM/PM.
810
+ 'a' => 'tt',
811
+ 'A' => 'TT',
812
+ // Swatch internet time (not supported).
813
+ 'B' => '',
814
+ // Hour.
815
+ 'h' => 'hh',
816
+ 'H' => 'HH',
817
+ 'g' => 'h',
818
+ 'G' => 'H',
819
+ // Minute.
820
+ 'i' => 'mm',
821
+ // Second.
822
+ 's' => 'ss',
823
+ // Microsecond.
824
+ 'u' => 'c',
825
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
826
 
827
+ if ( version_compare( PHP_VERSION, '7.0.0' ) >= 0 ) {
828
+ // Millisecond.
829
+ $symbols['v'] = 'l';
830
+ }
831
+
832
+ } else {
833
+
834
+ $symbols = array(
835
+ // Day.
836
+ 'd' => 'dd',
837
+ 'l' => 'DD',
838
+ 'D' => 'D',
839
+ 'j' => 'd',
840
+ 'N' => '',
841
+ 'S' => '',
842
+ 'w' => '',
843
+ 'z' => 'o',
844
+ // Week.
845
+ 'W' => '',
846
+ // Month.
847
+ 'F' => 'MM',
848
+ 'm' => 'mm',
849
+ 'M' => 'M',
850
+ 'n' => 'm',
851
+ 't' => '',
852
+ // Year.
853
+ 'L' => '',
854
+ 'o' => '',
855
+ 'Y' => 'yy',
856
+ 'y' => 'y',
857
+ );
858
  }
859
 
860
  if ( 'jquery_ui' === $args['source'] ) {
classes/fields/time.php CHANGED
@@ -169,6 +169,19 @@ class PodsField_Time extends PodsField_DateTime {
169
  return empty( $value );
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  /**
173
  * {@inheritdoc}
174
  */
@@ -209,7 +222,10 @@ class PodsField_Time extends PodsField_DateTime {
209
 
210
  if ( empty( $format ) ) {
211
  $format = pods_v( static::$type . '_format_custom', $options, '' );
212
- $format = $this->convert_format( $format, array( 'source' => 'php' ) );
 
 
 
213
  }
214
  }
215
 
@@ -218,7 +234,7 @@ class PodsField_Time extends PodsField_DateTime {
218
  $format = get_option( 'time_format' );
219
 
220
  if ( $js ) {
221
- $format = $this->convert_format( $format, array( 'source' => 'php' ) );
222
  }
223
 
224
  break;
169
  return empty( $value );
170
  }
171
 
172
+ /**
173
+ * {@inheritdoc}
174
+ */
175
+ public function format_display( $options, $js = false ) {
176
+
177
+ if ( $js && 'custom' === pods_v( static::$type . '_type', $options, 'format' ) ) {
178
+ $format = $this->format_datetime( $options, $js );
179
+ return $this->convert_format( $format, array( 'source' => 'jquery_ui', 'type' => 'time' ) );
180
+ }
181
+
182
+ return parent::format_display( $options, $js );
183
+ }
184
+
185
  /**
186
  * {@inheritdoc}
187
  */
222
 
223
  if ( empty( $format ) ) {
224
  $format = pods_v( static::$type . '_format_custom', $options, '' );
225
+
226
+ if ( $js ) {
227
+ $format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'time' ) );
228
+ }
229
  }
230
  }
231
 
234
  $format = get_option( 'time_format' );
235
 
236
  if ( $js ) {
237
+ $format = $this->convert_format( $format, array( 'source' => 'php', 'type' => 'time' ) );
238
  }
239
 
240
  break;
components/Migrate-Packages/Migrate-Packages.php CHANGED
@@ -374,6 +374,12 @@ class Pods_Migrate_Packages extends PodsComponent {
374
 
375
  $pod = array_merge( $pod, $pod_data );
376
 
 
 
 
 
 
 
377
  foreach ( $pod['fields'] as $k => $field ) {
378
  if ( isset( $field['id'] ) && ! isset( $existing_fields[ $field['name'] ] ) ) {
379
  unset( $pod['fields'][ $k ]['id'] );
@@ -400,13 +406,14 @@ class Pods_Migrate_Packages extends PodsComponent {
400
  }
401
  }//end foreach
402
 
403
- $api->save_pod( $pod );
 
 
 
404
 
405
- if ( ! isset( $found['pods'] ) ) {
406
- $found['pods'] = array();
407
  }
408
 
409
- $found['pods'][ $pod['name'] ] = $pod['label'];
410
  }//end foreach
411
  }//end if
412
 
374
 
375
  $pod = array_merge( $pod, $pod_data );
376
 
377
+ if ( in_array( $pod['name'], pods_reserved_keywords(), true ) ) {
378
+ // Extending objects when using reserved keywords.
379
+ // This will then accept `post`, `page` etc. as Pods object names.
380
+ $pod['create_extend'] = 'extend';
381
+ }
382
+
383
  foreach ( $pod['fields'] as $k => $field ) {
384
  if ( isset( $field['id'] ) && ! isset( $existing_fields[ $field['name'] ] ) ) {
385
  unset( $pod['fields'][ $k ]['id'] );
406
  }
407
  }//end foreach
408
 
409
+ if ( $api->save_pod( $pod ) ) {
410
+ if ( ! isset( $found['pods'] ) ) {
411
+ $found['pods'] = array();
412
+ }
413
 
414
+ $found['pods'][ $pod['name'] ] = $pod['label'];
 
415
  }
416
 
 
417
  }//end foreach
418
  }//end if
419
 
components/Roles/Roles.php CHANGED
@@ -57,16 +57,6 @@ class Pods_Roles extends PodsComponent {
57
 
58
  global $wp_roles;
59
 
60
- // Hook into Gravity Forms roles (since it only adds filter if Members plugin itself is activated
61
- if ( class_exists( 'RGForms' ) && ! has_filter(
62
- 'members_get_capabilities', array(
63
- 'RGForms',
64
- 'members_get_capabilities',
65
- )
66
- ) ) {
67
- add_filter( 'members_get_capabilities', array( 'RGForms', 'members_get_capabilities' ) );
68
- }
69
-
70
  $default_role = get_option( 'default_role' );
71
 
72
  $roles = array();
@@ -447,7 +437,12 @@ class Pods_Roles extends PodsComponent {
447
 
448
  $capabilities = array_merge( $default_caps, $role_caps, $plugin_caps );
449
 
450
- // To support Members filters
 
 
 
 
 
451
  $capabilities = apply_filters( 'members_get_capabilities', $capabilities );
452
 
453
  $capabilities = apply_filters( 'pods_roles_get_capabilities', $capabilities );
57
 
58
  global $wp_roles;
59
 
 
 
 
 
 
 
 
 
 
 
60
  $default_role = get_option( 'default_role' );
61
 
62
  $roles = array();
437
 
438
  $capabilities = array_merge( $default_caps, $role_caps, $plugin_caps );
439
 
440
+ // Gravity Forms.
441
+ if ( is_callable( 'GFCommon::all_caps' ) ) {
442
+ $capabilities = array_merge( $capabilities, GFCommon::all_caps() );
443
+ }
444
+
445
+ // To support Members filters.
446
  $capabilities = apply_filters( 'members_get_capabilities', $capabilities );
447
 
448
  $capabilities = apply_filters( 'pods_roles_get_capabilities', $capabilities );
includes/data.php CHANGED
@@ -1383,13 +1383,14 @@ function pods_absint( $maybeint, $strict = true, $allow_negative = false ) {
1383
  /**
1384
  * Functions like str_replace except it will restrict $occurrences
1385
  *
 
 
1386
  * @param mixed $find
1387
  * @param mixed $replace
1388
  * @param string $string
1389
  * @param int $occurrences (optional)
1390
  *
1391
  * @return mixed
1392
- * @version 2.0
1393
  */
1394
  function pods_str_replace( $find, $replace, $string, $occurrences = - 1 ) {
1395
 
@@ -1416,8 +1417,12 @@ function pods_str_replace( $find, $replace, $string, $occurrences = - 1 ) {
1416
  } else {
1417
  $find = '/' . preg_quote( $find, '/' ) . '/';
1418
  }
1419
-
1420
- return preg_replace( $find, $replace, $string, $occurrences );
 
 
 
 
1421
  }
1422
 
1423
  /**
@@ -1462,82 +1467,82 @@ function pods_mb_substr( $string, $start, $length = null, $encoding = null ) {
1462
  }
1463
 
1464
  /**
1465
- * Evaluate tags like magic tags but through pods_v
1466
  *
1467
- * @param string|array|object $tags String to be evaluated
1468
- * @param bool $sanitize Whether to sanitize tags
1469
  *
1470
- * @return string
 
 
1471
  *
1472
- * @version 2.1
1473
  *
1474
- * @see pods_evaluate_tag
1475
  */
1476
- function pods_evaluate_tags( $tags, $sanitize = false ) {
1477
-
1478
  if ( is_array( $tags ) ) {
1479
  foreach ( $tags as $k => $tag ) {
1480
  $tags[ $k ] = pods_evaluate_tags( $tag, $sanitize );
1481
  }
1482
 
1483
  return $tags;
1484
- } elseif ( is_object( $tags ) ) {
1485
- $tags = get_object_vars( $tags );
1486
 
1487
- foreach ( $tags as $k => $tag ) {
1488
- $tags[ $k ] = pods_evaluate_tags( $tag, $sanitize );
1489
- }
1490
 
1491
- $tags = (object) $tags;
 
1492
 
1493
  return $tags;
1494
  }
1495
 
1496
- $callback = 'pods_evaluate_tag';
1497
-
1498
- if ( true === $sanitize ) {
1499
- $callback = 'pods_evaluate_tag_sanitized';
1500
- }
1501
-
1502
- return preg_replace_callback( '/({@(.*?)})/m', $callback, (string) $tags );
1503
-
1504
  }
1505
 
1506
  /**
1507
- * Evaluate tag like magic tag but mapped through pods_v_sanitized
1508
  *
1509
- * @param string|array $tag
1510
  *
1511
- * @return string
1512
  *
1513
- * @version 2.1
1514
  *
1515
- * @see pods_evaluate_tag
1516
  */
1517
  function pods_evaluate_tag_sanitized( $tag ) {
1518
-
1519
  return pods_evaluate_tag( $tag, true );
1520
-
1521
  }
1522
 
1523
  /**
1524
- * Evaluate tag like magic tag but mapped through pods_v
1525
  *
1526
- * @param string|array $tag
1527
- * @param bool $sanitize Whether to sanitize tags
1528
  *
1529
- * @return string
 
 
1530
  *
1531
- * @version 2.1
1532
  */
1533
- function pods_evaluate_tag( $tag, $sanitize = false ) {
1534
-
1535
  global $wpdb;
1536
 
1537
  // Handle pods_evaluate_tags
1538
  if ( is_array( $tag ) ) {
1539
- if ( ! isset( $tag[2] ) && strlen( trim( $tag[2] ) ) < 1 ) {
1540
- return '';
 
 
 
 
1541
  }
1542
 
1543
  $tag = $tag[2];
@@ -1546,8 +1551,12 @@ function pods_evaluate_tag( $tag, $sanitize = false ) {
1546
  $tag = trim( $tag, ' {@}' );
1547
  $tag = explode( '.', $tag );
1548
 
1549
- if ( empty( $tag ) || ! isset( $tag[0] ) || strlen( trim( $tag[0] ) ) < 1 ) {
1550
- return '';
 
 
 
 
1551
  }
1552
 
1553
  // Fix formatting that may be after the first .
@@ -1584,16 +1593,16 @@ function pods_evaluate_tag( $tag, $sanitize = false ) {
1584
  );
1585
 
1586
  if ( in_array( $tag[0], $single_supported, true ) ) {
1587
- $value = pods_v( '', $tag[0], '', true );
1588
- } elseif ( 1 == count( $tag ) ) {
1589
- $value = pods_v( $tag[0], 'get', '', true );
1590
- } elseif ( 2 == count( $tag ) ) {
1591
- $value = pods_v( $tag[1], $tag[0], '', true );
1592
  }
1593
 
1594
- $value = apply_filters( 'pods_evaluate_tag', $value, $tag );
1595
 
1596
- if ( is_array( $value ) && 1 == count( $value ) ) {
1597
  $value = current( $value );
1598
  }
1599
 
@@ -1601,12 +1610,19 @@ function pods_evaluate_tag( $tag, $sanitize = false ) {
1601
  $value = pods_serial_comma( $value );
1602
  }
1603
 
 
 
 
 
1604
  if ( $sanitize ) {
1605
  $value = pods_sanitize( $value );
1606
  }
1607
 
1608
- return $value;
 
 
1609
 
 
1610
  }
1611
 
1612
  /**
1383
  /**
1384
  * Functions like str_replace except it will restrict $occurrences
1385
  *
1386
+ * @since 2.0
1387
+ *
1388
  * @param mixed $find
1389
  * @param mixed $replace
1390
  * @param string $string
1391
  * @param int $occurrences (optional)
1392
  *
1393
  * @return mixed
 
1394
  */
1395
  function pods_str_replace( $find, $replace, $string, $occurrences = - 1 ) {
1396
 
1417
  } else {
1418
  $find = '/' . preg_quote( $find, '/' ) . '/';
1419
  }
1420
+ if ( is_string( $string ) ) {
1421
+ return preg_replace( $find, $replace, $string, $occurrences );
1422
+ } else {
1423
+ // Occasionally we will receive non string values (true, false, null). Allow those to pass through
1424
+ return $string;
1425
+ }
1426
  }
1427
 
1428
  /**
1467
  }
1468
 
1469
  /**
1470
+ * Evaluate tags like magic tags but through pods_v.
1471
  *
1472
+ * @since 2.1
 
1473
  *
1474
+ * @param string|array|object $tags String to be evaluated.
1475
+ * @param bool $sanitize Whether to sanitize.
1476
+ * @param null|mixed $fallback The fallback value to use if not set, should already be sanitized.
1477
  *
1478
+ * @return string
1479
  *
1480
+ * @see pods_evaluate_tag
1481
  */
1482
+ function pods_evaluate_tags( $tags, $sanitize = false, $fallback = null ) {
 
1483
  if ( is_array( $tags ) ) {
1484
  foreach ( $tags as $k => $tag ) {
1485
  $tags[ $k ] = pods_evaluate_tags( $tag, $sanitize );
1486
  }
1487
 
1488
  return $tags;
1489
+ }
 
1490
 
1491
+ if ( is_object( $tags ) ) {
1492
+ $tags = get_object_vars( $tags );
 
1493
 
1494
+ // Evaluate array and cast as object.
1495
+ $tags = (object) pods_evaluate_tags( $tags );
1496
 
1497
  return $tags;
1498
  }
1499
 
1500
+ return preg_replace_callback(
1501
+ '/({@(.*?)})/m',
1502
+ function ( $tag ) use ( $sanitize, $fallback ) {
1503
+ return pods_evaluate_tag( $tag, $sanitize, $fallback );
1504
+ },
1505
+ (string) $tags
1506
+ );
 
1507
  }
1508
 
1509
  /**
1510
+ * Evaluate tag like magic tag but mapped through pods_v_sanitized.
1511
  *
1512
+ * @since 2.1
1513
  *
1514
+ * @param string|array $tag String to be evaluated.
1515
  *
1516
+ * @return string Evaluated content.
1517
  *
1518
+ * @see pods_evaluate_tag
1519
  */
1520
  function pods_evaluate_tag_sanitized( $tag ) {
 
1521
  return pods_evaluate_tag( $tag, true );
 
1522
  }
1523
 
1524
  /**
1525
+ * Evaluate tag like magic tag but mapped through pods_v.
1526
  *
1527
+ * @since 2.1
 
1528
  *
1529
+ * @param string|array $tag String to be evaluated.
1530
+ * @param bool $sanitize Whether to sanitize tags.
1531
+ * @param null|mixed $fallback The fallback value to use if not set, should already be sanitized.
1532
  *
1533
+ * @return string Evaluated content.
1534
  */
1535
+ function pods_evaluate_tag( $tag, $sanitize = false, $fallback = null ) {
 
1536
  global $wpdb;
1537
 
1538
  // Handle pods_evaluate_tags
1539
  if ( is_array( $tag ) ) {
1540
+ if ( ! isset( $tag[2] ) && '' === trim( $tag[2] ) ) {
1541
+ if ( null === $fallback ) {
1542
+ return '';
1543
+ }
1544
+
1545
+ return $fallback;
1546
  }
1547
 
1548
  $tag = $tag[2];
1551
  $tag = trim( $tag, ' {@}' );
1552
  $tag = explode( '.', $tag );
1553
 
1554
+ if ( empty( $tag ) || ! isset( $tag[0] ) || '' === trim( $tag[0] ) ) {
1555
+ if ( null === $fallback ) {
1556
+ return '';
1557
+ }
1558
+
1559
+ return $fallback;
1560
  }
1561
 
1562
  // Fix formatting that may be after the first .
1593
  );
1594
 
1595
  if ( in_array( $tag[0], $single_supported, true ) ) {
1596
+ $value = pods_v( '', $tag[0], null );
1597
+ } elseif ( 1 === count( $tag ) ) {
1598
+ $value = pods_v( $tag[0], 'get', null );
1599
+ } elseif ( 2 === count( $tag ) ) {
1600
+ $value = pods_v( $tag[1], $tag[0], null );
1601
  }
1602
 
1603
+ $value = apply_filters( 'pods_evaluate_tag', $value, $tag, $fallback );
1604
 
1605
+ if ( is_array( $value ) && 1 === count( $value ) ) {
1606
  $value = current( $value );
1607
  }
1608
 
1610
  $value = pods_serial_comma( $value );
1611
  }
1612
 
1613
+ if ( null === $value ) {
1614
+ $value = '';
1615
+ }
1616
+
1617
  if ( $sanitize ) {
1618
  $value = pods_sanitize( $value );
1619
  }
1620
 
1621
+ if ( null !== $fallback && '' === $value ) {
1622
+ $value = $fallback;
1623
+ }
1624
 
1625
+ return $value;
1626
  }
1627
 
1628
  /**
includes/general.php CHANGED
@@ -459,6 +459,21 @@ function pods_api_cache() {
459
  return true;
460
  }
461
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  /**
463
  * Marks a function as deprecated and informs when it has been used.
464
  *
@@ -784,7 +799,8 @@ function pods_shortcode_run( $tags, $content = null ) {
784
  $offset = max( $offset, 0 );
785
  }
786
 
787
- $defaults = array(
 
788
  'use_current' => false,
789
  'name' => null,
790
  'id' => null,
@@ -806,21 +822,26 @@ function pods_shortcode_run( $tags, $content = null ) {
806
  'filters_location' => 'before',
807
  'pagination_label' => null,
808
  'pagination_location' => 'after',
809
- 'field' => null,
810
- 'col' => null,
811
- 'template' => null,
812
- 'pods_page' => null,
813
- 'helper' => null,
814
- 'form' => null,
815
- 'fields' => null,
816
- 'label' => null,
817
- 'thank_you' => null,
818
- 'view' => null,
819
- 'cache_mode' => 'none',
820
- 'expires' => 0,
821
- 'shortcodes' => false,
822
  );
823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  if ( ! empty( $tags ) ) {
825
  $tags = array_merge( $defaults, $tags );
826
  } else {
@@ -853,7 +874,9 @@ function pods_shortcode_run( $tags, $content = null ) {
853
  }
854
 
855
  if ( ! $tags['use_current'] && empty( $tags['name'] ) ) {
856
- if ( in_the_loop() || is_singular() ) {
 
 
857
  $pod = pods( get_post_type(), get_the_ID(), false );
858
 
859
  if ( ! empty( $pod ) ) {
@@ -891,16 +914,16 @@ function pods_shortcode_run( $tags, $content = null ) {
891
  if ( ! empty( $tags['slug'] ) ) {
892
  $id = $tags['slug'];
893
 
894
- if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
895
- $id = pods_evaluate_tags( $id );
896
  }
897
  }
898
 
899
  if ( ! empty( $tags['id'] ) ) {
900
  $id = $tags['id'];
901
 
902
- if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
903
- $id = pods_evaluate_tags( $id );
904
  }
905
 
906
  if ( is_numeric( $id ) ) {
@@ -937,16 +960,16 @@ function pods_shortcode_run( $tags, $content = null ) {
937
  if ( 0 < strlen( $tags['where'] ) ) {
938
  $params['where'] = $tags['where'];
939
 
940
- if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
941
- $params['where'] = pods_evaluate_tags( html_entity_decode( $params['where'] ) );
942
  }
943
  }
944
 
945
  if ( 0 < strlen( $tags['having'] ) ) {
946
  $params['having'] = $tags['having'];
947
 
948
- if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
949
- $params['having'] = pods_evaluate_tags( html_entity_decode( $params['having'] ) );
950
  }
951
  }
952
 
@@ -2154,7 +2177,7 @@ function pods_no_conflict_on( $object_type = 'post', $object = null ) {
2154
 
2155
  $no_conflict['action'] = array(
2156
  array( 'transition_post_status', array( PodsInit::$meta, 'save_post_detect_new' ), 10, 3 ),
2157
- array( 'save_post', array( PodsInit::$meta, 'save_post' ), 10, 2 ),
2158
  array( 'wp_insert_post_data', array( PodsInit::$meta, 'save_post_track_changed_fields' ), 10, 2 ),
2159
  );
2160
  } elseif ( 'taxonomy' === $object_type ) {
459
  return true;
460
  }
461
 
462
+ /**
463
+ * Determine if Pods shortcodes can evaluate magic tags.
464
+ *
465
+ * @since 2.7.16
466
+ *
467
+ * @return bool
468
+ */
469
+ function pods_shortcode_allow_evaluate_tags() {
470
+ if ( defined( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS' ) && PODS_SHORTCODE_ALLOW_EVALUATE_TAGS ) {
471
+ return true;
472
+ }
473
+
474
+ return false;
475
+ }
476
+
477
  /**
478
  * Marks a function as deprecated and informs when it has been used.
479
  *
799
  $offset = max( $offset, 0 );
800
  }
801
 
802
+ // Query related tags separated to use later.
803
+ $default_query_tags = array(
804
  'use_current' => false,
805
  'name' => null,
806
  'id' => null,
822
  'filters_location' => 'before',
823
  'pagination_label' => null,
824
  'pagination_location' => 'after',
 
 
 
 
 
 
 
 
 
 
 
 
 
825
  );
826
 
827
+ $default_other_tags = array(
828
+ 'field' => null,
829
+ 'col' => null,
830
+ 'template' => null,
831
+ 'pods_page' => null,
832
+ 'helper' => null,
833
+ 'form' => null,
834
+ 'fields' => null,
835
+ 'label' => null,
836
+ 'thank_you' => null,
837
+ 'view' => null,
838
+ 'cache_mode' => 'none',
839
+ 'expires' => 0,
840
+ 'shortcodes' => false,
841
+ );
842
+
843
+ $defaults = array_merge( $default_other_tags, $default_query_tags );
844
+
845
  if ( ! empty( $tags ) ) {
846
  $tags = array_merge( $defaults, $tags );
847
  } else {
874
  }
875
 
876
  if ( ! $tags['use_current'] && empty( $tags['name'] ) ) {
877
+ $has_query_tags = array_intersect_key( array_diff( $tags, $defaults ), $default_query_tags );
878
+
879
+ if ( ( in_the_loop() || is_singular() ) && ! $has_query_tags ) {
880
  $pod = pods( get_post_type(), get_the_ID(), false );
881
 
882
  if ( ! empty( $pod ) ) {
914
  if ( ! empty( $tags['slug'] ) ) {
915
  $id = $tags['slug'];
916
 
917
+ if ( pods_shortcode_allow_evaluate_tags() ) {
918
+ $id = pods_evaluate_tags( $id, true );
919
  }
920
  }
921
 
922
  if ( ! empty( $tags['id'] ) ) {
923
  $id = $tags['id'];
924
 
925
+ if ( pods_shortcode_allow_evaluate_tags() ) {
926
+ $id = pods_evaluate_tags( $id, true );
927
  }
928
 
929
  if ( is_numeric( $id ) ) {
960
  if ( 0 < strlen( $tags['where'] ) ) {
961
  $params['where'] = $tags['where'];
962
 
963
+ if ( pods_shortcode_allow_evaluate_tags() ) {
964
+ $params['where'] = pods_evaluate_tags( html_entity_decode( $params['where'] ), true, '""' );
965
  }
966
  }
967
 
968
  if ( 0 < strlen( $tags['having'] ) ) {
969
  $params['having'] = $tags['having'];
970
 
971
+ if ( pods_shortcode_allow_evaluate_tags() ) {
972
+ $params['having'] = pods_evaluate_tags( html_entity_decode( $params['having'] ), true, '""' );
973
  }
974
  }
975
 
2177
 
2178
  $no_conflict['action'] = array(
2179
  array( 'transition_post_status', array( PodsInit::$meta, 'save_post_detect_new' ), 10, 3 ),
2180
+ array( 'save_post', array( PodsInit::$meta, 'save_post' ), 10, 3 ),
2181
  array( 'wp_insert_post_data', array( PodsInit::$meta, 'save_post_track_changed_fields' ), 10, 2 ),
2182
  );
2183
  } elseif ( 'taxonomy' === $object_type ) {
init.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Pods - Custom Content Types and Fields
4
  Plugin URI: https://pods.io/
5
  Description: Pods is a framework for creating, managing, and deploying customized content types and fields
6
- Version: 2.7.15
7
  Author: Pods Framework Team
8
  Author URI: https://pods.io/about/
9
  Text Domain: pods
@@ -36,7 +36,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
36
  add_action( 'init', 'pods_deactivate_pods_ui' );
37
  } else {
38
  // Current version
39
- define( 'PODS_VERSION', '2.7.15' );
40
 
41
  // Version tracking between DB updates themselves
42
  define( 'PODS_DB_VERSION', '2.3.5' );
3
  Plugin Name: Pods - Custom Content Types and Fields
4
  Plugin URI: https://pods.io/
5
  Description: Pods is a framework for creating, managing, and deploying customized content types and fields
6
+ Version: 2.7.16.1
7
  Author: Pods Framework Team
8
  Author URI: https://pods.io/about/
9
  Text Domain: pods
36
  add_action( 'init', 'pods_deactivate_pods_ui' );
37
  } else {
38
  // Current version
39
+ define( 'PODS_VERSION', '2.7.16.1' );
40
 
41
  // Version tracking between DB updates themselves
42
  define( 'PODS_DB_VERSION', '2.3.5' );
readme.txt CHANGED
@@ -3,117 +3,130 @@ Contributors: sc0ttkclark, pglewis, jimtrue, keraweb, quasel, jamesgol, ramoonus
3
  Donate link: https://pods.io/friends-of-pods/
4
  Tags: pods, custom post types, custom taxonomies, content types, custom fields, cck, database, user fields, comment fields, media fields, relationships, drupal
5
  Requires at least: 4.5
6
- Tested up to: 5.2
7
  Requires PHP: 5.3
8
- Stable tag: 2.7.15
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
  Pods is a framework for creating, managing, and deploying customized content types and fields.
13
 
14
  == Description ==
15
- Manage all your custom content needs in ONE location with the Pods Framework. You can:
16
 
17
- * Create and edit custom post types, taxonomy, fields and extend existing WordPress objects like users, media, posts and pages or extend other plugins' custom post types -- all from Pods.
18
- * Easily display your custom content, whether you want to use shortcodes, widgets, the code-free Pods Template approach, or use standard PHP in WordPress Theme templates and functions.
19
- * Create connections between any of your content to help organize it in logical and useful ways with relationship fields.
20
 
21
- Let Pods help you grow your development skills and manage content beyond the standard WordPress Posts & Pages. Check out [pods.io](https://pods.io/) for our User Guide, [Support Forum](https://pods.io/forums/), and our [Slack Chat](https://pods.io/chat/) to help you develop with Pods.
 
 
 
 
 
 
 
22
 
23
  = Introduction =
 
24
  [youtube http://www.youtube.com/watch?v=bYEE2i3nPOM]
25
 
26
  = Content types that evolve with your needs =
27
- Create any type of content that you want -- small or large -- we've got you covered. Every content type created with Pods gets all the love it needs to grow up big and strong. You'll get an easy to use interface that lets you manage custom fields and how your content type will function.
28
 
29
- We now give you the power you've never before had with a single plugin because we've re-imagined how to manage content types from the ground up.
30
 
31
  = Create new content types =
32
- With Pods, you can create entirely new content types:
33
-
34
- * Custom Post Types - Content types that look and function like Posts and Pages, but in their own separate areas
35
- * Custom Taxonomies - Content types that look and function like Categories and Tags, but in their own separate areas
36
- * Custom Settings Pages - Create custom admin forms under Settings to help organize your site's custom global settings
37
- * Advanced Content Types - These are entirely separate from WordPress and function off their own database tables
38
 
39
- = Extend existing content types =
40
- Not satisfied? How about the power of being able to extend existing content types? We've got you covered with extending these major WordPress objects:
41
-
42
- * Post Types - Create and manage fields for any existing Post Type (Posts, Pages, etc), even those created by plugins or themes
43
- * Taxonomies - Create and manage fields for any existing Taxonomies (Categories, Tags, etc), even those created by plugins or themes
44
- * Media - Create and manage fields for your media uploads, easily add additional information and context to any file you want
45
- * Users - Create and manage fields for your user profiles, this is truly the bees knees!
46
- * Comments - Create and manage fields for your visitor comments, easily add fields to fit the way you use comments as reviews and more
47
 
48
- = Use our field types, or make your own =
49
- We have a lot of common field types available for you to use, or you can build your own with our extensible field type classes.
 
 
50
 
51
- Each of these field type have their own set of options, if those aren't enough they are also easily extended:
52
 
53
- * Date / Time - Date, Time, or both
54
- * Number - Plain Number or Currency
55
- * Text - Plain Text, Website, Phone, E-mail, or Password
56
- * Paragraph Text - Plain Paragraph, WYSIWYG (TinyMCE or CLEditor, or add your own), or Code (Syntax Highlighting)
57
- * Color Picker - Choose colors, because colors are great
58
- * Yes / No - You can't really go wrong with a checkbox, but we've added a few charms to make it stand out
59
- * File / Image / Video - Upload new media or select from existing ones with our Media Library integration, or use a simple uploader, your choice
60
- * Avatars - Upload new media or select from existing ones, automatically integrates with get_avatar calls for Users extended by Pods
61
- * Relationships - Relate any item, to any item of any WP object type, another Pod, or a custom user-defined list -- with bidirectional relationships
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  = Relationships to rule the world with =
64
 
65
- * Custom defined list
66
- * Post Types
67
- * Taxonomies
68
- * Users
69
- * User Roles
70
- * User Capabilities
71
- * Media
72
- * Comments
73
 
74
- And many other relationships are also available including:
75
-
76
- * Image Sizes
77
- * Navigation Menus
78
- * Post Formats
79
- * Post Status
80
- * Sidebars
81
- * Countries (predefined)
82
- * US States (predefined)
83
- * Days of Week (predefined)
84
- * Months of Year (predefined)
85
-
86
- = Easily display your content =
87
- There are several ways to get Pods data to show up throughout your site, but with any WP object type you create or extend with Pods, you can use all of the functions and methods you're already used to with the core WordPress API / Loop -- out of the box!
88
 
89
- Additionally, we have a United Theming API that lets you theme your content types across every type of Pod, regardless if it's a post type or taxonomy or user, or.. you get the picture.
90
 
91
- = Customized Management Panels =
92
- Utilize Pods UI (included in Pods 1.10+) to build your own Custom Management panels for your Pods.
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  = Optional Components to do even more =
95
  You can enable some of our included components to extend your WordPress site even further:
96
 
97
- * Roles and Capabilities - Create or edit Roles for your site, and customize their corresponding capabilities
98
- * Pages - Create custom pages that function off of your site's path, with wildcard support, and choose the Page Template to use
99
- * Templates - Use our template engine to create templates that can be handed off to clients for carefree management
100
- * Helpers - Customize how Pods works right from the admin area with simple to advanced reusable code snippets
101
- * Advanced Content Types - These types of content were built into Pods prior to 2.3, but are now optionally enabled
102
- * Table Storage - Enable table-based storage for custom fields on Post Types, Media, Users, and Comments. Also adds the ability to add custom fields to Taxonomies
103
- * Advanced Relationships - Add advanced relationship objects for relating to including Database Tables, Multisite Networks, Multisite Sites, Themes, Page Templates, Sidebars, Post Type Objects, and Taxonomy Objects
104
- * Markdown Syntax - Parses Markdown Syntax for Paragraph Text / WYSIWYG fields
105
- * Builder theme integration - Use our tightly integrated modules for Builder in your layouts
106
-
107
- = Migrate to Pods, find out what you've been missing =
108
- Using another solution? We've built additional components to help you transition:
109
-
110
- * Import from Custom Post Type UI
111
- * More imports coming soon including Importing from Custom Field Suite, Advanced Custom Fields, and Custom Tables
112
 
113
  = Plays well with others =
 
114
  We also do our best to integrate and play nicely with other projects:
115
 
116
- * Plugins we've integrated with
117
  * [Tabify Edit Screen](http://wordpress.org/plugins/tabify-edit-screen/)
118
  * [Codepress Admin Columns](http://wordpress.org/plugins/codepress-admin-columns/)
119
  * [Polylang](http://wordpress.org/plugins/polylang/)
@@ -123,7 +136,7 @@ We also do our best to integrate and play nicely with other projects:
123
  * [Timber](http://upstatement.com/timber/)
124
  * [Gravity Forms](http://www.gravityforms.com/) Using the [Pods Gravity Forms Add-on](https://wordpress.org/plugins/pods-gravity-forms/)
125
  * [Beaver Builder](https://www.wpbeaverbuilder.com/) and [Beaver Themer](https://www.wpbeaverbuilder.com/beaver-themer/) Using the [Pods Beaver Themer Add-On](https://wordpress.org/plugins/pods-beaver-builder-themer-add-on/)
126
- * Themes we've integrated with
127
  * [Builder](http://www.ithemes.com/) (iThemes)
128
  * [Genesis](http://www.studiopress.com/) (StudioPress)
129
 
@@ -140,7 +153,7 @@ OR you can just install it with WordPress by going to Plugins >> Add New >> and
140
 
141
  = Where do we go for Support on your plugin? =
142
 
143
- Our primary Support is handled through our Support Forums at [https://pods.io/forums/](https://pods.io/forums/). For the fastest support, you can contact us on our Slack Chat at [https://pods.io/chat/](https://pods.io/chat/) in the #support channel. We do not staff our Slack channel 24 hours, but we do check any questions that come through daily and reply to any unanswered questions.
144
 
145
  We do have a community of Pods users and developers that hang out on Slack so you're sure to get an answer quickly. We answer our Forum questions once a week with follow-up during the week as we're prioritizing resources towards restructuring and improving our documentation.
146
 
@@ -150,7 +163,7 @@ If you’ve uncovered a Bug or have a Feature Request, we kindly request you to
150
 
151
  = Will Pods work with my Theme? =
152
 
153
- We don't provide any special CSS or display attributes with your custom content so as long as your theme works with WordPress standard functions and the [WordPress Template Hierarchy](https://wphierarchy.com), you should be fine. You may need to create special PHP WordPress Theme Templates for your content, or you can use our Pods Templates and the Auto Template option to display your 'template' containing your custom content where your theme normally outputs `the_content` filter.
154
 
155
  == Screenshots ==
156
 
@@ -165,20 +178,50 @@ We don't provide any special CSS or display attributes with your custom content
165
 
166
  == Contributors ==
167
 
168
- Pods really wouldn't be where it is without all of the contributions both financially and through code / time. Check out our GitHub for a list of contributors, or search our GitHub issues to see everyone involved in adding features, fixing bugs, or reporting issues/testing.
169
-
170
- [github.com/pods-framework/pods/graphs/contributors](https://github.com/pods-framework/pods/graphs/contributors)
171
 
172
  == Translations ==
173
 
174
- Many thanks go out to the fine folks who have helped us translate Pods into other languages other than English!
175
 
176
  Join us in further translating the Pods interface at: [https://translate.wordpress.org/projects/wp-plugins/pods](https://translate.wordpress.org/projects/wp-plugins/pods)
177
 
178
- We also have a dedicated [Slack Chat](https://pods.io/chat/) channel to help our translators get started and to support them on the process.
179
 
180
  == Changelog ==
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  = 2.7.15 - September 5th 2019 =
183
 
184
  **Enhancements**
3
  Donate link: https://pods.io/friends-of-pods/
4
  Tags: pods, custom post types, custom taxonomies, content types, custom fields, cck, database, user fields, comment fields, media fields, relationships, drupal
5
  Requires at least: 4.5
6
+ Tested up to: 5.3
7
  Requires PHP: 5.3
8
+ Stable tag: 2.7.16.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
  Pods is a framework for creating, managing, and deploying customized content types and fields.
13
 
14
  == Description ==
 
15
 
16
+ Manage all your custom content needs in one location with the Pods Framework.
 
 
17
 
18
+ * **Create content types** including custom post types, custom taxonomies and advanced content types using custom tables (separate from WordPress)
19
+ * **Extend and customize content types** including posts, pages, categories, tags, users, and media
20
+ * **Create custom settings pages** easily within seconds
21
+ * **Add custom fields** to *any* content type or settings page
22
+ * **Show your fields** anywhere using our [shortcodes](https://docs.pods.io/displaying-pods/pods-shortcode/), [widgets](https://pods.io/2015/05/03/podscast-005-templates-shortcodes-widgets-displaying-data-in-pods-pt-3/), the code-free [Pods Template](https://pods.io/2015/05/03/podscast-005-templates-shortcodes-widgets-displaying-data-in-pods-pt-3/) approach, or our [automatic theme integration](https://docs.pods.io/displaying-pods/wordpress-theme-templates/)
23
+ * **Create connections** between any of your content with [relationship fields](https://docs.pods.io/fields/relationship-fields/) to keep your content organized
24
+
25
+ Let Pods help you grow your development skills and manage content beyond the standard WordPress Posts & Pages. Check out our [Documentation](https://docs.pods.io/), [Support Forums](https://wordpress.org/support/plugin/pods/), and our [Live Slack Chat](https://pods.io/chat/) to help you build your dream project with Pods.
26
 
27
  = Introduction =
28
+
29
  [youtube http://www.youtube.com/watch?v=bYEE2i3nPOM]
30
 
31
  = Content types that evolve with your needs =
 
32
 
33
+ Create any type of content that you want -- small or large -- we've got you covered. Every content type created with Pods gets all the love it needs to grow up big and strong. You'll get an easy to use interface that lets you manage custom fields and how your content type will look or function.
34
 
35
  = Create new content types =
 
 
 
 
 
 
36
 
37
+ With Pods, you can create entirely new content types and settings pages.
 
 
 
 
 
 
 
38
 
39
+ * **Custom Post Types** - Content types that look and function like Posts and Pages, but in their own separate sections of WordPress
40
+ * **Custom Taxonomies** - Content types that look and function like Categories and Tags, but in their own separate sections of WordPress
41
+ * **Custom Settings Pages** - Create custom settings under Settings menu to help organize your site's custom global settings
42
+ * **Advanced Content Types** - These are entirely separate from WordPress and function off their own database tables (much like the [Drupal CCK](https://www.drupal.org/project/cck))
43
 
44
+ = Extend existing content types =
45
 
46
+ Need to customize your existing content types in WordPress? We offer the ability to extend existing content types across all of WordPress:
47
+
48
+ * **Post Types** - Customize and create/manage fields for any existing post type -- Posts, Pages, and even those created by plugins or themes
49
+ * **Taxonomies** - Customize and create/manage fields for any existing taxonomy -- Categories, Tags, and even those created by plugins or themes
50
+ * **Media** - Create and manage fields for your media uploads to enable you to fill in additional information and context to any image/file you want
51
+ * **Users** - Create and manage fields for your user/author profiles
52
+ * **Comments** - Create and manage fields for your visitor comments, easily add fields to fit the way you use comments as reviews and more
53
+
54
+ = Field Types =
55
+
56
+ We have an extensive collection of fields that you can leverage to build the perfect content structure for your site. You can also build your own custom field types with our extensible field type classes.
57
+
58
+ * **Text**
59
+ * Plain Text
60
+ * Website
61
+ * Phone
62
+ * E-mail
63
+ * Password
64
+ * **Paragraph**
65
+ * Plain Paragraph Text
66
+ * WYSIWYG (Visual Editor)
67
+ * Code (Syntax Highlighting)
68
+ * **Date / Time**
69
+ * Date and Time
70
+ * Date
71
+ * Time
72
+ * **Number**
73
+ * Plain Number
74
+ * Currency (30+ international currencies)
75
+ * **Relationships / Media**
76
+ * File / Image / Video
77
+ * Avatar (for extended Users)
78
+ * oEmbed
79
+ * Relationship
80
+ * **Checkbox** (Yes / No)
81
+ * **Color Picker**
82
 
83
  = Relationships to rule the world with =
84
 
85
+ The power is in your hands with our comprehensive support to **relate your content to anything**.
 
 
 
 
 
 
 
86
 
87
+ * **Custom defined lists** of text options
88
+ * Relate to **Post Type** content
89
+ * Relate to **Taxonomy** content
90
+ * Relate to any **User** profile
91
+ * Relate to **User Roles**
92
+ * Relate to **User Capabilities**
93
+ * Relate to **Media** attachments
94
+ * Relate to any **Comment**
 
 
 
 
 
 
95
 
96
+ And many other relationships are also available including:
97
 
98
+ * **Image Sizes**
99
+ * **Navigation Menus**
100
+ * **Post Formats**
101
+ * **Post Status**
102
+ * Relate to content within **any Database Table**
103
+ * **Themes**
104
+ * **Page Templates**
105
+ * **Sidebars**
106
+ * **Post Type Objects** (choose the post type itself)
107
+ * **Taxonomy Objects** (choose the taxonomy itself)
108
+ * **Countries** (predefined)
109
+ * **US States** (predefined)
110
+ * **Canadian Provinces** (predefined)
111
+ * **Calendar - Days of Week** (predefined)
112
+ * **Calendar - Months of Year** (predefined)
113
 
114
  = Optional Components to do even more =
115
  You can enable some of our included components to extend your WordPress site even further:
116
 
117
+ * **Roles and Capabilities** - Create or edit Roles for your site, and customize their corresponding capabilities
118
+ * **Templates** - Use our template engine to create templates that can be handed off to clients for care-free management
119
+ * **Advanced Relationships** - Add advanced relationship objects for relating to including Database Tables, Multisite Networks, Multisite Sites, Themes, Page Templates, Sidebars, Post Type Objects, and Taxonomy Objects
120
+ * **Advanced Content Types** - These types of content were built into Pods prior to 2.3, but are now optionally enabled
121
+ * **Table Storage** - Enable table-based storage for custom fields on Post Types, Media, Users, and Comments. Also adds the ability to add custom fields to Taxonomies
122
+ * **Markdown Syntax** - Parses Markdown Syntax for Paragraph Text / WYSIWYG fields
123
+ * **Pages** - Create custom pages that function off of your site's URL path, with wildcard support, and choose the Page Template to use
 
 
 
 
 
 
 
 
124
 
125
  = Plays well with others =
126
+
127
  We also do our best to integrate and play nicely with other projects:
128
 
129
+ * **Plugins we've integrated with**
130
  * [Tabify Edit Screen](http://wordpress.org/plugins/tabify-edit-screen/)
131
  * [Codepress Admin Columns](http://wordpress.org/plugins/codepress-admin-columns/)
132
  * [Polylang](http://wordpress.org/plugins/polylang/)
136
  * [Timber](http://upstatement.com/timber/)
137
  * [Gravity Forms](http://www.gravityforms.com/) Using the [Pods Gravity Forms Add-on](https://wordpress.org/plugins/pods-gravity-forms/)
138
  * [Beaver Builder](https://www.wpbeaverbuilder.com/) and [Beaver Themer](https://www.wpbeaverbuilder.com/beaver-themer/) Using the [Pods Beaver Themer Add-On](https://wordpress.org/plugins/pods-beaver-builder-themer-add-on/)
139
+ * **Themes we've integrated with**
140
  * [Builder](http://www.ithemes.com/) (iThemes)
141
  * [Genesis](http://www.studiopress.com/) (StudioPress)
142
 
153
 
154
  = Where do we go for Support on your plugin? =
155
 
156
+ Our primary Support is handled through our [Support Forums](https://wordpress.org/support/plugin/pods/). For the fastest support, you can contact us on our [Live Slack Chat](https://pods.io/chat/) in the #support channel. We do not staff our Slack channel 24/7, but we do check any questions that come through daily and reply to any unanswered questions.
157
 
158
  We do have a community of Pods users and developers that hang out on Slack so you're sure to get an answer quickly. We answer our Forum questions once a week with follow-up during the week as we're prioritizing resources towards restructuring and improving our documentation.
159
 
163
 
164
  = Will Pods work with my Theme? =
165
 
166
+ Most likely the answer is yes. We don't require any special CSS or display attributes to use Pods with your theme so you should have little to no difficulty showing your content in your theme. If you encounter any issues, contact your theme developer and ask them about their support for the standard WordPress theming functions and how to use [WordPress Template Hierarchy](https://wphierarchy.com) with their theme.
167
 
168
  == Screenshots ==
169
 
178
 
179
  == Contributors ==
180
 
181
+ Pods really wouldn't be where it is without all of the contributions from our [donors](https://friends.pods.io) and [code/support contributors](https://github.com/pods-framework/pods/graphs/contributors).
 
 
182
 
183
  == Translations ==
184
 
185
+ Many thanks go out to the fine folks who have helped us translate Pods into many other languages.
186
 
187
  Join us in further translating the Pods interface at: [https://translate.wordpress.org/projects/wp-plugins/pods](https://translate.wordpress.org/projects/wp-plugins/pods)
188
 
189
+ We are also available through our [Live Slack Chat](https://pods.io/chat/) to help our translators get started and to support them on the process.
190
 
191
  == Changelog ==
192
 
193
+ = 2.7.16.1 - November 13th 2019 =
194
+
195
+ * Fixed: Reverted changes in #5289 to auto templates that introduced breaking changes. We will revisit this in a future maintenance release. #5531
196
+
197
+ = 2.7.16 - November 13th 2019 =
198
+
199
+ **Enhancements**
200
+ * Enhancement: CSS fixes for WP 5.3. #5501 (@JoryHogeveen)
201
+ * Enhancement: Format traversed fields properly. #4932 (@jamesgol)
202
+ * Enhancement: ACT list view pagination. #5510 (@JoryHogeveen)
203
+ * Enhancement: Add PODS_SHORTCODE_ALLOW_EVALUATE_TAGS to debug info. #5310 (@JoryHogeveen)
204
+
205
+ **Bug Fixes**
206
+ * Fixed: Avoid SQL errors when using special magic tags. #5310 (@sc0ttkclark)
207
+ * Fixed: Validate shortcode query tags before default to current object. #5520 (@JoryHogeveen)
208
+ * Fixed: Unslash simple relationship values to support saving quoted values. #5517 (@JoryHogeveen)
209
+ * Fixed: Add sanitize_title optional to sluggables instead of applying default. #5516 (@JoryHogeveen)
210
+ * Fixed: DateTime: Always parse any manual input data. Also fixes clearing values. #5488 (@JoryHogeveen)
211
+ * Fixed: DateTime: jQuery date & time picker overlapping formats. #5467 (@JoryHogeveen)
212
+ * Fixed: DateTime: Fix datetime-local HTML5 input format. #5460 (@JoryHogeveen)
213
+ * Fixed: Could not submit a form if required checkbox not ticked. #5481 (@Turkal)
214
+ * Fixed: Allow migrate packages to import pages. #5476 (@jamesgol)
215
+ * Fixed: Allow pods_str_replace() function to handle non-strings. #5254 (@jamesgol)
216
+ * Fixed: Refactor and fix issues with Advanced Content Types capabilities. #5504 (@JoryHogeveen)
217
+ * Fixed: Add `object` key to prevent undefined index notice. #5493 (@JoryHogeveen)
218
+ * Fixed: Make sure number of arguments passed to PodsMeta->save_post() is correct. #5512 (@jamesgol)
219
+ * Fixed: ACT pagination URL for child type. #5510 (@JoryHogeveen)
220
+ * Fixed: Custom table relationships SQL error. #5505 (@JoryHogeveen)
221
+ * Fixed: Allow Pods to ALTER table if the SQL field definition has changed. #5507 (@jamesgol)
222
+ * Fixed: Admin menu: set hook priority to 9 instead of 99 to fix CPT submenu placement. #5497 (@JoryHogeveen)
223
+ * Fixed: Make auto templates for a Taxonomy Pod behave sensibly. #5289 (@gwhitney, @sc0ttkclark, @JoryHogeveen)
224
+
225
  = 2.7.15 - September 5th 2019 =
226
 
227
  **Enhancements**
ui/admin/setup-edit-field-fluid.php CHANGED
@@ -80,7 +80,7 @@ $pick_object = trim( pods_v_sanitized( 'pick_object', $field ) . '-' . pods_v_sa
80
  'maxlength' => 50,
81
  'data-sluggable' => 'field_data[' . $pods_i . '][label]',
82
  ),
83
- 'class' => 'pods-validate pods-validate-required pods-slugged-lower',
84
  )
85
  );
86
  ?>
80
  'maxlength' => 50,
81
  'data-sluggable' => 'field_data[' . $pods_i . '][label]',
82
  ),
83
+ 'class' => 'pods-validate pods-validate-required pods-slugged-lower pods-slugged-sanitize-title',
84
  )
85
  );
86
  ?>
ui/fields/datetime.php CHANGED
@@ -45,7 +45,7 @@ $args = array(
45
 
46
  if ( $use_date ) {
47
  $args['dateFormat'] = PodsForm::field_method( $form_field_type, 'format_date', $options, true );
48
- $args['altFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_date_format );
49
  $args['changeMonth'] = true;
50
  $args['changeYear'] = true;
51
  $args['firstDay'] = (int) get_option( 'start_of_week', 0 );
@@ -57,8 +57,9 @@ if ( $use_date ) {
57
  }
58
  if ( $use_time ) {
59
  $args['timeFormat'] = PodsForm::field_method( $form_field_type, 'format_time', $options, true );
60
- $args['altTimeFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_time_format );
61
  $args['ampm'] = ( false !== stripos( $args['timeFormat'], 'tt' ) );
 
62
  }
63
 
64
  $mysql_format = '';
@@ -97,7 +98,7 @@ switch ( $form_field_type ) {
97
  $date = PodsForm::field_method( $form_field_type, 'createFromFormat', $format, (string) $value );
98
  $date_default = PodsForm::field_method( $form_field_type, 'createFromFormat', $mysql_format, (string) $value );
99
 
100
- $formatted_value = $value;
101
  $mysql_value = $value;
102
 
103
  $empty_values = array(
@@ -126,8 +127,13 @@ if (
126
  }
127
 
128
  if ( $html5 ) {
129
- // HTML5 uses mysql date format.
130
- $value = $mysql_value;
 
 
 
 
 
131
  }
132
  }
133
 
@@ -146,15 +152,11 @@ $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type,
146
  <input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
147
 
148
  <script>
149
- jQuery( function () {
150
- var $container = jQuery( '<div>' ).appendTo( 'body' ).addClass( 'pods-compat-container' ),
151
- $element = jQuery( 'input#<?php echo esc_js( $attributes['id'] ); ?>' ),
152
- beforeShow = {
153
- 'beforeShow': function( textbox, instance) {
154
- jQuery( '#ui-datepicker-div' ).appendTo( $container );
155
- }
156
- },
157
- args = jQuery.extend( <?php echo json_encode( $args ); ?>, beforeShow );
158
 
159
  <?php
160
  if ( 'text' !== $type ) {
@@ -165,38 +167,44 @@ $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type,
165
  input.setAttribute( 'type', '<?php echo $type; ?>' );
166
 
167
  var notADateValue = 'not-a-date';
168
- input.setAttribute('value', notADateValue);
169
 
170
- return (input.value !== notADateValue);
171
  }
172
 
173
  if ( ! podsCheckHtml5() ) {
174
- args = altField( args, $element );
175
  $element.val( '<?php echo esc_js( $formatted_value ); ?>' );
176
- $element.<?php echo esc_js( $method ); ?>( args );
177
  }
178
  <?php
179
  } else {
180
  ?>
181
- args = altField( args, $element );
182
- $element.<?php echo esc_js( $method ); ?>( args );
183
  <?php
184
- }//end if
185
  ?>
186
- function altField( args, el ) {
187
- var $el = $( el ),
188
- $alt = $el.clone();
189
 
 
 
190
  $alt.attr( 'type', 'hidden' );
191
  $alt.val( '<?php echo esc_attr( $mysql_value ) ?>' );
192
- $el.after( $alt );
193
-
194
- $el.attr( 'name', $el.attr( 'name' ) + '__ui' );
195
- $el.attr( 'id', $el.attr( 'id' ) + '__ui' );
196
 
 
197
  args.altField = 'input#' + $alt.attr( 'id' );
 
 
 
 
 
 
 
 
198
 
199
- return args;
200
- };
201
  } );
202
  </script>
45
 
46
  if ( $use_date ) {
47
  $args['dateFormat'] = PodsForm::field_method( $form_field_type, 'format_date', $options, true );
48
+ $args['altFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_date_format, array( 'type' => 'date' ) );
49
  $args['changeMonth'] = true;
50
  $args['changeYear'] = true;
51
  $args['firstDay'] = (int) get_option( 'start_of_week', 0 );
57
  }
58
  if ( $use_time ) {
59
  $args['timeFormat'] = PodsForm::field_method( $form_field_type, 'format_time', $options, true );
60
+ $args['altTimeFormat'] = PodsForm::field_method( $form_field_type, 'convert_format', $mysql_time_format, array( 'type' => 'time' ) );
61
  $args['ampm'] = ( false !== stripos( $args['timeFormat'], 'tt' ) );
62
+ $args['parse'] = 'loose';
63
  }
64
 
65
  $mysql_format = '';
98
  $date = PodsForm::field_method( $form_field_type, 'createFromFormat', $format, (string) $value );
99
  $date_default = PodsForm::field_method( $form_field_type, 'createFromFormat', $mysql_format, (string) $value );
100
 
101
+ $formatted_value = PodsForm::field_method( $form_field_type, 'format_value_display', $value, $options, true );
102
  $mysql_value = $value;
103
 
104
  $empty_values = array(
127
  }
128
 
129
  if ( $html5 ) {
130
+ /**
131
+ * HTML5 uses mysql date format separated with a T.
132
+ * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
133
+ */
134
+ $value = str_replace( ' ', 'T', $mysql_value );
135
+ } else {
136
+ $value = $formatted_value;
137
  }
138
  }
139
 
152
  <input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
153
 
154
  <script>
155
+ jQuery( function ( $ ) {
156
+ var $container = $( '<div>' ).appendTo( 'body' ).addClass( 'pods-compat-container' ),
157
+ $element = $( 'input#<?php echo esc_js( $attributes['id'] ); ?>' ),
158
+ $alt = null,
159
+ args = <?php echo wp_json_encode( $args ); ?>;
 
 
 
 
160
 
161
  <?php
162
  if ( 'text' !== $type ) {
167
  input.setAttribute( 'type', '<?php echo $type; ?>' );
168
 
169
  var notADateValue = 'not-a-date';
170
+ input.setAttribute( 'value', notADateValue );
171
 
172
+ return ( input.value !== notADateValue );
173
  }
174
 
175
  if ( ! podsCheckHtml5() ) {
 
176
  $element.val( '<?php echo esc_js( $formatted_value ); ?>' );
177
+ jQueryField();
178
  }
179
  <?php
180
  } else {
181
  ?>
182
+ jQueryField();
 
183
  <?php
184
+ } //end if
185
  ?>
186
+ function jQueryField() {
 
 
187
 
188
+ // Create alt field.
189
+ $alt = $element.clone();
190
  $alt.attr( 'type', 'hidden' );
191
  $alt.val( '<?php echo esc_attr( $mysql_value ) ?>' );
192
+ $element.after( $alt );
193
+ $element.attr( 'name', $element.attr( 'name' ) + '__ui' );
194
+ $element.attr( 'id', $element.attr( 'id' ) + '__ui' );
 
195
 
196
+ // Add alt field option.
197
  args.altField = 'input#' + $alt.attr( 'id' );
198
+ // Fix manual user input changes.
199
+ args.onClose = function() {
200
+ $element.<?php echo esc_js( $method ); ?>( 'setDate', $element.val() );
201
+ };
202
+ // Wrapper.
203
+ args.beforeShow = function( textbox, instance ) {
204
+ $( '#ui-datepicker-div' ).appendTo( $container );
205
+ };
206
 
207
+ $element.<?php echo esc_js( $method ); ?>( args );
208
+ }
209
  } );
210
  </script>
ui/images/spinner.gif CHANGED
File without changes
ui/js/jquery.pods.js CHANGED
@@ -513,40 +513,55 @@
513
  sluggable_single : function ( sluggable ) {
514
  var $slug = $( 'input[name="' + sluggable.replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]' );
515
 
516
- if ( $slug[ 0 ] ) {
517
- $( 'form' ).on( 'change', 'input[name="' + sluggable.replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]', function () {
518
- if ( 0 < $( this ).val().length ) {
519
- var slug = $( this ).val();
520
-
521
- slug = slug.replace( /<( ?:. )*?>/g, '' ).replace( /([^0-9a-zA-Z\_\- ])/g, '' );
522
-
523
- // update fields
524
- $( 'input.pods-slugged[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]' ).each( function () {
525
- if ( '' === $( this ).val() ) {
526
- $( this ).val( slug.charAt( 0 ).toUpperCase() + slug.slice( 1 ) );
527
- $( this ).trigger( 'change' );
528
- }
529
- } );
530
- $( 'input.pods-slugged-lower[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]' ).each( function () {
531
- if ( '' === $( this ).val() ) {
532
- $( this ).val( slug.toLowerCase() );
533
- $( this ).trigger( 'change' );
534
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  } );
536
-
537
- // update elements and trigger change
538
- $( '.pods-slugged-lower[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]:not(input )' )
539
- .html( slug.toLowerCase() )
540
- .trigger( 'change' );
541
-
542
- // trigger change
543
- $( '.pods-slugged[data-sluggable="' + $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]:not(input )' )
544
- .html( slug.charAt( 0 ).toUpperCase() + slug.slice( 1 ) )
545
- .trigger( 'change' );
546
  }
547
  } );
548
 
549
- if ( 0 < $slug.val().length ) {
550
  $slug.trigger( 'change' );
551
  }
552
  }
513
  sluggable_single : function ( sluggable ) {
514
  var $slug = $( 'input[name="' + sluggable.replace( '[', '\\[' ).replace( ']', '\\]' ) + '"]' );
515
 
516
+ if ( $slug.length ) {
517
+ $slug.on( 'change', function () {
518
+ // Strip HTML/code.
519
+ var slug = $( this ).val().replace( /<( ?:. )*?>/g, '' ),
520
+ name = $( this ).prop( 'name' ).replace( '[', '\\[' ).replace( ']', '\\]' );
521
+
522
+ if ( slug.length ) {
523
+
524
+ var slug_lower = slug.toLowerCase(),
525
+ slug_sanitized = slug.replace( /([^0-9a-zA-Z\_\- ])/g, '' ),
526
+ slug_sanitized_lower = slug_sanitized.toLowerCase();
527
+
528
+ slug = slug.charAt( 0 ).toUpperCase() + slug.slice( 1 );
529
+
530
+ // Update elements and trigger change.
531
+ $( '.pods-slugged[data-sluggable="' + name + '"], .pods-slugged-lower[data-sluggable="' + name + '"]' ).each( function() {
532
+ var $this = $( this ),
533
+ lowercase = $this.hasClass( 'pods-slugged-lower' ),
534
+ sanitize_title = $this.hasClass( 'pods-slugged-sanitize-title' ),
535
+ val = slug;
536
+
537
+ if ( sanitize_title ) {
538
+ val = slug_sanitized;
539
+ if ( lowercase ) {
540
+ val = slug_sanitized_lower;
541
+ }
542
+ } else if ( lowercase ) {
543
+ val = slug_lower;
544
+ }
545
+
546
+ switch ( this.nodeName.toLowerCase() ) {
547
+ case 'input':
548
+ case 'textarea':
549
+ // Update fields.
550
+ if ( '' === $this.val() ) {
551
+ $this.val( val );
552
+ }
553
+ break;
554
+ default:
555
+ // Update html.
556
+ $this.html( val );
557
+ break;
558
+ }
559
+ $this.trigger( 'change' );
560
  } );
 
 
 
 
 
 
 
 
 
 
561
  }
562
  } );
563
 
564
+ if ( $slug.val().length ) {
565
  $slug.trigger( 'change' );
566
  }
567
  }
ui/js/pods-dfv/_src/core/iframe-frame.js CHANGED
@@ -28,9 +28,6 @@ export const IframeFrame = wp.media.view.Frame.extend( {
28
 
29
  this.on( 'title:create:default', this.createTitle, this );
30
  this.title.mode( 'default' );
31
- this.on( 'title:render', function ( view ) {
32
- view.$el.append( '<span class="dashicons dashicons-arrow-down"></span>' );
33
- } );
34
  },
35
 
36
  initState: function () {
28
 
29
  this.on( 'title:create:default', this.createTitle, this );
30
  this.title.mode( 'default' );
 
 
 
31
  },
32
 
33
  initState: function () {