Pods – Custom Content Types and Fields - Version 2.7.21

Version Description

  • June 30th 2020 =

New Features & Enhancements

  • Added: New filter: pods_field_pick_object_data_params. #5756 (@JoryHogeveen)
  • Added: Pods fields & magic tags: Traverse through serialized metadata. #5603 (@JoryHogeveen)
  • Added: Support get_query_var() in pods_v (and thus special magic tags: {@query.##}). #5719 (@JoryHogeveen)
  • Added: WYSIWYG field option for custom editor height. #5673 (@JoryHogeveen)
  • Enhancement: REST field options: Only display depth for array response type. #5714 (@JoryHogeveen)
  • Updated: Refactor Pods::field() method. #5682 (@JoryHogeveen)

Bug Fixes

  • Fixed: Relationship dropdown error & encoding. #5740 (@JoryHogeveen)
  • Fixed: Getting single vs multiple metadata values edge case errors. #5661 (@JoryHogeveen)
  • Fixed: Nested relationship fields should render as array of objects in REST. #5745 (@lkraav)
  • Fixed: Add noopener and noreferrer for all target _blank links. #5742 (@JoryHogeveen)
  • Fixed: Only check delete_users for single installations in pods_is_admin(). #5712 (@JoryHogeveen)
  • Fixed: Deprecated taxonomy form actions. #5700 (@JoryHogeveen)
  • Fixed: DateTime field: Allow input values compatible with the display format. #5687 (@JoryHogeveen)
  • Fixed: Whitespace trimming for templates. #5672 (@sc0ttkclark)
  • Fixed: Taxonomy option rewrite with front label tooltip. #5681 (@JoryHogeveen)
  • Fixed: Pods test factory compatibility with WP core text factory. #5716 (@JoryHogeveen)
Download this release

Release Info

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

Code changes from version 2.7.20.1 to 2.7.21

classes/Pods.php CHANGED
@@ -890,58 +890,102 @@ class Pods implements Iterator {
890
 
891
  $params->traverse = array();
892
 
893
- if ( in_array( $params->name, array(
894
  '_link',
895
  'detail_url',
896
- ), true ) || ( in_array( $params->name, array(
897
  'permalink',
898
  'the_permalink',
899
- ), true ) && in_array( $this->pod_data['type'], array(
 
 
900
  'post_type',
901
  'taxonomy',
902
  'media',
903
  'user',
904
  'comment',
905
- ), true ) ) ) {
 
 
 
 
 
 
 
906
  if ( 0 < strlen( $this->detail_page ) ) {
907
  $value = get_home_url() . '/' . $this->do_magic_tags( $this->detail_page );
908
- } elseif ( in_array( $this->pod_data['type'], array( 'post_type', 'media' ), true ) ) {
909
- $value = get_permalink( $this->id() );
910
- } elseif ( 'taxonomy' === $this->pod_data['type'] ) {
911
- $value = get_term_link( $this->id(), $this->pod_data['name'] );
912
- } elseif ( 'user' === $this->pod_data['type'] ) {
913
- $value = get_author_posts_url( $this->id() );
914
- } elseif ( 'comment' === $this->pod_data['type'] ) {
915
- $value = get_comment_link( $this->id() );
 
 
 
 
 
 
 
 
916
  }
917
  }
918
 
919
- $field_data = false;
920
- $last_field_data = false;
921
- $field_type = false;
922
-
923
- $first_field = explode( '.', $params->name );
924
- $first_field = $first_field[0];
 
 
 
 
 
 
925
 
926
- if ( isset( $this->fields[ $first_field ] ) ) {
927
- $field_data = $this->fields[ $first_field ];
928
- $field_type = 'field';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
929
  } elseif ( ! empty( $this->pod_data['object_fields'] ) ) {
 
930
  if ( isset( $this->pod_data['object_fields'][ $first_field ] ) ) {
931
- $field_data = $this->pod_data['object_fields'][ $first_field ];
932
- $field_type = 'object_field';
 
933
  } else {
934
  $object_fields = (array) $this->pod_data['object_fields'];
935
 
 
936
  foreach ( $object_fields as $object_field => $object_field_opt ) {
937
  if ( in_array( $first_field, $object_field_opt['alias'], true ) ) {
938
  if ( $first_field === $params->name ) {
939
  $params->name = $object_field;
940
  }
941
 
942
- $first_field = $object_field;
943
- $field_data = $object_field_opt;
944
- $field_type = 'object_field';
 
945
 
946
  break;
947
  }
@@ -949,40 +993,51 @@ class Pods implements Iterator {
949
  }
950
  }//end if
951
 
 
 
 
 
 
952
  // Simple fields have no other output options.
953
- if ( 'pick' === $field_data['type'] && in_array( $field_data['pick_object'], $simple_tableless_objects, true ) ) {
954
  $params->output = 'arrays';
955
  }
956
 
957
- if ( empty( $value ) && in_array( $field_data['type'], $tableless_field_types, true ) ) {
 
958
  $params->raw = true;
959
 
960
  $value = false;
961
 
962
- $row_key = sprintf( '_%s_%s', $params->output, $params->name );
963
 
964
  if ( 'arrays' !== $params->output && isset( $this->row[ $row_key ] ) ) {
965
- $value = $this->row[ '_' . $params->output . '_' . $params->name ];
966
  } elseif ( 'arrays' === $params->output && isset( $this->row[ $params->name ] ) ) {
967
  $value = $this->row[ $params->name ];
968
  }
969
 
970
- if ( false !== $value && ! is_array( $value ) && 'pick' === $field_data['type'] && in_array( $field_data['pick_object'], $simple_tableless_objects, true ) ) {
 
 
 
 
 
971
  $value = PodsForm::field_method( 'pick', 'simple_value', $params->name, $value, $field_data, $this->pod_data, $this->id(), true );
972
  }
973
  }
974
 
975
- if ( empty( $value ) && isset( $this->row[ $params->name ] ) && ( ! in_array( $field_data['type'], $tableless_field_types, true ) || 'arrays' === $params->output ) ) {
976
- if ( empty( $field_data ) || in_array( $field_data['type'], array(
977
- 'boolean',
978
- 'number',
979
- 'currency',
980
- ), true ) ) {
981
  $params->raw = true;
982
  }
983
 
984
  if ( null === $params->single ) {
985
- if ( isset( $this->fields[ $params->name ] ) && ! in_array( $this->fields[ $params->name ]['type'], $tableless_field_types, true ) ) {
986
  $params->single = true;
987
  } else {
988
  $params->single = false;
@@ -993,31 +1048,34 @@ class Pods implements Iterator {
993
  } elseif ( empty( $value ) ) {
994
  $object_field_found = false;
995
 
996
- if ( 'object_field' === $field_type ) {
997
  $object_field_found = true;
998
 
999
  if ( isset( $this->row[ $first_field ] ) ) {
1000
  $value = $this->row[ $first_field ];
1001
- } elseif ( in_array( $field_data['type'], $tableless_field_types, true ) ) {
 
1002
  $this->fields[ $first_field ] = $field_data;
1003
 
1004
  $object_field_found = false;
1005
  } else {
1006
  return null;
1007
  }
1008
- }
1009
 
1010
- // Default image field handlers.
1011
- $image_fields = array(
1012
- 'image_attachment',
1013
- 'image_attachment_url',
1014
- );
 
 
 
 
1015
 
1016
- if ( 'post_type' === $this->pod_data['type'] ) {
1017
- $image_fields[] = 'post_thumbnail';
1018
- $image_fields[] = 'post_thumbnail_url';
1019
- } elseif ( 'user' === $this->pod_data['type'] && ! isset( $this->fields[ $params->name ] ) ) {
1020
- if ( ! isset( $this->fields['avatar'] ) && ( 'avatar' === $params->name || 0 === strpos( $params->name, 'avatar.' ) ) ) {
1021
  $size = null;
1022
 
1023
  if ( 0 === strpos( $params->name, 'avatar.' ) ) {
@@ -1035,116 +1093,88 @@ class Pods implements Iterator {
1035
  }
1036
 
1037
  $object_field_found = true;
1038
- }
1039
- }
1040
 
1041
- if ( ! $object_field_found ) {
1042
- foreach ( $image_fields as $image_field ) {
1043
- if ( isset( $this->fields[ $image_field ] ) ) {
1044
- // Skip any names that are registered fields within this Pod.
1045
- continue;
1046
- }
1047
- if (
1048
- $image_field === $params->name ||
1049
- 0 === strpos( $params->name, $image_field . '.' )
1050
- ) {
1051
- // Is it a URL request?
1052
- $url = '_url' === substr( $image_field, -4 );
1053
- if ( $url ) {
1054
- $image_field = substr( $image_field, 0, -4 );
1055
- }
1056
 
1057
- // Results in an empty array if no traversal names are passed.
1058
- $traverse_names = explode( '.', $params->name );
1059
- array_shift( $traverse_names );
1060
-
1061
- $attachment_id = 0;
1062
- switch ( $image_field ) {
1063
- case 'post_thumbnail':
1064
- $attachment_id = get_post_thumbnail_id( $this->id() );
1065
- break;
1066
- case 'image_attachment':
1067
- if ( isset( $traverse_names[0] ) ) {
1068
- $attachment_id = $traverse_names[0];
1069
- array_shift( $traverse_names );
1070
- }
1071
- break;
1072
- }
1073
-
1074
- if ( $attachment_id ) {
1075
-
1076
- $size = 'thumbnail';
1077
- if ( isset( $traverse_names[0] ) ) {
1078
- $size = $traverse_names[0];
1079
- $sizes = get_intermediate_image_sizes();
1080
- // Not shown by default.
1081
- $sizes[] = 'full';
1082
- $sizes[] = 'original';
1083
- if ( ! in_array( $size, $sizes, true ) ) {
1084
- // No valid image size found.
1085
- $size = false;
1086
- }
1087
- }
1088
 
1089
- if ( $url ) {
1090
- $value = pods_image_url( $attachment_id, $size, 0, true );
 
 
1091
 
1092
- $object_field_found = true;
1093
- break;
 
 
 
 
 
 
 
1094
  }
 
 
1095
 
1096
- if ( $size ) {
1097
- // Pods will auto-get the thumbnail ID if this isn't an attachment.
1098
- $value = pods_image( $attachment_id, $size, 0, null, true );
1099
-
1100
- $object_field_found = true;
1101
- break;
 
 
 
 
 
 
1102
  }
 
1103
 
 
 
 
 
 
 
1104
  // Fallback to attachment Post object to look for other image properties.
1105
  $media = pods( 'media', $attachment_id );
1106
 
1107
  if ( $media && $media->valid() && $media->exists() ) {
1108
- $value = $media->field( implode( '.', $traverse_names ) );
1109
  } else {
1110
  // Fallback to default attachment object.
1111
  $attachment = get_post( $attachment_id );
1112
- $value = pods_v( implode( '.', $traverse_names ), $attachment, '' );
1113
- if ( ! $value ) {
1114
- $meta_key = array_shift( $traverse_names );
1115
- $value = get_post_meta( $attachment_id, $meta_key, true );
1116
-
1117
- // Maybe traverse.
1118
- if ( count( $traverse_names ) ) {
1119
- if ( is_array( $value ) ) {
1120
- foreach ( $traverse_names as $field ) {
1121
- if ( ! isset( $value[ $field ] ) ) {
1122
- $value = null;
1123
-
1124
- break;
1125
- }
1126
 
1127
- $value = $value[ $field ];
1128
- }
1129
- } else {
1130
- $value = null;
1131
- }
 
 
1132
  }
1133
- }
1134
- }
1135
 
1136
- if ( null !== $value ) {
1137
- $object_field_found = true;
1138
- break;
1139
  }
1140
  }
1141
 
1142
- // Already found a matching field name. Stop foreach loop.
1143
- break;
1144
- } //end if
1145
- } //end foreach
 
1146
  }
1147
 
 
1148
  if ( false === $object_field_found ) {
1149
  $params->traverse = array( $params->name );
1150
 
@@ -1154,8 +1184,8 @@ class Pods implements Iterator {
1154
  $params->name = $params->traverse[0];
1155
  }
1156
 
1157
- if ( isset( $this->fields[ $params->name ], $this->fields[ $params->name ]['type'] ) ) {
1158
- $field_type = $this->fields[ $params->name ]['type'];
1159
  /**
1160
  * Modify value returned by field() after its retrieved, but before its validated or formatted
1161
  *
@@ -1177,35 +1207,25 @@ class Pods implements Iterator {
1177
 
1178
  $simple = false;
1179
 
1180
- if ( isset( $this->fields[ $params->name ] ) ) {
1181
- if ( 'meta' === $this->pod_data['storage'] && ! in_array( $this->fields[ $params->name ]['type'], $tableless_field_types, true ) ) {
 
1182
  $simple = true;
1183
  }
1184
 
1185
- if ( in_array( $this->fields[ $params->name ]['type'], $tableless_field_types, true ) ) {
1186
  $params->raw = true;
1187
 
1188
- if ( 'pick' === $this->fields[ $params->name ]['type'] && in_array( $this->fields[ $params->name ]['pick_object'], $simple_tableless_objects, true ) ) {
1189
  $simple = true;
1190
  $params->single = true;
1191
  }
1192
- } elseif ( in_array( $this->fields[ $params->name ]['type'], array(
1193
- 'boolean',
1194
- 'number',
1195
- 'currency',
1196
- ), true ) ) {
1197
  $params->raw = true;
1198
  }
1199
  }
1200
 
1201
- $is_field_set = isset( $this->fields[ $params->name ] );
1202
- $is_tableless_field = false;
1203
-
1204
- if ( $is_field_set ) {
1205
- $is_tableless_field = in_array( $this->fields[ $params->name ]['type'], $tableless_field_types, true );
1206
- }
1207
-
1208
- if ( $simple || ! $is_field_set || ! $is_tableless_field ) {
1209
  if ( null === $params->single ) {
1210
  if ( $is_field_set && ! $is_tableless_field ) {
1211
  $params->single = true;
@@ -1214,35 +1234,30 @@ class Pods implements Iterator {
1214
  }
1215
  }
1216
 
1217
- $no_conflict = pods_no_conflict_check( $this->pod_data['type'] );
1218
 
1219
  if ( ! $no_conflict ) {
1220
- pods_no_conflict_on( $this->pod_data['type'] );
 
1221
  }
1222
 
1223
- if ( in_array( $this->pod_data['type'], array(
1224
- 'post_type',
1225
- 'media',
1226
- 'taxonomy',
1227
- 'user',
1228
- 'comment',
1229
- ), true ) ) {
1230
  $id = $this->id();
1231
 
1232
- $metadata_type = $this->pod_data['type'];
1233
 
1234
- if ( in_array( $this->pod_data['type'], array( 'post_type', 'media' ), true ) ) {
1235
  $metadata_type = 'post';
1236
 
1237
  // Support for WPML 'duplicated' translation handling.
1238
  if ( did_action( 'wpml_loaded' ) && apply_filters( 'wpml_is_translated_post_type', false, $this->pod_data['name'] ) ) {
1239
  $master_post_id = (int) apply_filters( 'wpml_master_post_from_duplicate', $id );
1240
 
1241
- if ( 0 < $master_post_id ) {
1242
  $id = $master_post_id;
1243
  }
1244
  }
1245
- } elseif ( 'taxonomy' === $this->pod_data['type'] ) {
1246
  $metadata_type = 'term';
1247
  }
1248
 
@@ -1250,14 +1265,14 @@ class Pods implements Iterator {
1250
 
1251
  $single_multi = 'single';
1252
 
1253
- if ( $is_field_set ) {
1254
- $single_multi = pods_v( $this->fields[ $params->name ]['type'] . '_format_type', $this->fields[ $params->name ]['options'], $single_multi );
1255
  }
1256
 
1257
  if ( $simple && ! is_array( $value ) && 'single' !== $single_multi ) {
1258
  $value = get_metadata( $metadata_type, $id, $params->name );
1259
  }
1260
- } elseif ( 'settings' === $this->pod_data['type'] ) {
1261
  $value = get_option( $this->pod_data['name'] . '_' . $params->name, null );
1262
  }//end if
1263
 
@@ -1271,7 +1286,8 @@ class Pods implements Iterator {
1271
  }
1272
 
1273
  if ( ! $no_conflict ) {
1274
- pods_no_conflict_off( $this->pod_data['type'] );
 
1275
  }
1276
  } else {
1277
  // Dot-traversal.
@@ -1317,10 +1333,10 @@ class Pods implements Iterator {
1317
  $last_object = '';
1318
  $last_pick_val = '';
1319
 
1320
- $single_multi = pods_v( $this->fields[ $params->name ]['type'] . '_format_type', $this->fields[ $params->name ]['options'], 'single' );
1321
 
1322
  if ( 'multi' === $single_multi ) {
1323
- $limit = (int) pods_v( $this->fields[ $params->name ]['type'] . '_limit', $this->fields[ $params->name ]['options'], 0 );
1324
  } else {
1325
  $limit = 1;
1326
  }
@@ -1338,7 +1354,11 @@ class Pods implements Iterator {
1338
  $simple = false;
1339
  $last_options = array();
1340
 
1341
- if ( $field_exists && 'pick' === $all_fields[ $pod ][ $field ]['type'] && in_array( $all_fields[ $pod ][ $field ]['pick_object'], $simple_tableless_objects, true ) ) {
 
 
 
 
1342
  $simple = true;
1343
  $last_options = $all_fields[ $pod ][ $field ];
1344
  }
@@ -1414,12 +1434,13 @@ class Pods implements Iterator {
1414
  }
1415
  } else {
1416
  // Assume last iteration.
 
 
1417
  if ( 0 === $key ) {
1418
- // Invalid field.
1419
- return false;
 
1420
  }
1421
-
1422
- $last_loop = true;
1423
  }//end if
1424
 
1425
  if ( $last_loop ) {
@@ -1650,20 +1671,14 @@ class Pods implements Iterator {
1650
  $object_type = 'post';
1651
  }
1652
 
1653
- $no_conflict = true;
1654
 
1655
- if ( in_array( $object_type, array(
1656
- 'post',
1657
- 'taxonomy',
1658
- 'user',
1659
- 'comment',
1660
- 'settings',
1661
- ), true ) ) {
1662
- $no_conflict = pods_no_conflict_check( $object_type );
1663
 
1664
- if ( ! $no_conflict ) {
1665
- pods_no_conflict_on( $object_type );
1666
- }
 
 
1667
  }
1668
 
1669
  if ( $is_field_output_full ) {
@@ -1675,7 +1690,9 @@ class Pods implements Iterator {
1675
 
1676
  foreach ( $data as $item_id => $item ) {
1677
  // $field is 123x123, needs to be _src.123x123
1678
- $full_field = implode( '.', array_splice( $params->traverse, $key ) );
 
 
1679
 
1680
  if ( is_array( $item ) && isset( $item[ $field ] ) ) {
1681
  if ( $table['field_id'] === $field ) {
@@ -1692,16 +1709,16 @@ class Pods implements Iterator {
1692
  } elseif ( ! empty( $related_obj ) && 0 === strpos( $full_field, 'post_thumbnail' ) ) {
1693
  // We want to catch post_thumbnail and post_thumbnail_url here
1694
  $value[] = $related_obj->field( $full_field );
1695
- } elseif ( ( ( false !== strpos( $full_field, '_src' ) || 'guid' === $field ) && ( in_array( $table['type'], array(
1696
- 'attachment',
1697
- 'media',
1698
- ), true ) || in_array( $last_type, PodsForm::file_field_types(), true ) ) ) || ( in_array( $field, array(
1699
- '_link',
1700
- 'detail_url',
1701
- ), true ) || in_array( $field, array(
1702
- 'permalink',
1703
- 'the_permalink',
1704
- ), true ) && in_array( $last_type, PodsForm::file_field_types(), true ) ) ) {
1705
  // @todo Refactor the above condition statement.
1706
  $size = 'full';
1707
 
@@ -1803,20 +1820,17 @@ class Pods implements Iterator {
1803
  $metadata_type = 'term';
1804
  }
1805
 
1806
- $value[] = get_metadata( $metadata_type, $metadata_object_id, $field, true );
 
1807
  } elseif ( 'settings' === $object_type ) {
1808
- $value[] = get_option( $object . '_' . $field );
 
1809
  }//end if
1810
  }//end foreach
1811
  }//end if
1812
 
1813
- if ( ! $no_conflict && in_array( $object_type, array(
1814
- 'post',
1815
- 'taxonomy',
1816
- 'user',
1817
- 'comment',
1818
- 'settings',
1819
- ), true ) ) {
1820
  pods_no_conflict_off( $object_type );
1821
  }
1822
 
@@ -4155,9 +4169,7 @@ class Pods implements Iterator {
4155
  return '';
4156
  }
4157
 
4158
- foreach ( $tag as $k => $v ) {
4159
- $tag[ $k ] = trim( $v );
4160
- }
4161
 
4162
  $field_name = $tag[0];
4163
 
@@ -4165,7 +4177,7 @@ class Pods implements Iterator {
4165
  $before = '';
4166
  $after = '';
4167
 
4168
- if ( isset( $tag[1] ) && ! empty( $tag[1] ) ) {
4169
  $value = $this->field( $field_name );
4170
 
4171
  $helper_name = $tag[1];
@@ -4175,11 +4187,11 @@ class Pods implements Iterator {
4175
  $value = $this->display( $field_name );
4176
  }
4177
 
4178
- if ( isset( $tag[2] ) && ! empty( $tag[2] ) ) {
4179
  $before = $tag[2];
4180
  }
4181
 
4182
- if ( isset( $tag[3] ) && ! empty( $tag[3] ) ) {
4183
  $after = $tag[3];
4184
  }
4185
 
890
 
891
  $params->traverse = array();
892
 
893
+ $permalink_fields = array(
894
  '_link',
895
  'detail_url',
 
896
  'permalink',
897
  'the_permalink',
898
+ );
899
+
900
+ $wp_object_types = array(
901
  'post_type',
902
  'taxonomy',
903
  'media',
904
  'user',
905
  'comment',
906
+ );
907
+
908
+ /** @var string $pod_type The pod object type. */
909
+ $pod_type = pods_v( 'type', $this->pod_data, '' );
910
+
911
+ $is_wp_object = in_array( $pod_type, $wp_object_types, true );
912
+
913
+ if ( $is_wp_object && in_array( $params->name, $permalink_fields, true ) ) {
914
  if ( 0 < strlen( $this->detail_page ) ) {
915
  $value = get_home_url() . '/' . $this->do_magic_tags( $this->detail_page );
916
+ } else {
917
+ switch ( $pod_type ) {
918
+ case 'post_type':
919
+ case 'media':
920
+ $value = get_permalink( $this->id() );
921
+ break;
922
+ case 'taxonomy':
923
+ $value = get_term_link( $this->id(), $this->pod_data['name'] );
924
+ break;
925
+ case 'user':
926
+ $value = get_author_posts_url( $this->id() );
927
+ break;
928
+ case 'comment':
929
+ $value = get_comment_link( $this->id() );
930
+ break;
931
+ }
932
  }
933
  }
934
 
935
+ /**
936
+ * @var bool $is_field_set Is the field found.
937
+ * @var bool $is_tableless_field Is it a tableless field.
938
+ * @var string $field_source Regular field or object field.
939
+ * @var array $field_data The field data.
940
+ * @var string $field_type The field type.
941
+ * @var array $field_options The field options.
942
+ * @var array $traverse_fields All the traversal field names.
943
+ * @var bool $is_traversal Is it a traversal field request.
944
+ * @var string $first_field The name of the fieds without the traversal names from $params->name.
945
+ * @var array $last_field_data The field data used in traversal loop.
946
+ */
947
 
948
+ $is_field_set = false;
949
+ $is_tableless_field = false;
950
+ $field_source = '';
951
+ $field_data = array();
952
+ $field_type = '';
953
+ $field_options = array();
954
+ $traverse_fields = explode( '.', $params->name );
955
+ $is_traversal = 1 < count( $traverse_fields );
956
+ $first_field = $traverse_fields[0];
957
+ $last_field_data = null;
958
+
959
+ if ( isset( $this->fields[ $params->name ] ) ) {
960
+ // Get the full field name data.
961
+ $field_data = $this->fields[ $params->name ];
962
+ $field_source = 'field';
963
+ $is_field_set = true;
964
+ } elseif ( isset( $this->fields[ $first_field ] ) ) {
965
+ // Get the first field name data.
966
+ $field_data = $this->fields[ $first_field ];
967
+ $field_source = 'field';
968
+ $is_field_set = true;
969
  } elseif ( ! empty( $this->pod_data['object_fields'] ) ) {
970
+ // Get the object field data.
971
  if ( isset( $this->pod_data['object_fields'][ $first_field ] ) ) {
972
+ $field_data = $this->pod_data['object_fields'][ $first_field ];
973
+ $field_source = 'object_field';
974
+ $is_field_set = true;
975
  } else {
976
  $object_fields = (array) $this->pod_data['object_fields'];
977
 
978
+ // Search through field aliases.
979
  foreach ( $object_fields as $object_field => $object_field_opt ) {
980
  if ( in_array( $first_field, $object_field_opt['alias'], true ) ) {
981
  if ( $first_field === $params->name ) {
982
  $params->name = $object_field;
983
  }
984
 
985
+ $first_field = $object_field;
986
+ $field_data = $object_field_opt;
987
+ $field_source = 'object_field';
988
+ $is_field_set = true;
989
 
990
  break;
991
  }
993
  }
994
  }//end if
995
 
996
+ // Store field info.
997
+ $field_type = pods_v( 'type', $field_data, '' );
998
+ $field_options = pods_v( 'options', $field_data, array() );
999
+ $is_tableless_field = in_array( $field_type, $tableless_field_types, true );
1000
+
1001
  // Simple fields have no other output options.
1002
+ if ( 'pick' === $field_type && in_array( $field_data['pick_object'], $simple_tableless_objects, true ) ) {
1003
  $params->output = 'arrays';
1004
  }
1005
 
1006
+ // Enforce output type for tableless fields in forms.
1007
+ if ( empty( $value ) && $is_tableless_field ) {
1008
  $params->raw = true;
1009
 
1010
  $value = false;
1011
 
1012
+ $row_key = '_' . $params->output . '_' . $params->name;
1013
 
1014
  if ( 'arrays' !== $params->output && isset( $this->row[ $row_key ] ) ) {
1015
+ $value = $this->row[ $row_key ];
1016
  } elseif ( 'arrays' === $params->output && isset( $this->row[ $params->name ] ) ) {
1017
  $value = $this->row[ $params->name ];
1018
  }
1019
 
1020
+ if (
1021
+ false !== $value &&
1022
+ ! is_array( $value ) &&
1023
+ 'pick' === $field_type &&
1024
+ in_array( $field_data['pick_object'], $simple_tableless_objects, true )
1025
+ ) {
1026
  $value = PodsForm::field_method( 'pick', 'simple_value', $params->name, $value, $field_data, $this->pod_data, $this->id(), true );
1027
  }
1028
  }
1029
 
1030
+ if (
1031
+ empty( $value ) &&
1032
+ isset( $this->row[ $params->name ] ) &&
1033
+ ( ! $is_tableless_field || 'arrays' === $params->output )
1034
+ ) {
1035
+ if ( empty( $field_data ) || in_array( $field_type, array( 'boolean', 'number', 'currency' ), true ) ) {
1036
  $params->raw = true;
1037
  }
1038
 
1039
  if ( null === $params->single ) {
1040
+ if ( ! $is_tableless_field ) {
1041
  $params->single = true;
1042
  } else {
1043
  $params->single = false;
1048
  } elseif ( empty( $value ) ) {
1049
  $object_field_found = false;
1050
 
1051
+ if ( 'object_field' === $field_source ) {
1052
  $object_field_found = true;
1053
 
1054
  if ( isset( $this->row[ $first_field ] ) ) {
1055
  $value = $this->row[ $first_field ];
1056
+ } elseif ( $is_tableless_field ) {
1057
+ // Overwrite existing field data.
1058
  $this->fields[ $first_field ] = $field_data;
1059
 
1060
  $object_field_found = false;
1061
  } else {
1062
  return null;
1063
  }
1064
+ } elseif ( ! $is_field_set ) {
1065
 
1066
+ $image_fields = array(
1067
+ 'image_attachment',
1068
+ 'image_attachment_url',
1069
+ );
1070
+
1071
+ if ( 'post_type' === $pod_type ) {
1072
+ $image_fields[] = 'post_thumbnail';
1073
+ $image_fields[] = 'post_thumbnail_url';
1074
+ }
1075
 
1076
+ // Handle special field tags.
1077
+ if ( 'avatar' === $first_field && 'user' === $pod_type ) {
1078
+ // User avatar.
 
 
1079
  $size = null;
1080
 
1081
  if ( 0 === strpos( $params->name, 'avatar.' ) ) {
1093
  }
1094
 
1095
  $object_field_found = true;
 
 
1096
 
1097
+ } elseif ( in_array( $first_field, $image_fields, true ) ) {
1098
+ // Default image field handlers.
 
 
 
 
 
 
 
 
 
 
 
 
 
1099
 
1100
+ $image_field = $first_field;
1101
+ // Is it a URL request?
1102
+ $url = '_url' === substr( $image_field, - 4 );
1103
+ if ( $url ) {
1104
+ $image_field = substr( $image_field, 0, - 4 );
1105
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1106
 
1107
+ // Copy traversal parameters.
1108
+ $traverse_params = $traverse_fields;
1109
+ // Results in an empty array if no traversal params are passed.
1110
+ array_shift( $traverse_params );
1111
 
1112
+ $attachment_id = 0;
1113
+ switch ( $image_field ) {
1114
+ case 'post_thumbnail':
1115
+ $attachment_id = get_post_thumbnail_id( $this->id() );
1116
+ break;
1117
+ case 'image_attachment':
1118
+ if ( isset( $traverse_params[0] ) ) {
1119
+ $attachment_id = $traverse_params[0];
1120
+ array_shift( $traverse_params );
1121
  }
1122
+ break;
1123
+ }
1124
 
1125
+ if ( $attachment_id ) {
1126
+
1127
+ $size = 'thumbnail';
1128
+ if ( isset( $traverse_params[0] ) ) {
1129
+ $size = $traverse_params[0];
1130
+ $sizes = get_intermediate_image_sizes();
1131
+ // Not shown by default.
1132
+ $sizes[] = 'full';
1133
+ $sizes[] = 'original';
1134
+ if ( ! in_array( $size, $sizes, true ) ) {
1135
+ // No valid image size found.
1136
+ $size = false;
1137
  }
1138
+ }
1139
 
1140
+ if ( $url ) {
1141
+ $value = pods_image_url( $attachment_id, $size, 0, true );
1142
+ } elseif ( $size ) {
1143
+ // Pods will auto-get the thumbnail ID if this isn't an attachment.
1144
+ $value = pods_image( $attachment_id, $size, 0, null, true );
1145
+ } else {
1146
  // Fallback to attachment Post object to look for other image properties.
1147
  $media = pods( 'media', $attachment_id );
1148
 
1149
  if ( $media && $media->valid() && $media->exists() ) {
1150
+ $value = $media->field( implode( '.', $traverse_params ) );
1151
  } else {
1152
  // Fallback to default attachment object.
1153
  $attachment = get_post( $attachment_id );
1154
+ $value = pods_v( implode( '.', $traverse_params ), $attachment, null );
 
 
 
 
 
 
 
 
 
 
 
 
 
1155
 
1156
+ if ( null === $value ) {
1157
+ // Start traversal though object property or metadata.
1158
+ $name_key = array_shift( $traverse_params );
1159
+ $value = pods_v( $name_key, $attachment, null );
1160
+
1161
+ if ( null === $value ) {
1162
+ $value = get_post_meta( $attachment_id, $name_key, true );
1163
  }
 
 
1164
 
1165
+ $value = pods_traverse( $traverse_params, $value );
1166
+ }
 
1167
  }
1168
  }
1169
 
1170
+ if ( null !== $value ) {
1171
+ $object_field_found = true;
1172
+ }
1173
+ }
1174
+ }
1175
  }
1176
 
1177
+ // Continue regular field parsing.
1178
  if ( false === $object_field_found ) {
1179
  $params->traverse = array( $params->name );
1180
 
1184
  $params->name = $params->traverse[0];
1185
  }
1186
 
1187
+ if ( $field_type ) {
1188
+
1189
  /**
1190
  * Modify value returned by field() after its retrieved, but before its validated or formatted
1191
  *
1207
 
1208
  $simple = false;
1209
 
1210
+ if ( $is_field_set ) {
1211
+
1212
+ if ( 'meta' === $this->pod_data['storage'] && ! $is_tableless_field ) {
1213
  $simple = true;
1214
  }
1215
 
1216
+ if ( $is_tableless_field ) {
1217
  $params->raw = true;
1218
 
1219
+ if ( 'pick' === $field_type && in_array( $field_data['pick_object'], $simple_tableless_objects, true ) ) {
1220
  $simple = true;
1221
  $params->single = true;
1222
  }
1223
+ } elseif ( in_array( $field_type, array( 'boolean', 'number', 'currency' ), true ) ) {
 
 
 
 
1224
  $params->raw = true;
1225
  }
1226
  }
1227
 
1228
+ if ( ! $is_traversal && ( $simple || ! $is_field_set || ! $is_tableless_field ) ) {
 
 
 
 
 
 
 
1229
  if ( null === $params->single ) {
1230
  if ( $is_field_set && ! $is_tableless_field ) {
1231
  $params->single = true;
1234
  }
1235
  }
1236
 
1237
+ $no_conflict = pods_no_conflict_check( $pod_type );
1238
 
1239
  if ( ! $no_conflict ) {
1240
+ // Temporarily enable no conflict.
1241
+ pods_no_conflict_on( $pod_type );
1242
  }
1243
 
1244
+ if ( $is_wp_object ) {
 
 
 
 
 
 
1245
  $id = $this->id();
1246
 
1247
+ $metadata_type = $pod_type;
1248
 
1249
+ if ( in_array( $metadata_type, array( 'post_type', 'media' ), true ) ) {
1250
  $metadata_type = 'post';
1251
 
1252
  // Support for WPML 'duplicated' translation handling.
1253
  if ( did_action( 'wpml_loaded' ) && apply_filters( 'wpml_is_translated_post_type', false, $this->pod_data['name'] ) ) {
1254
  $master_post_id = (int) apply_filters( 'wpml_master_post_from_duplicate', $id );
1255
 
1256
+ if ( $master_post_id ) {
1257
  $id = $master_post_id;
1258
  }
1259
  }
1260
+ } elseif ( 'taxonomy' === $metadata_type ) {
1261
  $metadata_type = 'term';
1262
  }
1263
 
1265
 
1266
  $single_multi = 'single';
1267
 
1268
+ if ( $is_field_set && $field_type ) {
1269
+ $single_multi = pods_v( $field_type . '_format_type', $field_options, $single_multi );
1270
  }
1271
 
1272
  if ( $simple && ! is_array( $value ) && 'single' !== $single_multi ) {
1273
  $value = get_metadata( $metadata_type, $id, $params->name );
1274
  }
1275
+ } elseif ( 'settings' === $pod_type ) {
1276
  $value = get_option( $this->pod_data['name'] . '_' . $params->name, null );
1277
  }//end if
1278
 
1286
  }
1287
 
1288
  if ( ! $no_conflict ) {
1289
+ // Revert temporarily no conflict mode.
1290
+ pods_no_conflict_off( $pod_type );
1291
  }
1292
  } else {
1293
  // Dot-traversal.
1333
  $last_object = '';
1334
  $last_pick_val = '';
1335
 
1336
+ $single_multi = pods_v( $field_type . '_format_type', $field_options, 'single' );
1337
 
1338
  if ( 'multi' === $single_multi ) {
1339
+ $limit = (int) pods_v( $field_type . '_limit', $field_options, 0 );
1340
  } else {
1341
  $limit = 1;
1342
  }
1354
  $simple = false;
1355
  $last_options = array();
1356
 
1357
+ if (
1358
+ $field_exists &&
1359
+ 'pick' === $all_fields[ $pod ][ $field ]['type'] &&
1360
+ in_array( $all_fields[ $pod ][ $field ]['pick_object'], $simple_tableless_objects, true )
1361
+ ) {
1362
  $simple = true;
1363
  $last_options = $all_fields[ $pod ][ $field ];
1364
  }
1434
  }
1435
  } else {
1436
  // Assume last iteration.
1437
+ $last_loop = true;
1438
+
1439
  if ( 0 === $key ) {
1440
+ // This is also the first loop. Assume metadata or options to traverse into.
1441
+ $last_object = $this->pod_data['object_type'];
1442
+ $last_pick_val = $this->pod_data['name'];
1443
  }
 
 
1444
  }//end if
1445
 
1446
  if ( $last_loop ) {
1671
  $object_type = 'post';
1672
  }
1673
 
 
1674
 
1675
+ $object_no_conflict = in_array( $object_type, array( 'post', 'taxonomy', 'user', 'comment', 'settings' ), true );
 
 
 
 
 
 
 
1676
 
1677
+ $no_conflict = pods_no_conflict_check( $object_type );
1678
+
1679
+ if ( $object_no_conflict && ! $no_conflict ) {
1680
+ // Temporarily enable no conflict.
1681
+ pods_no_conflict_on( $object_type );
1682
  }
1683
 
1684
  if ( $is_field_output_full ) {
1690
 
1691
  foreach ( $data as $item_id => $item ) {
1692
  // $field is 123x123, needs to be _src.123x123
1693
+ $traverse_fields = array_splice( $params->traverse, $key );
1694
+ $full_field = implode( '.', $traverse_fields );
1695
+ array_shift( $traverse_fields );
1696
 
1697
  if ( is_array( $item ) && isset( $item[ $field ] ) ) {
1698
  if ( $table['field_id'] === $field ) {
1709
  } elseif ( ! empty( $related_obj ) && 0 === strpos( $full_field, 'post_thumbnail' ) ) {
1710
  // We want to catch post_thumbnail and post_thumbnail_url here
1711
  $value[] = $related_obj->field( $full_field );
1712
+ } elseif (
1713
+ (
1714
+ ( false !== strpos( $full_field, '_src' ) || 'guid' === $field )
1715
+ && (
1716
+ in_array( $table['type'], array( 'attachment', 'media' ), true )
1717
+ || in_array( $last_type, PodsForm::file_field_types(), true )
1718
+ )
1719
+ )
1720
+ || ( in_array( $field, $permalink_fields, true ) && in_array( $last_type, PodsForm::file_field_types(), true ) )
1721
+ ) {
1722
  // @todo Refactor the above condition statement.
1723
  $size = 'full';
1724
 
1820
  $metadata_type = 'term';
1821
  }
1822
 
1823
+ $meta_value = get_metadata( $metadata_type, $metadata_object_id, $field, true );
1824
+ $value[] = pods_traverse( $traverse_fields, $meta_value );
1825
  } elseif ( 'settings' === $object_type ) {
1826
+ $option_value = get_option( $object . '_' . $field );
1827
+ $value[] = pods_traverse( $traverse_fields, $option_value );
1828
  }//end if
1829
  }//end foreach
1830
  }//end if
1831
 
1832
+ if ( $object_no_conflict && ! $no_conflict ) {
1833
+ // Revert temporarily no conflict mode.
 
 
 
 
 
1834
  pods_no_conflict_off( $object_type );
1835
  }
1836
 
4169
  return '';
4170
  }
4171
 
4172
+ $tag = pods_trim( $tag );
 
 
4173
 
4174
  $field_name = $tag[0];
4175
 
4177
  $before = '';
4178
  $after = '';
4179
 
4180
+ if ( ! empty( $tag[1] ) ) {
4181
  $value = $this->field( $field_name );
4182
 
4183
  $helper_name = $tag[1];
4187
  $value = $this->display( $field_name );
4188
  }
4189
 
4190
+ if ( ! empty( $tag[2] ) ) {
4191
  $before = $tag[2];
4192
  }
4193
 
4194
+ if ( ! empty( $tag[3] ) ) {
4195
  $after = $tag[3];
4196
  }
4197
 
classes/PodsAPI.php CHANGED
@@ -5025,7 +5025,14 @@ class PodsAPI {
5025
 
5026
  $related_item = $this->export_pod_item_level( $related_pod, $related_params );
5027
 
5028
- $related_data[ $related_id ] = $this->do_hook( 'export_pod_item_level', $related_item, $related_pod->pod, $related_pod->id(), $related_pod, $related_fields, $depth, $flatten, ( $current_depth + 1 ), $params );
 
 
 
 
 
 
 
5029
  }
5030
  }
5031
 
5025
 
5026
  $related_item = $this->export_pod_item_level( $related_pod, $related_params );
5027
 
5028
+ $related_item_data = $this->do_hook( 'export_pod_item_level', $related_item, $related_pod->pod, $related_pod->id(), $related_pod, $related_fields, $depth, $flatten, ( $current_depth + 1 ), $params );
5029
+
5030
+ if ( function_exists( 'wp_is_json_request' ) && wp_is_json_request() ) {
5031
+ // Don't pass IDs as keys for REST API context to ensure arrays of data are returned.
5032
+ $related_data[] = $related_item_data;
5033
+ } else {
5034
+ $related_data[ $related_id ] = $related_item_data;
5035
+ }
5036
  }
5037
  }
5038
 
classes/PodsAdmin.php CHANGED
@@ -1748,7 +1748,7 @@ class PodsAdmin {
1748
  ),
1749
  'menu_icon' => array(
1750
  'label' => __( 'Menu Icon', 'pods' ),
1751
- 'help' => __( 'URL or Dashicon name for the menu icon. You may specify the path to the icon using one of the <a href="https://pods.io/docs/build/special-magic-tags/#site-tags" target="_blank">site tag</a> type <a href="https://pods.io/docs/build/special-magic-tags/" target="_blank">special magic tags</a>. For example, for a file in your theme directory, use "{@template-url}/path/to/image.png". You may also use the name of a <a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">Dashicon</a>. For example, to use the empty star icon, use "dashicons-star-empty".', 'pods' ),
1752
  'type' => 'text',
1753
  'default' => '',
1754
  'depends-on' => array( 'show_in_menu' => true ),
@@ -2107,8 +2107,8 @@ class PodsAdmin {
2107
  'depends-on' => array( 'rewrite' => true ),
2108
  ),
2109
  'rewrite_with_front' => array(
2110
- 'label' => __( 'Allow Front Prepend', 'pods' ),
2111
- 'help' => __( 'Allows permalinks to be prepended with front base (example: if your permalink structure is /blog/, then your links will be: Checked->/news/, Unchecked->/blog/news/)', 'pods' ),
2112
  'type' => 'boolean',
2113
  'default' => true,
2114
  'boolean_yes_label' => '',
@@ -3052,7 +3052,7 @@ class PodsAdmin {
3052
  }
3053
 
3054
  if ( ! empty( $website ) ) {
3055
- $website = ' ' . sprintf( __( 'You can find it at %s', 'pods' ), '<a href="' . $website . '" target="_blank">' . $website . '</a>' );
3056
  }
3057
 
3058
  $message = sprintf( __( 'The %1$s component requires that you have the <strong>%2$s</strong> plugin installed and activated.', 'pods' ), PodsInit::$components->components[ $component ]['Name'], $dependency[0] ) . $website;
@@ -3074,7 +3074,7 @@ class PodsAdmin {
3074
  $website = '';
3075
 
3076
  if ( isset( $dependency[2] ) ) {
3077
- $website = ' ' . sprintf( __( 'You can find it at %s', 'pods' ), '<a href="' . $dependency[2] . '" target="_blank">' . $dependency[2] . '</a>' );
3078
  }
3079
 
3080
  $message = sprintf( __( 'The %1$s component requires that you have the <strong>%2$s</strong> theme installed and activated.', 'pods' ), PodsInit::$components->components[ $component ]['Name'], $dependency[0] ) . $website;
@@ -3619,8 +3619,8 @@ class PodsAdmin {
3619
  if ( ! function_exists( 'register_rest_field' ) ) {
3620
  $options['rest-api'] = array(
3621
  'no_dependencies' => array(
3622
- 'label' => sprintf( __( 'Pods REST API support requires WordPress 4.3.1 or later and the %s or later.', 'pods' ), '<a href="https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/" target="_blank">WordPress REST API 2.0-beta9</a>' ),
3623
- 'help' => sprintf( __( 'See %s for more information.', 'pods' ), '<a href="https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/" target="_blank">https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/</a>' ),
3624
  'type' => 'html',
3625
  ),
3626
  );
@@ -3662,7 +3662,7 @@ class PodsAdmin {
3662
  $options['rest-api'] = array(
3663
  'not_restable' => array(
3664
  'label' => __( 'Pods REST API support covers post type, taxonomy and user Pods.', 'pods' ),
3665
- 'help' => sprintf( __( 'See %s for more information.', 'pods' ), '<a href="https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/" target="_blank">https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/"</a>' ),
3666
  'type' => 'html',
3667
  ),
3668
  );
@@ -3695,7 +3695,7 @@ class PodsAdmin {
3695
  ),
3696
  'rest_write' => array(
3697
  'label' => __( 'Write via REST API?', 'pods' ),
3698
- 'help' => __( 'Should this field be readable via the REST API? You must enable REST API support for this Pod.', 'pods' ),
3699
  'type' => 'boolean',
3700
  'default' => '',
3701
  ),
@@ -3703,15 +3703,15 @@ class PodsAdmin {
3703
  $options['rest'][ __( 'Relationship Field Options', 'pods' ) ] = array(
3704
  'rest_pick_response' => array(
3705
  'label' => __( 'Response Type', 'pods' ),
3706
- 'help' => __( 'Should this field be readable via the REST API? You must enable REST API support for this Pod.', 'pods' ),
3707
  'type' => 'pick',
3708
  'default' => 'array',
3709
  'depends-on' => array( 'type' => 'pick' ),
 
3710
  'data' => array(
3711
  'array' => __( 'Full', 'pods' ),
3712
  'id' => __( 'ID only', 'pods' ),
3713
  'name' => __( 'Name', 'pods' ),
3714
-
3715
  ),
3716
  ),
3717
  'rest_pick_depth' => array(
@@ -3719,8 +3719,10 @@ class PodsAdmin {
3719
  'help' => __( 'How far to traverse relationships in response', 'pods' ),
3720
  'type' => 'number',
3721
  'default' => '2',
3722
- 'depends-on' => array( 'type' => 'pick' ),
3723
-
 
 
3724
  ),
3725
 
3726
  );
1748
  ),
1749
  'menu_icon' => array(
1750
  'label' => __( 'Menu Icon', 'pods' ),
1751
+ 'help' => __( 'URL or Dashicon name for the menu icon. You may specify the path to the icon using one of the <a href="https://pods.io/docs/build/special-magic-tags/#site-tags" target="_blank" rel="noopener noreferrer">site tag</a> type <a href="https://pods.io/docs/build/special-magic-tags/" target="_blank" rel="noopener noreferrer">special magic tags</a>. For example, for a file in your theme directory, use "{@template-url}/path/to/image.png". You may also use the name of a <a href="https://developer.wordpress.org/resource/dashicons/" target="_blank" rel="noopener noreferrer">Dashicon</a>. For example, to use the empty star icon, use "dashicons-star-empty".', 'pods' ),
1752
  'type' => 'text',
1753
  'default' => '',
1754
  'depends-on' => array( 'show_in_menu' => true ),
2107
  'depends-on' => array( 'rewrite' => true ),
2108
  ),
2109
  'rewrite_with_front' => array(
2110
+ 'label' => __( 'Rewrite with Front', 'pods' ),
2111
+ 'help' => __( 'Allows permalinks to be prepended with your front base (example: if your permalink structure is /blog/, then your links will be: Unchecked->/news/, Checked->/blog/news/)', 'pods' ),
2112
  'type' => 'boolean',
2113
  'default' => true,
2114
  'boolean_yes_label' => '',
3052
  }
3053
 
3054
  if ( ! empty( $website ) ) {
3055
+ $website = ' ' . sprintf( __( 'You can find it at %s', 'pods' ), '<a href="' . $website . '" target="_blank" rel="noopener noreferrer">' . $website . '</a>' );
3056
  }
3057
 
3058
  $message = sprintf( __( 'The %1$s component requires that you have the <strong>%2$s</strong> plugin installed and activated.', 'pods' ), PodsInit::$components->components[ $component ]['Name'], $dependency[0] ) . $website;
3074
  $website = '';
3075
 
3076
  if ( isset( $dependency[2] ) ) {
3077
+ $website = ' ' . sprintf( __( 'You can find it at %s', 'pods' ), '<a href="' . $dependency[2] . '" target="_blank" rel="noopener noreferrer">' . $dependency[2] . '</a>' );
3078
  }
3079
 
3080
  $message = sprintf( __( 'The %1$s component requires that you have the <strong>%2$s</strong> theme installed and activated.', 'pods' ), PodsInit::$components->components[ $component ]['Name'], $dependency[0] ) . $website;
3619
  if ( ! function_exists( 'register_rest_field' ) ) {
3620
  $options['rest-api'] = array(
3621
  'no_dependencies' => array(
3622
+ 'label' => sprintf( __( 'Pods REST API support requires WordPress 4.3.1 or later and the %s or later.', 'pods' ), '<a href="https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/" target="_blank" rel="noopener noreferrer">WordPress REST API 2.0-beta9</a>' ),
3623
+ 'help' => sprintf( __( 'See %s for more information.', 'pods' ), '<a href="https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/" target="_blank" rel="noopener noreferrer">https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/</a>' ),
3624
  'type' => 'html',
3625
  ),
3626
  );
3662
  $options['rest-api'] = array(
3663
  'not_restable' => array(
3664
  'label' => __( 'Pods REST API support covers post type, taxonomy and user Pods.', 'pods' ),
3665
+ 'help' => sprintf( __( 'See %s for more information.', 'pods' ), '<a href="https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/" target="_blank" rel="noopener noreferrer">https://pods.io/docs/build/extending-core-wordpress-rest-api-routes-with-pods/"</a>' ),
3666
  'type' => 'html',
3667
  ),
3668
  );
3695
  ),
3696
  'rest_write' => array(
3697
  'label' => __( 'Write via REST API?', 'pods' ),
3698
+ 'help' => __( 'Should this field be writeable via the REST API? You must enable REST API support for this Pod.', 'pods' ),
3699
  'type' => 'boolean',
3700
  'default' => '',
3701
  ),
3703
  $options['rest'][ __( 'Relationship Field Options', 'pods' ) ] = array(
3704
  'rest_pick_response' => array(
3705
  'label' => __( 'Response Type', 'pods' ),
3706
+ 'help' => __( 'This will determine what amount of data for the related items will be returned.', 'pods' ),
3707
  'type' => 'pick',
3708
  'default' => 'array',
3709
  'depends-on' => array( 'type' => 'pick' ),
3710
+ 'dependency' => true,
3711
  'data' => array(
3712
  'array' => __( 'Full', 'pods' ),
3713
  'id' => __( 'ID only', 'pods' ),
3714
  'name' => __( 'Name', 'pods' ),
 
3715
  ),
3716
  ),
3717
  'rest_pick_depth' => array(
3719
  'help' => __( 'How far to traverse relationships in response', 'pods' ),
3720
  'type' => 'number',
3721
  'default' => '2',
3722
+ 'depends-on' => array(
3723
+ 'type' => 'pick',
3724
+ 'rest_pick_response' => 'array',
3725
+ ),
3726
  ),
3727
 
3728
  );
classes/PodsInit.php CHANGED
@@ -260,7 +260,7 @@ class PodsInit {
260
  /**
261
  * Filter the Freemius plugins API data.
262
  *
263
- * @since TBD
264
  *
265
  * @param object $data Freemius plugins API data.
266
  *
@@ -279,7 +279,7 @@ class PodsInit {
279
  /**
280
  * Filter the Freemius add-ons HTML.
281
  *
282
- * @since TBD
283
  *
284
  * @param string $html Freemius add-ons HTML.
285
  *
@@ -295,7 +295,7 @@ class PodsInit {
295
  $html = preg_replace( '/<div\s+class="button button-primary fs-dropdown-arrow-button">/Uim', '<div class="hidden">', $html );
296
 
297
  // Use landing page for Become a Friend link.
298
- $replace = '$1<a target="_blank" href="' . esc_url( $this->get_freemius_action_link() ) . '"$2class="$3">';
299
 
300
  // Replace all Friends-only add-on links.
301
  foreach ( $freemius_friends_addons as $addon_slug => $addon ) {
@@ -310,7 +310,7 @@ class PodsInit {
310
  /**
311
  * Get action link URL.
312
  *
313
- * @since TBD
314
  *
315
  * @param string $url Action link URL.
316
  *
@@ -323,7 +323,7 @@ class PodsInit {
323
  /**
324
  * Get list of add-ons for Freemius.
325
  *
326
- * @since TBD
327
  *
328
  * @return array List of add-ons for Freemius.
329
  */
@@ -341,7 +341,7 @@ class PodsInit {
341
  /**
342
  * Get list of Friends-only add-ons for Freemius.
343
  *
344
- * @since TBD
345
  *
346
  * @return array List of Friends-only add-ons for Freemius.
347
  */
@@ -1445,13 +1445,13 @@ class PodsInit {
1445
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels['singular_name'], wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
1446
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels['singular_name'], esc_url( get_permalink( $post_ID ) ), $labels['view_item'] ),
1447
  7 => sprintf( __( '%s saved.', 'pods' ), $labels['singular_name'] ),
1448
- 8 => sprintf( __( '%1$s submitted. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels['singular_name'], esc_url( $preview_post_link ), $labels['singular_name'] ),
1449
  9 => sprintf(
1450
- __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" href="%3$s">Preview %4$s</a>', 'pods' ), $labels['singular_name'],
1451
  // translators: Publish box date format, see http://php.net/date
1452
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels['singular_name']
1453
  ),
1454
- 10 => sprintf( __( '%1$s draft updated. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels['singular_name'], esc_url( $preview_post_link ), $labels['singular_name'] ),
1455
  );
1456
 
1457
  if ( false === (boolean) $pods_cpt_ct['post_types'][ $post_type['name'] ]['public'] ) {
260
  /**
261
  * Filter the Freemius plugins API data.
262
  *
263
+ * @since 2.7.17
264
  *
265
  * @param object $data Freemius plugins API data.
266
  *
279
  /**
280
  * Filter the Freemius add-ons HTML.
281
  *
282
+ * @since 2.7.17
283
  *
284
  * @param string $html Freemius add-ons HTML.
285
  *
295
  $html = preg_replace( '/<div\s+class="button button-primary fs-dropdown-arrow-button">/Uim', '<div class="hidden">', $html );
296
 
297
  // Use landing page for Become a Friend link.
298
+ $replace = '$1<a target="_blank" rel="noopener noreferrer" href="' . esc_url( $this->get_freemius_action_link() ) . '"$2class="$3">';
299
 
300
  // Replace all Friends-only add-on links.
301
  foreach ( $freemius_friends_addons as $addon_slug => $addon ) {
310
  /**
311
  * Get action link URL.
312
  *
313
+ * @since 2.7.17
314
  *
315
  * @param string $url Action link URL.
316
  *
323
  /**
324
  * Get list of add-ons for Freemius.
325
  *
326
+ * @since 2.7.17
327
  *
328
  * @return array List of add-ons for Freemius.
329
  */
341
  /**
342
  * Get list of Friends-only add-ons for Freemius.
343
  *
344
+ * @since TB2.7.17D
345
  *
346
  * @return array List of Friends-only add-ons for Freemius.
347
  */
1445
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels['singular_name'], wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
1446
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels['singular_name'], esc_url( get_permalink( $post_ID ) ), $labels['view_item'] ),
1447
  7 => sprintf( __( '%s saved.', 'pods' ), $labels['singular_name'] ),
1448
+ 8 => sprintf( __( '%1$s submitted. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels['singular_name'], esc_url( $preview_post_link ), $labels['singular_name'] ),
1449
  9 => sprintf(
1450
+ __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" rel="noopener noreferrer" href="%3$s">Preview %4$s</a>', 'pods' ), $labels['singular_name'],
1451
  // translators: Publish box date format, see http://php.net/date
1452
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels['singular_name']
1453
  ),
1454
+ 10 => sprintf( __( '%1$s draft updated. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels['singular_name'], esc_url( $preview_post_link ), $labels['singular_name'] ),
1455
  );
1456
 
1457
  if ( false === (boolean) $pods_cpt_ct['post_types'][ $post_type['name'] ]['public'] ) {
classes/PodsMeta.php CHANGED
@@ -3104,8 +3104,8 @@ class PodsMeta {
3104
  'get_meta' => true,
3105
  ) );
3106
 
3107
- if ( $single && ( ! is_array( $meta_cache[ $meta_k ] ) || ! isset( $meta_cache[ $meta_k ][0] ) ) ) {
3108
- if ( empty( $meta_cache[ $meta_k ] ) && ! is_array( $meta_cache[ $meta_k ] ) ) {
3109
  $meta_cache[ $meta_k ] = array();
3110
  } else {
3111
  $meta_cache[ $meta_k ] = array( $meta_cache[ $meta_k ] );
3104
  'get_meta' => true,
3105
  ) );
3106
 
3107
+ if ( ! is_array( $meta_cache[ $meta_k ] ) || ! isset( $meta_cache[ $meta_k ][0] ) ) {
3108
+ if ( empty( $meta_cache[ $meta_k ] ) ) {
3109
  $meta_cache[ $meta_k ] = array();
3110
  } else {
3111
  $meta_cache[ $meta_k ] = array( $meta_cache[ $meta_k ] );
classes/PodsUI.php CHANGED
@@ -2444,7 +2444,7 @@ class PodsUI {
2444
 
2445
  $export_file = $migrate->save( $save_params );
2446
 
2447
- $this->message( sprintf( __( '<strong>Success:</strong> Your export is ready, you can download it <a href="%s" target="_blank">here</a>', 'pods' ), $export_file ) );
2448
 
2449
  // echo '<script type="text/javascript">window.open("' . esc_js( $export_file ) . '");</script>';
2450
  $this->get_data();
2444
 
2445
  $export_file = $migrate->save( $save_params );
2446
 
2447
+ $this->message( sprintf( __( '<strong>Success:</strong> Your export is ready, you can download it <a href="%s" target="_blank" rel="noopener noreferrer">here</a>', 'pods' ), $export_file ) );
2448
 
2449
  // echo '<script type="text/javascript">window.open("' . esc_js( $export_file ) . '");</script>';
2450
  $this->get_data();
classes/fields/date.php CHANGED
@@ -78,7 +78,7 @@ class PodsField_Date extends PodsField_DateTime {
78
  'default' => '',
79
  'type' => 'text',
80
  'help' => sprintf(
81
- '<a href="http://php.net/manual/function.date.php" target="_blank">%s</a>',
82
  esc_html__( 'PHP date documentation', 'pods' )
83
  ),
84
  ),
@@ -88,7 +88,7 @@ class PodsField_Date extends PodsField_DateTime {
88
  'default' => '',
89
  'type' => 'text',
90
  'help' => sprintf(
91
- '<a href="https://api.jqueryui.com/datepicker/" target="_blank">%1$s</a><br />%2$s',
92
  esc_html__( 'jQuery UI datepicker documentation', 'pods' ),
93
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
94
  ),
@@ -116,7 +116,7 @@ class PodsField_Date extends PodsField_DateTime {
116
  'default' => '',
117
  'type' => 'text',
118
  'help' => sprintf(
119
- '%1$s<br /><a href="https://api.jqueryui.com/datepicker/#option-yearRange" target="_blank">%2$s</a>',
120
  sprintf(
121
  esc_html__( 'Example: %1$s for specifying a hard coded year range or %2$s for the last and next 10 years.', 'pods' ),
122
  '<code>2010:2030</code>',
78
  'default' => '',
79
  'type' => 'text',
80
  'help' => sprintf(
81
+ '<a href="http://php.net/manual/function.date.php" target="_blank" rel="noopener noreferrer">%s</a>',
82
  esc_html__( 'PHP date documentation', 'pods' )
83
  ),
84
  ),
88
  'default' => '',
89
  'type' => 'text',
90
  'help' => sprintf(
91
+ '<a href="https://api.jqueryui.com/datepicker/" target="_blank" rel="noopener noreferrer">%1$s</a><br />%2$s',
92
  esc_html__( 'jQuery UI datepicker documentation', 'pods' ),
93
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
94
  ),
116
  'default' => '',
117
  'type' => 'text',
118
  'help' => sprintf(
119
+ '%1$s<br /><a href="https://api.jqueryui.com/datepicker/#option-yearRange" target="_blank" rel="noopener noreferrer">%2$s</a>',
120
  sprintf(
121
  esc_html__( 'Example: %1$s for specifying a hard coded year range or %2$s for the last and next 10 years.', 'pods' ),
122
  '<code>2010:2030</code>',
classes/fields/datetime.php CHANGED
@@ -83,7 +83,7 @@ class PodsField_DateTime extends PodsField {
83
  'default' => '',
84
  'type' => 'text',
85
  'help' => sprintf(
86
- '<a href="http://php.net/manual/function.date.php" target="_blank">%s</a>',
87
  esc_html__( 'PHP date documentation', 'pods' )
88
  ),
89
  ),
@@ -93,7 +93,7 @@ class PodsField_DateTime extends PodsField {
93
  'default' => '',
94
  'type' => 'text',
95
  'help' => sprintf(
96
- '<a href="https://api.jqueryui.com/datepicker/" target="_blank">%1$s</a><br />%2$s',
97
  esc_html__( 'jQuery UI datepicker documentation', 'pods' ),
98
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
99
  ),
@@ -137,7 +137,7 @@ class PodsField_DateTime extends PodsField {
137
  'excludes-on' => array( static::$type . '_format' => 'c' ),
138
  'default' => '',
139
  'type' => 'text',
140
- 'help' => '<a href="http://php.net/manual/function.date.php" target="_blank">' . __( 'PHP date documentation', 'pods' ) . '</a>',
141
  ),
142
  static::$type . '_time_format_custom_js' => array(
143
  'label' => __( 'Time format field input', 'pods' ),
@@ -146,7 +146,7 @@ class PodsField_DateTime extends PodsField {
146
  'default' => '',
147
  'type' => 'text',
148
  'help' => sprintf(
149
- '<a href="http://trentrichardson.com/examples/timepicker/#tp-formatting" target="_blank">%1$s</a><br />%2$s',
150
  esc_html__( 'jQuery UI timepicker documentation', 'pods' ),
151
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
152
  ),
@@ -186,7 +186,7 @@ class PodsField_DateTime extends PodsField {
186
  'default' => '',
187
  'type' => 'text',
188
  'help' => sprintf(
189
- '%1$s<br /><a href="https://api.jqueryui.com/datepicker/#option-yearRange" target="_blank">%2$s</a>',
190
  sprintf(
191
  esc_html__( 'Example: %1$s for specifying a hard coded year range or %2$s for the last and next 10 years.', 'pods' ),
192
  '<code>2010:2030</code>',
@@ -309,15 +309,15 @@ class PodsField_DateTime extends PodsField {
309
  public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
310
 
311
  if ( ! $this->is_empty( $value ) ) {
312
- $js = true;
313
-
314
- if ( 'custom' !== pods_v( static::$type . '_type', $options, 'format' ) ) {
315
- $js = false;
316
- }
317
 
318
  // Value should always be passed as storage format since 2.7.15.
319
  $format = static::$storage_format;
320
 
 
 
 
 
 
321
  $check = $this->convert_date( $value, static::$storage_format, $format, true );
322
 
323
  if ( false === $check ) {
@@ -339,6 +339,10 @@ class PodsField_DateTime extends PodsField {
339
  $format = static::$storage_format;
340
 
341
  if ( ! $this->is_empty( $value ) ) {
 
 
 
 
342
  $value = $this->convert_date( $value, static::$storage_format, $format );
343
  } elseif ( pods_v( static::$type . '_allow_empty', $options, 1 ) ) {
344
  $value = static::$empty_value;
@@ -718,6 +722,40 @@ class PodsField_DateTime extends PodsField {
718
  return apply_filters( 'pods_form_ui_field_datetime_formatter', $datetime, $format, $date );
719
  }
720
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
  /**
722
  * Convert a date from one format to another.
723
  *
@@ -736,7 +774,7 @@ class PodsField_DateTime extends PodsField {
736
 
737
  $date = '';
738
 
739
- if ( ! empty( $value ) && ! in_array( $value, array( '0000-00-00', '0000-00-00 00:00:00' ), true ) ) {
740
  $date = $this->createFromFormat( $original_format, (string) $value, $return_timestamp );
741
 
742
  if ( $date instanceof DateTime ) {
83
  'default' => '',
84
  'type' => 'text',
85
  'help' => sprintf(
86
+ '<a href="http://php.net/manual/function.date.php" target="_blank" rel="noopener noreferrer">%s</a>',
87
  esc_html__( 'PHP date documentation', 'pods' )
88
  ),
89
  ),
93
  'default' => '',
94
  'type' => 'text',
95
  'help' => sprintf(
96
+ '<a href="https://api.jqueryui.com/datepicker/" target="_blank" rel="noopener noreferrer">%1$s</a><br />%2$s',
97
  esc_html__( 'jQuery UI datepicker documentation', 'pods' ),
98
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
99
  ),
137
  'excludes-on' => array( static::$type . '_format' => 'c' ),
138
  'default' => '',
139
  'type' => 'text',
140
+ 'help' => '<a href="http://php.net/manual/function.date.php" target="_blank" rel="noopener noreferrer">' . __( 'PHP date documentation', 'pods' ) . '</a>',
141
  ),
142
  static::$type . '_time_format_custom_js' => array(
143
  'label' => __( 'Time format field input', 'pods' ),
146
  'default' => '',
147
  'type' => 'text',
148
  'help' => sprintf(
149
+ '<a href="http://trentrichardson.com/examples/timepicker/#tp-formatting" target="_blank" rel="noopener noreferrer">%1$s</a><br />%2$s',
150
  esc_html__( 'jQuery UI timepicker documentation', 'pods' ),
151
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
152
  ),
186
  'default' => '',
187
  'type' => 'text',
188
  'help' => sprintf(
189
+ '%1$s<br /><a href="https://api.jqueryui.com/datepicker/#option-yearRange" target="_blank" rel="noopener noreferrer">%2$s</a>',
190
  sprintf(
191
  esc_html__( 'Example: %1$s for specifying a hard coded year range or %2$s for the last and next 10 years.', 'pods' ),
192
  '<code>2010:2030</code>',
309
  public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
310
 
311
  if ( ! $this->is_empty( $value ) ) {
 
 
 
 
 
312
 
313
  // Value should always be passed as storage format since 2.7.15.
314
  $format = static::$storage_format;
315
 
316
+ if ( ! $this->is_storage_format( $value ) ) {
317
+ // Allow input values compatible with the display format.
318
+ $format = $this->format_display( $options, false );
319
+ }
320
+
321
  $check = $this->convert_date( $value, static::$storage_format, $format, true );
322
 
323
  if ( false === $check ) {
339
  $format = static::$storage_format;
340
 
341
  if ( ! $this->is_empty( $value ) ) {
342
+ if ( ! $this->is_storage_format( $value ) ) {
343
+ // Allow input values compatible with the display format.
344
+ $format = $this->format_display( $options, false );
345
+ }
346
  $value = $this->convert_date( $value, static::$storage_format, $format );
347
  } elseif ( pods_v( static::$type . '_allow_empty', $options, 1 ) ) {
348
  $value = static::$empty_value;
722
  return apply_filters( 'pods_form_ui_field_datetime_formatter', $datetime, $format, $date );
723
  }
724
 
725
+ /**
726
+ * Check if a value is compatible with the storage format.
727
+ *
728
+ * Valid:
729
+ * - 0000-00-00 00:00:00
730
+ * - 0000-00-00 00:00
731
+ * - 0000-00-00
732
+ * - 0000-00
733
+ * - etc.
734
+ *
735
+ * @param string $value The date value.
736
+ * @return bool
737
+ */
738
+ public function is_storage_format( $value ) {
739
+ $value_parts = str_split( $value );
740
+ $format_parts = str_split( gmdate( static::$storage_format ) );
741
+
742
+ $valid = true;
743
+ foreach ( $value_parts as $i => $part ) {
744
+ if ( isset( $format_parts[ $i ] ) ) {
745
+ if ( is_numeric( $format_parts[ $i ] ) ) {
746
+ if ( ! is_numeric( $part ) ) {
747
+ $valid = false;
748
+ break;
749
+ }
750
+ } elseif ( $format_parts[ $i ] !== $part ) {
751
+ $valid = false;
752
+ break;
753
+ }
754
+ }
755
+ }
756
+ return $valid;
757
+ }
758
+
759
  /**
760
  * Convert a date from one format to another.
761
  *
774
 
775
  $date = '';
776
 
777
+ if ( ! $this->is_empty( $value ) ) {
778
  $date = $this->createFromFormat( $original_format, (string) $value, $return_timestamp );
779
 
780
  if ( $date instanceof DateTime ) {
classes/fields/file.php CHANGED
@@ -182,7 +182,7 @@ class PodsField_File extends PodsField {
182
  /* WP GALLERY OUTPUT */
183
  static::$type . '_wp_gallery_output' => array(
184
  'label' => __( 'Output as a WP Gallery', 'pods' ),
185
- 'help' => sprintf( __( '<a href="%s" target="_blank">Click here for more info</a>', 'pods' ), 'https://wordpress.org/support/article/inserting-images-into-posts-and-pages/' ),
186
  'depends-on' => array( static::$type . '_type' => 'images' ),
187
  'dependency' => true,
188
  'type' => 'boolean',
@@ -562,7 +562,7 @@ class PodsField_File extends PodsField {
562
  $data[] = array(
563
  'id' => esc_html( $id ),
564
  'icon' => esc_attr( $icon ),
565
- 'name' => esc_html( $title ),
566
  'edit_link' => esc_url( $edit_link ),
567
  'link' => esc_url( $link ),
568
  'download' => esc_url( $download ),
@@ -857,7 +857,7 @@ class PodsField_File extends PodsField {
857
  if ( $linked ) {
858
  ?>
859
  <li class="pods-file-col pods-file-download">
860
- <a href="<?php echo esc_url( $link ); ?>" target="_blank">Download</a></li>
861
  <?php
862
  }
863
  ?>
182
  /* WP GALLERY OUTPUT */
183
  static::$type . '_wp_gallery_output' => array(
184
  'label' => __( 'Output as a WP Gallery', 'pods' ),
185
+ 'help' => sprintf( __( '<a href="%s" target="_blank" rel="noopener noreferrer">Click here for more info</a>', 'pods' ), 'https://wordpress.org/support/article/inserting-images-into-posts-and-pages/' ),
186
  'depends-on' => array( static::$type . '_type' => 'images' ),
187
  'dependency' => true,
188
  'type' => 'boolean',
562
  $data[] = array(
563
  'id' => esc_html( $id ),
564
  'icon' => esc_attr( $icon ),
565
+ 'name' => esc_html( wp_kses_post( html_entity_decode( $title ) ) ),
566
  'edit_link' => esc_url( $edit_link ),
567
  'link' => esc_url( $link ),
568
  'download' => esc_url( $download ),
857
  if ( $linked ) {
858
  ?>
859
  <li class="pods-file-col pods-file-download">
860
+ <a href="<?php echo esc_url( $link ); ?>" target="_blank" rel="noopener noreferrer">Download</a></li>
861
  <?php
862
  }
863
  ?>
classes/fields/link.php CHANGED
@@ -146,7 +146,7 @@ class PodsField_Link extends PodsField_Website {
146
 
147
  if ( ! empty( $value['target'] ) || ( ! isset( $value['target'] ) && 1 === (int) pods_v( static::$type . '_new_window', $options ) ) ) {
148
  // Possible support for other targets in future
149
- $atts .= ' target="' . esc_attr( $value['target'] ) . '"';
150
  }
151
 
152
  // Do shortcodes if this is enabled
146
 
147
  if ( ! empty( $value['target'] ) || ( ! isset( $value['target'] ) && 1 === (int) pods_v( static::$type . '_new_window', $options ) ) ) {
148
  // Possible support for other targets in future
149
+ $atts .= ' target="' . esc_attr( $value['target'] ) . '" rel="noopener noreferrer"';
150
  }
151
 
152
  // Do shortcodes if this is enabled
classes/fields/pick.php CHANGED
@@ -99,15 +99,22 @@ class PodsField_Pick extends PodsField {
99
  add_action( 'wp_ajax_nopriv_pods_relationship', array( $this, 'admin_ajax_relationship' ) );
100
 
101
  // Handle modal input.
 
102
  add_action( 'edit_form_top', array( $this, 'admin_modal_input' ) );
103
  add_action( 'show_user_profile', array( $this, 'admin_modal_input' ) );
104
  add_action( 'edit_user_profile', array( $this, 'admin_modal_input' ) );
105
- add_action( 'edit_category_form', array( $this, 'admin_modal_input' ) );
106
- add_action( 'edit_link_category_form', array( $this, 'admin_modal_input' ) );
107
- add_action( 'edit_tag_form', array( $this, 'admin_modal_input' ) );
108
- // @todo add_tag_form is deprecated, replace our hook usage.
109
- add_action( 'add_tag_form', array( $this, 'admin_modal_input' ) );
110
- add_action( 'pods_meta_box_pre', array( $this, 'admin_modal_input' ) );
 
 
 
 
 
 
111
 
112
  // Handle modal saving.
113
  add_filter( 'redirect_post_location', array( $this, 'admin_modal_bail_post_redirect' ), 10, 2 );
@@ -1337,6 +1344,11 @@ class PodsField_Pick extends PodsField {
1337
  $icon = sanitize_html_class( $icon );
1338
  }
1339
 
 
 
 
 
 
1340
  // Support modal editing
1341
  if ( ! empty( $edit_link ) ) {
1342
  // @todo: Replace string literal with defined constant
@@ -1381,12 +1393,12 @@ class PodsField_Pick extends PodsField {
1381
  }
1382
 
1383
  $item = array(
1384
- 'id' => esc_html( $item_id ),
1385
- 'icon' => esc_attr( $icon ),
1386
- 'name' => esc_html( $item_title ),
1387
- 'edit_link' => esc_url( $edit_link ),
1388
- 'link' => esc_url( $link ),
1389
- 'selected' => $selected,
1390
  );
1391
 
1392
  return $item;
@@ -1979,6 +1991,27 @@ class PodsField_Pick extends PodsField {
1979
  ), $object_params
1980
  );
1981
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1982
  $object_params['options'] = (array) $object_params['options'];
1983
  $object_params['data_params'] = (array) $object_params['data_params'];
1984
 
99
  add_action( 'wp_ajax_nopriv_pods_relationship', array( $this, 'admin_ajax_relationship' ) );
100
 
101
  // Handle modal input.
102
+ add_action( 'pods_meta_box_pre', array( $this, 'admin_modal_input' ) );
103
  add_action( 'edit_form_top', array( $this, 'admin_modal_input' ) );
104
  add_action( 'show_user_profile', array( $this, 'admin_modal_input' ) );
105
  add_action( 'edit_user_profile', array( $this, 'admin_modal_input' ) );
106
+
107
+ // Hook into every taxonomy form.
108
+ $taxonomies = get_taxonomies();
109
+
110
+ foreach ( $taxonomies as $taxonomy ) {
111
+ if ( $taxonomy instanceof WP_Term ) {
112
+ $taxonomy = $taxonomy->name;
113
+ }
114
+
115
+ add_action( $taxonomy . '_add_form', array( $this, 'admin_modal_input' ) );
116
+ add_action( $taxonomy . '_edit_form', array( $this, 'admin_modal_input' ) );
117
+ }
118
 
119
  // Handle modal saving.
120
  add_filter( 'redirect_post_location', array( $this, 'admin_modal_bail_post_redirect' ), 10, 2 );
1344
  $icon = sanitize_html_class( $icon );
1345
  }
1346
 
1347
+ // #5740 Check for WP_Error object.
1348
+ if ( ! is_string( $link ) ) {
1349
+ $link = '';
1350
+ }
1351
+
1352
  // Support modal editing
1353
  if ( ! empty( $edit_link ) ) {
1354
  // @todo: Replace string literal with defined constant
1393
  }
1394
 
1395
  $item = array(
1396
+ 'id' => esc_html( $item_id ),
1397
+ 'icon' => esc_attr( $icon ),
1398
+ 'name' => esc_html( wp_kses_post( html_entity_decode( $item_title ) ) ),
1399
+ 'edit_link' => esc_url( $edit_link ),
1400
+ 'link' => esc_url( $link ),
1401
+ 'selected' => $selected,
1402
  );
1403
 
1404
  return $item;
1991
  ), $object_params
1992
  );
1993
 
1994
+ /**
1995
+ * Overwrite parameters used by PodsField_Pick::get_object_data.
1996
+ *
1997
+ * @since 2.7.21
1998
+ *
1999
+ * @param array $object_params {
2000
+ * Get object parameters
2001
+ *
2002
+ * @type string $name Field name.
2003
+ * @type mixed $value Current value.
2004
+ * @type array $options Field options.
2005
+ * @type array $pod Pod data.
2006
+ * @type int|string $id Current item ID.
2007
+ * @type string $context Data context.
2008
+ * @type array $data_params Data parameters.
2009
+ * @type int $page Page number of results to get.
2010
+ * @type int $limit How many data items to limit to (autocomplete defaults to 30, set to -1 or 1+ to override).
2011
+ * }
2012
+ */
2013
+ $object_params = apply_filters( 'pods_field_pick_object_data_params', $object_params );
2014
+
2015
  $object_params['options'] = (array) $object_params['options'];
2016
  $object_params['data_params'] = (array) $object_params['data_params'];
2017
 
classes/fields/time.php CHANGED
@@ -85,7 +85,7 @@ class PodsField_Time extends PodsField_DateTime {
85
  'default' => '',
86
  'type' => 'text',
87
  'help' => sprintf(
88
- '<a href="http://php.net/manual/function.date.php" target="_blank">%s</a>',
89
  esc_html__( 'PHP date documentation', 'pods' )
90
  ),
91
  ),
@@ -95,7 +95,7 @@ class PodsField_Time extends PodsField_DateTime {
95
  'default' => '',
96
  'type' => 'text',
97
  'help' => sprintf(
98
- '<a href="http://trentrichardson.com/examples/timepicker/#tp-formatting" target="_blank">%1$s</a><br />%2$s',
99
  esc_html__( 'jQuery UI timepicker documentation', 'pods' ),
100
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
101
  ),
85
  'default' => '',
86
  'type' => 'text',
87
  'help' => sprintf(
88
+ '<a href="http://php.net/manual/function.date.php" target="_blank" rel="noopener noreferrer">%s</a>',
89
  esc_html__( 'PHP date documentation', 'pods' )
90
  ),
91
  ),
95
  'default' => '',
96
  'type' => 'text',
97
  'help' => sprintf(
98
+ '<a href="http://trentrichardson.com/examples/timepicker/#tp-formatting" target="_blank" rel="noopener noreferrer">%1$s</a><br />%2$s',
99
  esc_html__( 'jQuery UI timepicker documentation', 'pods' ),
100
  esc_html__( 'Leave empty to auto-generate from PHP format.', 'pods' )
101
  ),
classes/fields/website.php CHANGED
@@ -133,7 +133,7 @@ class PodsField_Website extends PodsField {
133
  $atts = '';
134
 
135
  if ( 1 === (int) pods_v( static::$type . '_new_window', $options ) ) {
136
- $atts .= ' target="_blank"';
137
  }
138
 
139
  $value = sprintf( $link, esc_url( $value ), $atts, esc_html( $value ) );
133
  $atts = '';
134
 
135
  if ( 1 === (int) pods_v( static::$type . '_new_window', $options ) ) {
136
+ $atts .= ' target="_blank" rel="noopener noreferrer"';
137
  }
138
 
139
  $value = sprintf( $link, esc_url( $value ), $atts, esc_html( $value ) );
classes/fields/wysiwyg.php CHANGED
@@ -71,6 +71,14 @@ class PodsField_WYSIWYG extends PodsField {
71
  ),
72
  ),
73
  ),
 
 
 
 
 
 
 
 
74
  'output_options' => array(
75
  'label' => __( 'Output Options', 'pods' ),
76
  'group' => array(
71
  ),
72
  ),
73
  ),
74
+ static::$type . '_editor_height' => array(
75
+ 'label' => __( 'Editor Height', 'pods' ),
76
+ 'help' => __( 'Height in pixels', 'pods' ),
77
+ 'default' => '',
78
+ 'type' => 'number',
79
+ 'depends-on' => array( static::$type . '_editor' => 'tinymce' ),
80
+ 'number_decimals' => 0,
81
+ ),
82
  'output_options' => array(
83
  'label' => __( 'Output Options', 'pods' ),
84
  'group' => array(
components/Helpers.php CHANGED
@@ -121,13 +121,13 @@ class Pods_Helpers extends PodsComponent {
121
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
122
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels->singular_name, esc_url( get_permalink( $post_ID ) ), $labels->view_item ),
123
  7 => sprintf( __( '%s saved.', 'pods' ), $labels->singular_name ),
124
- 8 => sprintf( __( '%1$s submitted. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
125
  9 => sprintf(
126
- __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" href="%3$s">Preview %4$s</a>', 'pods' ), $labels->singular_name,
127
  // translators: Publish box date format, see http://php.net/date
128
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels->singular_name
129
  ),
130
- 10 => sprintf( __( '%1$s draft updated. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
131
  );
132
 
133
  if ( false === (boolean) $post_type->public ) {
121
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
122
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels->singular_name, esc_url( get_permalink( $post_ID ) ), $labels->view_item ),
123
  7 => sprintf( __( '%s saved.', 'pods' ), $labels->singular_name ),
124
+ 8 => sprintf( __( '%1$s submitted. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
125
  9 => sprintf(
126
+ __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" rel="noopener noreferrer" href="%3$s">Preview %4$s</a>', 'pods' ), $labels->singular_name,
127
  // translators: Publish box date format, see http://php.net/date
128
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels->singular_name
129
  ),
130
+ 10 => sprintf( __( '%1$s draft updated. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
131
  );
132
 
133
  if ( false === (boolean) $post_type->public ) {
components/Pages.php CHANGED
@@ -211,13 +211,13 @@ class Pods_Pages extends PodsComponent {
211
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
212
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels->singular_name, esc_url( get_permalink( $post_ID ) ), $labels->view_item ),
213
  7 => sprintf( __( '%s saved.', 'pods' ), $labels->singular_name ),
214
- 8 => sprintf( __( '%1$s submitted. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
215
  9 => sprintf(
216
- __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" href="%3$s">Preview %4$s</a>', 'pods' ), $labels->singular_name,
217
  // translators: Publish box date format, see http://php.net/date
218
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels->singular_name
219
  ),
220
- 10 => sprintf( __( '%1$s draft updated. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
221
  );
222
 
223
  if ( false === (boolean) $post_type->public ) {
211
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
212
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels->singular_name, esc_url( get_permalink( $post_ID ) ), $labels->view_item ),
213
  7 => sprintf( __( '%s saved.', 'pods' ), $labels->singular_name ),
214
+ 8 => sprintf( __( '%1$s submitted. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
215
  9 => sprintf(
216
+ __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" rel="noopener noreferrer" href="%3$s">Preview %4$s</a>', 'pods' ), $labels->singular_name,
217
  // translators: Publish box date format, see http://php.net/date
218
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels->singular_name
219
  ),
220
+ 10 => sprintf( __( '%1$s draft updated. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
221
  );
222
 
223
  if ( false === (boolean) $post_type->public ) {
components/Roles/Roles.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Menu Name: Roles &amp; Capabilities
6
  *
7
- * Description: Create and Manage WordPress User Roles and Capabilities; Uses the '<a href="http://wordpress.org/plugins/members/" target="_blank">Members</a>' plugin filters for additional plugin integrations; Portions of code based on the '<a href="http://wordpress.org/plugins/members/" target="_blank">Members</a>' plugin by Justin Tadlock
8
  *
9
  * Version: 1.0
10
  *
4
  *
5
  * Menu Name: Roles &amp; Capabilities
6
  *
7
+ * Description: Create and Manage WordPress User Roles and Capabilities; Uses the '<a href="http://wordpress.org/plugins/members/" target="_blank" rel="noopener noreferrer">Members</a>' plugin filters for additional plugin integrations; Portions of code based on the '<a href="http://wordpress.org/plugins/members/" target="_blank" rel="noopener noreferrer">Members</a>' plugin by Justin Tadlock
8
  *
9
  * Version: 1.0
10
  *
components/Templates/Templates.php CHANGED
@@ -181,13 +181,13 @@ class Pods_Templates extends PodsComponent {
181
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
182
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels->singular_name, esc_url( get_permalink( $post_ID ) ), $labels->view_item ),
183
  7 => sprintf( __( '%s saved.', 'pods' ), $labels->singular_name ),
184
- 8 => sprintf( __( '%1$s submitted. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
185
  9 => sprintf(
186
- __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" href="%3$s">Preview %4$s</a>', 'pods' ), $labels->singular_name,
187
  // translators: Publish box date format, see http://php.net/date
188
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels->singular_name
189
  ),
190
- 10 => sprintf( __( '%1$s draft updated. <a target="_blank" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
191
  );
192
 
193
  if ( false === (boolean) $post_type->public ) {
@@ -582,8 +582,6 @@ class Pods_Templates extends PodsComponent {
582
  return '';
583
  }
584
 
585
- $code = trim( $code );
586
-
587
  if ( false !== strpos( $code, '<?' ) && ( ! defined( 'PODS_DISABLE_EVAL' ) || ! PODS_DISABLE_EVAL ) ) {
588
  pods_deprecated( 'Pod Template PHP code has been deprecated, please use WP Templates instead of embedding PHP.', '2.3' );
589
 
@@ -600,6 +598,11 @@ class Pods_Templates extends PodsComponent {
600
 
601
  $out = $obj->do_magic_tags( $out );
602
 
 
 
 
 
 
603
  return apply_filters( 'pods_templates_do_template', $out, $code, $obj );
604
  }
605
 
181
  5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'pods' ), $labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
182
  6 => sprintf( __( '%1$s published. <a href="%2$s">%3$s</a>', 'pods' ), $labels->singular_name, esc_url( get_permalink( $post_ID ) ), $labels->view_item ),
183
  7 => sprintf( __( '%s saved.', 'pods' ), $labels->singular_name ),
184
+ 8 => sprintf( __( '%1$s submitted. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
185
  9 => sprintf(
186
+ __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" rel="noopener noreferrer" href="%3$s">Preview %4$s</a>', 'pods' ), $labels->singular_name,
187
  // translators: Publish box date format, see http://php.net/date
188
  date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ), $labels->singular_name
189
  ),
190
+ 10 => sprintf( __( '%1$s draft updated. <a target="_blank" rel="noopener noreferrer" href="%2$s">Preview %3$s</a>', 'pods' ), $labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ), $labels->singular_name ),
191
  );
192
 
193
  if ( false === (boolean) $post_type->public ) {
582
  return '';
583
  }
584
 
 
 
585
  if ( false !== strpos( $code, '<?' ) && ( ! defined( 'PODS_DISABLE_EVAL' ) || ! PODS_DISABLE_EVAL ) ) {
586
  pods_deprecated( 'Pod Template PHP code has been deprecated, please use WP Templates instead of embedding PHP.', '2.3' );
587
 
598
 
599
  $out = $obj->do_magic_tags( $out );
600
 
601
+ // Prevent blank whitespace from being output if nothing came through.
602
+ if ( '' === trim( $out ) ) {
603
+ $out = '';
604
+ }
605
+
606
  return apply_filters( 'pods_templates_do_template', $out, $code, $obj );
607
  }
608
 
includes/data.php CHANGED
@@ -310,6 +310,48 @@ function pods_trim( $input, $charlist = null, $lr = null ) {
310
 
311
  }
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  /**
314
  * Return a variable (if exists)
315
  *
@@ -363,6 +405,9 @@ function pods_v( $var = null, $type = 'get', $default = null, $strict = false, $
363
  $output = pods_unslash( $_REQUEST[ $var ] );
364
  }
365
  break;
 
 
 
366
  case 'url':
367
  case 'uri':
368
  $url = parse_url( pods_current_url() );
310
 
311
  }
312
 
313
+ /**
314
+ * Traverse an array or object by array values order or a string (name.name.name).
315
+ *
316
+ * @since 2.7.18
317
+ *
318
+ * @param array|string|int $traverse The traversal names/keys.
319
+ * @param array|object $value The value to traverse into.
320
+ *
321
+ * @return mixed
322
+ */
323
+ function pods_traverse( $traverse, $value ) {
324
+ if ( ! $traverse && ! is_numeric( $traverse ) ) {
325
+ return $value;
326
+ }
327
+
328
+ if ( is_scalar( $value ) ) {
329
+ return null;
330
+ }
331
+
332
+ if ( is_object( $value ) ) {
333
+ $value = (array) $value;
334
+ }
335
+
336
+ if ( ! is_array( $traverse ) ) {
337
+ $traverse = explode( '.', $traverse );
338
+ }
339
+
340
+ $key = array_shift( $traverse );
341
+
342
+ if ( ! isset( $value[ $key ] ) ) {
343
+ return null;
344
+ }
345
+
346
+ $value = $value[ $key ];
347
+
348
+ if ( $traverse ) {
349
+ $value = pods_traverse( $traverse, $value );
350
+ }
351
+
352
+ return $value;
353
+ }
354
+
355
  /**
356
  * Return a variable (if exists)
357
  *
405
  $output = pods_unslash( $_REQUEST[ $var ] );
406
  }
407
  break;
408
+ case 'query':
409
+ $output = get_query_var( $var, $default );
410
+ break;
411
  case 'url':
412
  case 'uri':
413
  $url = parse_url( pods_current_url() );
includes/general.php CHANGED
@@ -322,17 +322,20 @@ function pods_is_debug_display() {
322
  function pods_is_admin( $cap = null ) {
323
 
324
  if ( is_user_logged_in() ) {
325
- // Default is_super_admin() checks against this.
326
- $pods_admin_capabilities = array(
327
- 'delete_users',
328
- );
329
-
330
- $pods_admin_capabilities = apply_filters( 'pods_admin_capabilities', $pods_admin_capabilities, $cap );
331
 
332
  if ( is_multisite() && is_super_admin() ) {
333
  return apply_filters( 'pods_is_admin', true, $cap, '_super_admin' );
334
  }
335
 
 
 
 
 
 
 
 
 
 
336
  if ( empty( $cap ) ) {
337
  $cap = array();
338
  } else {
@@ -559,7 +562,7 @@ function pods_help( $text, $url = null ) {
559
  }
560
 
561
  if ( 0 < strlen( $url ) ) {
562
- $text .= '<br /><br /><a href="' . $url . '" target="_blank">' . __( 'Find out more', 'pods' ) . ' &raquo;</a>';
563
  }
564
 
565
  echo '<img src="' . esc_url( PODS_URL ) . 'ui/images/help.png" alt="' . esc_attr( $text ) . '" class="pods-icon pods-qtip" />';
@@ -1092,7 +1095,6 @@ function pods_shortcode_run( $tags, $content = null ) {
1092
  }
1093
 
1094
  $content = $pod->template( $tags['template'], $content );
1095
- $content = trim( $content );
1096
 
1097
  if ( empty( $content ) && ! empty( $tags['not_found'] ) ) {
1098
  $content = $pod->do_magic_tags( $tags['not_found'] );
@@ -2183,7 +2185,7 @@ function pods_no_conflict_check( $object_type = 'post' ) {
2183
  pods_init();
2184
  }
2185
 
2186
- if ( ! empty( PodsInit::$no_conflict ) && isset( PodsInit::$no_conflict[ $object_type ] ) && ! empty( PodsInit::$no_conflict[ $object_type ] ) ) {
2187
  return true;
2188
  }
2189
 
@@ -2212,7 +2214,7 @@ function pods_no_conflict_on( $object_type = 'post', $object = null ) {
2212
  pods_init();
2213
  }
2214
 
2215
- if ( ! empty( PodsInit::$no_conflict ) && isset( PodsInit::$no_conflict[ $object_type ] ) && ! empty( PodsInit::$no_conflict[ $object_type ] ) ) {
2216
  return true;
2217
  }
2218
 
@@ -2409,7 +2411,7 @@ function pods_no_conflict_off( $object_type = 'post' ) {
2409
  pods_init();
2410
  }
2411
 
2412
- if ( empty( PodsInit::$no_conflict ) || ! isset( PodsInit::$no_conflict[ $object_type ] ) || empty( PodsInit::$no_conflict[ $object_type ] ) ) {
2413
  return false;
2414
  }
2415
 
322
  function pods_is_admin( $cap = null ) {
323
 
324
  if ( is_user_logged_in() ) {
 
 
 
 
 
 
325
 
326
  if ( is_multisite() && is_super_admin() ) {
327
  return apply_filters( 'pods_is_admin', true, $cap, '_super_admin' );
328
  }
329
 
330
+ $pods_admin_capabilities = array();
331
+
332
+ if ( ! is_multisite() ) {
333
+ // Default is_super_admin() checks against this capability.
334
+ $pods_admin_capabilities[] = 'delete_users';
335
+ }
336
+
337
+ $pods_admin_capabilities = apply_filters( 'pods_admin_capabilities', $pods_admin_capabilities, $cap );
338
+
339
  if ( empty( $cap ) ) {
340
  $cap = array();
341
  } else {
562
  }
563
 
564
  if ( 0 < strlen( $url ) ) {
565
+ $text .= '<br /><br /><a href="' . $url . '" target="_blank" rel="noopener noreferrer">' . __( 'Find out more', 'pods' ) . ' &raquo;</a>';
566
  }
567
 
568
  echo '<img src="' . esc_url( PODS_URL ) . 'ui/images/help.png" alt="' . esc_attr( $text ) . '" class="pods-icon pods-qtip" />';
1095
  }
1096
 
1097
  $content = $pod->template( $tags['template'], $content );
 
1098
 
1099
  if ( empty( $content ) && ! empty( $tags['not_found'] ) ) {
1100
  $content = $pod->do_magic_tags( $tags['not_found'] );
2185
  pods_init();
2186
  }
2187
 
2188
+ if ( ! empty( PodsInit::$no_conflict[ $object_type ] ) ) {
2189
  return true;
2190
  }
2191
 
2214
  pods_init();
2215
  }
2216
 
2217
+ if ( ! empty( PodsInit::$no_conflict[ $object_type ] ) ) {
2218
  return true;
2219
  }
2220
 
2411
  pods_init();
2412
  }
2413
 
2414
+ if ( empty( PodsInit::$no_conflict[ $object_type ] ) ) {
2415
  return false;
2416
  }
2417
 
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.20.1
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.20.1' );
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.21
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.21' );
40
 
41
  // Version tracking between DB updates themselves
42
  define( 'PODS_DB_VERSION', '2.3.5' );
readme.txt CHANGED
@@ -3,9 +3,9 @@ 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.4
7
  Requires PHP: 5.3
8
- Stable tag: 2.7.20.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -190,6 +190,30 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  = 2.7.20.1 - June 4th 2020 =
194
 
195
  * Security: Remove deprecated usage of escapeMarkup in selectWoo and tighten JS rendering (@sc0ttkclark, @miha.jirov)
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.4.2
7
  Requires PHP: 5.3
8
+ Stable tag: 2.7.21
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
190
 
191
  == Changelog ==
192
 
193
+ = 2.7.21 - June 30th 2020 =
194
+
195
+ **New Features & Enhancements**
196
+
197
+ * Added: New filter: `pods_field_pick_object_data_params`. #5756 (@JoryHogeveen)
198
+ * Added: Pods fields & magic tags: Traverse through serialized metadata. #5603 (@JoryHogeveen)
199
+ * Added: Support `get_query_var()` in pods_v (and thus special magic tags: `{@query.##}`). #5719 (@JoryHogeveen)
200
+ * Added: WYSIWYG field option for custom editor height. #5673 (@JoryHogeveen)
201
+ * Enhancement: REST field options: Only display depth for array response type. #5714 (@JoryHogeveen)
202
+ * Updated: Refactor Pods::field() method. #5682 (@JoryHogeveen)
203
+
204
+ **Bug Fixes**
205
+
206
+ * Fixed: Relationship dropdown error & encoding. #5740 (@JoryHogeveen)
207
+ * Fixed: Getting single vs multiple metadata values edge case errors. #5661 (@JoryHogeveen)
208
+ * Fixed: Nested relationship fields should render as array of objects in REST. #5745 (@lkraav)
209
+ * Fixed: Add `noopener` and `noreferrer` for all target `_blank` links. #5742 (@JoryHogeveen)
210
+ * Fixed: Only check `delete_users` for single installations in `pods_is_admin()`. #5712 (@JoryHogeveen)
211
+ * Fixed: Deprecated taxonomy form actions. #5700 (@JoryHogeveen)
212
+ * Fixed: DateTime field: Allow input values compatible with the display format. #5687 (@JoryHogeveen)
213
+ * Fixed: Whitespace trimming for templates. #5672 (@sc0ttkclark)
214
+ * Fixed: Taxonomy option rewrite with front label tooltip. #5681 (@JoryHogeveen)
215
+ * Fixed: Pods test factory compatibility with WP core text factory. #5716 (@JoryHogeveen)
216
+
217
  = 2.7.20.1 - June 4th 2020 =
218
 
219
  * Security: Remove deprecated usage of escapeMarkup in selectWoo and tighten JS rendering (@sc0ttkclark, @miha.jirov)
ui/admin/form.php CHANGED
@@ -87,7 +87,7 @@ if ( isset( $_POST['_pods_nonce'] ) ) {
87
  $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
88
 
89
  if ( 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) {
90
- $message .= ' <a target="_blank" href="' . $pod->field( 'detail_url' ) . '">' . sprintf( __( 'View %s', 'pods' ), $obj->item ) . '</a>';
91
  }
92
 
93
  $error = sprintf( __( '<strong>Error:</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
@@ -112,7 +112,7 @@ if ( isset( $_POST['_pods_nonce'] ) ) {
112
  $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
113
 
114
  if ( 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) {
115
- $message .= ' <a target="_blank" href="' . $pod->field( 'detail_url' ) . '">' . sprintf( __( 'View %s', 'pods' ), $obj->item ) . '</a>';
116
  }
117
 
118
  $error = sprintf( __( '<strong>Error:</strong> %1$s not %2$s.', 'pods' ), $obj->item, $action );
@@ -213,7 +213,7 @@ if ( 0 < $pod->id() ) {
213
  ?>
214
  <div id="minor-publishing-actions">
215
  <div id="preview-action">
216
- <a class="button" href="<?php echo esc_url( $pod->field( 'detail_url' ) ); ?>" target="_blank"><?php echo sprintf( __( 'View %s', 'pods' ), $obj->item ); ?></a>
217
  </div>
218
  <div class="clear"></div>
219
  </div>
87
  $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
88
 
89
  if ( 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) {
90
+ $message .= ' <a target="_blank" rel="noopener noreferrer" href="' . $pod->field( 'detail_url' ) . '">' . sprintf( __( 'View %s', 'pods' ), $obj->item ) . '</a>';
91
  }
92
 
93
  $error = sprintf( __( '<strong>Error:</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
112
  $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
113
 
114
  if ( 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) {
115
+ $message .= ' <a target="_blank" rel="noopener noreferrer" href="' . $pod->field( 'detail_url' ) . '">' . sprintf( __( 'View %s', 'pods' ), $obj->item ) . '</a>';
116
  }
117
 
118
  $error = sprintf( __( '<strong>Error:</strong> %1$s not %2$s.', 'pods' ), $obj->item, $action );
213
  ?>
214
  <div id="minor-publishing-actions">
215
  <div id="preview-action">
216
+ <a class="button" href="<?php echo esc_url( $pod->field( 'detail_url' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php echo sprintf( __( 'View %s', 'pods' ), $obj->item ); ?></a>
217
  </div>
218
  <div class="clear"></div>
219
  </div>
ui/admin/help.php CHANGED
@@ -6,13 +6,13 @@
6
 
7
  <h3><?php _e( 'Pods Support' , 'pods'); ?></h3>
8
 
9
- <p><?php _e( 'There are many resources available to help you learn to use Pods on our site, <a href="https://pods.io/" target="_blank">Pods.io</a>:', 'pods'); ?></p>
10
  <ul class="ul-disc">
11
- <li><?php _e('To learn more about using Pods, see our <a href="https://pods.io/docs/" target="_blank">documentation</a> and subscribe to our <a href="https://www.youtube.com/user/podsframework/" target="_blank">YouTube Channel</a>', 'pods'); ?>.
12
 
13
- <li><?php _e( 'To get help with a specific issue, you can ask in our <a href="https://wordpress.org/support/plugin/pods" target="_blank">support forums</a>, or you can join <a href="https://pods.io/chat/" target="_blank">our Slack chat</a>', 'pods'); ?>.
14
 
15
- <li><?php _e('To report <strong>bugs or request features</strong>, go to our <a href="https://github.com/pods-framework/pods/issues?sort=updated&direction=desc&state=open" target="_blank">GitHub</a>.', 'pods' ); ?></li>
16
 
17
  <li><?php _e( "Pods is open source, so if you want to get into the code and submit your own fixes or features, go at it, we'd love to have you contribute on our project! With GitHub, it's really easy to contribute back, so why not give it a try?", 'pods'); ?></li>
18
  </ul>
@@ -30,7 +30,7 @@
30
 
31
  if ( 0 < $max_items ) {
32
  ?>
33
- <h3><?php _e( 'Latest Forum Posts at <a href="https://wordpress.org/support/plugin/pods" target="_blank">wordpress.org</a>', 'pods'); ?></h3>
34
 
35
  <ul class="ul-disc">
36
  <?php
@@ -43,7 +43,7 @@
43
  $author_text = '<br /> by ';
44
 
45
  if ( !empty( $author->link ) )
46
- $author_text .= '<a href="' . $author->link . '" target="_blank">';
47
 
48
  $author_text .= $author->name;
49
 
@@ -77,7 +77,7 @@
77
 
78
  if ( 0 < $max_items ) {
79
  ?>
80
- <h3><?php _e( 'Latest Activity on <a href="http://github.com/pods-framework/pods" target="_blank">GitHub</a>', 'pods' ); ?></h3>
81
 
82
  <ul class="ul-disc">
83
  <?php
@@ -90,7 +90,7 @@
90
  $author_text = '<br /> by ';
91
 
92
  if ( !empty( $author->link ) )
93
- $author_text .= '<a href="' . $author->link . '" target="_blank">';
94
 
95
  $author_text .= $author->name;
96
 
6
 
7
  <h3><?php _e( 'Pods Support' , 'pods'); ?></h3>
8
 
9
+ <p><?php _e( 'There are many resources available to help you learn to use Pods on our site, <a href="https://pods.io/" target="_blank" rel="noopener noreferrer">Pods.io</a>:', 'pods'); ?></p>
10
  <ul class="ul-disc">
11
+ <li><?php _e('To learn more about using Pods, see our <a href="https://pods.io/docs/" target="_blank" rel="noopener noreferrer">documentation</a> and subscribe to our <a href="https://www.youtube.com/user/podsframework/" target="_blank" rel="noopener noreferrer">YouTube Channel</a>', 'pods'); ?>.
12
 
13
+ <li><?php _e( 'To get help with a specific issue, you can ask in our <a href="https://wordpress.org/support/plugin/pods" target="_blank" rel="noopener noreferrer">support forums</a>, or you can join <a href="https://pods.io/chat/" target="_blank" rel="noopener noreferrer">our Slack chat</a>', 'pods'); ?>.
14
 
15
+ <li><?php _e('To report <strong>bugs or request features</strong>, go to our <a href="https://github.com/pods-framework/pods/issues?sort=updated&direction=desc&state=open" target="_blank" rel="noopener noreferrer">GitHub</a>.', 'pods' ); ?></li>
16
 
17
  <li><?php _e( "Pods is open source, so if you want to get into the code and submit your own fixes or features, go at it, we'd love to have you contribute on our project! With GitHub, it's really easy to contribute back, so why not give it a try?", 'pods'); ?></li>
18
  </ul>
30
 
31
  if ( 0 < $max_items ) {
32
  ?>
33
+ <h3><?php _e( 'Latest Forum Posts at <a href="https://wordpress.org/support/plugin/pods" target="_blank" rel="noopener noreferrer">wordpress.org</a>', 'pods'); ?></h3>
34
 
35
  <ul class="ul-disc">
36
  <?php
43
  $author_text = '<br /> by ';
44
 
45
  if ( !empty( $author->link ) )
46
+ $author_text .= '<a href="' . $author->link . '" target="_blank" rel="noopener noreferrer">';
47
 
48
  $author_text .= $author->name;
49
 
77
 
78
  if ( 0 < $max_items ) {
79
  ?>
80
+ <h3><?php _e( 'Latest Activity on <a href="http://github.com/pods-framework/pods" target="_blank" rel="noopener noreferrer">GitHub</a>', 'pods' ); ?></h3>
81
 
82
  <ul class="ul-disc">
83
  <?php
90
  $author_text = '<br /> by ';
91
 
92
  if ( !empty( $author->link ) )
93
+ $author_text .= '<a href="' . $author->link . '" target="_blank" rel="noopener noreferrer">';
94
 
95
  $author_text .= $author->name;
96
 
ui/admin/setup-add.php CHANGED
@@ -65,7 +65,7 @@
65
  <p>
66
  <?php _e( 'Pods are content types that you can customize and define fields for based on your needs. You can choose to create a Custom Post Type, Custom Taxonomy, or Custom Settings Pages for site-specific data. You can also extend existing content types like WP Objects such as Post Types, Taxonomies, Users, or Comments.', 'pods' ); ?>
67
  <br /><br />
68
- <?php _e( 'Not sure what content type you should use? Check out our <a href="https://pods.io/docs/comparisons/compare-content-types/" target="_blank">Content Type Comparison</a> to help you decide.', 'pods' ); ?>
69
  </p>
70
 
71
  </div>
65
  <p>
66
  <?php _e( 'Pods are content types that you can customize and define fields for based on your needs. You can choose to create a Custom Post Type, Custom Taxonomy, or Custom Settings Pages for site-specific data. You can also extend existing content types like WP Objects such as Post Types, Taxonomies, Users, or Comments.', 'pods' ); ?>
67
  <br /><br />
68
+ <?php _e( 'Not sure what content type you should use? Check out our <a href="https://pods.io/docs/comparisons/compare-content-types/" target="_blank" rel="noopener noreferrer">Content Type Comparison</a> to help you decide.', 'pods' ); ?>
69
  </p>
70
 
71
  </div>
ui/admin/setup-edit.php CHANGED
@@ -674,7 +674,7 @@ if ( isset( $tabs[ 'extra-fields' ] ) ) {
674
 
675
  <p><?php echo sprintf( __( 'Enabling extra fields for this taxonomy will add a custom table into your database as <em>%s</em>.', 'pods' ), $wpdb->prefix . 'pods_' . pods_v( 'name', $pod ) ); ?></p>
676
 
677
- <p><a href="https://pods.io/docs/comparisons/compare-storage-types/" target="_blank"><?php _e( 'Find out more', 'pods' ); ?> &raquo;</a></p>
678
 
679
  <p class="submit">
680
  <a href="<?php echo esc_url( pods_query_arg( array( 'enable_extra_fields' => 1 ) ) ); ?>" class="button-primary"><?php _e( 'Enable Extra Fields', 'pods' ); ?></a>
674
 
675
  <p><?php echo sprintf( __( 'Enabling extra fields for this taxonomy will add a custom table into your database as <em>%s</em>.', 'pods' ), $wpdb->prefix . 'pods_' . pods_v( 'name', $pod ) ); ?></p>
676
 
677
+ <p><a href="https://pods.io/docs/comparisons/compare-storage-types/" target="_blank" rel="noopener noreferrer"><?php _e( 'Find out more', 'pods' ); ?> &raquo;</a></p>
678
 
679
  <p class="submit">
680
  <a href="<?php echo esc_url( pods_query_arg( array( 'enable_extra_fields' => 1 ) ) ); ?>" class="button-primary"><?php _e( 'Enable Extra Fields', 'pods' ); ?></a>
ui/admin/upgrade/backup.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  <div id="pods-wizard-options">
4
  <div class="pods-wizard-option">
5
- <a href="http://ithemes.com/member/go.php?r=31250&i=l44" target="_blank">
6
  <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/logo_backupbuddy.png" alt="Backup Buddy" />
7
 
8
  <p><?php _e( 'Receive 25% off', 'pods' ); ?></p>
@@ -15,7 +15,7 @@
15
  </p>
16
  </div>
17
  <div class="pods-wizard-option">
18
- <a href="http://vaultpress.com/podsframework/" target="_blank">
19
  <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/logo_vaultpress.png" alt="Vaultpress" />
20
 
21
  <p><?php _e( '1 free month', 'pods' ); ?></p>
2
 
3
  <div id="pods-wizard-options">
4
  <div class="pods-wizard-option">
5
+ <a href="http://ithemes.com/member/go.php?r=31250&i=l44" target="_blank" rel="noopener noreferrer">
6
  <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/logo_backupbuddy.png" alt="Backup Buddy" />
7
 
8
  <p><?php _e( 'Receive 25% off', 'pods' ); ?></p>
15
  </p>
16
  </div>
17
  <div class="pods-wizard-option">
18
+ <a href="http://vaultpress.com/podsframework/" target="_blank" rel="noopener noreferrer">
19
  <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/logo_vaultpress.png" alt="Vaultpress" />
20
 
21
  <p><?php _e( '1 free month', 'pods' ); ?></p>
ui/admin/view.php CHANGED
@@ -27,7 +27,7 @@ wp_enqueue_style( 'pods-form' );
27
  ?>
28
  <div id="minor-publishing-actions">
29
  <div id="preview-action">
30
- <a class="button" href="<?php echo esc_url( $pod->field( 'detail_url' ) ); ?>" target="_blank"><?php echo sprintf( __( 'View %s', 'pods' ), $obj->item ); ?></a>
31
  </div>
32
  <div class="clear"></div>
33
  </div>
27
  ?>
28
  <div id="minor-publishing-actions">
29
  <div id="preview-action">
30
+ <a class="button" href="<?php echo esc_url( $pod->field( 'detail_url' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php echo sprintf( __( 'View %s', 'pods' ), $obj->item ); ?></a>
31
  </div>
32
  <div class="clear"></div>
33
  </div>
ui/admin/widgets/list.php CHANGED
@@ -10,7 +10,7 @@
10
  }
11
  </style>
12
 
13
- <p><em><?php _e('You must specify a Pods Template or create a custom template, using <a href="https://pods.io/docs/build/using-magic-tags/" title="Using Magic Tags" target="_blank">magic tags</a>.', 'pods'); ?></p></em>
14
 
15
  <ol class="pods_list_widget_form">
16
  <li>
10
  }
11
  </style>
12
 
13
+ <p><em><?php _e('You must specify a Pods Template or create a custom template, using <a href="https://pods.io/docs/build/using-magic-tags/" title="Using Magic Tags" target="_blank" rel="noopener noreferrer">magic tags</a>.', 'pods'); ?></p></em>
14
 
15
  <ol class="pods_list_widget_form">
16
  <li>
ui/admin/widgets/single.php CHANGED
@@ -10,7 +10,7 @@
10
  }
11
  </style>
12
 
13
- <p><em><?php _e('You must specify a Pods Template or create a custom template, using <a href="https://pods.io/docs/build/using-magic-tags/" title="Using Magic Tags" target="_blank">magic tags</a>.', 'pods'); ?></p></em>
14
 
15
  <ol class="pods_single_widget_form">
16
  <li>
10
  }
11
  </style>
12
 
13
+ <p><em><?php _e('You must specify a Pods Template or create a custom template, using <a href="https://pods.io/docs/build/using-magic-tags/" title="Using Magic Tags" target="_blank" rel="noopener noreferrer">magic tags</a>.', 'pods'); ?></p></em>
14
 
15
  <ol class="pods_single_widget_form">
16
  <li>
ui/fields/tinymce.php CHANGED
@@ -6,6 +6,11 @@ if ( ! ( defined( 'PODS_DISABLE_FILE_UPLOAD' ) && true === PODS_DISABLE_FILE_UPL
6
  $settings['media_buttons'] = (boolean) pods_var( 'wysiwyg_media_buttons', $options, true );
7
  }
8
 
 
 
 
 
 
9
  if ( isset( $options['settings'] ) ) {
10
  $settings = array_merge( $settings, $options['settings'] );
11
  }
6
  $settings['media_buttons'] = (boolean) pods_var( 'wysiwyg_media_buttons', $options, true );
7
  }
8
 
9
+ $editor_height = pods_v( 'wysiwyg_editor_height', $options, false );
10
+ if ( $editor_height ) {
11
+ $settings['editor_height'] = $editor_height;
12
+ }
13
+
14
  if ( isset( $options['settings'] ) ) {
15
  $settings = array_merge( $settings, $options['settings'] );
16
  }
ui/js/pods-dfv/_src/file-upload/views/file-upload-item.html CHANGED
@@ -32,12 +32,12 @@
32
  </li>
33
  <% if ( 1 == fieldConfig.file_linked && '' != download ) { %>
34
  <li class="pods-dfv-list-col pods-dfv-list-download">
35
- <a href="<%- download %>" target="_blank" title="<%- PodsI18n.__( 'Download' ) %>"><%- PodsI18n.__( 'Download' ) %></a>
36
  </li>
37
  <% } %>
38
  <% if ( 1 == fieldConfig.file_show_edit_link && '' != edit_link ) { %>
39
  <li class="pods-dfv-list-col pods-dfv-list-edit">
40
- <a href="<%- edit_link %>" target="_blank" title="<%- PodsI18n.__( 'Edit' ) %>"><%- PodsI18n.__( 'Edit' ) %></a>
41
  </li>
42
  <% } %>
43
  </ul>
32
  </li>
33
  <% if ( 1 == fieldConfig.file_linked && '' != download ) { %>
34
  <li class="pods-dfv-list-col pods-dfv-list-download">
35
+ <a href="<%- download %>" target="_blank" rel="noopener noreferrer" title="<%- PodsI18n.__( 'Download' ) %>"><%- PodsI18n.__( 'Download' ) %></a>
36
  </li>
37
  <% } %>
38
  <% if ( 1 == fieldConfig.file_show_edit_link && '' != edit_link ) { %>
39
  <li class="pods-dfv-list-col pods-dfv-list-edit">
40
+ <a href="<%- edit_link %>" target="_blank" rel="noopener noreferrer" title="<%- PodsI18n.__( 'Edit' ) %>"><%- PodsI18n.__( 'Edit' ) %></a>
41
  </li>
42
  <% } %>
43
  </ul>
ui/js/pods-dfv/_src/pick/views/list-item.html CHANGED
@@ -35,9 +35,9 @@
35
  </li>
36
  <li class="pods-dfv-list-col pods-dfv-list-remove"><a href="#remove" title="<%- PodsI18n.__( 'Deselect' ) %>"><%- PodsI18n.__( 'Deselect' ) %></a></li>
37
  <% if ( 1 == fieldConfig.pick_show_view_link && '' != link ) { %>
38
- <li class="pods-dfv-list-col pods-dfv-list-link"><a href="<%- link %>" title="<%- PodsI18n.__( 'View' ) %>" target="_blank"><%- PodsI18n.__( 'View' ) %></a></li>
39
  <% } %>
40
  <% if ( 1 == fieldConfig.pick_show_edit_link && '' != edit_link ) { %>
41
- <li class="pods-dfv-list-col pods-dfv-list-edit"><a href="<%- edit_link %>" title="<%- PodsI18n.__( 'Edit' ) %>" target="_blank"><%- PodsI18n.__( 'Edit' ) %></a></li>
42
  <% } %>
43
  </ul>
35
  </li>
36
  <li class="pods-dfv-list-col pods-dfv-list-remove"><a href="#remove" title="<%- PodsI18n.__( 'Deselect' ) %>"><%- PodsI18n.__( 'Deselect' ) %></a></li>
37
  <% if ( 1 == fieldConfig.pick_show_view_link && '' != link ) { %>
38
+ <li class="pods-dfv-list-col pods-dfv-list-link"><a href="<%- link %>" title="<%- PodsI18n.__( 'View' ) %>" target="_blank" rel="noopener noreferrer"><%- PodsI18n.__( 'View' ) %></a></li>
39
  <% } %>
40
  <% if ( 1 == fieldConfig.pick_show_edit_link && '' != edit_link ) { %>
41
+ <li class="pods-dfv-list-col pods-dfv-list-edit"><a href="<%- edit_link %>" title="<%- PodsI18n.__( 'Edit' ) %>" target="_blank" rel="noopener noreferrer"><%- PodsI18n.__( 'Edit' ) %></a></li>
42
  <% } %>
43
  </ul>
ui/js/pods-dfv/_src/pick/views/select-view.js CHANGED
@@ -339,7 +339,30 @@ export const SelectView = PodsMn.CollectionView.extend( {
339
  placeholder: placeholder,
340
  allowClear: isSingle,
341
  disabled: fieldConfig.limitDisable,
342
- tags: fieldConfig.pick_taggable
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  };
344
 
345
  if ( ajaxData.ajax ) {
339
  placeholder: placeholder,
340
  allowClear: isSingle,
341
  disabled: fieldConfig.limitDisable,
342
+ tags: fieldConfig.pick_taggable,
343
+ escapeMarkup: function( html ) {
344
+ // Do not try to escape the markup if it's not a string.
345
+ if ( 'string' !== typeof html ) {
346
+ return html;
347
+ }
348
+
349
+ // Escape potential script tags.
350
+ return String( html ).replace( /<script|<\/script/g, function( html ) {
351
+ let replaceMap = {
352
+ '\\': '&#92;',
353
+ '&': '&amp;',
354
+ '<': '&lt;',
355
+ '>': '&gt;',
356
+ '"': '&quot;',
357
+ '\'': '&#39;',
358
+ '/': '&#47;'
359
+ };
360
+
361
+ return String( html ).replace( /[&<>"'\/\\]/g, function( match ) {
362
+ return replaceMap[ match ];
363
+ } );
364
+ } );
365
+ }
366
  };
367
 
368
  if ( ajaxData.ajax ) {
ui/js/pods-dfv/pods-dfv.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var PodsDFV=function(){"use strict";var o=Backbone.Model.extend({defaults:{htmlAttr:{},fieldConfig:{}}}),n=wp.data&&wp.data.select("core/editor"),e=void 0,i=function(){e=n.isCurrentPostPublished()?wp.data.subscribe(d):wp.data.subscribe(l)};function t(){var e=n.getCurrentPostAttribute("featured_media"),i="";if(!e)return i;var t=wp.data.select("core").getMedia(e);if(t){var l=wp.hooks.applyFilters("editor.PostFeaturedImage.imageSize","post-thumbnail","");i=t.media_details&&t.media_details.sizes&&t.media_details.sizes[l]?t.media_details.sizes[l].source_url:t.source_url}return i}function l(){n.isCurrentPostPublished()&&(e(),s({icon:t(),link:n.getPermalink(),edit_link:"post.php?post="+n.getCurrentPostId()+"&action=edit&pods_modal=1",selected:!0}))}function d(){d.wasSaving?n.isSavingPost()||(d.wasSaving=!1,n.didPostSaveRequestSucceed()&&(e(),s({icon:t()}))):d.wasSaving=!(!n.isSavingPost()||n.isAutosavingPost())}function s(e){var i={id:n.getCurrentPostId(),name:n.getCurrentPostAttribute("title")},t=Object.assign(i,e);window.parent.jQuery(window.parent).trigger("dfv:modal:update",t)}var a=PodsMn.CollectionView.extend({childViewEventPrefix:!1,initialize:function(e){this.fieldModel=e.fieldModel,this.childViewOptions={fieldModel:e.fieldModel}}}),c=PodsMn.View.extend({childViewEventPrefix:!1,serializeData:function(){var e=this.options.fieldModel,i=this.model?this.model.toJSON():{};return i.htmlAttr=e.get("htmlAttr"),i.fieldConfig=e.get("fieldConfig"),i}}),r=PodsMn.View.extend({childViewEventPrefix:!1,initialize:function(e){this.fieldItemData=e.fieldItemData}}),f=Backbone.Model.extend({defaults:{id:0,icon:"",name:"",edit_link:"",link:"",download:""}}),h=Backbone.Collection.extend({model:f}),m=c.extend({childViewEventPrefix:!1,tagName:"li",template:_.template('<input name="<%- htmlAttr.name %>[<%- id %>][id]" data-name-clean="<%- htmlAttr.name_clean %>-id" id="<%- htmlAttr.id %>-<%- id %>-id" class="<%- htmlAttr.class %>" type="hidden" value="<%- id %>">\n<ul class="pods-dfv-list-meta media-item">\n\t<% if ( 1 != fieldConfig.file_limit ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-handle"><span><%- PodsI18n.__( \'Reorder\' ) %></span></li>\n\t<% } %>\n\t<li class="pods-dfv-list-col pods-dfv-list-icon"><img class="pinkynail" src="<%- icon %>" alt="<%- PodsI18n.__( \'Icon\' ) %>"></li>\n\t<li class="pods-dfv-list-col pods-dfv-list-name">\n\t\t<% if ( 0 != fieldConfig.file_edit_title ) { %>\n\t\t\t<input name="<%- htmlAttr.name %>[<%- id %>][title]" data-name-clean="<%- htmlAttr.name_clean %>-title" id="pods-form-ui-<%- htmlAttr.name_clean %>-<%- id %>-title" class="pods-form-ui-field-type-text pods-form-ui-field-name-<%- htmlAttr.name_clean %>-title" type="text" value="<%- name %>" tabindex="2" maxlength="255">\n\t\t<% } else { %>\n\t\t\t<%- name %>\n\t\t<% } %>\n\t</li>\n\t<li class="pods-dfv-list-col pods-dfv-list-actions">\n\t\t<ul>\n\t\t\t<li class="pods-dfv-list-col pods-dfv-list-remove">\n\t\t\t\t<a href="#remove" title="<%- PodsI18n.__( \'Deselect\' ) %>"><%- PodsI18n.__( \'Deselect\' ) %></a>\n\t\t\t</li>\n\t\t\t<% if ( 1 == fieldConfig.file_linked && \'\' != download ) { %>\n\t\t\t\t<li class="pods-dfv-list-col pods-dfv-list-download">\n\t\t\t\t\t<a href="<%- download %>" target="_blank" title="<%- PodsI18n.__( \'Download\' ) %>"><%- PodsI18n.__( \'Download\' ) %></a>\n\t\t\t\t</li>\n\t\t\t<% } %>\n\t\t\t<% if ( 1 == fieldConfig.file_show_edit_link && \'\' != edit_link ) { %>\n\t\t\t\t<li class="pods-dfv-list-col pods-dfv-list-edit">\n\t\t\t\t\t<a href="<%- edit_link %>" target="_blank" title="<%- PodsI18n.__( \'Edit\' ) %>"><%- PodsI18n.__( \'Edit\' ) %></a>\n\t\t\t\t</li>\n\t\t\t<% } %>\n\t\t</ul>\n\t</li>\n</ul>\n'),className:"pods-dfv-list-item",ui:{dragHandle:".pods-dfv-list-handle",editLink:".pods-dfv-list-edit-link",viewLink:".pods-dfv-list-link",downloadLink:".pods-dfv-list-download",removeButton:".pods-dfv-list-remove",itemName:".pods-dfv-list-name"},triggers:{"click @ui.removeButton":"remove:file:click"}}),p=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-dfv-list",childView:m,childViewTriggers:{"remove:file:click":"childview:remove:file:click"},onAttach:function(){var e=this.options.fieldModel.get("fieldConfig"),i="y";1!=e.file_limit&&("tiles"==e.file_field_template&&(i=""),this.$el.sortable({containment:"parent",axis:i,scrollSensitivity:40,tolerance:"pointer",opacity:.6}))}}),u=c.extend({childViewEventPrefix:!1,tagName:"div",template:_.template('<a class="button pods-dfv-list-add" href="#" tabindex="2"><%= fieldConfig.file_add_button %></a>'),ui:{addButton:".pods-dfv-list-add"},triggers:{"click @ui.addButton":"childview:add:file:click"}}),v=PodsMn.Object.extend({constructor:function(e){this.browseButton=e.browseButton,this.uiRegion=e.uiRegion,this.fieldConfig=e.fieldConfig,PodsMn.Object.call(this,e)}}),g=Backbone.Model.extend({defaults:{id:0,filename:"",progress:0,errorMsg:""}}),w=PodsMn.View.extend({model:g,tagName:"li",template:_.template('<ul class="pods-dfv-list-meta media-item">\n\t<% if ( \'\' === errorMsg ) { %>\n\t\t<li class="pods-dfv-list-col pods-progress"><div class="progress-bar" style="width: <%- progress %>%;"></div></li>\n\t<% } %>\n\t<li class="pods-dfv-list-col pods-dfv-list-name"><%- filename %></li>\n</ul>\n<% if ( \'\' !== errorMsg ) { %>\n\t<div class="error"><%- errorMsg %></div>\n<% } %>\n'),attributes:function(){return{class:"pods-dfv-list-item",id:this.model.get("id")}},modelEvents:{change:"onModelChanged"},onModelChanged:function(){this.render()}}),C=PodsMn.CollectionView.extend({tagName:"ul",className:"pods-dfv-list pods-dfv-list-queue",childView:w}),b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k=[v.extend({plupload:{},fileUploader:"plupload",initialize:function(){this.fieldConfig.plupload_init.browse_button=this.browseButton,this.plupload=new plupload.Uploader(this.fieldConfig.plupload_init),this.plupload.init(),this.plupload.bind("FilesAdded",this.onFilesAdded,this),this.plupload.bind("UploadProgress",this.onUploadProgress,this),this.plupload.bind("FileUploaded",this.onFileUploaded,this)},onFilesAdded:function(e,i){var t=void 0,l=void 0,n=void 0;l=new Backbone.Collection,jQuery.each(i,function(e,i){t=new g({id:i.id,filename:i.name}),l.add(t)}),(n=new C({collection:l})).render(),this.uiRegion.reset(),this.uiRegion.show(n),this.queueCollection=l,e.refresh(),e.start()},onUploadProgress:function(e,i){this.queueCollection.get(i.id).set({progress:i.percent})},onFileUploaded:function(e,i,t){var l=this.queueCollection.get(i.id),n=t.response,o=[],d=void 0;if("Error: "===t.response.substr(0,7))n=n.substr(7),window.console&&console.log(n),l.set({progress:0,errorMsg:n});else if("<e>"===t.response.substr(0,3))n=jQuery(n).text(),window.console&&console.log(n),l.set({progress:0,errorMsg:n});else{if("object"!==(void 0===(d=null!==(d=n.match(/{.*}$/))&&0<d.length?jQuery.parseJSON(d[0]):{})?"undefined":b(d))||jQuery.isEmptyObject(d))return window.console&&console.log(n),window.console&&console.log(d),void l.set({progress:0,errorMsg:PodsI18n.__("Error uploading file: ")+i.name});o={id:d.ID,icon:d.thumbnail,name:d.post_title,edit_link:d.edit_link,link:d.link,download:d.download},l.trigger("destroy",l),this.trigger("added:files",o)}}}),v.extend({mediaObject:{},fileUploader:"attachment",invoke:function(){void 0===wp.Uploader.defaults.filters.mime_types&&(wp.Uploader.defaults.filters.mime_types=[{title:PodsI18n.__("Allowed Files"),extensions:"*"}]);var e=wp.Uploader.defaults.filters.mime_types[0].extensions;wp.Uploader.defaults.filters.mime_types[0].extensions=this.fieldConfig.limit_extensions,this.mediaObject=wp.media({title:this.fieldConfig.file_modal_title,multiple:1!=this.fieldConfig.file_limit,library:{type:this.fieldConfig.limit_types},button:{text:this.fieldConfig.file_modal_add_button}}),this.mediaObject.once("select",this.onMediaSelect,this),this.mediaObject.open(),this.mediaObject.content.mode(this.fieldConfig.file_attachment_tab),wp.Uploader.defaults.filters.mime_types[0].extensions=e},onMediaSelect:function(){var e=this.mediaObject.state().get("selection"),l=[];e&&(e.each(function(e){var i=e.attributes.sizes,t=void 0;t=e.attributes.icon,void 0!==i&&(void 0!==i.thumbnail&&void 0!==i.thumbnail.url?t=i.thumbnail.url:void 0!==i.full&&void 0!==i.full.url&&(t=i.full.url)),l.push({id:e.attributes.id,icon:t,name:e.attributes.title,edit_link:e.attributes.editLink,link:e.attributes.link,download:e.attributes.url})}),this.trigger("added:files",l))}})],y=r.extend({childViewEventPrefix:!1,template:_.template('<div class="pods-ui-file-list pods-field-template-<%- fieldConfig.file_field_template %>"></div>\n<div class="pods-ui-region"></div>\n<div class="pods-ui-form"></div>\n'),regions:{list:".pods-ui-file-list",uiRegion:".pods-ui-region",form:".pods-ui-form"},childViewEvents:{"childview:remove:file:click":"onChildviewRemoveFileClick","childview:add:file:click":"onChildviewAddFileClick"},uploader:{},onBeforeRender:function(){void 0===this.collection&&(this.collection=new h(this.fieldItemData))},onRender:function(){var e=new p({collection:this.collection,fieldModel:this.model}),i=new u({fieldModel:this.model});this.showChildView("list",e),this.showChildView("form",i),this.uploader=this.createUploader(),this.listenTo(this.uploader,"added:files",this.onAddedFiles)},onChildviewRemoveFileClick:function(e){this.collection.remove(e.model)},onChildviewAddFileClick:function(){"function"==typeof this.uploader.invoke&&this.uploader.invoke()},onAddedFiles:function(e){var i=+this.model.get("fieldConfig").file_limit,t=void 0,l=void 0;(t=this.collection.clone()).add(e),l=0===i?t.models:t.filter(function(e){return t.indexOf(e)>=t.length-i}),this.collection.reset(l)},createUploader:function(){var e=this.model.get("fieldConfig"),t=e.file_uploader,l=void 0;if(jQuery.each(k,function(e,i){if(t===i.prototype.fileUploader)return l=i,!1}),void 0!==l)return this.uploader=new l({browseButton:this.getRegion("form").getEl(".pods-dfv-list-add").get(),uiRegion:this.getRegion("uiRegion"),fieldConfig:e}),this.uploader;throw"Could not locate file uploader '"+t+"'"}}),x=wp.media.view.Modal.extend({close:function(e){var i=wp.media.view.Modal.prototype.close.apply(this,e);return e&&e.escape&&window.parent.jQuery(window.parent).trigger("dfv:modal:cancel"),i}}),P=wp.media.view.Frame.extend({className:"pods-modal-frame",template:_.template('<div class="media-frame-title" /><div class="media-frame-iframe" />'),regions:["title","iframe"],initialize:function(){wp.media.view.Frame.prototype.initialize.apply(this,arguments),this.$el.addClass("wp-core-ui"),this.initState(),this.initModal(),this.on("iframe:create:default",this.iframeContent,this),this.iframe.mode("default"),this.on("title:create:default",this.createTitle,this),this.title.mode("default")},initState:function(){var e=this.options.title||PodsI18n.__("Add New Record"),i=this.options.src||"/";this.states.add([new wp.media.controller.State({id:"default",title:e,src:i})]),this.options.state="default"},initModal:function(){this.modal=new x({controller:this}),this.modal.content(this)},render:function(){return!this.state()&&this.options.state&&this.setState(this.options.state),wp.media.view.Frame.prototype.render.apply(this,arguments)},iframeContent:function(e){e.view=new wp.media.view.Iframe({controller:this})},createTitle:function(e){e.view=new wp.media.View({controller:this,tagName:"h1"})}}),S=Backbone.Model.extend({defaults:{id:0,name:"",icon:"",link:"",edit_link:"",selected:!1},toggleSelected:function(){this.set("selected",!this.get("selected"))}}),A=Backbone.Collection.extend({model:S,setSelected:function(t){this.map(function(e){var i=_.contains(t,e.get("id")+"");e.set("selected",i)})},filterBySelected:function(){var e=this.filter(function(e){return e.get("selected")});return new A(e)},filterByUnselected:function(){var e=this.filter(function(e){return!e.get("selected")});return new A(e)}}),M=Backbone.Model.extend({defaults:{view_name:"select",iframe_src:"",pick_format_type:"single",pick_show_icon:!1,pick_show_view_link:!1,pick_show_edit_link:!1}}),V=c.extend({childViewEventPrefix:!1,tagName:"li",template:_.template('<div class="pods-field pods-boolean">\n\t<input name="<%- htmlAttr.name %>" data-name-clean="<%- htmlAttr.name_clean %>" data-label="<%- fieldConfig.label %>" id="<%- htmlAttr.id %><%= ordinal %>" class="pods-form-ui-field-type-pick pods-form-ui-field-name-<%- htmlAttr.name_clean %>" type="radio"\n\t\t\t<% if ( selected ) { %>\n\t\t\t\tchecked="CHECKED"\n\t\t\t<% } %>\n\t\t\tvalue="<%- id %>" tabindex="2">\n\t<label class="pods-form-ui-label pods-form-ui-label-<%- htmlAttr.id %><%= ordinal %>" for="<%- htmlAttr.id %><%= ordinal %>">\n\t\t<%= name %>\n\t</label>\n</div>\n'),templateContext:function(){return{ordinal:this.model.collection.indexOf(this.model)+1}},modelChanged:function(){this.render()}}),j=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-radio",childView:V}),I=c.extend({childViewEventPrefix:!1,tagName:"li",template:_.template('<div class="pods-field pods-boolean">\n\t<input name="<%- htmlAttr.name %>[<%= ordinal %>]"\n\t\t<%= selected ? \'checked="checked"\' : \'\' %>\n\t\tdata-name-clean="<%- htmlAttr.name_clean %>" data-label="<%- fieldConfig.label %>" id="<%- htmlAttr.id %><%= ordinal %>" class="pods-form-ui-field-type-pick" type="checkbox" tabindex="2" value="<%- id %>">\n\t<label class="pods-form-ui-label" for="<%- htmlAttr.id %><%= ordinal %>">\n\t\t<%= name %>\n\t</label>\n</div>\n'),className:"pods-pick",ui:{checkbox:"input.pods-form-ui-field-type-pick"},triggers:{"click @ui.checkbox":"toggle:selected"},modelEvents:{change:"modelChanged"},templateContext:function(){return{ordinal:this.model.collection.indexOf(this.model)}},modelChanged:function(){this.render()}}),L=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-checkbox-view",childView:I,childViewEvents:{"toggle:selected":"onChildviewToggleSelected"},onAttach:function(){this.validateSelectionLimit()||this.selectionLimitOver()},onChildviewToggleSelected:function(e){e.model.toggleSelected(),this.validateSelectionLimit()?this.selectionLimitUnder():this.selectionLimitOver()},validateSelectionLimit:function(){var e,i;return e=+this.fieldModel.get("fieldConfig").pick_limit,i=this.collection.filterBySelected().length,0===e||i<e},selectionLimitOver:function(){this.$el.find("input:checkbox:not(:checked)").prop("disabled",!0),this.trigger("selection:limit:over",this)},selectionLimitUnder:function(){this.$el.find("input:checkbox").prop("disabled",!1),this.trigger("selection:limit:under",this)}}),N=c.extend({childViewEventPrefix:!1,tagName:"option",template:!1,initialize:function(e){this.$el.val(this.model.get("id")),this.$el.text(this.model.get("name")),this.model.get("selected")&&this.$el.prop("selected","selected")}}),E=a.extend({childViewEventPrefix:!1,tagName:"optgroup",childView:N,attributes:function(){return{label:this.model.get("label")}}}),B=PodsMn.CollectionView.extend({childViewEventPrefix:!1,tagName:"select",triggers:{change:{event:"change:selected",stopPropagation:!1}},multiLastValidSelection:[],setCollection:function(e){this.collection=e},initialize:function(e){this.fieldModel=e.fieldModel,this.fieldConfig=this.fieldModel.get("fieldConfig")},childView:function(e){return this.fieldConfig.optgroup?E:N},childViewOptions:function(e,i){var t={fieldModel:this.fieldModel};return this.fieldConfig.optgroup&&(t.collection=new A(e.get("collection"))),t},serializeData:function(){var e=this.options.fieldModel,i=this.model?this.model.toJSON():{};return i.htmlAttr=e.get("attributes"),i.fieldConfig=e.get("fieldConfig"),i},attributes:function(){var e=this.options.fieldModel,i=e.get("htmlAttr"),t=e.get("fieldConfig"),l=i.name;return"multi"===t.pick_format_type&&(l+="[]"),{name:l,class:i.class,"data-name-clean":i.name_clean,id:i.id,tabindex:"2",multiple:"multi"===t.pick_format_type}},onAttach:function(){var e=this.fieldConfig.view_name,i=this.fieldConfig.pick_format_type;"select2"===e&&this.setupSelect2(),"select"===e&&"multi"===i&&(this.multiLastValidSelection=this.$el.val()),this.validateSelectionLimit()||this.selectionLimitOver()},onChangeSelected:function(){var e=+this.fieldConfig.pick_limit,i=this.fieldConfig.view_name,t=this.fieldConfig.pick_format_type;if("select"===i&&"multi"===t&&null!==this.$el.val()&&0!==e&&e<this.$el.val().length)return this.$el.val(this.multiLastValidSelection),window.alert(PodsI18n.__("You can only select")+" "+sprintf(PodsI18n._n("%s item","%s items",e),e)),void this.trigger("childview:change:selected",this);this.collection.setSelected(this.$el.val()),this.multiLastValidSelection=this.$el.val(),this.validateSelectionLimit()?this.selectionLimitUnder():this.selectionLimitOver(),this.trigger("childview:change:selected",this)},onBeforeDetach:function(){this.$el.selectWoo("destroy")},validateSelectionLimit:function(){var e,i,t=this.fieldConfig.pick_format_type,l=this.fieldConfig.pick_format_single;return""===this.$el.val()&&"single"===t&&"dropdown"===l||(e=+this.fieldConfig.pick_limit,i=this.collection.filterBySelected().length,0===e||i<e)},selectionLimitOver:function(){var e=this.fieldConfig.view_name,i=this.fieldConfig.pick_format_type;"select"===e&&"multi"===i&&this.$el.find("option:not(:selected)").prop("disabled",!0),this.trigger("childview:selection:limit:over",this)},selectionLimitUnder:function(){var e=this.fieldConfig.view_name,i=this.fieldConfig.pick_format_type;"select"===e&&"multi"===i&&this.$el.find("option").prop("disabled",!1),this.trigger("childview:selection:limit:under",this)},filterAjaxList:function(e){var i=this.collection.filterBySelected(),t=[];return _.each(e.results,function(e){e.text=e.name,i.get(e.id)||t.push(e)}),{results:t}},setupSelect2:function(){var e,t=this,l=this.$el,i=this.options.fieldModel.get("fieldConfig"),n=i.ajax_data,o=i.select2_overrides,d=i.pick_limit,s="single"===i.pick_format_type,a=this.collection.filterBySelected().length,c=void 0;0===a&&s&&l.prepend('<option selected="selected">'),e={maximumSelectionLength:s?void 0:d,placeholder:i.limitDisable?PodsI18n.__("You can only select")+" "+sprintf(PodsI18n._n("%s item","%s items",d),d):PodsI18n.__("Search")+" "+i.label+"...",allowClear:s,disabled:i.limitDisable,tags:i.pick_taggable},n.ajax&&jQuery.extend(e,{minimumInputLength:n.minimum_input_length,ajax:{url:ajaxurl+"?pods_ajax=1",type:"POST",dataType:"json",delay:n.delay,data:function(e){return{_wpnonce:n._wpnonce,action:"pods_relationship",method:"select2",pod:n.pod,field:n.field,uri:n.uri,id:n.id,query:e.term}},processResults:function(e,i){return t.filterAjaxList(e,i)}}}),l.selectWoo(jQuery.extend(!0,e,o)),(c=l.parent().find("ul.select2-selection__rendered")).sortable({containment:"parent"}),c.on("sortstop",function(){var e=c.find(".select2-selection__choice").get().reverse();jQuery(e).each(function(){var e=jQuery(this).data("data").id,i=l.find('option[value="'+e+'"]')[0];l.prepend(i)})})}}),O=c.extend({childViewEventPrefix:!1,tagName:"li",className:"pods-dfv-list-item pods-relationship",template:_.template('<input\n\t\t<% if ( \'single\' === fieldConfig.pick_format_type ) { %>\n\t\t\tname="<%- htmlAttr.name %>" id="<%- htmlAttr.id %>"\n\t\t<% } else { %>\n\t\t\tname="<%- htmlAttr.name %>[<%= ordinal %>]" id="<%- htmlAttr.id %><%= ordinal %>"\n\t\t<% } %>\n\t\tdata-name-clean="<%- htmlAttr.name_clean %>" type="hidden" value="<%- id %>">\n<ul class="pods-dfv-list-meta relationship-item">\n\t<% if ( 1 != fieldConfig.pick_limit ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-handle"><span><%- PodsI18n.__( \'Reorder\' ) %></span></li>\n\t<% } %>\n\t<% if ( 1 == fieldConfig.pick_show_icon ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-icon">\n\t\t\t<% if ( \'\' == icon ) { %>\n\t\t\t\t<% if ( /^dashicons/.test( fieldConfig.default_icon ) ) { %>\n\t\t\t\t\t<span class="pinkynail dashicons <%- fieldConfig.default_icon %>"></span>\n\t\t\t\t<% } else { %>\n\t\t\t\t\t<img class="pinkynail" src="<%- fieldConfig.default_icon %>" alt="Icon">\n\t\t\t\t<% } %>\n\t\t\t<% } else { %>\n\t\t\t\t<% if ( /^dashicons/.test( icon ) ) { %>\n\t\t\t\t\t<span class="pinkynail dashicons <%- icon %>"></span>\n\t\t\t\t<% } else { %>\n\t\t\t\t\t<img class="pinkynail" src="<%- icon %>" alt="Icon">\n\t\t\t\t<% } %>\n\t\t\t<% } %>\n\t\t</li>\n\t<% } %>\n\t<li class="pods-dfv-list-col pods-dfv-list-name">\n\t\t<%= name %>\n\t</li>\n\t<li class="pods-dfv-list-col pods-dfv-list-remove"><a href="#remove" title="<%- PodsI18n.__( \'Deselect\' ) %>"><%- PodsI18n.__( \'Deselect\' ) %></a></li>\n\t<% if ( 1 == fieldConfig.pick_show_view_link && \'\' != link ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-link"><a href="<%- link %>" title="<%- PodsI18n.__( \'View\' ) %>" target="_blank"><%- PodsI18n.__( \'View\' ) %></a></li>\n\t<% } %>\n\t<% if ( 1 == fieldConfig.pick_show_edit_link && \'\' != edit_link ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-edit"><a href="<%- edit_link %>" title="<%- PodsI18n.__( \'Edit\' ) %>" target="_blank"><%- PodsI18n.__( \'Edit\' ) %></a></li>\n\t<% } %>\n</ul>\n'),ui:{removeButton:".pods-dfv-list-remove a",editButton:".pods-dfv-list-edit a"},triggers:{"click @ui.removeButton":"remove:item:click","click @ui.editButton":"edit:item:click"},templateContext:function(){return{ordinal:this.model.collection.indexOf(this.model)}}}),U=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-dfv-list pods-relationship",childView:O,childViewTriggers:{"remove:item:click":"childview:remove:item:click","edit:item:click":"childview:edit:item:click"},filter:function(e,i,t){return e.attributes.selected},onAttach:function(){1!==this.options.fieldModel.get("fieldConfig").pick_limit&&this.$el.sortable({containment:"parent",axis:"y",scrollSensitivity:40,tolerance:"pointer",opacity:.6})}}),F="button-disabled",R=c.extend({childViewEventPrefix:!1,tagName:"div",className:"podsform-dfv-list-relationship-container",ui:{addButton:"a.pods-related-add-new"},template:_.template('<a href="/wp-admin/?pods_modal=1" class="button pods-related-add-new pods-modal" data-pod-id="<%- fieldConfig.pod_id %>" data-field-id="<%- fieldConfig.id %>" data-item-id="<%- fieldConfig.item_id %>">\n\t<%- PodsI18n.__( \'Add New\' ) %>\n</a>'),triggers:{"click @ui.addButton":"add:new:click"},disable:function(){this.getUI("addButton").addClass(F)},enable:function(){this.getUI("addButton").removeClass(F)},onAddNewClick:function(){this.getUI("addButton").hasClass(F)||this.trigger("childview:add:new",this)}}),D={checkbox:L,select:B,select2:B,radio:j,list:U},Q=void 0,$=r.extend({childViewEventPrefix:!1,template:_.template('<%if ( fieldConfig.view_name === \'list\' ) { %>\n\t<div class="pods-ui-list-autocomplete"></div>\n<% } %>\n\n<div class="pods-pick-values"></div>\n\n<% if ( fieldConfig.iframe_src != \'\' ) { %>\n\t<div class="pods-ui-add-new"></div>\n<% } %>'),regions:{autocomplete:".pods-ui-list-autocomplete",list:".pods-pick-values",addNew:".pods-ui-add-new"},childViewEvents:{"childview:remove:item:click":"onChildviewRemoveItemClick","childview:edit:item:click":"onChildviewEditItemClick","childview:selection:limit:over":"onChildviewSelectionLimitOver","childview:selection:limit:under":"onChildviewSelectionLimitUnder","childview:change:selected":"onChildviewChangeSelected","childview:add:new":"onChildviewAddNew"},onBeforeRender:function(){void 0===this.collection&&(this.collection=new A(this.fieldItemData))},onRender:function(){this.fieldConfig=new M(this.model.get("fieldConfig")),""!==this.fieldConfig.get("iframe_src")&&1==this.fieldConfig.get("pick_allow_add_new")&&this.showAddNew(),"list"===this.fieldConfig.get("view_name")&&this.buildAutocomplete(),this.showList()},buildAutocomplete:function(){var e,i,t=void 0,l=void 0,n=+this.fieldConfig.get("pick_limit");t={view_name:"select2",pick_format_type:"multi",selectFromExisting:!0,ajax_data:this.fieldConfig.get("ajax_data"),select2_overrides:this.fieldConfig.get("select2_overrides"),label:this.fieldConfig.get("label"),pick_limit:n},this.collection.filterBySelected().length>=n&&0!==n?(t.limitDisable=!0,this.onChildviewSelectionLimitOver()):this.onChildviewSelectionLimitUnder(),e=new o({fieldConfig:t}),i=this.collection.filterByUnselected(),(l=new B({collection:i,fieldModel:e})).filterAjaxList=this.filterAjaxList.bind(this),this.showChildView("autocomplete",l)},showList:function(){var e,i;if(e=this.fieldConfig.get("view_name"),void 0===D[e])throw new Error('Invalid view name "'+e+'"');i=new D[e]({collection:this.collection,fieldModel:this.model}),this.showChildView("list",i)},showAddNew:function(){var e=new R({fieldModel:this.model});this.showChildView("addNew",e)},filterAjaxList:function(e){var i=this.collection.filterBySelected(),t=[];return _.each(e.results,function(e){e.text=e.name,i.get(e.id)||t.push(e)}),this.collection.add(t),this.getChildView("autocomplete").setCollection(this.collection.filterByUnselected()),{results:t}},onChildviewSelectionLimitOver:function(e){var i=this.getChildView("addNew");i&&i.disable()},onChildviewSelectionLimitUnder:function(e){var i=this.getChildView("addNew");i&&i.enable()},onChildviewRemoveItemClick:function(e){e.model.toggleSelected(),this.getChildView("list").render(),"list"===this.fieldConfig.get("view_name")&&this.buildAutocomplete()},onChildviewAddNew:function(e){var i=this.model.get("fieldConfig");Q=new P({title:i.iframe_title_add,src:i.iframe_src}),this.setModalListeners(),Q.modal.open()},onChildviewEditItemClick:function(e){var i=this.model.get("fieldConfig");Q=new P({title:i.iframe_title_edit,src:e.ui.editButton.attr("href")}),this.setModalListeners(),Q.modal.open()},onChildviewChangeSelected:function(e){e.fieldConfig.selectFromExisting&&(_.defer(this.buildAutocomplete.bind(this)),this.getChildView("list").render())},setModalListeners:function(){jQuery(window).on("dfv:modal:update",this.modalSuccess.bind(this)),jQuery(window).on("dfv:modal:cancel",this.modalCancel.bind(this))},clearModalListeners:function(){jQuery(window).off("dfv:modal:update"),jQuery(window).off("dfv:modal:cancel")},modalSuccess:function(e,i){var t=this.collection.get(i.id);t?(t.set(i),this.getChildView("list").render()):this.collection.add(i),this.clearModalListeners(),Q.modal.close({})},modalCancel:function(){this.clearModalListeners()}}),z={file:y,avatar:y,pick:$},T={fields:Object.freeze({FileUpload:y,Pick:$}),models:Object.freeze({PodsDFVFieldModel:o,RelationshipModel:S,RelationshipCollection:A,FileUploadModel:f,FileUploadCollection:h}),fieldInstances:{},init:function(){var l=this;jQuery(".pods-form-ui-field").each(function(){var e=void 0,i=void 0,t={fieldType:void 0};jQuery(this).find("script.pods-dfv-field-data").each(function(){var e=jQuery.parseJSON(jQuery(this).html());jQuery(this).parents(".media-modal-content").length&&(e.fieldConfig.pick_allow_add_new=0),jQuery.extend(t,e),jQuery(this).remove()}),void 0!==t.fieldType&&void 0!==(e=z[t.fieldType])&&((i=new e({el:this,model:new o({htmlAttr:t.htmlAttr,fieldConfig:t.fieldConfig}),fieldItemData:t.fieldItemData})).render(),jQuery(this).trigger("render"),l.fieldInstances[t.htmlAttr.id]=i)})},isModalWindow:function(){return-1!==location.search.indexOf("pods_modal=")},isGutenbergEditorLoaded:function(){return void 0!==wp.data&&void 0!==wp.data.select("core/editor")}};return document.addEventListener("DOMContentLoaded",function(){T.init(),T.isModalWindow()&&T.isGutenbergEditorLoaded()&&i()}),T}();
2
  //# sourceMappingURL=pods-dfv.min.js.map
1
+ var PodsDFV=function(){"use strict";var o=Backbone.Model.extend({defaults:{htmlAttr:{},fieldConfig:{}}}),n=wp.data&&wp.data.select("core/editor"),e=void 0,i=function(){e=n.isCurrentPostPublished()?wp.data.subscribe(d):wp.data.subscribe(l)};function t(){var e=n.getCurrentPostAttribute("featured_media"),i="";if(!e)return i;var t=wp.data.select("core").getMedia(e);if(t){var l=wp.hooks.applyFilters("editor.PostFeaturedImage.imageSize","post-thumbnail","");i=t.media_details&&t.media_details.sizes&&t.media_details.sizes[l]?t.media_details.sizes[l].source_url:t.source_url}return i}function l(){n.isCurrentPostPublished()&&(e(),s({icon:t(),link:n.getPermalink(),edit_link:"post.php?post="+n.getCurrentPostId()+"&action=edit&pods_modal=1",selected:!0}))}function d(){d.wasSaving?n.isSavingPost()||(d.wasSaving=!1,n.didPostSaveRequestSucceed()&&(e(),s({icon:t()}))):d.wasSaving=!(!n.isSavingPost()||n.isAutosavingPost())}function s(e){var i={id:n.getCurrentPostId(),name:n.getCurrentPostAttribute("title")},t=Object.assign(i,e);window.parent.jQuery(window.parent).trigger("dfv:modal:update",t)}var a=PodsMn.CollectionView.extend({childViewEventPrefix:!1,initialize:function(e){this.fieldModel=e.fieldModel,this.childViewOptions={fieldModel:e.fieldModel}}}),c=PodsMn.View.extend({childViewEventPrefix:!1,serializeData:function(){var e=this.options.fieldModel,i=this.model?this.model.toJSON():{};return i.htmlAttr=e.get("htmlAttr"),i.fieldConfig=e.get("fieldConfig"),i}}),r=PodsMn.View.extend({childViewEventPrefix:!1,initialize:function(e){this.fieldItemData=e.fieldItemData}}),f=Backbone.Model.extend({defaults:{id:0,icon:"",name:"",edit_link:"",link:"",download:""}}),h=Backbone.Collection.extend({model:f}),m=c.extend({childViewEventPrefix:!1,tagName:"li",template:_.template('<input name="<%- htmlAttr.name %>[<%- id %>][id]" data-name-clean="<%- htmlAttr.name_clean %>-id" id="<%- htmlAttr.id %>-<%- id %>-id" class="<%- htmlAttr.class %>" type="hidden" value="<%- id %>">\n<ul class="pods-dfv-list-meta media-item">\n\t<% if ( 1 != fieldConfig.file_limit ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-handle"><span><%- PodsI18n.__( \'Reorder\' ) %></span></li>\n\t<% } %>\n\t<li class="pods-dfv-list-col pods-dfv-list-icon"><img class="pinkynail" src="<%- icon %>" alt="<%- PodsI18n.__( \'Icon\' ) %>"></li>\n\t<li class="pods-dfv-list-col pods-dfv-list-name">\n\t\t<% if ( 0 != fieldConfig.file_edit_title ) { %>\n\t\t\t<input name="<%- htmlAttr.name %>[<%- id %>][title]" data-name-clean="<%- htmlAttr.name_clean %>-title" id="pods-form-ui-<%- htmlAttr.name_clean %>-<%- id %>-title" class="pods-form-ui-field-type-text pods-form-ui-field-name-<%- htmlAttr.name_clean %>-title" type="text" value="<%- name %>" tabindex="2" maxlength="255">\n\t\t<% } else { %>\n\t\t\t<%- name %>\n\t\t<% } %>\n\t</li>\n\t<li class="pods-dfv-list-col pods-dfv-list-actions">\n\t\t<ul>\n\t\t\t<li class="pods-dfv-list-col pods-dfv-list-remove">\n\t\t\t\t<a href="#remove" title="<%- PodsI18n.__( \'Deselect\' ) %>"><%- PodsI18n.__( \'Deselect\' ) %></a>\n\t\t\t</li>\n\t\t\t<% if ( 1 == fieldConfig.file_linked && \'\' != download ) { %>\n\t\t\t\t<li class="pods-dfv-list-col pods-dfv-list-download">\n\t\t\t\t\t<a href="<%- download %>" target="_blank" title="<%- PodsI18n.__( \'Download\' ) %>"><%- PodsI18n.__( \'Download\' ) %></a>\n\t\t\t\t</li>\n\t\t\t<% } %>\n\t\t\t<% if ( 1 == fieldConfig.file_show_edit_link && \'\' != edit_link ) { %>\n\t\t\t\t<li class="pods-dfv-list-col pods-dfv-list-edit">\n\t\t\t\t\t<a href="<%- edit_link %>" target="_blank" title="<%- PodsI18n.__( \'Edit\' ) %>"><%- PodsI18n.__( \'Edit\' ) %></a>\n\t\t\t\t</li>\n\t\t\t<% } %>\n\t\t</ul>\n\t</li>\n</ul>\n'),className:"pods-dfv-list-item",ui:{dragHandle:".pods-dfv-list-handle",editLink:".pods-dfv-list-edit-link",viewLink:".pods-dfv-list-link",downloadLink:".pods-dfv-list-download",removeButton:".pods-dfv-list-remove",itemName:".pods-dfv-list-name"},triggers:{"click @ui.removeButton":"remove:file:click"}}),p=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-dfv-list",childView:m,childViewTriggers:{"remove:file:click":"childview:remove:file:click"},onAttach:function(){var e=this.options.fieldModel.get("fieldConfig"),i="y";1!=e.file_limit&&("tiles"==e.file_field_template&&(i=""),this.$el.sortable({containment:"parent",axis:i,scrollSensitivity:40,tolerance:"pointer",opacity:.6}))}}),u=c.extend({childViewEventPrefix:!1,tagName:"div",template:_.template('<a class="button pods-dfv-list-add" href="#" tabindex="2"><%= fieldConfig.file_add_button %></a>'),ui:{addButton:".pods-dfv-list-add"},triggers:{"click @ui.addButton":"childview:add:file:click"}}),v=PodsMn.Object.extend({constructor:function(e){this.browseButton=e.browseButton,this.uiRegion=e.uiRegion,this.fieldConfig=e.fieldConfig,PodsMn.Object.call(this,e)}}),g=Backbone.Model.extend({defaults:{id:0,filename:"",progress:0,errorMsg:""}}),w=PodsMn.View.extend({model:g,tagName:"li",template:_.template('<ul class="pods-dfv-list-meta media-item">\n\t<% if ( \'\' === errorMsg ) { %>\n\t\t<li class="pods-dfv-list-col pods-progress"><div class="progress-bar" style="width: <%- progress %>%;"></div></li>\n\t<% } %>\n\t<li class="pods-dfv-list-col pods-dfv-list-name"><%- filename %></li>\n</ul>\n<% if ( \'\' !== errorMsg ) { %>\n\t<div class="error"><%- errorMsg %></div>\n<% } %>\n'),attributes:function(){return{class:"pods-dfv-list-item",id:this.model.get("id")}},modelEvents:{change:"onModelChanged"},onModelChanged:function(){this.render()}}),C=PodsMn.CollectionView.extend({tagName:"ul",className:"pods-dfv-list pods-dfv-list-queue",childView:w}),b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k=[v.extend({plupload:{},fileUploader:"plupload",initialize:function(){this.fieldConfig.plupload_init.browse_button=this.browseButton,this.plupload=new plupload.Uploader(this.fieldConfig.plupload_init),this.plupload.init(),this.plupload.bind("FilesAdded",this.onFilesAdded,this),this.plupload.bind("UploadProgress",this.onUploadProgress,this),this.plupload.bind("FileUploaded",this.onFileUploaded,this)},onFilesAdded:function(e,i){var t=void 0,l=void 0,n=void 0;l=new Backbone.Collection,jQuery.each(i,function(e,i){t=new g({id:i.id,filename:i.name}),l.add(t)}),(n=new C({collection:l})).render(),this.uiRegion.reset(),this.uiRegion.show(n),this.queueCollection=l,e.refresh(),e.start()},onUploadProgress:function(e,i){this.queueCollection.get(i.id).set({progress:i.percent})},onFileUploaded:function(e,i,t){var l=this.queueCollection.get(i.id),n=t.response,o=[],d=void 0;if("Error: "===t.response.substr(0,7))n=n.substr(7),window.console&&console.log(n),l.set({progress:0,errorMsg:n});else if("<e>"===t.response.substr(0,3))n=jQuery(n).text(),window.console&&console.log(n),l.set({progress:0,errorMsg:n});else{if("object"!==(void 0===(d=null!==(d=n.match(/{.*}$/))&&0<d.length?jQuery.parseJSON(d[0]):{})?"undefined":b(d))||jQuery.isEmptyObject(d))return window.console&&console.log(n),window.console&&console.log(d),void l.set({progress:0,errorMsg:PodsI18n.__("Error uploading file: ")+i.name});o={id:d.ID,icon:d.thumbnail,name:d.post_title,edit_link:d.edit_link,link:d.link,download:d.download},l.trigger("destroy",l),this.trigger("added:files",o)}}}),v.extend({mediaObject:{},fileUploader:"attachment",invoke:function(){void 0===wp.Uploader.defaults.filters.mime_types&&(wp.Uploader.defaults.filters.mime_types=[{title:PodsI18n.__("Allowed Files"),extensions:"*"}]);var e=wp.Uploader.defaults.filters.mime_types[0].extensions;wp.Uploader.defaults.filters.mime_types[0].extensions=this.fieldConfig.limit_extensions,this.mediaObject=wp.media({title:this.fieldConfig.file_modal_title,multiple:1!=this.fieldConfig.file_limit,library:{type:this.fieldConfig.limit_types},button:{text:this.fieldConfig.file_modal_add_button}}),this.mediaObject.once("select",this.onMediaSelect,this),this.mediaObject.open(),this.mediaObject.content.mode(this.fieldConfig.file_attachment_tab),wp.Uploader.defaults.filters.mime_types[0].extensions=e},onMediaSelect:function(){var e=this.mediaObject.state().get("selection"),l=[];e&&(e.each(function(e){var i=e.attributes.sizes,t=void 0;t=e.attributes.icon,void 0!==i&&(void 0!==i.thumbnail&&void 0!==i.thumbnail.url?t=i.thumbnail.url:void 0!==i.full&&void 0!==i.full.url&&(t=i.full.url)),l.push({id:e.attributes.id,icon:t,name:e.attributes.title,edit_link:e.attributes.editLink,link:e.attributes.link,download:e.attributes.url})}),this.trigger("added:files",l))}})],y=r.extend({childViewEventPrefix:!1,template:_.template('<div class="pods-ui-file-list pods-field-template-<%- fieldConfig.file_field_template %>"></div>\n<div class="pods-ui-region"></div>\n<div class="pods-ui-form"></div>\n'),regions:{list:".pods-ui-file-list",uiRegion:".pods-ui-region",form:".pods-ui-form"},childViewEvents:{"childview:remove:file:click":"onChildviewRemoveFileClick","childview:add:file:click":"onChildviewAddFileClick"},uploader:{},onBeforeRender:function(){void 0===this.collection&&(this.collection=new h(this.fieldItemData))},onRender:function(){var e=new p({collection:this.collection,fieldModel:this.model}),i=new u({fieldModel:this.model});this.showChildView("list",e),this.showChildView("form",i),this.uploader=this.createUploader(),this.listenTo(this.uploader,"added:files",this.onAddedFiles)},onChildviewRemoveFileClick:function(e){this.collection.remove(e.model)},onChildviewAddFileClick:function(){"function"==typeof this.uploader.invoke&&this.uploader.invoke()},onAddedFiles:function(e){var i=+this.model.get("fieldConfig").file_limit,t=void 0,l=void 0;(t=this.collection.clone()).add(e),l=0===i?t.models:t.filter(function(e){return t.indexOf(e)>=t.length-i}),this.collection.reset(l)},createUploader:function(){var e=this.model.get("fieldConfig"),t=e.file_uploader,l=void 0;if(jQuery.each(k,function(e,i){if(t===i.prototype.fileUploader)return l=i,!1}),void 0!==l)return this.uploader=new l({browseButton:this.getRegion("form").getEl(".pods-dfv-list-add").get(),uiRegion:this.getRegion("uiRegion"),fieldConfig:e}),this.uploader;throw"Could not locate file uploader '"+t+"'"}}),x=wp.media.view.Modal.extend({close:function(e){var i=wp.media.view.Modal.prototype.close.apply(this,e);return e&&e.escape&&window.parent.jQuery(window.parent).trigger("dfv:modal:cancel"),i}}),P=wp.media.view.Frame.extend({className:"pods-modal-frame",template:_.template('<div class="media-frame-title" /><div class="media-frame-iframe" />'),regions:["title","iframe"],initialize:function(){wp.media.view.Frame.prototype.initialize.apply(this,arguments),this.$el.addClass("wp-core-ui"),this.initState(),this.initModal(),this.on("iframe:create:default",this.iframeContent,this),this.iframe.mode("default"),this.on("title:create:default",this.createTitle,this),this.title.mode("default")},initState:function(){var e=this.options.title||PodsI18n.__("Add New Record"),i=this.options.src||"/";this.states.add([new wp.media.controller.State({id:"default",title:e,src:i})]),this.options.state="default"},initModal:function(){this.modal=new x({controller:this}),this.modal.content(this)},render:function(){return!this.state()&&this.options.state&&this.setState(this.options.state),wp.media.view.Frame.prototype.render.apply(this,arguments)},iframeContent:function(e){e.view=new wp.media.view.Iframe({controller:this})},createTitle:function(e){e.view=new wp.media.View({controller:this,tagName:"h1"})}}),S=Backbone.Model.extend({defaults:{id:0,name:"",icon:"",link:"",edit_link:"",selected:!1},toggleSelected:function(){this.set("selected",!this.get("selected"))}}),M=Backbone.Collection.extend({model:S,setSelected:function(t){this.map(function(e){var i=_.contains(t,e.get("id")+"");e.set("selected",i)})},filterBySelected:function(){var e=this.filter(function(e){return e.get("selected")});return new M(e)},filterByUnselected:function(){var e=this.filter(function(e){return!e.get("selected")});return new M(e)}}),A=Backbone.Model.extend({defaults:{view_name:"select",iframe_src:"",pick_format_type:"single",pick_show_icon:!1,pick_show_view_link:!1,pick_show_edit_link:!1}}),V=c.extend({childViewEventPrefix:!1,tagName:"li",template:_.template('<div class="pods-field pods-boolean">\n\t<input name="<%- htmlAttr.name %>" data-name-clean="<%- htmlAttr.name_clean %>" data-label="<%- fieldConfig.label %>" id="<%- htmlAttr.id %><%= ordinal %>" class="pods-form-ui-field-type-pick pods-form-ui-field-name-<%- htmlAttr.name_clean %>" type="radio"\n\t\t\t<% if ( selected ) { %>\n\t\t\t\tchecked="CHECKED"\n\t\t\t<% } %>\n\t\t\tvalue="<%- id %>" tabindex="2">\n\t<label class="pods-form-ui-label pods-form-ui-label-<%- htmlAttr.id %><%= ordinal %>" for="<%- htmlAttr.id %><%= ordinal %>">\n\t\t<%= name %>\n\t</label>\n</div>\n'),templateContext:function(){return{ordinal:this.model.collection.indexOf(this.model)+1}},modelChanged:function(){this.render()}}),j=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-radio",childView:V}),I=c.extend({childViewEventPrefix:!1,tagName:"li",template:_.template('<div class="pods-field pods-boolean">\n\t<input name="<%- htmlAttr.name %>[<%= ordinal %>]"\n\t\t<%= selected ? \'checked="checked"\' : \'\' %>\n\t\tdata-name-clean="<%- htmlAttr.name_clean %>" data-label="<%- fieldConfig.label %>" id="<%- htmlAttr.id %><%= ordinal %>" class="pods-form-ui-field-type-pick" type="checkbox" tabindex="2" value="<%- id %>">\n\t<label class="pods-form-ui-label" for="<%- htmlAttr.id %><%= ordinal %>">\n\t\t<%= name %>\n\t</label>\n</div>\n'),className:"pods-pick",ui:{checkbox:"input.pods-form-ui-field-type-pick"},triggers:{"click @ui.checkbox":"toggle:selected"},modelEvents:{change:"modelChanged"},templateContext:function(){return{ordinal:this.model.collection.indexOf(this.model)}},modelChanged:function(){this.render()}}),L=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-checkbox-view",childView:I,childViewEvents:{"toggle:selected":"onChildviewToggleSelected"},onAttach:function(){this.validateSelectionLimit()||this.selectionLimitOver()},onChildviewToggleSelected:function(e){e.model.toggleSelected(),this.validateSelectionLimit()?this.selectionLimitUnder():this.selectionLimitOver()},validateSelectionLimit:function(){var e,i;return e=+this.fieldModel.get("fieldConfig").pick_limit,i=this.collection.filterBySelected().length,0===e||i<e},selectionLimitOver:function(){this.$el.find("input:checkbox:not(:checked)").prop("disabled",!0),this.trigger("selection:limit:over",this)},selectionLimitUnder:function(){this.$el.find("input:checkbox").prop("disabled",!1),this.trigger("selection:limit:under",this)}}),N=c.extend({childViewEventPrefix:!1,tagName:"option",template:!1,initialize:function(e){this.$el.val(this.model.get("id")),this.$el.text(this.model.get("name")),this.model.get("selected")&&this.$el.prop("selected","selected")}}),E=a.extend({childViewEventPrefix:!1,tagName:"optgroup",childView:N,attributes:function(){return{label:this.model.get("label")}}}),B=PodsMn.CollectionView.extend({childViewEventPrefix:!1,tagName:"select",triggers:{change:{event:"change:selected",stopPropagation:!1}},multiLastValidSelection:[],setCollection:function(e){this.collection=e},initialize:function(e){this.fieldModel=e.fieldModel,this.fieldConfig=this.fieldModel.get("fieldConfig")},childView:function(e){return this.fieldConfig.optgroup?E:N},childViewOptions:function(e,i){var t={fieldModel:this.fieldModel};return this.fieldConfig.optgroup&&(t.collection=new M(e.get("collection"))),t},serializeData:function(){var e=this.options.fieldModel,i=this.model?this.model.toJSON():{};return i.htmlAttr=e.get("attributes"),i.fieldConfig=e.get("fieldConfig"),i},attributes:function(){var e=this.options.fieldModel,i=e.get("htmlAttr"),t=e.get("fieldConfig"),l=i.name;return"multi"===t.pick_format_type&&(l+="[]"),{name:l,class:i.class,"data-name-clean":i.name_clean,id:i.id,tabindex:"2",multiple:"multi"===t.pick_format_type}},onAttach:function(){var e=this.fieldConfig.view_name,i=this.fieldConfig.pick_format_type;"select2"===e&&this.setupSelect2(),"select"===e&&"multi"===i&&(this.multiLastValidSelection=this.$el.val()),this.validateSelectionLimit()||this.selectionLimitOver()},onChangeSelected:function(){var e=+this.fieldConfig.pick_limit,i=this.fieldConfig.view_name,t=this.fieldConfig.pick_format_type;if("select"===i&&"multi"===t&&null!==this.$el.val()&&0!==e&&e<this.$el.val().length)return this.$el.val(this.multiLastValidSelection),window.alert(PodsI18n.__("You can only select")+" "+sprintf(PodsI18n._n("%s item","%s items",e),e)),void this.trigger("childview:change:selected",this);this.collection.setSelected(this.$el.val()),this.multiLastValidSelection=this.$el.val(),this.validateSelectionLimit()?this.selectionLimitUnder():this.selectionLimitOver(),this.trigger("childview:change:selected",this)},onBeforeDetach:function(){this.$el.selectWoo("destroy")},validateSelectionLimit:function(){var e,i,t=this.fieldConfig.pick_format_type,l=this.fieldConfig.pick_format_single;return""===this.$el.val()&&"single"===t&&"dropdown"===l||(e=+this.fieldConfig.pick_limit,i=this.collection.filterBySelected().length,0===e||i<e)},selectionLimitOver:function(){var e=this.fieldConfig.view_name,i=this.fieldConfig.pick_format_type;"select"===e&&"multi"===i&&this.$el.find("option:not(:selected)").prop("disabled",!0),this.trigger("childview:selection:limit:over",this)},selectionLimitUnder:function(){var e=this.fieldConfig.view_name,i=this.fieldConfig.pick_format_type;"select"===e&&"multi"===i&&this.$el.find("option").prop("disabled",!1),this.trigger("childview:selection:limit:under",this)},filterAjaxList:function(e){var i=this.collection.filterBySelected(),t=[];return _.each(e.results,function(e){e.text=e.name,i.get(e.id)||t.push(e)}),{results:t}},setupSelect2:function(){var e,t=this,l=this.$el,i=this.options.fieldModel.get("fieldConfig"),n=i.ajax_data,o=i.select2_overrides,d=i.pick_limit,s="single"===i.pick_format_type,a=this.collection.filterBySelected().length,c=void 0;0===a&&s&&l.prepend('<option selected="selected">'),e={maximumSelectionLength:s?void 0:d,placeholder:i.limitDisable?PodsI18n.__("You can only select")+" "+sprintf(PodsI18n._n("%s item","%s items",d),d):PodsI18n.__("Search")+" "+i.label+"...",allowClear:s,disabled:i.limitDisable,tags:i.pick_taggable,escapeMarkup:function(e){return"string"!=typeof e?e:String(e).replace(/<script|<\/script/g,function(e){var i={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return i[e]})})}},n.ajax&&jQuery.extend(e,{minimumInputLength:n.minimum_input_length,ajax:{url:ajaxurl+"?pods_ajax=1",type:"POST",dataType:"json",delay:n.delay,data:function(e){return{_wpnonce:n._wpnonce,action:"pods_relationship",method:"select2",pod:n.pod,field:n.field,uri:n.uri,id:n.id,query:e.term}},processResults:function(e,i){return t.filterAjaxList(e,i)}}}),l.selectWoo(jQuery.extend(!0,e,o)),(c=l.parent().find("ul.select2-selection__rendered")).sortable({containment:"parent"}),c.on("sortstop",function(){var e=c.find(".select2-selection__choice").get().reverse();jQuery(e).each(function(){var e=jQuery(this).data("data").id,i=l.find('option[value="'+e+'"]')[0];l.prepend(i)})})}}),O=c.extend({childViewEventPrefix:!1,tagName:"li",className:"pods-dfv-list-item pods-relationship",template:_.template('<input\n\t\t<% if ( \'single\' === fieldConfig.pick_format_type ) { %>\n\t\t\tname="<%- htmlAttr.name %>" id="<%- htmlAttr.id %>"\n\t\t<% } else { %>\n\t\t\tname="<%- htmlAttr.name %>[<%= ordinal %>]" id="<%- htmlAttr.id %><%= ordinal %>"\n\t\t<% } %>\n\t\tdata-name-clean="<%- htmlAttr.name_clean %>" type="hidden" value="<%- id %>">\n<ul class="pods-dfv-list-meta relationship-item">\n\t<% if ( 1 != fieldConfig.pick_limit ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-handle"><span><%- PodsI18n.__( \'Reorder\' ) %></span></li>\n\t<% } %>\n\t<% if ( 1 == fieldConfig.pick_show_icon ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-icon">\n\t\t\t<% if ( \'\' == icon ) { %>\n\t\t\t\t<% if ( /^dashicons/.test( fieldConfig.default_icon ) ) { %>\n\t\t\t\t\t<span class="pinkynail dashicons <%- fieldConfig.default_icon %>"></span>\n\t\t\t\t<% } else { %>\n\t\t\t\t\t<img class="pinkynail" src="<%- fieldConfig.default_icon %>" alt="Icon">\n\t\t\t\t<% } %>\n\t\t\t<% } else { %>\n\t\t\t\t<% if ( /^dashicons/.test( icon ) ) { %>\n\t\t\t\t\t<span class="pinkynail dashicons <%- icon %>"></span>\n\t\t\t\t<% } else { %>\n\t\t\t\t\t<img class="pinkynail" src="<%- icon %>" alt="Icon">\n\t\t\t\t<% } %>\n\t\t\t<% } %>\n\t\t</li>\n\t<% } %>\n\t<li class="pods-dfv-list-col pods-dfv-list-name">\n\t\t<%= name %>\n\t</li>\n\t<li class="pods-dfv-list-col pods-dfv-list-remove"><a href="#remove" title="<%- PodsI18n.__( \'Deselect\' ) %>"><%- PodsI18n.__( \'Deselect\' ) %></a></li>\n\t<% if ( 1 == fieldConfig.pick_show_view_link && \'\' != link ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-link"><a href="<%- link %>" title="<%- PodsI18n.__( \'View\' ) %>" target="_blank"><%- PodsI18n.__( \'View\' ) %></a></li>\n\t<% } %>\n\t<% if ( 1 == fieldConfig.pick_show_edit_link && \'\' != edit_link ) { %>\n\t\t<li class="pods-dfv-list-col pods-dfv-list-edit"><a href="<%- edit_link %>" title="<%- PodsI18n.__( \'Edit\' ) %>" target="_blank"><%- PodsI18n.__( \'Edit\' ) %></a></li>\n\t<% } %>\n</ul>\n'),ui:{removeButton:".pods-dfv-list-remove a",editButton:".pods-dfv-list-edit a"},triggers:{"click @ui.removeButton":"remove:item:click","click @ui.editButton":"edit:item:click"},templateContext:function(){return{ordinal:this.model.collection.indexOf(this.model)}}}),U=a.extend({childViewEventPrefix:!1,tagName:"ul",className:"pods-dfv-list pods-relationship",childView:O,childViewTriggers:{"remove:item:click":"childview:remove:item:click","edit:item:click":"childview:edit:item:click"},filter:function(e,i,t){return e.attributes.selected},onAttach:function(){1!==this.options.fieldModel.get("fieldConfig").pick_limit&&this.$el.sortable({containment:"parent",axis:"y",scrollSensitivity:40,tolerance:"pointer",opacity:.6})}}),F="button-disabled",R=c.extend({childViewEventPrefix:!1,tagName:"div",className:"podsform-dfv-list-relationship-container",ui:{addButton:"a.pods-related-add-new"},template:_.template('<a href="/wp-admin/?pods_modal=1" class="button pods-related-add-new pods-modal" data-pod-id="<%- fieldConfig.pod_id %>" data-field-id="<%- fieldConfig.id %>" data-item-id="<%- fieldConfig.item_id %>">\n\t<%- PodsI18n.__( \'Add New\' ) %>\n</a>'),triggers:{"click @ui.addButton":"add:new:click"},disable:function(){this.getUI("addButton").addClass(F)},enable:function(){this.getUI("addButton").removeClass(F)},onAddNewClick:function(){this.getUI("addButton").hasClass(F)||this.trigger("childview:add:new",this)}}),D={checkbox:L,select:B,select2:B,radio:j,list:U},Q=void 0,$=r.extend({childViewEventPrefix:!1,template:_.template('<%if ( fieldConfig.view_name === \'list\' ) { %>\n\t<div class="pods-ui-list-autocomplete"></div>\n<% } %>\n\n<div class="pods-pick-values"></div>\n\n<% if ( fieldConfig.iframe_src != \'\' ) { %>\n\t<div class="pods-ui-add-new"></div>\n<% } %>'),regions:{autocomplete:".pods-ui-list-autocomplete",list:".pods-pick-values",addNew:".pods-ui-add-new"},childViewEvents:{"childview:remove:item:click":"onChildviewRemoveItemClick","childview:edit:item:click":"onChildviewEditItemClick","childview:selection:limit:over":"onChildviewSelectionLimitOver","childview:selection:limit:under":"onChildviewSelectionLimitUnder","childview:change:selected":"onChildviewChangeSelected","childview:add:new":"onChildviewAddNew"},onBeforeRender:function(){void 0===this.collection&&(this.collection=new M(this.fieldItemData))},onRender:function(){this.fieldConfig=new A(this.model.get("fieldConfig")),""!==this.fieldConfig.get("iframe_src")&&1==this.fieldConfig.get("pick_allow_add_new")&&this.showAddNew(),"list"===this.fieldConfig.get("view_name")&&this.buildAutocomplete(),this.showList()},buildAutocomplete:function(){var e,i,t=void 0,l=void 0,n=+this.fieldConfig.get("pick_limit");t={view_name:"select2",pick_format_type:"multi",selectFromExisting:!0,ajax_data:this.fieldConfig.get("ajax_data"),select2_overrides:this.fieldConfig.get("select2_overrides"),label:this.fieldConfig.get("label"),pick_limit:n},this.collection.filterBySelected().length>=n&&0!==n?(t.limitDisable=!0,this.onChildviewSelectionLimitOver()):this.onChildviewSelectionLimitUnder(),e=new o({fieldConfig:t}),i=this.collection.filterByUnselected(),(l=new B({collection:i,fieldModel:e})).filterAjaxList=this.filterAjaxList.bind(this),this.showChildView("autocomplete",l)},showList:function(){var e,i;if(e=this.fieldConfig.get("view_name"),void 0===D[e])throw new Error('Invalid view name "'+e+'"');i=new D[e]({collection:this.collection,fieldModel:this.model}),this.showChildView("list",i)},showAddNew:function(){var e=new R({fieldModel:this.model});this.showChildView("addNew",e)},filterAjaxList:function(e){var i=this.collection.filterBySelected(),t=[];return _.each(e.results,function(e){e.text=e.name,i.get(e.id)||t.push(e)}),this.collection.add(t),this.getChildView("autocomplete").setCollection(this.collection.filterByUnselected()),{results:t}},onChildviewSelectionLimitOver:function(e){var i=this.getChildView("addNew");i&&i.disable()},onChildviewSelectionLimitUnder:function(e){var i=this.getChildView("addNew");i&&i.enable()},onChildviewRemoveItemClick:function(e){e.model.toggleSelected(),this.getChildView("list").render(),"list"===this.fieldConfig.get("view_name")&&this.buildAutocomplete()},onChildviewAddNew:function(e){var i=this.model.get("fieldConfig");Q=new P({title:i.iframe_title_add,src:i.iframe_src}),this.setModalListeners(),Q.modal.open()},onChildviewEditItemClick:function(e){var i=this.model.get("fieldConfig");Q=new P({title:i.iframe_title_edit,src:e.ui.editButton.attr("href")}),this.setModalListeners(),Q.modal.open()},onChildviewChangeSelected:function(e){e.fieldConfig.selectFromExisting&&(_.defer(this.buildAutocomplete.bind(this)),this.getChildView("list").render())},setModalListeners:function(){jQuery(window).on("dfv:modal:update",this.modalSuccess.bind(this)),jQuery(window).on("dfv:modal:cancel",this.modalCancel.bind(this))},clearModalListeners:function(){jQuery(window).off("dfv:modal:update"),jQuery(window).off("dfv:modal:cancel")},modalSuccess:function(e,i){var t=this.collection.get(i.id);t?(t.set(i),this.getChildView("list").render()):this.collection.add(i),this.clearModalListeners(),Q.modal.close({})},modalCancel:function(){this.clearModalListeners()}}),z={file:y,avatar:y,pick:$},T={fields:Object.freeze({FileUpload:y,Pick:$}),models:Object.freeze({PodsDFVFieldModel:o,RelationshipModel:S,RelationshipCollection:M,FileUploadModel:f,FileUploadCollection:h}),fieldInstances:{},init:function(){var l=this;jQuery(".pods-form-ui-field").each(function(){var e=void 0,i=void 0,t={fieldType:void 0};jQuery(this).find("script.pods-dfv-field-data").each(function(){var e=jQuery.parseJSON(jQuery(this).html());jQuery(this).parents(".media-modal-content").length&&(e.fieldConfig.pick_allow_add_new=0),jQuery.extend(t,e),jQuery(this).remove()}),void 0!==t.fieldType&&void 0!==(e=z[t.fieldType])&&((i=new e({el:this,model:new o({htmlAttr:t.htmlAttr,fieldConfig:t.fieldConfig}),fieldItemData:t.fieldItemData})).render(),jQuery(this).trigger("render"),l.fieldInstances[t.htmlAttr.id]=i)})},isModalWindow:function(){return-1!==location.search.indexOf("pods_modal=")},isGutenbergEditorLoaded:function(){return void 0!==wp.data&&void 0!==wp.data.select("core/editor")}};return document.addEventListener("DOMContentLoaded",function(){T.init(),T.isModalWindow()&&T.isGutenbergEditorLoaded()&&i()}),T}();
2
  //# sourceMappingURL=pods-dfv.min.js.map