Version Description
May 20th, 2021 =
Added: New upload directory option for File fields using Plupload that lets you choose to customize which directory the files end up in. #6021 (@JoryHogeveen)
Added: Relationship fields now support custom selectors in the REST API. You can specify
my_field.some_field
to output a specific field in your REST API options for each relationship field. (@sc0ttkclark)Added: New
pods_image_for_post()
andpods_image_url_for_post()
functions have been added for certain page builders like Oxygen. (@sc0ttkclark)Added: New query variable prefix option (
num_prefix
) for PodsUI instances. (@sc0ttkclark)Added:
pagination_type
andpagination_location
options for PodsUI instances to support more flexible pagination options. (@sc0ttkclark)Enhancement: Implement
search
andsort
field sets for PodsUI instances to more easily specify which fields are searchable or sortable. (@sc0ttkclark)Fixed: PHP fatal errors no longer occur for avatar fields in certain situations. #6007 (@JoryHogeveen)
Fixed: PHP fatal errors no longer occur for PHP 8 in certain situations. #6012 (@JoryHogeveen)
Fixed: Resolved an issue with relationship fields not outputting their full data to the REST API when the related object is not a valid pod. (@sc0ttkclark)
Fixed: Resolved an issue with not saving the fields for the extended Media pod when making update requests through the REST API. (@sc0ttkclark)
Fixed: Implemented a temporary PHP 7.4+ fix for Freemius. (@sc0ttkclark)
Fixed: Searching WP-based objects in PodsUI interfaces now resolves to the proper fields. (@sc0ttkclark)
Release Info
Developer | sc0ttkclark |
Plugin | Pods – Custom Content Types and Fields |
Version | 2.7.28 |
Comparing to | |
See all releases |
Code changes from version 2.7.27 to 2.7.28
- classes/Pods.php +6 -1
- classes/PodsAPI.php +1 -1
- classes/PodsAdmin.php +18 -7
- classes/PodsData.php +24 -3
- classes/PodsRESTHandlers.php +21 -11
- classes/PodsUI.php +528 -281
- classes/fields/avatar.php +1 -1
- classes/fields/file.php +134 -0
- includes/data.php +14 -0
- includes/media.php +82 -0
- init.php +2 -2
- readme.txt +18 -3
- vendor/freemius/wordpress-sdk/start.php +5 -0
@@ -1641,6 +1641,11 @@ class Pods implements Iterator {
|
|
1641 |
} else {
|
1642 |
$item = pods( $object, (int) $item_id );
|
1643 |
}
|
|
|
|
|
|
|
|
|
|
|
1644 |
} else {
|
1645 |
// arrays.
|
1646 |
$item = get_object_vars( (object) $item );
|
@@ -1945,7 +1950,7 @@ class Pods implements Iterator {
|
|
1945 |
$args = array_merge( $args, compact( $filter_args ) );
|
1946 |
}
|
1947 |
|
1948 |
-
$val = call_user_func_array( 'apply_filters', $args );
|
1949 |
|
1950 |
$value[ $key ] = $val;
|
1951 |
|
1641 |
} else {
|
1642 |
$item = pods( $object, (int) $item_id );
|
1643 |
}
|
1644 |
+
|
1645 |
+
if ( ! $item || ! $item->valid() ) {
|
1646 |
+
// Related pod does not exist.
|
1647 |
+
$item = false;
|
1648 |
+
}
|
1649 |
} else {
|
1650 |
// arrays.
|
1651 |
$item = get_object_vars( (object) $item );
|
1950 |
$args = array_merge( $args, compact( $filter_args ) );
|
1951 |
}
|
1952 |
|
1953 |
+
$val = call_user_func_array( 'apply_filters', array_values( $args ) );
|
1954 |
|
1955 |
$value[ $key ] = $val;
|
1956 |
|
@@ -1063,7 +1063,7 @@ class PodsAPI {
|
|
1063 |
'post_password' => array(
|
1064 |
'name' => 'post_password',
|
1065 |
'label' => 'Password',
|
1066 |
-
'type' => '
|
1067 |
'alias' => array()
|
1068 |
),
|
1069 |
'post_name' => array(
|
1063 |
'post_password' => array(
|
1064 |
'name' => 'post_password',
|
1065 |
'label' => 'Password',
|
1066 |
+
'type' => 'password',
|
1067 |
'alias' => array()
|
1068 |
),
|
1069 |
'post_name' => array(
|
@@ -3714,7 +3714,7 @@ class PodsAdmin {
|
|
3714 |
),
|
3715 |
'rest_write' => array(
|
3716 |
'label' => __( 'Write via REST API?', 'pods' ),
|
3717 |
-
'help' => __( 'Should this field be writeable via the REST API? You must enable REST API support for this Pod.', 'pods' ),
|
3718 |
'type' => 'boolean',
|
3719 |
'default' => '',
|
3720 |
),
|
@@ -3728,22 +3728,33 @@ class PodsAdmin {
|
|
3728 |
'depends-on' => array( 'type' => 'pick' ),
|
3729 |
'dependency' => true,
|
3730 |
'data' => array(
|
3731 |
-
'array'
|
3732 |
-
'id'
|
3733 |
-
'name'
|
|
|
3734 |
),
|
3735 |
),
|
3736 |
'rest_pick_depth' => array(
|
3737 |
'label' => __( 'Depth', 'pods' ),
|
3738 |
-
'help' => __( 'How far to traverse relationships in response', 'pods' ),
|
3739 |
'type' => 'number',
|
3740 |
-
'default' => '
|
3741 |
'depends-on' => array(
|
3742 |
'type' => 'pick',
|
3743 |
'rest_pick_response' => 'array',
|
3744 |
),
|
3745 |
),
|
3746 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3747 |
);
|
3748 |
|
3749 |
}//end if
|
3714 |
),
|
3715 |
'rest_write' => array(
|
3716 |
'label' => __( 'Write via REST API?', 'pods' ),
|
3717 |
+
'help' => __( 'Should this field be writeable via the REST API? You must enable REST API support for this Pod. For relationship and file fields, you will always pass the ID of the related item/file. If this is a non-ID based relationship field, you will pass the related value (not label).', 'pods' ),
|
3718 |
'type' => 'boolean',
|
3719 |
'default' => '',
|
3720 |
),
|
3728 |
'depends-on' => array( 'type' => 'pick' ),
|
3729 |
'dependency' => true,
|
3730 |
'data' => array(
|
3731 |
+
'array' => __( 'All fields', 'pods' ),
|
3732 |
+
'id' => __( 'ID only', 'pods' ),
|
3733 |
+
'name' => __( 'Name only', 'pods' ),
|
3734 |
+
'custom' => __( 'Custom return (specify field to return)', 'pods' ),
|
3735 |
),
|
3736 |
),
|
3737 |
'rest_pick_depth' => array(
|
3738 |
'label' => __( 'Depth', 'pods' ),
|
3739 |
+
'help' => __( 'How far to traverse relationships in response. 1 will get you all of the fields on the related item. 2 will get you all of those fields plus related items and their fields. The higher the depth, the more data will be returned and the slower performance the REST API calls will be. Updates to this field do NOT take depth into account, so you will always send the ID of the related item when saving.', 'pods' ),
|
3740 |
'type' => 'number',
|
3741 |
+
'default' => '1',
|
3742 |
'depends-on' => array(
|
3743 |
'type' => 'pick',
|
3744 |
'rest_pick_response' => 'array',
|
3745 |
),
|
3746 |
),
|
3747 |
+
'rest_pick_custom' => array(
|
3748 |
+
'label' => __( 'Custom return', 'pods' ),
|
3749 |
+
'help' => __( 'Specify the field to use following the established this_field_name.ID traversal pattern. You must include this field name in the selector for this to work properly.', 'pods' ),
|
3750 |
+
'type' => 'text',
|
3751 |
+
'default' => '',
|
3752 |
+
'placeholder' => 'this_field_name.ID',
|
3753 |
+
'depends-on' => array(
|
3754 |
+
'type' => 'pick',
|
3755 |
+
'rest_pick_response' => 'custom',
|
3756 |
+
),
|
3757 |
+
),
|
3758 |
);
|
3759 |
|
3760 |
}//end if
|
@@ -825,6 +825,11 @@ class PodsData {
|
|
825 |
|
826 |
$simple_tableless_objects = PodsForm::simple_tableless_objects();
|
827 |
$file_field_types = PodsForm::file_field_types();
|
|
|
|
|
|
|
|
|
|
|
828 |
|
829 |
$defaults = array(
|
830 |
'select' => '*',
|
@@ -906,12 +911,20 @@ class PodsData {
|
|
906 |
$params->offset = 0;
|
907 |
}
|
908 |
|
|
|
|
|
909 |
if ( ( empty( $params->fields ) || ! is_array( $params->fields ) ) && ! empty( $pod ) && isset( $this->fields ) && ! empty( $this->fields ) ) {
|
910 |
$params->fields = $this->fields;
|
|
|
|
|
911 |
}
|
912 |
|
913 |
if ( ( empty( $params->object_fields ) || ! is_array( $params->object_fields ) ) && ! empty( $pod ) && isset( $pod['object_fields'] ) && ! empty( $pod['object_fields'] ) ) {
|
914 |
$params->object_fields = $pod['object_fields'];
|
|
|
|
|
|
|
|
|
915 |
}
|
916 |
|
917 |
if ( empty( $params->filters ) && $params->search ) {
|
@@ -1143,6 +1156,8 @@ class PodsData {
|
|
1143 |
'phone',
|
1144 |
'password',
|
1145 |
'boolean',
|
|
|
|
|
1146 |
), true
|
1147 |
) ) {
|
1148 |
continue;
|
@@ -1150,7 +1165,9 @@ class PodsData {
|
|
1150 |
|
1151 |
$fieldfield = '`' . $field . '`';
|
1152 |
|
1153 |
-
|
|
|
|
|
1154 |
if ( false === $params->search_across_picks ) {
|
1155 |
continue;
|
1156 |
} else {
|
@@ -1170,13 +1187,13 @@ class PodsData {
|
|
1170 |
} else {
|
1171 |
$fieldfield = $fieldfield . '.`post_title`';
|
1172 |
}
|
1173 |
-
} elseif ( isset( $params->fields[ $field ] ) ) {
|
1174 |
if ( $params->meta_fields ) {
|
1175 |
$fieldfield = $fieldfield . '.`meta_value`';
|
1176 |
} else {
|
1177 |
$fieldfield = '`' . $params->pod_table_prefix . '`.' . $fieldfield;
|
1178 |
}
|
1179 |
-
} elseif (
|
1180 |
$fieldfield = $fieldfield . '.`meta_value`';
|
1181 |
} else {
|
1182 |
$fieldfield = '`t`.' . $fieldfield;
|
@@ -3233,6 +3250,10 @@ class PodsData {
|
|
3233 |
$traverse['pod'] = null;
|
3234 |
}
|
3235 |
|
|
|
|
|
|
|
|
|
3236 |
$traverse['table_info'] = $this->api->get_table_info( $traverse['pick_object'], $traverse['pick_val'], null, $traverse['pod'], $traverse );
|
3237 |
}
|
3238 |
}//end if
|
825 |
|
826 |
$simple_tableless_objects = PodsForm::simple_tableless_objects();
|
827 |
$file_field_types = PodsForm::file_field_types();
|
828 |
+
$pick_field_types = [
|
829 |
+
'pick',
|
830 |
+
'comment',
|
831 |
+
'taxonomy',
|
832 |
+
];
|
833 |
|
834 |
$defaults = array(
|
835 |
'select' => '*',
|
911 |
$params->offset = 0;
|
912 |
}
|
913 |
|
914 |
+
$merge_object_fields = false;
|
915 |
+
|
916 |
if ( ( empty( $params->fields ) || ! is_array( $params->fields ) ) && ! empty( $pod ) && isset( $this->fields ) && ! empty( $this->fields ) ) {
|
917 |
$params->fields = $this->fields;
|
918 |
+
|
919 |
+
$merge_object_fields = true;
|
920 |
}
|
921 |
|
922 |
if ( ( empty( $params->object_fields ) || ! is_array( $params->object_fields ) ) && ! empty( $pod ) && isset( $pod['object_fields'] ) && ! empty( $pod['object_fields'] ) ) {
|
923 |
$params->object_fields = $pod['object_fields'];
|
924 |
+
|
925 |
+
if ( $merge_object_fields ) {
|
926 |
+
$params->fields = array_merge( $params->object_fields, $params->fields );
|
927 |
+
}
|
928 |
}
|
929 |
|
930 |
if ( empty( $params->filters ) && $params->search ) {
|
1156 |
'phone',
|
1157 |
'password',
|
1158 |
'boolean',
|
1159 |
+
'comment',
|
1160 |
+
'taxonomy',
|
1161 |
), true
|
1162 |
) ) {
|
1163 |
continue;
|
1165 |
|
1166 |
$fieldfield = '`' . $field . '`';
|
1167 |
|
1168 |
+
$is_object_field = isset( $params->object_fields[ $field ] );
|
1169 |
+
|
1170 |
+
if ( in_array( $attributes['type'], $pick_field_types, true ) && ! in_array( pods_v( 'pick_object', $attributes ), $simple_tableless_objects, true ) ) {
|
1171 |
if ( false === $params->search_across_picks ) {
|
1172 |
continue;
|
1173 |
} else {
|
1187 |
} else {
|
1188 |
$fieldfield = $fieldfield . '.`post_title`';
|
1189 |
}
|
1190 |
+
} elseif ( isset( $params->fields[ $field ] ) && ! $is_object_field ) {
|
1191 |
if ( $params->meta_fields ) {
|
1192 |
$fieldfield = $fieldfield . '.`meta_value`';
|
1193 |
} else {
|
1194 |
$fieldfield = '`' . $params->pod_table_prefix . '`.' . $fieldfield;
|
1195 |
}
|
1196 |
+
} elseif ( ( empty( $params->object_fields ) || ! $is_object_field ) && 'meta' === $pod['storage'] ) {
|
1197 |
$fieldfield = $fieldfield . '.`meta_value`';
|
1198 |
} else {
|
1199 |
$fieldfield = '`t`.' . $fieldfield;
|
3250 |
$traverse['pod'] = null;
|
3251 |
}
|
3252 |
|
3253 |
+
if ( ! isset( $traverse['pick_val'] ) ) {
|
3254 |
+
$traverse['pick_val'] = null;
|
3255 |
+
}
|
3256 |
+
|
3257 |
$traverse['table_info'] = $this->api->get_table_info( $traverse['pick_object'], $traverse['pick_val'], null, $traverse['pod'], $traverse );
|
3258 |
}
|
3259 |
}//end if
|
@@ -125,7 +125,15 @@ class PodsRESTHandlers {
|
|
125 |
*/
|
126 |
$output_type = apply_filters( 'pods_rest_api_output_type_for_relationship_response', $output_type, $field_name, $field_data, $pod, $id, $request );
|
127 |
|
128 |
-
if ( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
$related_pod_items = $pod->field( $field_name, array( 'output' => 'pod' ) );
|
130 |
|
131 |
if ( $related_pod_items ) {
|
@@ -222,23 +230,19 @@ class PodsRESTHandlers {
|
|
222 |
public static function save_handler( $object, $request, $creating ) {
|
223 |
|
224 |
if ( is_a( $object, 'WP_Post' ) ) {
|
225 |
-
$
|
226 |
-
|
227 |
-
if ( 'attachment' === $pod_name ) {
|
228 |
-
$pod_name = 'media';
|
229 |
-
}
|
230 |
|
231 |
$id = $object->ID;
|
232 |
} elseif ( is_a( $object, 'WP_Term' ) ) {
|
233 |
-
$
|
234 |
|
235 |
$id = $object->term_id;
|
236 |
} elseif ( is_a( $object, 'WP_User' ) ) {
|
237 |
-
$
|
238 |
|
239 |
$id = $object->ID;
|
240 |
} elseif ( is_a( $object, 'WP_Comment' ) ) {
|
241 |
-
$
|
242 |
|
243 |
$id = $object->comment_ID;
|
244 |
} else {
|
@@ -246,13 +250,19 @@ class PodsRESTHandlers {
|
|
246 |
return;
|
247 |
}//end if
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
$pod = self::get_pod( $pod_name, $id );
|
250 |
|
251 |
global $wp_rest_additional_fields;
|
252 |
|
253 |
$rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data['options'], false );
|
254 |
|
255 |
-
if ( $pod && $rest_enable && ! empty( $wp_rest_additional_fields[ $
|
256 |
$fields = $pod->fields();
|
257 |
|
258 |
$save_fields = array();
|
@@ -262,7 +272,7 @@ class PodsRESTHandlers {
|
|
262 |
);
|
263 |
|
264 |
foreach ( $fields as $field_name => $field ) {
|
265 |
-
if ( empty( $wp_rest_additional_fields[ $
|
266 |
continue;
|
267 |
} elseif ( ! isset( $request[ $field_name ] ) ) {
|
268 |
continue;
|
125 |
*/
|
126 |
$output_type = apply_filters( 'pods_rest_api_output_type_for_relationship_response', $output_type, $field_name, $field_data, $pod, $id, $request );
|
127 |
|
128 |
+
if ( 'custom' === $output_type ) {
|
129 |
+
// Support custom selectors for the response.
|
130 |
+
$custom_selector = pods_v( 'rest_pick_custom', $field_data['options'], $field_name );
|
131 |
+
|
132 |
+
if ( ! empty( $custom_selector ) ) {
|
133 |
+
$field_name = $custom_selector;
|
134 |
+
}
|
135 |
+
} elseif ( 'array' === $output_type ) {
|
136 |
+
// Support fully fleshed out data for the response.
|
137 |
$related_pod_items = $pod->field( $field_name, array( 'output' => 'pod' ) );
|
138 |
|
139 |
if ( $related_pod_items ) {
|
230 |
public static function save_handler( $object, $request, $creating ) {
|
231 |
|
232 |
if ( is_a( $object, 'WP_Post' ) ) {
|
233 |
+
$type = $object->post_type;
|
|
|
|
|
|
|
|
|
234 |
|
235 |
$id = $object->ID;
|
236 |
} elseif ( is_a( $object, 'WP_Term' ) ) {
|
237 |
+
$type = $object->taxonomy;
|
238 |
|
239 |
$id = $object->term_id;
|
240 |
} elseif ( is_a( $object, 'WP_User' ) ) {
|
241 |
+
$type = 'user';
|
242 |
|
243 |
$id = $object->ID;
|
244 |
} elseif ( is_a( $object, 'WP_Comment' ) ) {
|
245 |
+
$type = 'comment';
|
246 |
|
247 |
$id = $object->comment_ID;
|
248 |
} else {
|
250 |
return;
|
251 |
}//end if
|
252 |
|
253 |
+
$pod_name = $type;
|
254 |
+
|
255 |
+
if ( 'attachment' === $type && is_a( $object, 'WP_Post' ) ) {
|
256 |
+
$pod_name = 'media';
|
257 |
+
}
|
258 |
+
|
259 |
$pod = self::get_pod( $pod_name, $id );
|
260 |
|
261 |
global $wp_rest_additional_fields;
|
262 |
|
263 |
$rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data['options'], false );
|
264 |
|
265 |
+
if ( $pod && $rest_enable && ! empty( $wp_rest_additional_fields[ $type ] ) ) {
|
266 |
$fields = $pod->fields();
|
267 |
|
268 |
$save_fields = array();
|
272 |
);
|
273 |
|
274 |
foreach ( $fields as $field_name => $field ) {
|
275 |
+
if ( empty( $wp_rest_additional_fields[ $type ][ $field_name ]['pods_update'] ) ) {
|
276 |
continue;
|
277 |
} elseif ( ! isset( $request[ $field_name ] ) ) {
|
278 |
continue;
|
@@ -55,10 +55,21 @@ class PodsUI {
|
|
55 |
public $id = 0;
|
56 |
|
57 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
* @var string
|
59 |
*/
|
60 |
public $num = '';
|
61 |
-
|
62 |
/**
|
63 |
* @var array
|
64 |
*/
|
@@ -137,6 +148,7 @@ class PodsUI {
|
|
137 |
public $fields = array(
|
138 |
'manage' => array(),
|
139 |
'search' => array(),
|
|
|
140 |
'form' => array(),
|
141 |
'add' => array(),
|
142 |
'edit' => array(),
|
@@ -146,6 +158,15 @@ class PodsUI {
|
|
146 |
'export' => array(),
|
147 |
);
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
/**
|
150 |
* @var bool
|
151 |
*/
|
@@ -161,6 +182,24 @@ class PodsUI {
|
|
161 |
*/
|
162 |
public $pagination = true;
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
/**
|
165 |
* @var bool
|
166 |
*/
|
@@ -447,7 +486,7 @@ class PodsUI {
|
|
447 |
*/
|
448 |
public function __construct( $options, $deprecated = false ) {
|
449 |
|
450 |
-
$this->_nonce = pods_v( '_wpnonce', 'request' );
|
451 |
|
452 |
$object = null;
|
453 |
|
@@ -897,16 +936,21 @@ class PodsUI {
|
|
897 |
|
898 |
$options = pods_array( $options );
|
899 |
|
|
|
900 |
$options->validate( 'num', '', 'absint' );
|
901 |
|
|
|
|
|
|
|
|
|
902 |
if ( empty( $options->num ) ) {
|
903 |
$options->num = '';
|
904 |
}
|
905 |
|
906 |
-
$options->validate( 'id', pods_var( 'id' . $options->num, 'get', $this->id ) );
|
907 |
|
908 |
$options->validate(
|
909 |
-
'do', pods_var( 'do' . $options->num, 'get', $this->do ), 'in_array', array(
|
910 |
'save',
|
911 |
'create',
|
912 |
)
|
@@ -914,14 +958,14 @@ class PodsUI {
|
|
914 |
|
915 |
$options->validate( 'excluded', self::$excluded, 'array_merge' );
|
916 |
|
917 |
-
$options->validate( 'action', pods_var( 'action' . $options->num, 'get', $this->action, null, true ), 'in_array', $this->actions );
|
918 |
$options->validate( 'actions_bulk', $this->actions_bulk, 'array_merge' );
|
919 |
-
$options->validate( 'action_bulk', pods_var( 'action_bulk' . $options->num, 'get', $this->action_bulk, null, true ), 'isset', $this->actions_bulk );
|
920 |
|
921 |
-
$bulk = pods_var( 'action_bulk_ids' . $options->num, 'get', array(), null, true );
|
922 |
|
923 |
if ( ! empty( $bulk ) ) {
|
924 |
-
$bulk = (array) pods_var( 'action_bulk_ids' . $options->num, 'get', array(), null, true );
|
925 |
} else {
|
926 |
$bulk = array();
|
927 |
}
|
@@ -929,10 +973,10 @@ class PodsUI {
|
|
929 |
$options->validate( 'bulk', $bulk, 'array_merge', $this->bulk );
|
930 |
|
931 |
$options->validate( 'views', $this->views, 'array' );
|
932 |
-
$options->validate( 'view',
|
933 |
|
934 |
$options->validate( 'searchable', $this->searchable, 'boolean' );
|
935 |
-
$options->validate( 'search',
|
936 |
$options->validate( 'search_across', $this->search_across, 'boolean' );
|
937 |
$options->validate( 'search_across_picks', $this->search_across_picks, 'boolean' );
|
938 |
$options->validate( 'filters', $this->filters, 'array' );
|
@@ -940,8 +984,10 @@ class PodsUI {
|
|
940 |
$options->validate( 'where', $this->where, 'array_merge' );
|
941 |
|
942 |
$options->validate( 'pagination', $this->pagination, 'boolean' );
|
943 |
-
$options->validate( '
|
944 |
-
$options->validate( '
|
|
|
|
|
945 |
|
946 |
if ( isset( $this->pods_data ) && is_object( $this->pods_data ) ) {
|
947 |
$this->sql = array(
|
@@ -953,17 +999,21 @@ class PodsUI {
|
|
953 |
$options->validate( 'sql', $this->sql, 'array_merge' );
|
954 |
|
955 |
$options->validate(
|
956 |
-
'orderby_dir', strtoupper( pods_v( 'orderby_dir' . $options
|
957 |
'ASC',
|
958 |
'DESC',
|
959 |
)
|
960 |
);
|
961 |
|
|
|
|
|
962 |
$orderby = $this->orderby;
|
963 |
|
|
|
|
|
964 |
// Enforce strict DB column name usage
|
965 |
-
if ( ! empty( $
|
966 |
-
$orderby = pods_clean_name( $
|
967 |
}
|
968 |
|
969 |
if ( ! empty( $orderby ) ) {
|
@@ -975,7 +1025,6 @@ class PodsUI {
|
|
975 |
}
|
976 |
|
977 |
$options->validate( 'orderby', $orderby, 'array_merge' );
|
978 |
-
$options->validate( 'sortable', $this->sortable, 'boolean' );
|
979 |
|
980 |
$options->validate( 'params', $this->params, 'array' );
|
981 |
|
@@ -1077,13 +1126,14 @@ class PodsUI {
|
|
1077 |
), 'array_merge'
|
1078 |
);
|
1079 |
|
1080 |
-
$options->validate(
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
|
|
1087 |
|
1088 |
$options->validate( 'export', $this->export, 'array_merge' );
|
1089 |
$options->validate( 'reorder', $this->reorder, 'array_merge' );
|
@@ -1185,7 +1235,7 @@ class PodsUI {
|
|
1185 |
|
1186 |
$unique_identifier .= '_' . $this->page;
|
1187 |
if ( 0 < strlen( $this->num ) ) {
|
1188 |
-
$unique_identifier .= '_' . $this->num;
|
1189 |
}
|
1190 |
|
1191 |
$this->unique_identifier = 'pods_ui_' . md5( $unique_identifier );
|
@@ -1261,6 +1311,10 @@ class PodsUI {
|
|
1261 |
}
|
1262 |
}
|
1263 |
|
|
|
|
|
|
|
|
|
1264 |
if ( ! isset( $attributes['real_name'] ) ) {
|
1265 |
$attributes['real_name'] = pods_var( 'name', $attributes, $field );
|
1266 |
}
|
@@ -1399,59 +1453,106 @@ class PodsUI {
|
|
1399 |
}//end foreach
|
1400 |
$fields = $new_fields;
|
1401 |
}//end if
|
|
|
1402 |
if ( false !== $init ) {
|
1403 |
-
if (
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
|
|
|
|
|
|
|
|
1407 |
}
|
1408 |
|
1409 |
if ( ! in_array( 'add', $this->actions_disabled ) || ! in_array( 'edit', $this->actions_disabled ) || ! in_array( 'duplicate', $this->actions_disabled ) ) {
|
1410 |
-
if (
|
1411 |
-
$this->fields['form']
|
1412 |
-
|
1413 |
-
|
|
|
|
|
|
|
|
|
1414 |
}
|
1415 |
|
1416 |
-
if (
|
1417 |
-
if (
|
1418 |
-
$this->fields['add']
|
|
|
|
|
1419 |
}
|
|
|
|
|
1420 |
}
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
|
|
|
|
|
|
1424 |
}
|
|
|
|
|
1425 |
}
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
|
|
|
|
|
|
1429 |
}
|
|
|
|
|
1430 |
}
|
1431 |
}//end if
|
1432 |
|
1433 |
-
if (
|
1434 |
-
if (
|
1435 |
-
$this->fields['search']
|
|
|
|
|
1436 |
} else {
|
1437 |
-
$this->fields['search'] =
|
1438 |
}
|
1439 |
-
|
1440 |
-
$this->
|
1441 |
}
|
1442 |
|
1443 |
-
if (
|
1444 |
-
if (
|
1445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1446 |
}
|
|
|
|
|
1447 |
}
|
1448 |
|
1449 |
-
if (
|
1450 |
-
if (
|
1451 |
-
$this->fields['
|
1452 |
-
|
1453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
}
|
|
|
|
|
1455 |
}
|
1456 |
}//end if
|
1457 |
|
@@ -1478,7 +1579,7 @@ class PodsUI {
|
|
1478 |
return;
|
1479 |
}
|
1480 |
?>
|
1481 |
-
<div id="message" class="<?php
|
1482 |
<p><?php echo $msg; ?></p>
|
1483 |
</div>
|
1484 |
<?php
|
@@ -1638,8 +1739,8 @@ class PodsUI {
|
|
1638 |
if ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
1639 |
$link = pods_query_arg(
|
1640 |
array(
|
1641 |
-
'action' . $this->num => 'manage',
|
1642 |
-
'id' . $this->num => '',
|
1643 |
), self::$allowed, $this->exclusion()
|
1644 |
);
|
1645 |
|
@@ -1697,9 +1798,9 @@ class PodsUI {
|
|
1697 |
if ( ! in_array( 'add', $this->actions_disabled ) && ! in_array( 'add', $this->actions_hidden ) && ! $this->restricted( 'add' ) ) {
|
1698 |
$link = pods_query_arg(
|
1699 |
array(
|
1700 |
-
'action' . $this->num => 'add',
|
1701 |
-
'id' . $this->num => '',
|
1702 |
-
'do' . $this->num => '',
|
1703 |
), self::$allowed, $this->exclusion()
|
1704 |
);
|
1705 |
|
@@ -1712,8 +1813,8 @@ class PodsUI {
|
|
1712 |
} elseif ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
1713 |
$link = pods_query_arg(
|
1714 |
array(
|
1715 |
-
'action' . $this->num => 'manage',
|
1716 |
-
'id' . $this->num => '',
|
1717 |
), self::$allowed, $this->exclusion()
|
1718 |
);
|
1719 |
|
@@ -1751,9 +1852,9 @@ class PodsUI {
|
|
1751 |
$label = $this->label['add'];
|
1752 |
$id = null;
|
1753 |
$vars = array(
|
1754 |
-
'action' . $this->num => $this->action_after['add'],
|
1755 |
-
'do' . $this->num => 'create',
|
1756 |
-
'id' . $this->num => 'X_ID_X',
|
1757 |
);
|
1758 |
|
1759 |
$alt_vars = $vars;
|
@@ -1776,9 +1877,9 @@ class PodsUI {
|
|
1776 |
$label = $this->do_template( $this->label['edit'] );
|
1777 |
$id = $this->row[ $this->sql['field_id'] ];
|
1778 |
$vars = array(
|
1779 |
-
'action' . $this->num => $this->action_after['edit'],
|
1780 |
-
'do' . $this->num => 'save',
|
1781 |
-
'id' . $this->num => $id,
|
1782 |
);
|
1783 |
|
1784 |
$alt_vars = $vars;
|
@@ -1789,9 +1890,9 @@ class PodsUI {
|
|
1789 |
$label = $this->do_template( $this->label['duplicate'] );
|
1790 |
$id = null;
|
1791 |
$vars = array(
|
1792 |
-
'action' . $this->num => $this->action_after['duplicate'],
|
1793 |
-
'do' . $this->num => 'create',
|
1794 |
-
'id' . $this->num => 'X_ID_X',
|
1795 |
);
|
1796 |
|
1797 |
$alt_vars = $vars;
|
@@ -2013,9 +2114,9 @@ class PodsUI {
|
|
2013 |
if ( ! in_array( 'add', $this->actions_disabled ) && ! in_array( 'add', $this->actions_hidden ) && ! $this->restricted( 'add' ) ) {
|
2014 |
$link = pods_query_arg(
|
2015 |
array(
|
2016 |
-
'action' . $this->num => 'add',
|
2017 |
-
'id' . $this->num => '',
|
2018 |
-
'do' . $this->num => '',
|
2019 |
), self::$allowed, $this->exclusion()
|
2020 |
);
|
2021 |
|
@@ -2028,8 +2129,8 @@ class PodsUI {
|
|
2028 |
} elseif ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
2029 |
$link = pods_query_arg(
|
2030 |
array(
|
2031 |
-
'action' . $this->num => 'manage',
|
2032 |
-
'id' . $this->num => '',
|
2033 |
), self::$allowed, $this->exclusion()
|
2034 |
);
|
2035 |
|
@@ -2364,8 +2465,8 @@ class PodsUI {
|
|
2364 |
<ul>
|
2365 |
<?php foreach ( $this->pod->fields() as $field_name => $field ) { ?>
|
2366 |
<li>
|
2367 |
-
<label for="bulk_export_fields_<?php
|
2368 |
-
<input type="checkbox" name="bulk_export_fields[]" id="bulk_export_fields_<?php
|
2369 |
<?php esc_html_e( $field['label'] ); ?>
|
2370 |
</label>
|
2371 |
</li>
|
@@ -2556,6 +2657,7 @@ class PodsUI {
|
|
2556 |
'search_query' => $this->search,
|
2557 |
'search_across' => $this->search_across,
|
2558 |
'search_across_picks' => $this->search_across_picks,
|
|
|
2559 |
'filters' => $this->filters,
|
2560 |
'sql' => $sql,
|
2561 |
);
|
@@ -2796,7 +2898,7 @@ class PodsUI {
|
|
2796 |
}
|
2797 |
|
2798 |
if ( ! empty( $this->action_bulk ) && ! empty( $this->actions_bulk ) && isset( $this->actions_bulk[ $this->action_bulk ] ) && ! in_array( $this->action_bulk, $this->actions_disabled ) && ( ! empty( $this->bulk ) || 'export' === $this->action_bulk ) ) {
|
2799 |
-
if ( empty( $_REQUEST[ '_wpnonce' . $this->num ] ) || false === wp_verify_nonce( $_REQUEST[ '_wpnonce' . $this->num ], 'pods-ui-action-bulk' ) ) {
|
2800 |
pods_message( __( 'Invalid bulk request, please try again.', 'pods' ) );
|
2801 |
} elseif ( false !== $this->callback_bulk( $this->action_bulk, $this->bulk ) ) {
|
2802 |
return null;
|
@@ -2813,6 +2915,8 @@ class PodsUI {
|
|
2813 |
|
2814 |
$this->screen_meta();
|
2815 |
|
|
|
|
|
2816 |
if ( true === $reorder ) {
|
2817 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
2818 |
}
|
@@ -2832,11 +2936,19 @@ class PodsUI {
|
|
2832 |
*/
|
2833 |
$custom_container_classes = apply_filters( 'pods_ui_manage_custom_container_classes', array() );
|
2834 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2835 |
$custom_container_classes = array_map( 'sanitize_html_class', $custom_container_classes );
|
2836 |
$custom_container_classes = implode( ' ', $custom_container_classes );
|
2837 |
?>
|
2838 |
-
<div class="
|
2839 |
<div class="pods-admin-container">
|
|
|
2840 |
<div id="icon-edit-pages" class="icon32"<?php echo $icon_style; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>>
|
2841 |
<br />
|
2842 |
</div>
|
@@ -2848,8 +2960,8 @@ class PodsUI {
|
|
2848 |
if ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
2849 |
$link = pods_query_arg(
|
2850 |
array(
|
2851 |
-
'action' . $this->num => 'manage',
|
2852 |
-
'id' . $this->num => '',
|
2853 |
),
|
2854 |
self::$allowed, $this->exclusion()
|
2855 |
);
|
@@ -2868,9 +2980,9 @@ class PodsUI {
|
|
2868 |
if ( ! in_array( 'add', $this->actions_disabled ) && ! in_array( 'add', $this->actions_hidden ) && ! $this->restricted( 'add' ) ) {
|
2869 |
$link = pods_query_arg(
|
2870 |
array(
|
2871 |
-
'action' . $this->num => 'add',
|
2872 |
-
'id' . $this->num => '',
|
2873 |
-
'do' . $this->num => '',
|
2874 |
),
|
2875 |
self::$allowed, $this->exclusion()
|
2876 |
);
|
@@ -2883,7 +2995,7 @@ class PodsUI {
|
|
2883 |
<?php
|
2884 |
}
|
2885 |
if ( ! in_array( 'reorder', $this->actions_disabled ) && ! in_array( 'reorder', $this->actions_hidden ) && false !== $this->reorder['on'] && ! $this->restricted( 'reorder' ) ) {
|
2886 |
-
$link = pods_query_arg( array( 'action' . $this->num => 'reorder' ), self::$allowed, $this->exclusion() );
|
2887 |
|
2888 |
if ( ! empty( $this->action_links['reorder'] ) ) {
|
2889 |
$link = $this->action_links['reorder'];
|
@@ -2894,19 +3006,20 @@ class PodsUI {
|
|
2894 |
}
|
2895 |
?>
|
2896 |
</h2>
|
|
|
2897 |
|
2898 |
<form id="posts-filter" action="" method="get">
|
2899 |
<?php
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
-
|
2906 |
-
|
2907 |
-
|
2908 |
|
2909 |
-
|
2910 |
|
2911 |
foreach ( $filters as $k => $filter ) {
|
2912 |
if ( isset( $this->pod->fields[ $filter ] ) ) {
|
@@ -2937,16 +3050,7 @@ class PodsUI {
|
|
2937 |
$excluded_filters[] = 'filter_' . $filter;
|
2938 |
}//end foreach
|
2939 |
|
2940 |
-
|
2941 |
-
|
2942 |
-
foreach ( $get as $k => $v ) {
|
2943 |
-
if ( is_array( $v ) || in_array( $k, $excluded_filters ) || 1 > strlen( $v ) ) {
|
2944 |
-
continue;
|
2945 |
-
}
|
2946 |
-
?>
|
2947 |
-
<input type="hidden" name="<?php esc_attr_e( $k ); ?>" value="<?php esc_attr_e( $v ); ?>" />
|
2948 |
-
<?php
|
2949 |
-
}
|
2950 |
|
2951 |
if ( false !== $this->callback( 'header', $reorder ) ) {
|
2952 |
return null;
|
@@ -2956,7 +3060,8 @@ class PodsUI {
|
|
2956 |
$this->get_data();
|
2957 |
} elseif ( $this->sortable ) {
|
2958 |
// we have the data already as an array
|
2959 |
-
$this->sort_data();
|
|
|
2960 |
|
2961 |
if ( 'export' === $this->action && ! in_array( 'export', $this->actions_disabled, true ) ) {
|
2962 |
$this->export();
|
@@ -2971,16 +3076,6 @@ class PodsUI {
|
|
2971 |
?>
|
2972 |
<p class="search-box" align="right">
|
2973 |
<?php
|
2974 |
-
$excluded_filters = array( 'search' . $this->num, 'pg' . $this->num );
|
2975 |
-
|
2976 |
-
foreach ( $this->filters as $filter ) {
|
2977 |
-
$excluded_filters[] = 'filter_' . $filter . '_start';
|
2978 |
-
$excluded_filters[] = 'filter_' . $filter . '_end';
|
2979 |
-
$excluded_filters[] = 'filter_' . $filter;
|
2980 |
-
}
|
2981 |
-
|
2982 |
-
$this->hidden_vars( $excluded_filters );
|
2983 |
-
|
2984 |
foreach ( $this->filters as $filter ) {
|
2985 |
if ( isset( $this->pod->fields[ $filter ] ) ) {
|
2986 |
$filter_field = $this->pod->fields[ $filter ];
|
@@ -3012,7 +3107,7 @@ class PodsUI {
|
|
3012 |
$end = PodsForm::field_method( $filter_field['type'], 'convert_date', $end, 'n/j/Y' );
|
3013 |
}
|
3014 |
?>
|
3015 |
-
<label for="pods-form-ui-filter-<?php
|
3016 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3017 |
</label>
|
3018 |
<?php
|
@@ -3030,7 +3125,7 @@ class PodsUI {
|
|
3030 |
);
|
3031 |
?>
|
3032 |
|
3033 |
-
<label for="pods-form-ui-filter-<?php
|
3034 |
to
|
3035 |
</label>
|
3036 |
<?php
|
@@ -3064,7 +3159,7 @@ class PodsUI {
|
|
3064 |
|
3065 |
$options = array_merge( $filter_field, $filter_field['options'] );
|
3066 |
?>
|
3067 |
-
<label for="pods-form-ui-filter-<?php
|
3068 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3069 |
</label>
|
3070 |
<?php
|
@@ -3104,7 +3199,7 @@ class PodsUI {
|
|
3104 |
|
3105 |
$options = array_merge( $filter_field, $filter_field['options'] );
|
3106 |
?>
|
3107 |
-
<label for="pods-form-ui-filter-<?php
|
3108 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3109 |
</label>
|
3110 |
<?php
|
@@ -3133,7 +3228,7 @@ class PodsUI {
|
|
3133 |
$options['input_helper'] = pods_var_raw( 'ui_input_helper', pods_var_raw( 'options', pods_var_raw( $filter, $this->fields['search'], array(), null, true ), array(), null, true ), '', null, true );
|
3134 |
$options['input_helper'] = pods_var_raw( 'ui_input_helper', $options, $options['input_helper'], null, true );
|
3135 |
?>
|
3136 |
-
<label for="pods-form-ui-filter-<?php
|
3137 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3138 |
</label>
|
3139 |
<?php
|
@@ -3158,19 +3253,19 @@ class PodsUI {
|
|
3158 |
if ( false !== $this->do_hook( 'filters_show_search', true ) ) {
|
3159 |
?>
|
3160 |
<span class="pods-form-ui-filter-container pods-form-ui-filter-container-search">
|
3161 |
-
<label<?php echo ( empty( $this->filters ) ) ? ' class="screen-reader-text"' : ''; ?> for="page-search<?php echo esc_attr( $this->num ); ?>-input"><?php _e( 'Search', 'pods' ); ?>:</label>
|
3162 |
-
<?php echo PodsForm::field( 'search' . $this->num, $this->search, 'text', array( 'attributes' => array( 'id' => 'page-search' . $this->num . '-input' ) ) ); ?>
|
3163 |
</span>
|
3164 |
<?php
|
3165 |
} else {
|
3166 |
-
echo PodsForm::field( 'search' . $this->num, '', 'hidden' );
|
3167 |
}
|
3168 |
|
3169 |
-
echo PodsForm::submit_button( $this->header['search'], 'button', false, false, array( 'id' => 'search' . $this->num . '-submit' ) );
|
3170 |
|
3171 |
if ( 0 < strlen( $this->search ) ) {
|
3172 |
$clear_filters = array(
|
3173 |
-
'search' . $this->num => false,
|
3174 |
);
|
3175 |
|
3176 |
foreach ( $this->filters as $filter ) {
|
@@ -3180,7 +3275,7 @@ class PodsUI {
|
|
3180 |
}
|
3181 |
?>
|
3182 |
<br class="clear" />
|
3183 |
-
<small>[<a href="<?php echo esc_url( pods_query_arg( $clear_filters, array( 'orderby' . $this->num, 'orderby_dir' . $this->num, 'limit' . $this->num, 'page' ), $this->exclusion() ) ); ?>"><?php _e( 'Reset Filters', 'pods' ); ?></a>]</small>
|
3184 |
<br class="clear" />
|
3185 |
<?php
|
3186 |
}
|
@@ -3201,9 +3296,9 @@ class PodsUI {
|
|
3201 |
if ( ! empty( $this->data ) && ! empty( $this->actions_bulk ) ) {
|
3202 |
?>
|
3203 |
<div class="alignleft actions">
|
3204 |
-
<?php wp_nonce_field( 'pods-ui-action-bulk', '_wpnonce' . $this->num, false ); ?>
|
3205 |
|
3206 |
-
<select name="action_bulk<?php
|
3207 |
<option value="-1" selected="selected"><?php _e( 'Bulk Actions', 'pods' ); ?></option>
|
3208 |
|
3209 |
<?php
|
@@ -3214,13 +3309,13 @@ class PodsUI {
|
|
3214 |
if ( ! isset( $action_data['label'] ) ) {
|
3215 |
$action_data['label'] = ucwords( str_replace( '_', ' ', $action ) );}
|
3216 |
?>
|
3217 |
-
<option value="<?php
|
3218 |
<?php
|
3219 |
}
|
3220 |
?>
|
3221 |
</select>
|
3222 |
|
3223 |
-
<input type="submit" id="doaction_bulk<?php
|
3224 |
</div>
|
3225 |
<?php
|
3226 |
}//end if
|
@@ -3228,7 +3323,7 @@ class PodsUI {
|
|
3228 |
if ( true !== $reorder && ( false !== $this->pagination_total || false !== $this->pagination ) ) {
|
3229 |
?>
|
3230 |
<div class="tablenav-pages<?php esc_attr_e( ( $this->limit < $this->total_found || 1 < $this->page ) ? '' : ' one-page' ); ?>">
|
3231 |
-
<?php $this->pagination(
|
3232 |
</div>
|
3233 |
<?php
|
3234 |
}
|
@@ -3236,8 +3331,8 @@ class PodsUI {
|
|
3236 |
if ( true === $reorder ) {
|
3237 |
$link = pods_query_arg(
|
3238 |
array(
|
3239 |
-
'action' . $this->num => 'manage',
|
3240 |
-
'id' . $this->num => '',
|
3241 |
), self::$allowed, $this->exclusion()
|
3242 |
);
|
3243 |
|
@@ -3253,8 +3348,8 @@ class PodsUI {
|
|
3253 |
$export_document_location = pods_slash(
|
3254 |
pods_query_arg(
|
3255 |
array(
|
3256 |
-
'action_bulk' . $this->num => 'export',
|
3257 |
-
'_wpnonce' => wp_create_nonce( 'pods-ui-action-bulk' ),
|
3258 |
), self::$allowed, $this->exclusion()
|
3259 |
)
|
3260 |
);
|
@@ -3291,7 +3386,7 @@ class PodsUI {
|
|
3291 |
?>
|
3292 |
<div class="tablenav">
|
3293 |
<div class="tablenav-pages<?php esc_attr_e( ( $this->limit < $this->total_found || 1 < $this->page ) ? '' : ' one-page' ); ?>">
|
3294 |
-
<?php $this->pagination(
|
3295 |
<br class="clear" />
|
3296 |
</div>
|
3297 |
</div>
|
@@ -3369,8 +3464,8 @@ class PodsUI {
|
|
3369 |
if ( false === strpos( $label, '<a' ) ) {
|
3370 |
$link = pods_query_arg(
|
3371 |
array(
|
3372 |
-
'view' . $this->num => $view,
|
3373 |
-
'pg' . $this->num => '',
|
3374 |
), self::$allowed, $this->exclusion()
|
3375 |
);
|
3376 |
|
@@ -3383,7 +3478,7 @@ class PodsUI {
|
|
3383 |
$label = wp_kses_post( $label );
|
3384 |
}
|
3385 |
?>
|
3386 |
-
<li class="<?php
|
3387 |
<?php
|
3388 |
/* Escaped above to support links */
|
3389 |
echo $label;
|
@@ -3402,9 +3497,9 @@ class PodsUI {
|
|
3402 |
?>
|
3403 |
<p class="search-box">
|
3404 |
<?php
|
3405 |
-
if ( $filtered || '' != pods_var_raw( 'search' . $this->num, 'get', '', null, true ) ) {
|
3406 |
$clear_filters = array(
|
3407 |
-
'search' . $this->num => false,
|
3408 |
);
|
3409 |
|
3410 |
foreach ( $this->filters as $filter ) {
|
@@ -3418,9 +3513,9 @@ class PodsUI {
|
|
3418 |
echo esc_url(
|
3419 |
pods_query_arg(
|
3420 |
$clear_filters, array(
|
3421 |
-
'orderby' . $this->num,
|
3422 |
-
'orderby_dir' . $this->num,
|
3423 |
-
'limit' . $this->num,
|
3424 |
'page',
|
3425 |
), $this->exclusion()
|
3426 |
)
|
@@ -3433,15 +3528,15 @@ class PodsUI {
|
|
3433 |
if ( false !== $this->do_hook( 'filters_show_search', true ) ) {
|
3434 |
?>
|
3435 |
|
3436 |
-
<label class="screen-reader-text" for="page-search<?php
|
3437 |
-
<?php echo PodsForm::field( 'search' . $this->num, $this->search, 'text', array( 'attributes' => array( 'id' => 'page-search' . $this->num . '-input' ) ) ); ?>
|
3438 |
<?php
|
3439 |
} else {
|
3440 |
-
echo PodsForm::field( 'search' . $this->num, '', 'hidden' );
|
3441 |
}
|
3442 |
?>
|
3443 |
|
3444 |
-
<?php echo PodsForm::submit_button( $this->header['search'], 'button', false, false, array( 'id' => 'search' . $this->num . '-submit' ) ); ?>
|
3445 |
</p>
|
3446 |
<?php
|
3447 |
}//end if
|
@@ -3536,7 +3631,7 @@ class PodsUI {
|
|
3536 |
$value_label = $value;
|
3537 |
}
|
3538 |
?>
|
3539 |
-
<li class="pods-ui-filter-bar-filter" data-filter="<?php
|
3540 |
<a href="#TB_inline?width=640&inlineId=pods-ui-posts-filter-popup" class="thickbox" title="<?php esc_attr_e( 'Advanced Filters', 'pods' ); ?>">
|
3541 |
<strong><?php esc_html_e( $filter_field['label'] ); ?>:</strong>
|
3542 |
<?php esc_html_e( $value_label ); ?>
|
@@ -3564,7 +3659,7 @@ class PodsUI {
|
|
3564 |
</div>
|
3565 |
|
3566 |
<script type="text/javascript">
|
3567 |
-
|
3568 |
jQuery( '.pods-ui-filter-bar-secondary' ).on( 'click', '.remove-filter', function ( e ) {
|
3569 |
jQuery( '.pods-ui-filter-popup #' + jQuery( this ).parent().data( 'filter' ) ).remove();
|
3570 |
|
@@ -3572,10 +3667,10 @@ class PodsUI {
|
|
3572 |
jQuery( this ).remove();
|
3573 |
} );
|
3574 |
|
3575 |
-
jQuery( 'form#posts-filter [name="pg<?php
|
3576 |
-
jQuery( 'form#posts-filter [name="action<?php
|
3577 |
-
jQuery( 'form#posts-filter [name="action_bulk<?php
|
3578 |
-
jQuery( 'form#posts-filter [name="_wpnonce<?php
|
3579 |
|
3580 |
jQuery( 'form#posts-filter' ).submit();
|
3581 |
|
@@ -3597,12 +3692,12 @@ class PodsUI {
|
|
3597 |
<div class="pods-ui-posts-filters">
|
3598 |
<?php
|
3599 |
$excluded_filters = array(
|
3600 |
-
'search' . $this->num,
|
3601 |
-
'pg' . $this->num,
|
3602 |
-
'action' . $this->num,
|
3603 |
-
'action_bulk' . $this->num,
|
3604 |
-
'action_bulk_ids' . $this->num,
|
3605 |
-
'_wpnonce' . $this->num,
|
3606 |
);
|
3607 |
|
3608 |
foreach ( $filters as $filter ) {
|
@@ -3620,7 +3715,7 @@ class PodsUI {
|
|
3620 |
continue;
|
3621 |
}
|
3622 |
?>
|
3623 |
-
<input type="hidden" name="<?php
|
3624 |
<?php
|
3625 |
}
|
3626 |
|
@@ -3643,7 +3738,7 @@ class PodsUI {
|
|
3643 |
continue;
|
3644 |
}
|
3645 |
?>
|
3646 |
-
<p class="pods-ui-posts-filter-toggled pods-ui-posts-filter-<?php
|
3647 |
<?php
|
3648 |
if ( in_array( $filter_field['type'], array( 'date', 'datetime', 'time' ) ) ) {
|
3649 |
$start = pods_var_raw( 'filter_' . $filter . '_start', 'get', pods_var_raw( 'filter_default', $filter_field, '', null, true ), null, true );
|
@@ -3676,7 +3771,7 @@ class PodsUI {
|
|
3676 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( ( empty( $start ) && empty( $end ) ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3677 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( ( empty( $start ) && empty( $end ) ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3678 |
|
3679 |
-
<label for="pods-form-ui-filter-<?php
|
3680 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3681 |
</label>
|
3682 |
|
@@ -3696,7 +3791,7 @@ class PodsUI {
|
|
3696 |
);
|
3697 |
?>
|
3698 |
|
3699 |
-
<label for="pods-form-ui-filter-<?php
|
3700 |
<?php
|
3701 |
// Prevent p div issues.
|
3702 |
echo str_replace(
|
@@ -3735,7 +3830,7 @@ class PodsUI {
|
|
3735 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( empty( $value ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3736 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( empty( $value ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3737 |
|
3738 |
-
<label for="pods-form-ui-filter-<?php
|
3739 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3740 |
</label>
|
3741 |
|
@@ -3784,7 +3879,7 @@ class PodsUI {
|
|
3784 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( empty( $value ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3785 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( empty( $value ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3786 |
|
3787 |
-
<label for="pods-form-ui-filter-<?php
|
3788 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3789 |
</label>
|
3790 |
|
@@ -3823,7 +3918,7 @@ class PodsUI {
|
|
3823 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( empty( $value ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3824 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( empty( $value ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3825 |
|
3826 |
-
<label for="pods-form-ui-filter-<?php
|
3827 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3828 |
</label>
|
3829 |
|
@@ -3852,22 +3947,22 @@ class PodsUI {
|
|
3852 |
}//end foreach
|
3853 |
?>
|
3854 |
|
3855 |
-
<p class="pods-ui-posts-filter-toggled pods-ui-posts-filter-search<?php
|
3856 |
-
<label for="pods-form-ui-search<?php
|
3857 |
-
<?php echo PodsForm::field( 'search' . $this->num, pods_var_raw( 'search' . $this->num ), 'text' ); ?>
|
3858 |
</p>
|
3859 |
|
3860 |
<?php $zebra = empty( $zebra ); ?>
|
3861 |
</div>
|
3862 |
|
3863 |
-
<p class="submit<?php
|
3864 |
-
<input type="submit" value="<?php
|
3865 |
</p>
|
3866 |
</form>
|
3867 |
</div>
|
3868 |
|
3869 |
<script type="text/javascript">
|
3870 |
-
|
3871 |
jQuery( document ).on( 'click', '.pods-ui-posts-filter-toggle.toggle-on', function ( e ) {
|
3872 |
jQuery( this ).parent().find( '.pods-ui-posts-filter' ).removeClass( 'pods-hidden' );
|
3873 |
|
@@ -3943,8 +4038,8 @@ class PodsUI {
|
|
3943 |
echo esc_url(
|
3944 |
pods_query_arg(
|
3945 |
array(
|
3946 |
-
'action' . $this->num => 'reorder',
|
3947 |
-
'do' . $this->num => 'save',
|
3948 |
'page' => pods_var_raw( 'page' ),
|
3949 |
), self::$allowed, $this->exclusion()
|
3950 |
)
|
@@ -4028,7 +4123,7 @@ class PodsUI {
|
|
4028 |
$width = ' style="width: ' . esc_attr( $attributes['width'] ) . '"';
|
4029 |
}
|
4030 |
|
4031 |
-
if ( $
|
4032 |
$column_classes[] = 'sortable' . $current_sort;
|
4033 |
?>
|
4034 |
<th scope="col"<?php echo $att_id; ?> class="<?php esc_attr_e( implode( ' ', $column_classes ) ); ?>"<?php echo $width; ?>>
|
@@ -4037,12 +4132,12 @@ class PodsUI {
|
|
4037 |
echo esc_url_raw(
|
4038 |
pods_query_arg(
|
4039 |
array(
|
4040 |
-
'orderby' . $this->num => $field,
|
4041 |
-
'orderby_dir' . $this->num => $dir,
|
4042 |
), array(
|
4043 |
-
'limit' . $this->num,
|
4044 |
-
'search' . $this->num,
|
4045 |
-
'pg' . $this->num,
|
4046 |
'page',
|
4047 |
), $this->exclusion()
|
4048 |
)
|
@@ -4092,20 +4187,20 @@ class PodsUI {
|
|
4092 |
$width = ' style="width: ' . esc_attr( $attributes['width'] ) . '"';
|
4093 |
}
|
4094 |
|
4095 |
-
if ( $
|
4096 |
?>
|
4097 |
-
<th scope="col" class="manage-column column-<?php
|
4098 |
<a href="
|
4099 |
<?php
|
4100 |
echo esc_url_raw(
|
4101 |
pods_query_arg(
|
4102 |
array(
|
4103 |
-
'orderby' . $this->num => $field,
|
4104 |
-
'orderby_dir' . $this->num => $dir,
|
4105 |
), array(
|
4106 |
-
'limit' . $this->num,
|
4107 |
-
'search' . $this->num,
|
4108 |
-
'pg' . $this->num,
|
4109 |
'page',
|
4110 |
), $this->exclusion()
|
4111 |
)
|
@@ -4116,7 +4211,7 @@ class PodsUI {
|
|
4116 |
<?php
|
4117 |
} else {
|
4118 |
?>
|
4119 |
-
<th scope="col" class="manage-column column-<?php
|
4120 |
<?php
|
4121 |
}//end if
|
4122 |
}//end foreach
|
@@ -4147,12 +4242,12 @@ class PodsUI {
|
|
4147 |
}
|
4148 |
}
|
4149 |
?>
|
4150 |
-
<tr id="item-<?php
|
4151 |
<?php
|
4152 |
if ( ! empty( $this->actions_bulk ) ) {
|
4153 |
?>
|
4154 |
<th scope="row" class="check-column">
|
4155 |
-
<input type="checkbox" name="action_bulk_ids<?php
|
4156 |
</th>
|
4157 |
<?php
|
4158 |
}
|
@@ -4328,19 +4423,32 @@ class PodsUI {
|
|
4328 |
if ( $first_field ) {
|
4329 |
$css_classes[] = 'column-primary';
|
4330 |
}
|
4331 |
-
|
4332 |
-
|
|
|
|
|
|
|
|
|
4333 |
$css_classes[] = 'column-title';
|
4334 |
|
4335 |
if ( 'raw' !== $attributes['type'] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4336 |
$row_value = wp_kses_post( $row_value );
|
4337 |
}
|
4338 |
|
4339 |
if ( ! in_array( 'edit', $this->actions_disabled ) && ! in_array( 'edit', $this->actions_hidden ) && ( false === $reorder || in_array( 'reorder', $this->actions_disabled ) || false === $this->reorder['on'] ) && 'edit' === $default_action ) {
|
4340 |
$link = pods_query_arg(
|
4341 |
array(
|
4342 |
-
'action' . $this->num => 'edit',
|
4343 |
-
'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4344 |
), self::$allowed, $this->exclusion()
|
4345 |
);
|
4346 |
|
@@ -4359,8 +4467,8 @@ class PodsUI {
|
|
4359 |
} elseif ( ! in_array( 'view', $this->actions_disabled ) && ! in_array( 'view', $this->actions_hidden ) && ( false === $reorder || in_array( 'reorder', $this->actions_disabled ) || false === $this->reorder['on'] ) && 'view' === $default_action ) {
|
4360 |
$link = pods_query_arg(
|
4361 |
array(
|
4362 |
-
'action' . $this->num => 'view',
|
4363 |
-
'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4364 |
), self::$allowed, $this->exclusion()
|
4365 |
);
|
4366 |
|
@@ -4399,7 +4507,7 @@ class PodsUI {
|
|
4399 |
|
4400 |
if ( ! empty( $actions ) ) {
|
4401 |
?>
|
4402 |
-
<div class="row-actions<?php
|
4403 |
<?php
|
4404 |
$this->callback( 'actions_start', $row, $actions );
|
4405 |
|
@@ -4412,13 +4520,16 @@ class PodsUI {
|
|
4412 |
}
|
4413 |
} else {
|
4414 |
?>
|
4415 |
-
<input type="hidden" name="order[]" value="<?php
|
4416 |
<?php
|
4417 |
}//end if
|
|
|
|
|
4418 |
?>
|
4419 |
-
|
4420 |
-
|
4421 |
-
|
|
|
4422 |
</td>
|
4423 |
<?php
|
4424 |
} elseif ( 'date' === $attributes['type'] ) {
|
@@ -4428,12 +4539,13 @@ class PodsUI {
|
|
4428 |
$css_classes[] = 'date';
|
4429 |
$css_classes[] = 'column-date';
|
4430 |
?>
|
4431 |
-
<td class="<?php esc_attr_e( implode( ' ', $css_classes ) ); ?>" data-colname="<?php
|
4432 |
-
<abbr title="<?php
|
4433 |
-
<?php if ( $first_field ) { ?>
|
4434 |
<button type="button" class="toggle-row">
|
4435 |
-
|
4436 |
-
</button
|
|
|
4437 |
</td>
|
4438 |
<?php
|
4439 |
} else {
|
@@ -4444,20 +4556,30 @@ class PodsUI {
|
|
4444 |
$css_classes[] = 'author';
|
4445 |
|
4446 |
if ( 'raw' !== $attributes['type'] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4447 |
$row_value = wp_kses_post( $row_value );
|
4448 |
}
|
4449 |
?>
|
4450 |
-
<td class="<?php esc_attr_e( implode( ' ', $css_classes ) ); ?>" data-colname="<?php
|
4451 |
<span>
|
4452 |
<?php
|
4453 |
/* Escaped above for non-HTML types */
|
4454 |
echo $row_value;
|
4455 |
?>
|
4456 |
</span>
|
4457 |
-
<?php if ( $first_field ) { ?>
|
4458 |
<button type="button" class="toggle-row">
|
4459 |
-
|
4460 |
-
</button
|
|
|
4461 |
</td>
|
4462 |
<?php
|
4463 |
}//end if
|
@@ -4480,20 +4602,20 @@ class PodsUI {
|
|
4480 |
}
|
4481 |
?>
|
4482 |
<script type="text/javascript">
|
4483 |
-
|
4484 |
-
|
4485 |
-
|
4486 |
-
|
4487 |
-
|
4488 |
-
|
4489 |
-
|
4490 |
-
|
4491 |
-
|
4492 |
-
|
|
|
|
|
|
|
4493 |
} );
|
4494 |
-
<?php
|
4495 |
-
}
|
4496 |
-
?>
|
4497 |
</script>
|
4498 |
<?php
|
4499 |
}
|
@@ -4512,8 +4634,8 @@ class PodsUI {
|
|
4512 |
if ( ! in_array( 'view', $this->actions_disabled ) && ! in_array( 'view', $this->actions_hidden ) ) {
|
4513 |
$link = pods_query_arg(
|
4514 |
array(
|
4515 |
-
'action' . $this->num => 'view',
|
4516 |
-
'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4517 |
), self::$allowed, $this->exclusion()
|
4518 |
);
|
4519 |
|
@@ -4527,8 +4649,8 @@ class PodsUI {
|
|
4527 |
if ( ! in_array( 'edit', $this->actions_disabled ) && ! in_array( 'edit', $this->actions_hidden ) && ! $this->restricted( 'edit', $row ) ) {
|
4528 |
$link = pods_query_arg(
|
4529 |
array(
|
4530 |
-
'action' . $this->num => 'edit',
|
4531 |
-
'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4532 |
), self::$allowed, $this->exclusion()
|
4533 |
);
|
4534 |
|
@@ -4542,8 +4664,8 @@ class PodsUI {
|
|
4542 |
if ( ! in_array( 'duplicate', $this->actions_disabled ) && ! in_array( 'duplicate', $this->actions_hidden ) && ! $this->restricted( 'edit', $row ) ) {
|
4543 |
$link = pods_query_arg(
|
4544 |
array(
|
4545 |
-
'action' . $this->num => 'duplicate',
|
4546 |
-
'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4547 |
), self::$allowed, $this->exclusion()
|
4548 |
);
|
4549 |
|
@@ -4557,14 +4679,14 @@ class PodsUI {
|
|
4557 |
if ( ! in_array( 'delete', $this->actions_disabled ) && ! in_array( 'delete', $this->actions_hidden ) && ! $this->restricted( 'delete', $row ) ) {
|
4558 |
$link = pods_query_arg(
|
4559 |
array(
|
4560 |
-
'action' . $this->num
|
4561 |
-
'id' . $this->num
|
4562 |
-
'_wpnonce'
|
4563 |
), self::$allowed, $this->exclusion()
|
4564 |
);
|
4565 |
|
4566 |
if ( ! empty( $this->action_links['delete'] ) ) {
|
4567 |
-
$link = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'pods-ui-action-delete' ) ), $this->do_template( $this->action_links['delete'], $row ) );
|
4568 |
}
|
4569 |
|
4570 |
$actions['delete'] = '<span class="delete"><a href="' . esc_url( $link ) . '" title="' . esc_attr__( 'Delete this item', 'pods' ) . '" class="submitdelete" onclick="if(confirm(\'' . esc_attr__( 'You are about to permanently delete this item\n Choose \\\'Cancel\\\' to stop, \\\'OK\\\' to delete.', 'pods' ) . '\')){return true;}return false;">' . __( 'Delete', 'pods' ) . '</a></span>';
|
@@ -4603,20 +4725,20 @@ class PodsUI {
|
|
4603 |
|
4604 |
if ( ! isset( $custom_data['link'] ) ) {
|
4605 |
$vars = array(
|
4606 |
-
'action' => $custom_action,
|
4607 |
-
'id' => $row[ $this->sql['field_id'] ],
|
4608 |
-
'_wpnonce' => wp_create_nonce( 'pods-ui-action-' . $custom_action ),
|
4609 |
);
|
4610 |
|
4611 |
if ( 'toggle' === $custom_action ) {
|
4612 |
-
$vars['toggle'] = (int) ( ! $row['toggle'] );
|
4613 |
-
$vars['toggled'] = 1;
|
4614 |
}
|
4615 |
|
4616 |
$custom_data['link'] = pods_query_arg( $vars, self::$allowed, $this->exclusion() );
|
4617 |
|
4618 |
if ( isset( $this->action_links[ $custom_action ] ) && ! empty( $this->action_links[ $custom_action ] ) ) {
|
4619 |
-
$custom_data['link'] = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'pods-ui-action-' . $custom_action ) ), $this->do_template( $this->action_links[ $custom_action ], $row ) );
|
4620 |
}
|
4621 |
}
|
4622 |
|
@@ -4712,8 +4834,8 @@ class PodsUI {
|
|
4712 |
continue;
|
4713 |
}
|
4714 |
?>
|
4715 |
-
<label for="<?php
|
4716 |
-
<input class="hide-column-tog" name="<?php
|
4717 |
</label>
|
4718 |
<?php
|
4719 |
}
|
@@ -4728,14 +4850,14 @@ class PodsUI {
|
|
4728 |
<?php
|
4729 |
if ( true === $this->pagination ) {
|
4730 |
?>
|
4731 |
-
<input type="text" class="screen-per-page" name="wp_screen_options[value]" id="<?php
|
4732 |
-
<label for="<?php
|
4733 |
<?php
|
4734 |
}
|
4735 |
$this->do_hook( 'screen_meta_screen_submit' );
|
4736 |
?>
|
4737 |
<input type="submit" name="screen-options-apply" id="screen-options-apply" class="button" value="<?php esc_attr_e( 'Apply', 'pods' ); ?>">
|
4738 |
-
<input type="hidden" name="wp_screen_options[option]" value="<?php
|
4739 |
<?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?>
|
4740 |
</div>
|
4741 |
<?php
|
@@ -4814,20 +4936,30 @@ class PodsUI {
|
|
4814 |
return null;
|
4815 |
}
|
4816 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4817 |
$total_pages = ceil( $this->total_found / $this->limit );
|
4818 |
$request_uri = pods_query_arg(
|
4819 |
-
array( 'pg' . $this->num => '' ),
|
4820 |
-
'limit' . $this->num,
|
4821 |
-
'orderby' . $this->num,
|
4822 |
-
'orderby_dir' . $this->num,
|
4823 |
-
'search' . $this->num,
|
4824 |
-
'filter_*',
|
4825 |
-
'view' . $this->num,
|
4826 |
-
'page' . $this->num,
|
4827 |
-
'post_type',
|
4828 |
-
'taxonomy',
|
4829 |
-
'action' . $this->num,
|
4830 |
-
), $this->exclusion()
|
4831 |
);
|
4832 |
|
4833 |
$append = false;
|
@@ -4844,12 +4976,45 @@ class PodsUI {
|
|
4844 |
<?php
|
4845 |
}
|
4846 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4847 |
if ( false !== $this->pagination ) {
|
4848 |
if ( 1 < $total_pages ) {
|
4849 |
-
$first_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=1' );
|
4850 |
-
$prev_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . max( $this->page - 1, 1 ) );
|
4851 |
-
$next_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . min( $this->page + 1, $total_pages ) );
|
4852 |
-
$last_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . 'pg' . $this->num . '=' . $total_pages );
|
4853 |
|
4854 |
$classes = '';
|
4855 |
if ( 1 >= $this->page ) {
|
@@ -4859,20 +5024,19 @@ class PodsUI {
|
|
4859 |
$classes .= ' button';
|
4860 |
}
|
4861 |
?>
|
4862 |
-
<a class="first-page<?php
|
4863 |
-
<a class="prev-page<?php
|
4864 |
<?php
|
4865 |
if ( true == $header ) {
|
4866 |
?>
|
4867 |
-
<span class="paging-input"><input class="current-page" title="<?php esc_attr_e( 'Current page', 'pods' ); ?>" type="text" name="pg<?php
|
4868 |
<span class="total-pages"><?php echo absint( $total_pages ); ?></span></span>
|
4869 |
-
<script>
|
4870 |
-
|
4871 |
-
|
4872 |
-
var pageInput = $( 'input.current-page' );
|
4873 |
var currentPage = pageInput.val();
|
4874 |
pageInput.closest( 'form' ).submit( function ( e ) {
|
4875 |
-
if ( ( 1 >
|
4876 |
pageInput.val( '1' );
|
4877 |
}
|
4878 |
} );
|
@@ -4893,8 +5057,8 @@ class PodsUI {
|
|
4893 |
$classes .= ' button';
|
4894 |
}
|
4895 |
?>
|
4896 |
-
<a class="next-page<?php
|
4897 |
-
<a class="last-page<?php
|
4898 |
<?php
|
4899 |
}//end if
|
4900 |
}//end if
|
@@ -4926,11 +5090,11 @@ class PodsUI {
|
|
4926 |
echo ' <a href="' . esc_url(
|
4927 |
pods_query_arg(
|
4928 |
array( 'limit' => $option ), array(
|
4929 |
-
'orderby' . $this->num,
|
4930 |
-
'orderby_dir' . $this->num,
|
4931 |
-
'search' . $this->num,
|
4932 |
'filter_*',
|
4933 |
-
'page'
|
4934 |
), $this->exclusion()
|
4935 |
)
|
4936 |
) . '">' . esc_html( $option ) . '</a>';
|
@@ -5041,19 +5205,19 @@ class PodsUI {
|
|
5041 |
}
|
5042 |
}
|
5043 |
foreach ( $get as $k => $v ) {
|
5044 |
-
if ( in_array( $k, $exclude ) ) {
|
5045 |
continue;
|
5046 |
}
|
5047 |
|
5048 |
if ( is_array( $v ) ) {
|
5049 |
foreach ( $v as $vk => $vv ) {
|
5050 |
?>
|
5051 |
-
<input type="hidden" name="<?php
|
5052 |
<?php
|
5053 |
}
|
5054 |
} else {
|
5055 |
?>
|
5056 |
-
<input type="hidden" name="<?php
|
5057 |
<?php
|
5058 |
}
|
5059 |
}
|
@@ -5067,7 +5231,7 @@ class PodsUI {
|
|
5067 |
$exclusion = self::$excluded;
|
5068 |
|
5069 |
foreach ( $exclusion as $k => $exclude ) {
|
5070 |
-
$exclusion[ $k ] = $exclude . $this->num;
|
5071 |
}
|
5072 |
|
5073 |
return $exclusion;
|
@@ -5365,6 +5529,89 @@ class PodsUI {
|
|
5365 |
return $restricted;
|
5366 |
}
|
5367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5368 |
/**
|
5369 |
* Check for a custom action callback and run it
|
5370 |
*
|
55 |
public $id = 0;
|
56 |
|
57 |
/**
|
58 |
+
* The prefix used for all URL parameters used by PodsUI.
|
59 |
+
*
|
60 |
+
* @since 2.7.28
|
61 |
+
*
|
62 |
+
* @var string
|
63 |
+
*/
|
64 |
+
public $num_prefix = '';
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Allows multiple co-existing PodsUI instances with separate functionality in URL.
|
68 |
+
*
|
69 |
* @var string
|
70 |
*/
|
71 |
public $num = '';
|
72 |
+
|
73 |
/**
|
74 |
* @var array
|
75 |
*/
|
148 |
public $fields = array(
|
149 |
'manage' => array(),
|
150 |
'search' => array(),
|
151 |
+
'sort' => array(),
|
152 |
'form' => array(),
|
153 |
'add' => array(),
|
154 |
'edit' => array(),
|
158 |
'export' => array(),
|
159 |
);
|
160 |
|
161 |
+
/**
|
162 |
+
* Which field sets haven set up.
|
163 |
+
*
|
164 |
+
* @since 2.7.28
|
165 |
+
*
|
166 |
+
* @var array
|
167 |
+
*/
|
168 |
+
public $fields_setup = array();
|
169 |
+
|
170 |
/**
|
171 |
* @var bool
|
172 |
*/
|
182 |
*/
|
183 |
public $pagination = true;
|
184 |
|
185 |
+
/**
|
186 |
+
* The type of pagination to use.
|
187 |
+
*
|
188 |
+
* @since 2.7.28
|
189 |
+
*
|
190 |
+
* @var string
|
191 |
+
*/
|
192 |
+
public $pagination_type = 'table';
|
193 |
+
|
194 |
+
/**
|
195 |
+
* The location of where to show pagination.
|
196 |
+
*
|
197 |
+
* @since 2.7.28
|
198 |
+
*
|
199 |
+
* @var string
|
200 |
+
*/
|
201 |
+
public $pagination_location = 'both';
|
202 |
+
|
203 |
/**
|
204 |
* @var bool
|
205 |
*/
|
486 |
*/
|
487 |
public function __construct( $options, $deprecated = false ) {
|
488 |
|
489 |
+
$this->_nonce = pods_v( $this->num_prefix . '_wpnonce' . $this->num, 'request' );
|
490 |
|
491 |
$object = null;
|
492 |
|
936 |
|
937 |
$options = pods_array( $options );
|
938 |
|
939 |
+
$options->validate( 'num_prefix', '' );
|
940 |
$options->validate( 'num', '', 'absint' );
|
941 |
|
942 |
+
if ( empty( $options->num_prefix ) ) {
|
943 |
+
$options->num_prefix = '';
|
944 |
+
}
|
945 |
+
|
946 |
if ( empty( $options->num ) ) {
|
947 |
$options->num = '';
|
948 |
}
|
949 |
|
950 |
+
$options->validate( 'id', pods_var( $options->num_prefix . 'id' . $options->num, 'get', $this->id ) );
|
951 |
|
952 |
$options->validate(
|
953 |
+
'do', pods_var( $options->num_prefix . 'do' . $options->num, 'get', $this->do ), 'in_array', array(
|
954 |
'save',
|
955 |
'create',
|
956 |
)
|
958 |
|
959 |
$options->validate( 'excluded', self::$excluded, 'array_merge' );
|
960 |
|
961 |
+
$options->validate( 'action', pods_var( $options->num_prefix . 'action' . $options->num, 'get', $this->action, null, true ), 'in_array', $this->actions );
|
962 |
$options->validate( 'actions_bulk', $this->actions_bulk, 'array_merge' );
|
963 |
+
$options->validate( 'action_bulk', pods_var( $options->num_prefix . 'action_bulk' . $options->num, 'get', $this->action_bulk, null, true ), 'isset', $this->actions_bulk );
|
964 |
|
965 |
+
$bulk = pods_var( $options->num_prefix . 'action_bulk_ids' . $options->num, 'get', array(), null, true );
|
966 |
|
967 |
if ( ! empty( $bulk ) ) {
|
968 |
+
$bulk = (array) pods_var( $options->num_prefix . 'action_bulk_ids' . $options->num, 'get', array(), null, true );
|
969 |
} else {
|
970 |
$bulk = array();
|
971 |
}
|
973 |
$options->validate( 'bulk', $bulk, 'array_merge', $this->bulk );
|
974 |
|
975 |
$options->validate( 'views', $this->views, 'array' );
|
976 |
+
$options->validate( 'view', pods_v( $options->num_prefix . 'view' . $options->num, 'get', $this->view, true ), 'isset', $this->views );
|
977 |
|
978 |
$options->validate( 'searchable', $this->searchable, 'boolean' );
|
979 |
+
$options->validate( 'search', pods_v( $options->num_prefix . 'search' . $options->num ) );
|
980 |
$options->validate( 'search_across', $this->search_across, 'boolean' );
|
981 |
$options->validate( 'search_across_picks', $this->search_across_picks, 'boolean' );
|
982 |
$options->validate( 'filters', $this->filters, 'array' );
|
984 |
$options->validate( 'where', $this->where, 'array_merge' );
|
985 |
|
986 |
$options->validate( 'pagination', $this->pagination, 'boolean' );
|
987 |
+
$options->validate( 'pagination_type', $this->pagination_type );
|
988 |
+
$options->validate( 'pagination_location', $this->pagination_location );
|
989 |
+
$options->validate( 'page', pods_v( $options->num_prefix . 'pg' . $options->num, 'get', $this->page ), 'absint' );
|
990 |
+
$options->validate( 'limit', pods_v( $options->num_prefix . 'limit' . $options->num, 'get', $this->limit ), 'int' );
|
991 |
|
992 |
if ( isset( $this->pods_data ) && is_object( $this->pods_data ) ) {
|
993 |
$this->sql = array(
|
999 |
$options->validate( 'sql', $this->sql, 'array_merge' );
|
1000 |
|
1001 |
$options->validate(
|
1002 |
+
'orderby_dir', strtoupper( pods_v( $options->num_prefix . 'orderby_dir' . $options->num, 'get', $this->orderby_dir, true ) ), 'in_array', array(
|
1003 |
'ASC',
|
1004 |
'DESC',
|
1005 |
)
|
1006 |
);
|
1007 |
|
1008 |
+
$options->validate( 'sortable', $this->sortable, 'boolean' );
|
1009 |
+
|
1010 |
$orderby = $this->orderby;
|
1011 |
|
1012 |
+
$provided_orderby = sanitize_text_field( pods_v( $options->num_prefix . 'orderby' . $options->num, 'get', '' ) );
|
1013 |
+
|
1014 |
// Enforce strict DB column name usage
|
1015 |
+
if ( ! empty( $options->sortable ) && ! empty( $provided_orderby ) ) {
|
1016 |
+
$orderby = pods_clean_name( $provided_orderby );
|
1017 |
}
|
1018 |
|
1019 |
if ( ! empty( $orderby ) ) {
|
1025 |
}
|
1026 |
|
1027 |
$options->validate( 'orderby', $orderby, 'array_merge' );
|
|
|
1028 |
|
1029 |
$options->validate( 'params', $this->params, 'array' );
|
1030 |
|
1126 |
), 'array_merge'
|
1127 |
);
|
1128 |
|
1129 |
+
$options->validate( 'fields', $this->fields, 'array_merge' );
|
1130 |
+
|
1131 |
+
// Set up default manage field.
|
1132 |
+
if ( empty( $options->fields['manage'] ) ) {
|
1133 |
+
$options->fields['manage'][ $options->sql['field_index'] ] = array(
|
1134 |
+
'label' => __( 'Name', 'pods' ),
|
1135 |
+
);
|
1136 |
+
}
|
1137 |
|
1138 |
$options->validate( 'export', $this->export, 'array_merge' );
|
1139 |
$options->validate( 'reorder', $this->reorder, 'array_merge' );
|
1235 |
|
1236 |
$unique_identifier .= '_' . $this->page;
|
1237 |
if ( 0 < strlen( $this->num ) ) {
|
1238 |
+
$unique_identifier .= '_' . $this->num_prefix . $this->num;
|
1239 |
}
|
1240 |
|
1241 |
$this->unique_identifier = 'pods_ui_' . md5( $unique_identifier );
|
1311 |
}
|
1312 |
}
|
1313 |
|
1314 |
+
if ( ! isset( $attributes['name'] ) ) {
|
1315 |
+
$attributes['name'] = $field;
|
1316 |
+
}
|
1317 |
+
|
1318 |
if ( ! isset( $attributes['real_name'] ) ) {
|
1319 |
$attributes['real_name'] = pods_var( 'name', $attributes, $field );
|
1320 |
}
|
1453 |
}//end foreach
|
1454 |
$fields = $new_fields;
|
1455 |
}//end if
|
1456 |
+
|
1457 |
if ( false !== $init ) {
|
1458 |
+
if ( empty( $this->fields_setup['fields'] ) ) {
|
1459 |
+
if ( 'fields' !== $which && ! empty( $this->fields ) ) {
|
1460 |
+
$this->fields = $this->setup_fields( $this->fields, 'fields' );
|
1461 |
+
} else {
|
1462 |
+
$this->fields['manage'] = $fields;
|
1463 |
+
}
|
1464 |
+
|
1465 |
+
$this->fields_setup['fields'] = true;
|
1466 |
}
|
1467 |
|
1468 |
if ( ! in_array( 'add', $this->actions_disabled ) || ! in_array( 'edit', $this->actions_disabled ) || ! in_array( 'duplicate', $this->actions_disabled ) ) {
|
1469 |
+
if ( empty( $this->fields_setup['form'] ) ) {
|
1470 |
+
if ( 'form' !== $which && isset( $this->fields['form'] ) && is_array( $this->fields['form'] ) ) {
|
1471 |
+
$this->fields['form'] = $this->setup_fields( $this->fields['form'], 'form' );
|
1472 |
+
} else {
|
1473 |
+
$this->fields['form'] = $fields;
|
1474 |
+
}
|
1475 |
+
|
1476 |
+
$this->fields_setup['form'] = true;
|
1477 |
}
|
1478 |
|
1479 |
+
if ( empty( $this->fields_setup['add'] ) ) {
|
1480 |
+
if ( ! in_array( 'add', $this->actions_disabled ) ) {
|
1481 |
+
if ( 'add' !== $which && isset( $this->fields['add'] ) && is_array( $this->fields['add'] ) ) {
|
1482 |
+
$this->fields['add'] = $this->setup_fields( $this->fields['add'], 'add' );
|
1483 |
+
}
|
1484 |
}
|
1485 |
+
|
1486 |
+
$this->fields_setup['add'] = true;
|
1487 |
}
|
1488 |
+
|
1489 |
+
if ( empty( $this->fields_setup['edit'] ) ) {
|
1490 |
+
if ( ! in_array( 'edit', $this->actions_disabled ) ) {
|
1491 |
+
if ( 'edit' !== $which && isset( $this->fields['edit'] ) && is_array( $this->fields['edit'] ) ) {
|
1492 |
+
$this->fields['edit'] = $this->setup_fields( $this->fields['edit'], 'edit' );
|
1493 |
+
}
|
1494 |
}
|
1495 |
+
|
1496 |
+
$this->fields_setup['edit'] = true;
|
1497 |
}
|
1498 |
+
|
1499 |
+
if ( empty( $this->fields_setup['duplicate'] ) ) {
|
1500 |
+
if ( ! in_array( 'duplicate', $this->actions_disabled ) ) {
|
1501 |
+
if ( 'duplicate' !== $which && isset( $this->fields['duplicate'] ) && is_array( $this->fields['duplicate'] ) ) {
|
1502 |
+
$this->fields['duplicate'] = $this->setup_fields( $this->fields['duplicate'], 'duplicate' );
|
1503 |
+
}
|
1504 |
}
|
1505 |
+
|
1506 |
+
$this->fields_setup['duplicate'] = true;
|
1507 |
}
|
1508 |
}//end if
|
1509 |
|
1510 |
+
if ( empty( $this->fields_setup['search'] ) ) {
|
1511 |
+
if ( false !== $this->searchable ) {
|
1512 |
+
if ( 'search' !== $which && isset( $this->fields['search'] ) && ! empty( $this->fields['search'] ) ) {
|
1513 |
+
$this->fields['search'] = $this->setup_fields( $this->fields['search'], 'search' );
|
1514 |
+
}
|
1515 |
} else {
|
1516 |
+
$this->fields['search'] = false;
|
1517 |
}
|
1518 |
+
|
1519 |
+
$this->fields_setup['search'] = true;
|
1520 |
}
|
1521 |
|
1522 |
+
if ( empty( $this->fields_setup['sort'] ) ) {
|
1523 |
+
if ( false !== $this->sortable ) {
|
1524 |
+
if ( 'sort' !== $which ) {
|
1525 |
+
if ( isset( $this->fields['sort'] ) && ! empty( $this->fields['sort'] ) ) {
|
1526 |
+
$this->fields['sort'] = $this->setup_fields( $this->fields['sort'], 'sort' );
|
1527 |
+
} else {
|
1528 |
+
$this->fields['sort'] = $fields;
|
1529 |
+
}
|
1530 |
+
}
|
1531 |
+
} else {
|
1532 |
+
$this->fields['sort'] = false;
|
1533 |
}
|
1534 |
+
|
1535 |
+
$this->fields_setup['sort'] = true;
|
1536 |
}
|
1537 |
|
1538 |
+
if ( empty( $this->fields_setup['export'] ) ) {
|
1539 |
+
if ( ! in_array( 'export', $this->actions_disabled, true ) ) {
|
1540 |
+
if ( 'export' !== $which && isset( $this->fields['export'] ) && ! empty( $this->fields['export'] ) ) {
|
1541 |
+
$this->fields['export'] = $this->setup_fields( $this->fields['export'], 'export' );
|
1542 |
+
}
|
1543 |
+
}
|
1544 |
+
|
1545 |
+
$this->fields_setup['export'] = true;
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
if ( empty( $this->fields_setup['reorder'] ) ) {
|
1549 |
+
if ( ! in_array( 'reorder', $this->actions_disabled, true ) && false !== $this->reorder['on'] ) {
|
1550 |
+
if ( 'reorder' !== $which && isset( $this->fields['reorder'] ) && ! empty( $this->fields['reorder'] ) ) {
|
1551 |
+
$this->fields['reorder'] = $this->setup_fields( $this->fields['reorder'], 'reorder' );
|
1552 |
+
}
|
1553 |
}
|
1554 |
+
|
1555 |
+
$this->fields_setup['reorder'] = true;
|
1556 |
}
|
1557 |
}//end if
|
1558 |
|
1579 |
return;
|
1580 |
}
|
1581 |
?>
|
1582 |
+
<div id="message" class="<?php echo esc_attr( $class ); ?> fade">
|
1583 |
<p><?php echo $msg; ?></p>
|
1584 |
</div>
|
1585 |
<?php
|
1739 |
if ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
1740 |
$link = pods_query_arg(
|
1741 |
array(
|
1742 |
+
$this->num_prefix . 'action' . $this->num => 'manage',
|
1743 |
+
$this->num_prefix . 'id' . $this->num => '',
|
1744 |
), self::$allowed, $this->exclusion()
|
1745 |
);
|
1746 |
|
1798 |
if ( ! in_array( 'add', $this->actions_disabled ) && ! in_array( 'add', $this->actions_hidden ) && ! $this->restricted( 'add' ) ) {
|
1799 |
$link = pods_query_arg(
|
1800 |
array(
|
1801 |
+
$this->num_prefix . 'action' . $this->num => 'add',
|
1802 |
+
$this->num_prefix . 'id' . $this->num => '',
|
1803 |
+
$this->num_prefix . 'do' . $this->num => '',
|
1804 |
), self::$allowed, $this->exclusion()
|
1805 |
);
|
1806 |
|
1813 |
} elseif ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
1814 |
$link = pods_query_arg(
|
1815 |
array(
|
1816 |
+
$this->num_prefix . 'action' . $this->num => 'manage',
|
1817 |
+
$this->num_prefix . 'id' . $this->num => '',
|
1818 |
), self::$allowed, $this->exclusion()
|
1819 |
);
|
1820 |
|
1852 |
$label = $this->label['add'];
|
1853 |
$id = null;
|
1854 |
$vars = array(
|
1855 |
+
$this->num_prefix . 'action' . $this->num => $this->action_after['add'],
|
1856 |
+
$this->num_prefix . 'do' . $this->num => 'create',
|
1857 |
+
$this->num_prefix . 'id' . $this->num => 'X_ID_X',
|
1858 |
);
|
1859 |
|
1860 |
$alt_vars = $vars;
|
1877 |
$label = $this->do_template( $this->label['edit'] );
|
1878 |
$id = $this->row[ $this->sql['field_id'] ];
|
1879 |
$vars = array(
|
1880 |
+
$this->num_prefix . 'action' . $this->num => $this->action_after['edit'],
|
1881 |
+
$this->num_prefix . 'do' . $this->num => 'save',
|
1882 |
+
$this->num_prefix . 'id' . $this->num => $id,
|
1883 |
);
|
1884 |
|
1885 |
$alt_vars = $vars;
|
1890 |
$label = $this->do_template( $this->label['duplicate'] );
|
1891 |
$id = null;
|
1892 |
$vars = array(
|
1893 |
+
$this->num_prefix . 'action' . $this->num => $this->action_after['duplicate'],
|
1894 |
+
$this->num_prefix . 'do' . $this->num => 'create',
|
1895 |
+
$this->num_prefix . 'id' . $this->num => 'X_ID_X',
|
1896 |
);
|
1897 |
|
1898 |
$alt_vars = $vars;
|
2114 |
if ( ! in_array( 'add', $this->actions_disabled ) && ! in_array( 'add', $this->actions_hidden ) && ! $this->restricted( 'add' ) ) {
|
2115 |
$link = pods_query_arg(
|
2116 |
array(
|
2117 |
+
$this->num_prefix . 'action' . $this->num => 'add',
|
2118 |
+
$this->num_prefix . 'id' . $this->num => '',
|
2119 |
+
$this->num_prefix . 'do' . $this->num => '',
|
2120 |
), self::$allowed, $this->exclusion()
|
2121 |
);
|
2122 |
|
2129 |
} elseif ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
2130 |
$link = pods_query_arg(
|
2131 |
array(
|
2132 |
+
$this->num_prefix . 'action' . $this->num => 'manage',
|
2133 |
+
$this->num_prefix . 'id' . $this->num => '',
|
2134 |
), self::$allowed, $this->exclusion()
|
2135 |
);
|
2136 |
|
2465 |
<ul>
|
2466 |
<?php foreach ( $this->pod->fields() as $field_name => $field ) { ?>
|
2467 |
<li>
|
2468 |
+
<label for="bulk_export_fields_<?php echo esc_attr( $field['name'] ); ?>">
|
2469 |
+
<input type="checkbox" name="bulk_export_fields[]" id="bulk_export_fields_<?php echo esc_attr( $field['name'] ); ?>" value="<?php echo esc_attr( $field['name'] ); ?>" />
|
2470 |
<?php esc_html_e( $field['label'] ); ?>
|
2471 |
</label>
|
2472 |
</li>
|
2657 |
'search_query' => $this->search,
|
2658 |
'search_across' => $this->search_across,
|
2659 |
'search_across_picks' => $this->search_across_picks,
|
2660 |
+
'fields' => $this->fields['search'],
|
2661 |
'filters' => $this->filters,
|
2662 |
'sql' => $sql,
|
2663 |
);
|
2898 |
}
|
2899 |
|
2900 |
if ( ! empty( $this->action_bulk ) && ! empty( $this->actions_bulk ) && isset( $this->actions_bulk[ $this->action_bulk ] ) && ! in_array( $this->action_bulk, $this->actions_disabled ) && ( ! empty( $this->bulk ) || 'export' === $this->action_bulk ) ) {
|
2901 |
+
if ( empty( $_REQUEST[ $this->num_prefix . '_wpnonce' . $this->num ] ) || false === wp_verify_nonce( $_REQUEST[ $this->num_prefix . '_wpnonce' . $this->num ], 'pods-ui-action-bulk' ) ) {
|
2902 |
pods_message( __( 'Invalid bulk request, please try again.', 'pods' ) );
|
2903 |
} elseif ( false !== $this->callback_bulk( $this->action_bulk, $this->bulk ) ) {
|
2904 |
return null;
|
2915 |
|
2916 |
$this->screen_meta();
|
2917 |
|
2918 |
+
wp_enqueue_script( 'jquery' );
|
2919 |
+
|
2920 |
if ( true === $reorder ) {
|
2921 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
2922 |
}
|
2936 |
*/
|
2937 |
$custom_container_classes = apply_filters( 'pods_ui_manage_custom_container_classes', array() );
|
2938 |
|
2939 |
+
if ( is_admin() ) {
|
2940 |
+
array_unshift( $custom_container_classes, 'wrap' );
|
2941 |
+
}
|
2942 |
+
|
2943 |
+
array_unshift( $custom_container_classes, 'pods-admin' );
|
2944 |
+
array_unshift( $custom_container_classes, 'pods-ui' );
|
2945 |
+
|
2946 |
$custom_container_classes = array_map( 'sanitize_html_class', $custom_container_classes );
|
2947 |
$custom_container_classes = implode( ' ', $custom_container_classes );
|
2948 |
?>
|
2949 |
+
<div class="<?php echo esc_attr( $custom_container_classes ); ?>">
|
2950 |
<div class="pods-admin-container">
|
2951 |
+
<?php if ( ! in_array( 'manage_header', $this->actions_disabled, true ) && ! in_array( 'manage_header', $this->actions_hidden, true ) ) : ?>
|
2952 |
<div id="icon-edit-pages" class="icon32"<?php echo $icon_style; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>>
|
2953 |
<br />
|
2954 |
</div>
|
2960 |
if ( ! in_array( 'manage', $this->actions_disabled ) && ! in_array( 'manage', $this->actions_hidden ) && ! $this->restricted( 'manage' ) ) {
|
2961 |
$link = pods_query_arg(
|
2962 |
array(
|
2963 |
+
$this->num_prefix . 'action' . $this->num => 'manage',
|
2964 |
+
$this->num_prefix . 'id' . $this->num => '',
|
2965 |
),
|
2966 |
self::$allowed, $this->exclusion()
|
2967 |
);
|
2980 |
if ( ! in_array( 'add', $this->actions_disabled ) && ! in_array( 'add', $this->actions_hidden ) && ! $this->restricted( 'add' ) ) {
|
2981 |
$link = pods_query_arg(
|
2982 |
array(
|
2983 |
+
$this->num_prefix . 'action' . $this->num => 'add',
|
2984 |
+
$this->num_prefix . 'id' . $this->num => '',
|
2985 |
+
$this->num_prefix . 'do' . $this->num => '',
|
2986 |
),
|
2987 |
self::$allowed, $this->exclusion()
|
2988 |
);
|
2995 |
<?php
|
2996 |
}
|
2997 |
if ( ! in_array( 'reorder', $this->actions_disabled ) && ! in_array( 'reorder', $this->actions_hidden ) && false !== $this->reorder['on'] && ! $this->restricted( 'reorder' ) ) {
|
2998 |
+
$link = pods_query_arg( array( $this->num_prefix . 'action' . $this->num => 'reorder' ), self::$allowed, $this->exclusion() );
|
2999 |
|
3000 |
if ( ! empty( $this->action_links['reorder'] ) ) {
|
3001 |
$link = $this->action_links['reorder'];
|
3006 |
}
|
3007 |
?>
|
3008 |
</h2>
|
3009 |
+
<?php endif; ?>
|
3010 |
|
3011 |
<form id="posts-filter" action="" method="get">
|
3012 |
<?php
|
3013 |
+
$excluded_filters = array(
|
3014 |
+
$this->num_prefix . 'search' . $this->num,
|
3015 |
+
$this->num_prefix . 'pg' . $this->num,
|
3016 |
+
$this->num_prefix . 'action' . $this->num,
|
3017 |
+
$this->num_prefix . 'action_bulk' . $this->num,
|
3018 |
+
$this->num_prefix . 'action_bulk_ids' . $this->num,
|
3019 |
+
$this->num_prefix . '_wpnonce' . $this->num,
|
3020 |
+
);
|
3021 |
|
3022 |
+
$filters = $this->filters;
|
3023 |
|
3024 |
foreach ( $filters as $k => $filter ) {
|
3025 |
if ( isset( $this->pod->fields[ $filter ] ) ) {
|
3050 |
$excluded_filters[] = 'filter_' . $filter;
|
3051 |
}//end foreach
|
3052 |
|
3053 |
+
$this->hidden_vars( $excluded_filters );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3054 |
|
3055 |
if ( false !== $this->callback( 'header', $reorder ) ) {
|
3056 |
return null;
|
3060 |
$this->get_data();
|
3061 |
} elseif ( $this->sortable ) {
|
3062 |
// we have the data already as an array
|
3063 |
+
$this->sort_data();
|
3064 |
+
}
|
3065 |
|
3066 |
if ( 'export' === $this->action && ! in_array( 'export', $this->actions_disabled, true ) ) {
|
3067 |
$this->export();
|
3076 |
?>
|
3077 |
<p class="search-box" align="right">
|
3078 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3079 |
foreach ( $this->filters as $filter ) {
|
3080 |
if ( isset( $this->pod->fields[ $filter ] ) ) {
|
3081 |
$filter_field = $this->pod->fields[ $filter ];
|
3107 |
$end = PodsForm::field_method( $filter_field['type'], 'convert_date', $end, 'n/j/Y' );
|
3108 |
}
|
3109 |
?>
|
3110 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>_start">
|
3111 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3112 |
</label>
|
3113 |
<?php
|
3125 |
);
|
3126 |
?>
|
3127 |
|
3128 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>_end">
|
3129 |
to
|
3130 |
</label>
|
3131 |
<?php
|
3159 |
|
3160 |
$options = array_merge( $filter_field, $filter_field['options'] );
|
3161 |
?>
|
3162 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>">
|
3163 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3164 |
</label>
|
3165 |
<?php
|
3199 |
|
3200 |
$options = array_merge( $filter_field, $filter_field['options'] );
|
3201 |
?>
|
3202 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>">
|
3203 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3204 |
</label>
|
3205 |
<?php
|
3228 |
$options['input_helper'] = pods_var_raw( 'ui_input_helper', pods_var_raw( 'options', pods_var_raw( $filter, $this->fields['search'], array(), null, true ), array(), null, true ), '', null, true );
|
3229 |
$options['input_helper'] = pods_var_raw( 'ui_input_helper', $options, $options['input_helper'], null, true );
|
3230 |
?>
|
3231 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>">
|
3232 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3233 |
</label>
|
3234 |
<?php
|
3253 |
if ( false !== $this->do_hook( 'filters_show_search', true ) ) {
|
3254 |
?>
|
3255 |
<span class="pods-form-ui-filter-container pods-form-ui-filter-container-search">
|
3256 |
+
<label<?php echo ( empty( $this->filters ) ) ? ' class="screen-reader-text"' : ''; ?> for="<?php echo esc_attr( $this->num_prefix ); ?>page-search<?php echo esc_attr( $this->num ); ?>-input"><?php _e( 'Search', 'pods' ); ?>:</label>
|
3257 |
+
<?php echo PodsForm::field( $this->num_prefix . 'search' . $this->num, $this->search, 'text', array( 'attributes' => array( 'id' => 'page-search' . $this->num . '-input' ) ) ); ?>
|
3258 |
</span>
|
3259 |
<?php
|
3260 |
} else {
|
3261 |
+
echo PodsForm::field( $this->num_prefix . 'search' . $this->num, '', 'hidden' );
|
3262 |
}
|
3263 |
|
3264 |
+
echo PodsForm::submit_button( $this->header['search'], 'button', false, false, array( 'id' => $this->num_prefix . 'search' . $this->num . '-submit' ) );
|
3265 |
|
3266 |
if ( 0 < strlen( $this->search ) ) {
|
3267 |
$clear_filters = array(
|
3268 |
+
$this->num_prefix . 'search' . $this->num => false,
|
3269 |
);
|
3270 |
|
3271 |
foreach ( $this->filters as $filter ) {
|
3275 |
}
|
3276 |
?>
|
3277 |
<br class="clear" />
|
3278 |
+
<small>[<a href="<?php echo esc_url( pods_query_arg( $clear_filters, array( $this->num_prefix . 'orderby' . $this->num, $this->num_prefix . 'orderby_dir' . $this->num, $this->num_prefix . 'limit' . $this->num, 'page' ), $this->exclusion() ) ); ?>"><?php _e( 'Reset Filters', 'pods' ); ?></a>]</small>
|
3279 |
<br class="clear" />
|
3280 |
<?php
|
3281 |
}
|
3296 |
if ( ! empty( $this->data ) && ! empty( $this->actions_bulk ) ) {
|
3297 |
?>
|
3298 |
<div class="alignleft actions">
|
3299 |
+
<?php wp_nonce_field( 'pods-ui-action-bulk', $this->num_prefix . '_wpnonce' . $this->num, false ); ?>
|
3300 |
|
3301 |
+
<select name="<?php echo esc_attr( $this->num_prefix ); ?>action_bulk<?php echo esc_attr( $this->num ); ?>">
|
3302 |
<option value="-1" selected="selected"><?php _e( 'Bulk Actions', 'pods' ); ?></option>
|
3303 |
|
3304 |
<?php
|
3309 |
if ( ! isset( $action_data['label'] ) ) {
|
3310 |
$action_data['label'] = ucwords( str_replace( '_', ' ', $action ) );}
|
3311 |
?>
|
3312 |
+
<option value="<?php echo esc_attr( $action ); ?>"><?php esc_html_e( $action_data['label'] ); ?></option>
|
3313 |
<?php
|
3314 |
}
|
3315 |
?>
|
3316 |
</select>
|
3317 |
|
3318 |
+
<input type="submit" id="<?php echo esc_attr( $this->num_prefix ); ?>doaction_bulk<?php echo esc_attr( $this->num ); ?>" class="button-secondary action" value="<?php esc_attr_e( 'Apply', 'pods' ); ?>">
|
3319 |
</div>
|
3320 |
<?php
|
3321 |
}//end if
|
3323 |
if ( true !== $reorder && ( false !== $this->pagination_total || false !== $this->pagination ) ) {
|
3324 |
?>
|
3325 |
<div class="tablenav-pages<?php esc_attr_e( ( $this->limit < $this->total_found || 1 < $this->page ) ? '' : ' one-page' ); ?>">
|
3326 |
+
<?php $this->pagination( true ); ?>
|
3327 |
</div>
|
3328 |
<?php
|
3329 |
}
|
3331 |
if ( true === $reorder ) {
|
3332 |
$link = pods_query_arg(
|
3333 |
array(
|
3334 |
+
$this->num_prefix . 'action' . $this->num => 'manage',
|
3335 |
+
$this->num_prefix . 'id' . $this->num => '',
|
3336 |
), self::$allowed, $this->exclusion()
|
3337 |
);
|
3338 |
|
3348 |
$export_document_location = pods_slash(
|
3349 |
pods_query_arg(
|
3350 |
array(
|
3351 |
+
$this->num_prefix . 'action_bulk' . $this->num => 'export',
|
3352 |
+
$this->num_prefix . '_wpnonce' . $this->num => wp_create_nonce( 'pods-ui-action-bulk' ),
|
3353 |
), self::$allowed, $this->exclusion()
|
3354 |
)
|
3355 |
);
|
3386 |
?>
|
3387 |
<div class="tablenav">
|
3388 |
<div class="tablenav-pages<?php esc_attr_e( ( $this->limit < $this->total_found || 1 < $this->page ) ? '' : ' one-page' ); ?>">
|
3389 |
+
<?php $this->pagination(); ?>
|
3390 |
<br class="clear" />
|
3391 |
</div>
|
3392 |
</div>
|
3464 |
if ( false === strpos( $label, '<a' ) ) {
|
3465 |
$link = pods_query_arg(
|
3466 |
array(
|
3467 |
+
$this->num_prefix . 'view' . $this->num => $view,
|
3468 |
+
$this->num_prefix . 'pg' . $this->num => '',
|
3469 |
), self::$allowed, $this->exclusion()
|
3470 |
);
|
3471 |
|
3478 |
$label = wp_kses_post( $label );
|
3479 |
}
|
3480 |
?>
|
3481 |
+
<li class="<?php echo esc_attr( $view ); ?>">
|
3482 |
<?php
|
3483 |
/* Escaped above to support links */
|
3484 |
echo $label;
|
3497 |
?>
|
3498 |
<p class="search-box">
|
3499 |
<?php
|
3500 |
+
if ( $filtered || '' != pods_var_raw( $this->num_prefix . 'search' . $this->num, 'get', '', null, true ) ) {
|
3501 |
$clear_filters = array(
|
3502 |
+
$this->num_prefix . 'search' . $this->num => false,
|
3503 |
);
|
3504 |
|
3505 |
foreach ( $this->filters as $filter ) {
|
3513 |
echo esc_url(
|
3514 |
pods_query_arg(
|
3515 |
$clear_filters, array(
|
3516 |
+
$this->num_prefix . 'orderby' . $this->num,
|
3517 |
+
$this->num_prefix . 'orderby_dir' . $this->num,
|
3518 |
+
$this->num_prefix . 'limit' . $this->num,
|
3519 |
'page',
|
3520 |
), $this->exclusion()
|
3521 |
)
|
3528 |
if ( false !== $this->do_hook( 'filters_show_search', true ) ) {
|
3529 |
?>
|
3530 |
|
3531 |
+
<label class="screen-reader-text" for="<?php echo esc_attr( $this->num_prefix ); ?>page-search<?php echo esc_attr( $this->num ); ?>-input"><?php _e( 'Search', 'pods' ); ?>:</label>
|
3532 |
+
<?php echo PodsForm::field( $this->num_prefix . 'search' . $this->num, $this->search, 'text', array( 'attributes' => array( 'id' => 'page-search' . $this->num . '-input' ) ) ); ?>
|
3533 |
<?php
|
3534 |
} else {
|
3535 |
+
echo PodsForm::field( $this->num_prefix . 'search' . $this->num, '', 'hidden' );
|
3536 |
}
|
3537 |
?>
|
3538 |
|
3539 |
+
<?php echo PodsForm::submit_button( $this->header['search'], 'button', false, false, array( 'id' => $this->num_prefix . 'search' . $this->num . '-submit' ) ); ?>
|
3540 |
</p>
|
3541 |
<?php
|
3542 |
}//end if
|
3631 |
$value_label = $value;
|
3632 |
}
|
3633 |
?>
|
3634 |
+
<li class="pods-ui-filter-bar-filter" data-filter="<?php echo esc_attr( $data_filter ); ?>">
|
3635 |
<a href="#TB_inline?width=640&inlineId=pods-ui-posts-filter-popup" class="thickbox" title="<?php esc_attr_e( 'Advanced Filters', 'pods' ); ?>">
|
3636 |
<strong><?php esc_html_e( $filter_field['label'] ); ?>:</strong>
|
3637 |
<?php esc_html_e( $value_label ); ?>
|
3659 |
</div>
|
3660 |
|
3661 |
<script type="text/javascript">
|
3662 |
+
document.addEventListener( 'DOMContentLoaded', function( event ) {
|
3663 |
jQuery( '.pods-ui-filter-bar-secondary' ).on( 'click', '.remove-filter', function ( e ) {
|
3664 |
jQuery( '.pods-ui-filter-popup #' + jQuery( this ).parent().data( 'filter' ) ).remove();
|
3665 |
|
3667 |
jQuery( this ).remove();
|
3668 |
} );
|
3669 |
|
3670 |
+
jQuery( 'form#posts-filter [name="<?php echo esc_attr( $this->num_prefix ); ?>pg<?php echo esc_attr( $this->num ); ?>"]' ).prop( 'disabled', true );
|
3671 |
+
jQuery( 'form#posts-filter [name="<?php echo esc_attr( $this->num_prefix ); ?>action<?php echo esc_attr( $this->num ); ?>"]' ).prop( 'disabled', true );
|
3672 |
+
jQuery( 'form#posts-filter [name="<?php echo esc_attr( $this->num_prefix ); ?>action_bulk<?php echo esc_attr( $this->num ); ?>"]' ).prop( 'disabled', true );
|
3673 |
+
jQuery( 'form#posts-filter [name="<?php echo esc_attr( $this->num_prefix ); ?>_wpnonce<?php echo esc_attr( $this->num ); ?>"]' ).prop( 'disabled', true );
|
3674 |
|
3675 |
jQuery( 'form#posts-filter' ).submit();
|
3676 |
|
3692 |
<div class="pods-ui-posts-filters">
|
3693 |
<?php
|
3694 |
$excluded_filters = array(
|
3695 |
+
$this->num_prefix . 'search' . $this->num,
|
3696 |
+
$this->num_prefix . 'pg' . $this->num,
|
3697 |
+
$this->num_prefix . 'action' . $this->num,
|
3698 |
+
$this->num_prefix . 'action_bulk' . $this->num,
|
3699 |
+
$this->num_prefix . 'action_bulk_ids' . $this->num,
|
3700 |
+
$this->num_prefix . '_wpnonce' . $this->num,
|
3701 |
);
|
3702 |
|
3703 |
foreach ( $filters as $filter ) {
|
3715 |
continue;
|
3716 |
}
|
3717 |
?>
|
3718 |
+
<input type="hidden" name="<?php echo esc_attr( $k ); ?>" value="<?php echo esc_attr( $v ); ?>" />
|
3719 |
<?php
|
3720 |
}
|
3721 |
|
3738 |
continue;
|
3739 |
}
|
3740 |
?>
|
3741 |
+
<p class="pods-ui-posts-filter-toggled pods-ui-posts-filter-<?php echo esc_attr( $filter . ( $zebra ? ' clear' : '' ) ); ?>">
|
3742 |
<?php
|
3743 |
if ( in_array( $filter_field['type'], array( 'date', 'datetime', 'time' ) ) ) {
|
3744 |
$start = pods_var_raw( 'filter_' . $filter . '_start', 'get', pods_var_raw( 'filter_default', $filter_field, '', null, true ), null, true );
|
3771 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( ( empty( $start ) && empty( $end ) ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3772 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( ( empty( $start ) && empty( $end ) ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3773 |
|
3774 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>_start">
|
3775 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3776 |
</label>
|
3777 |
|
3791 |
);
|
3792 |
?>
|
3793 |
|
3794 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>_end">to</label>
|
3795 |
<?php
|
3796 |
// Prevent p div issues.
|
3797 |
echo str_replace(
|
3830 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( empty( $value ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3831 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( empty( $value ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3832 |
|
3833 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>">
|
3834 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3835 |
</label>
|
3836 |
|
3879 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( empty( $value ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3880 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( empty( $value ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3881 |
|
3882 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>">
|
3883 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3884 |
</label>
|
3885 |
|
3918 |
<span class="pods-ui-posts-filter-toggle toggle-on<?php esc_attr_e( empty( $value ) ? '' : ' pods-hidden' ); ?>">+</span>
|
3919 |
<span class="pods-ui-posts-filter-toggle toggle-off<?php esc_attr_e( empty( $value ) ? ' pods-hidden' : '' ); ?>"><?php _e( 'Clear', 'pods' ); ?></span>
|
3920 |
|
3921 |
+
<label for="pods-form-ui-filter-<?php echo esc_attr( $filter ); ?>">
|
3922 |
<?php esc_html_e( $filter_field['label'] ); ?>
|
3923 |
</label>
|
3924 |
|
3947 |
}//end foreach
|
3948 |
?>
|
3949 |
|
3950 |
+
<p class="pods-ui-posts-filter-toggled pods-ui-posts-filter-search<?php echo esc_attr( $zebra ? ' clear' : '' ); ?>">
|
3951 |
+
<label for="<?php echo esc_attr( $this->num_prefix ); ?>pods-form-ui-search<?php echo esc_attr( $this->num ); ?>"><?php _e( 'Search Text', 'pods' ); ?></label>
|
3952 |
+
<?php echo PodsForm::field( $this->num_prefix . 'search' . $this->num, pods_var_raw( $this->num_prefix . 'search' . $this->num ), 'text' ); ?>
|
3953 |
</p>
|
3954 |
|
3955 |
<?php $zebra = empty( $zebra ); ?>
|
3956 |
</div>
|
3957 |
|
3958 |
+
<p class="submit<?php echo esc_attr( $zebra ? ' clear' : '' ); ?>">
|
3959 |
+
<input type="submit" value="<?php echo esc_attr( $this->header['search'] ); ?>" class="button button-primary" />
|
3960 |
</p>
|
3961 |
</form>
|
3962 |
</div>
|
3963 |
|
3964 |
<script type="text/javascript">
|
3965 |
+
document.addEventListener( 'DOMContentLoaded', function( event ) {
|
3966 |
jQuery( document ).on( 'click', '.pods-ui-posts-filter-toggle.toggle-on', function ( e ) {
|
3967 |
jQuery( this ).parent().find( '.pods-ui-posts-filter' ).removeClass( 'pods-hidden' );
|
3968 |
|
4038 |
echo esc_url(
|
4039 |
pods_query_arg(
|
4040 |
array(
|
4041 |
+
$this->num_prefix . 'action' . $this->num => 'reorder',
|
4042 |
+
$this->num_prefix . 'do' . $this->num => 'save',
|
4043 |
'page' => pods_var_raw( 'page' ),
|
4044 |
), self::$allowed, $this->exclusion()
|
4045 |
)
|
4123 |
$width = ' style="width: ' . esc_attr( $attributes['width'] ) . '"';
|
4124 |
}
|
4125 |
|
4126 |
+
if ( $this->is_field_sortable( $attributes ) ) {
|
4127 |
$column_classes[] = 'sortable' . $current_sort;
|
4128 |
?>
|
4129 |
<th scope="col"<?php echo $att_id; ?> class="<?php esc_attr_e( implode( ' ', $column_classes ) ); ?>"<?php echo $width; ?>>
|
4132 |
echo esc_url_raw(
|
4133 |
pods_query_arg(
|
4134 |
array(
|
4135 |
+
$this->num_prefix . 'orderby' . $this->num => $field,
|
4136 |
+
$this->num_prefix . 'orderby_dir' . $this->num => $dir,
|
4137 |
), array(
|
4138 |
+
$this->num_prefix . 'limit' . $this->num,
|
4139 |
+
$this->num_prefix . 'search' . $this->num,
|
4140 |
+
$this->num_prefix . 'pg' . $this->num,
|
4141 |
'page',
|
4142 |
), $this->exclusion()
|
4143 |
)
|
4187 |
$width = ' style="width: ' . esc_attr( $attributes['width'] ) . '"';
|
4188 |
}
|
4189 |
|
4190 |
+
if ( $this->is_field_sortable( $attributes ) ) {
|
4191 |
?>
|
4192 |
+
<th scope="col" class="manage-column column-<?php echo esc_attr( $id ); ?> sortable <?php echo esc_attr( $current_sort ); ?>"<?php echo $width; ?>>
|
4193 |
<a href="
|
4194 |
<?php
|
4195 |
echo esc_url_raw(
|
4196 |
pods_query_arg(
|
4197 |
array(
|
4198 |
+
$this->num_prefix . 'orderby' . $this->num => $field,
|
4199 |
+
$this->num_prefix . 'orderby_dir' . $this->num => $dir,
|
4200 |
), array(
|
4201 |
+
$this->num_prefix . 'limit' . $this->num,
|
4202 |
+
$this->num_prefix . 'search' . $this->num,
|
4203 |
+
$this->num_prefix . 'pg' . $this->num,
|
4204 |
'page',
|
4205 |
), $this->exclusion()
|
4206 |
)
|
4211 |
<?php
|
4212 |
} else {
|
4213 |
?>
|
4214 |
+
<th scope="col" class="manage-column column-<?php echo esc_attr( $id ); ?>"<?php echo $width; ?>><?php esc_html_e( $attributes['label'] ); ?></th>
|
4215 |
<?php
|
4216 |
}//end if
|
4217 |
}//end foreach
|
4242 |
}
|
4243 |
}
|
4244 |
?>
|
4245 |
+
<tr id="item-<?php echo esc_attr( $row[ $this->sql['field_id'] ] ); ?>" class="iedit<?php echo esc_attr( $toggle_class ); ?>">
|
4246 |
<?php
|
4247 |
if ( ! empty( $this->actions_bulk ) ) {
|
4248 |
?>
|
4249 |
<th scope="row" class="check-column">
|
4250 |
+
<input type="checkbox" name="<?php echo esc_attr( $this->num_prefix ); ?>action_bulk_ids<?php echo esc_attr( $this->num ); ?>[]" value="<?php echo esc_attr( $row[ $this->sql['field_id'] ] ); ?>">
|
4251 |
</th>
|
4252 |
<?php
|
4253 |
}
|
4423 |
if ( $first_field ) {
|
4424 |
$css_classes[] = 'column-primary';
|
4425 |
}
|
4426 |
+
|
4427 |
+
if ( is_admin() ) {
|
4428 |
+
$css_classes[] = 'post-title';
|
4429 |
+
$css_classes[] = 'page-title';
|
4430 |
+
}
|
4431 |
+
|
4432 |
$css_classes[] = 'column-title';
|
4433 |
|
4434 |
if ( 'raw' !== $attributes['type'] ) {
|
4435 |
+
// Deal with unexpected array values.
|
4436 |
+
if ( is_array( $row_value ) ) {
|
4437 |
+
if ( empty( $row_value ) ) {
|
4438 |
+
$row_value = '';
|
4439 |
+
} else {
|
4440 |
+
$row_value = pods_serial_comma( $row_value, $attributes );
|
4441 |
+
}
|
4442 |
+
}
|
4443 |
+
|
4444 |
$row_value = wp_kses_post( $row_value );
|
4445 |
}
|
4446 |
|
4447 |
if ( ! in_array( 'edit', $this->actions_disabled ) && ! in_array( 'edit', $this->actions_hidden ) && ( false === $reorder || in_array( 'reorder', $this->actions_disabled ) || false === $this->reorder['on'] ) && 'edit' === $default_action ) {
|
4448 |
$link = pods_query_arg(
|
4449 |
array(
|
4450 |
+
$this->num_prefix . 'action' . $this->num => 'edit',
|
4451 |
+
$this->num_prefix . 'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4452 |
), self::$allowed, $this->exclusion()
|
4453 |
);
|
4454 |
|
4467 |
} elseif ( ! in_array( 'view', $this->actions_disabled ) && ! in_array( 'view', $this->actions_hidden ) && ( false === $reorder || in_array( 'reorder', $this->actions_disabled ) || false === $this->reorder['on'] ) && 'view' === $default_action ) {
|
4468 |
$link = pods_query_arg(
|
4469 |
array(
|
4470 |
+
$this->num_prefix . 'action' . $this->num => 'view',
|
4471 |
+
$this->num_prefix . 'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4472 |
), self::$allowed, $this->exclusion()
|
4473 |
);
|
4474 |
|
4507 |
|
4508 |
if ( ! empty( $actions ) ) {
|
4509 |
?>
|
4510 |
+
<div class="row-actions<?php echo esc_attr( $toggle ? ' row-actions-toggle' : '' ); ?>">
|
4511 |
<?php
|
4512 |
$this->callback( 'actions_start', $row, $actions );
|
4513 |
|
4520 |
}
|
4521 |
} else {
|
4522 |
?>
|
4523 |
+
<input type="hidden" name="order[]" value="<?php echo esc_attr( $row[ $this->sql['field_id'] ] ); ?>" />
|
4524 |
<?php
|
4525 |
}//end if
|
4526 |
+
|
4527 |
+
if ( ! in_array( 'toggle_details', $this->actions_disabled, true ) ) {
|
4528 |
?>
|
4529 |
+
<button type="button" class="toggle-row">
|
4530 |
+
<span class="screen-reader-text"><?php esc_html_e( 'Show more details', 'pods' ); ?></span>
|
4531 |
+
</button>
|
4532 |
+
<?php } ?>
|
4533 |
</td>
|
4534 |
<?php
|
4535 |
} elseif ( 'date' === $attributes['type'] ) {
|
4539 |
$css_classes[] = 'date';
|
4540 |
$css_classes[] = 'column-date';
|
4541 |
?>
|
4542 |
+
<td class="<?php esc_attr_e( implode( ' ', $css_classes ) ); ?>" data-colname="<?php echo esc_attr( $attributes['label'] ); ?>">
|
4543 |
+
<abbr title="<?php echo esc_attr( $row_value ); ?>"><?php echo wp_kses_post( $row_value ); ?></abbr>
|
4544 |
+
<?php if ( $first_field && ! in_array( 'toggle_details', $this->actions_disabled, true ) ) { ?>
|
4545 |
<button type="button" class="toggle-row">
|
4546 |
+
<span class="screen-reader-text"><?php esc_html_e( 'Show more details', 'pods' ); ?></span>
|
4547 |
+
</button>
|
4548 |
+
<?php } ?>
|
4549 |
</td>
|
4550 |
<?php
|
4551 |
} else {
|
4556 |
$css_classes[] = 'author';
|
4557 |
|
4558 |
if ( 'raw' !== $attributes['type'] ) {
|
4559 |
+
// Deal with unexpected array values.
|
4560 |
+
if ( is_array( $row_value ) ) {
|
4561 |
+
if ( empty( $row_value ) ) {
|
4562 |
+
$row_value = '';
|
4563 |
+
} else {
|
4564 |
+
$row_value = pods_serial_comma( $row_value, $attributes );
|
4565 |
+
}
|
4566 |
+
}
|
4567 |
+
|
4568 |
$row_value = wp_kses_post( $row_value );
|
4569 |
}
|
4570 |
?>
|
4571 |
+
<td class="<?php esc_attr_e( implode( ' ', $css_classes ) ); ?>" data-colname="<?php echo esc_attr( $attributes['label'] ); ?>">
|
4572 |
<span>
|
4573 |
<?php
|
4574 |
/* Escaped above for non-HTML types */
|
4575 |
echo $row_value;
|
4576 |
?>
|
4577 |
</span>
|
4578 |
+
<?php if ( $first_field && ! in_array( 'toggle_details', $this->actions_disabled, true ) ) { ?>
|
4579 |
<button type="button" class="toggle-row">
|
4580 |
+
<span class="screen-reader-text"><?php esc_html_e( 'Show more details', 'pods' ); ?></span>
|
4581 |
+
</button>
|
4582 |
+
<?php } ?>
|
4583 |
</td>
|
4584 |
<?php
|
4585 |
}//end if
|
4602 |
}
|
4603 |
?>
|
4604 |
<script type="text/javascript">
|
4605 |
+
document.addEventListener( 'DOMContentLoaded', function( event ) {
|
4606 |
+
jQuery( 'table.widefat tbody tr:even' ).addClass( 'alternate' );
|
4607 |
+
<?php
|
4608 |
+
if ( true === $reorder && ! in_array( 'reorder', $this->actions_disabled ) && false !== $this->reorder['on'] ) {
|
4609 |
+
?>
|
4610 |
+
jQuery( ".reorderable" ).sortable( {axis : "y", handle : ".dragme"} );
|
4611 |
+
jQuery( ".reorderable" ).bind( 'sortupdate', function ( event, ui ) {
|
4612 |
+
jQuery( 'table.widefat tbody tr' ).removeClass( 'alternate' );
|
4613 |
+
jQuery( 'table.widefat tbody tr:even' ).addClass( 'alternate' );
|
4614 |
+
} );
|
4615 |
+
<?php
|
4616 |
+
}
|
4617 |
+
?>
|
4618 |
} );
|
|
|
|
|
|
|
4619 |
</script>
|
4620 |
<?php
|
4621 |
}
|
4634 |
if ( ! in_array( 'view', $this->actions_disabled ) && ! in_array( 'view', $this->actions_hidden ) ) {
|
4635 |
$link = pods_query_arg(
|
4636 |
array(
|
4637 |
+
$this->num_prefix . 'action' . $this->num => 'view',
|
4638 |
+
$this->num_prefix . 'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4639 |
), self::$allowed, $this->exclusion()
|
4640 |
);
|
4641 |
|
4649 |
if ( ! in_array( 'edit', $this->actions_disabled ) && ! in_array( 'edit', $this->actions_hidden ) && ! $this->restricted( 'edit', $row ) ) {
|
4650 |
$link = pods_query_arg(
|
4651 |
array(
|
4652 |
+
$this->num_prefix . 'action' . $this->num => 'edit',
|
4653 |
+
$this->num_prefix . 'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4654 |
), self::$allowed, $this->exclusion()
|
4655 |
);
|
4656 |
|
4664 |
if ( ! in_array( 'duplicate', $this->actions_disabled ) && ! in_array( 'duplicate', $this->actions_hidden ) && ! $this->restricted( 'edit', $row ) ) {
|
4665 |
$link = pods_query_arg(
|
4666 |
array(
|
4667 |
+
$this->num_prefix . 'action' . $this->num => 'duplicate',
|
4668 |
+
$this->num_prefix . 'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4669 |
), self::$allowed, $this->exclusion()
|
4670 |
);
|
4671 |
|
4679 |
if ( ! in_array( 'delete', $this->actions_disabled ) && ! in_array( 'delete', $this->actions_hidden ) && ! $this->restricted( 'delete', $row ) ) {
|
4680 |
$link = pods_query_arg(
|
4681 |
array(
|
4682 |
+
$this->num_prefix . 'action' . $this->num => 'delete',
|
4683 |
+
$this->num_prefix . 'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4684 |
+
$this->num_prefix . '_wpnonce' . $this->num => wp_create_nonce( 'pods-ui-action-delete' ),
|
4685 |
), self::$allowed, $this->exclusion()
|
4686 |
);
|
4687 |
|
4688 |
if ( ! empty( $this->action_links['delete'] ) ) {
|
4689 |
+
$link = add_query_arg( array( $this->num_prefix . '_wpnonce' . $this->num => wp_create_nonce( 'pods-ui-action-delete' ) ), $this->do_template( $this->action_links['delete'], $row ) );
|
4690 |
}
|
4691 |
|
4692 |
$actions['delete'] = '<span class="delete"><a href="' . esc_url( $link ) . '" title="' . esc_attr__( 'Delete this item', 'pods' ) . '" class="submitdelete" onclick="if(confirm(\'' . esc_attr__( 'You are about to permanently delete this item\n Choose \\\'Cancel\\\' to stop, \\\'OK\\\' to delete.', 'pods' ) . '\')){return true;}return false;">' . __( 'Delete', 'pods' ) . '</a></span>';
|
4725 |
|
4726 |
if ( ! isset( $custom_data['link'] ) ) {
|
4727 |
$vars = array(
|
4728 |
+
$this->num_prefix . 'action' . $this->num => $custom_action,
|
4729 |
+
$this->num_prefix . 'id' . $this->num => $row[ $this->sql['field_id'] ],
|
4730 |
+
$this->num_prefix . '_wpnonce' . $this->num => wp_create_nonce( 'pods-ui-action-' . $custom_action ),
|
4731 |
);
|
4732 |
|
4733 |
if ( 'toggle' === $custom_action ) {
|
4734 |
+
$vars[ $this->num_prefix . 'toggle' . $this->num ] = (int) ( ! $row['toggle'] );
|
4735 |
+
$vars[ $this->num_prefix . 'toggled' . $this->num ] = 1;
|
4736 |
}
|
4737 |
|
4738 |
$custom_data['link'] = pods_query_arg( $vars, self::$allowed, $this->exclusion() );
|
4739 |
|
4740 |
if ( isset( $this->action_links[ $custom_action ] ) && ! empty( $this->action_links[ $custom_action ] ) ) {
|
4741 |
+
$custom_data['link'] = add_query_arg( array( $this->num_prefix . '_wpnonce' . $this->num => wp_create_nonce( 'pods-ui-action-' . $custom_action ) ), $this->do_template( $this->action_links[ $custom_action ], $row ) );
|
4742 |
}
|
4743 |
}
|
4744 |
|
4834 |
continue;
|
4835 |
}
|
4836 |
?>
|
4837 |
+
<label for="<?php echo esc_attr( $field ); ?>-hide">
|
4838 |
+
<input class="hide-column-tog" name="<?php echo esc_attr( $this->unique_identifier ); ?>_<?php echo esc_attr( $field ); ?>-hide" type="checkbox" id="<?php echo esc_attr( $field ); ?>-hide" value="<?php echo esc_attr( $field ); ?>" checked="checked"><?php esc_html_e( $attributes['label'] ); ?>
|
4839 |
</label>
|
4840 |
<?php
|
4841 |
}
|
4850 |
<?php
|
4851 |
if ( true === $this->pagination ) {
|
4852 |
?>
|
4853 |
+
<input type="text" class="screen-per-page" name="wp_screen_options[value]" id="<?php echo esc_attr( $this->unique_identifier ); ?>_per_page" maxlength="3" value="20">
|
4854 |
+
<label for="<?php echo esc_attr( $this->unique_identifier ); ?>_per_page"><?php esc_html_e( sprintf( __( '%s per page', 'pods' ), $this->items ) ); ?></label>
|
4855 |
<?php
|
4856 |
}
|
4857 |
$this->do_hook( 'screen_meta_screen_submit' );
|
4858 |
?>
|
4859 |
<input type="submit" name="screen-options-apply" id="screen-options-apply" class="button" value="<?php esc_attr_e( 'Apply', 'pods' ); ?>">
|
4860 |
+
<input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr( $this->unique_identifier ); ?>_per_page">
|
4861 |
<?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?>
|
4862 |
</div>
|
4863 |
<?php
|
4936 |
return null;
|
4937 |
}
|
4938 |
|
4939 |
+
// Check if we should show the pagination in this location.
|
4940 |
+
if ( $header && 'after' === $this->pagination_location ) {
|
4941 |
+
return null;
|
4942 |
+
} elseif ( ! $header && 'before' === $this->pagination_location ) {
|
4943 |
+
return null;
|
4944 |
+
}
|
4945 |
+
|
4946 |
+
$allowed_query_args = array(
|
4947 |
+
$this->num_prefix . 'limit' . $this->num,
|
4948 |
+
$this->num_prefix . 'orderby' . $this->num,
|
4949 |
+
$this->num_prefix . 'orderby_dir' . $this->num,
|
4950 |
+
$this->num_prefix . 'search' . $this->num,
|
4951 |
+
'filter_*',
|
4952 |
+
$this->num_prefix . 'view' . $this->num,
|
4953 |
+
$this->num_prefix . 'pg' . $this->num,
|
4954 |
+
'page',
|
4955 |
+
'post_type',
|
4956 |
+
'taxonomy',
|
4957 |
+
$this->num_prefix . 'action' . $this->num,
|
4958 |
+
);
|
4959 |
+
|
4960 |
$total_pages = ceil( $this->total_found / $this->limit );
|
4961 |
$request_uri = pods_query_arg(
|
4962 |
+
array( $this->num_prefix . 'pg' . $this->num => '' ), $allowed_query_args, $this->exclusion()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4963 |
);
|
4964 |
|
4965 |
$append = false;
|
4976 |
<?php
|
4977 |
}
|
4978 |
|
4979 |
+
// Check if we need to output a different pagination type.
|
4980 |
+
if ( 'table' !== $this->pagination_type ) {
|
4981 |
+
// This pagination type requires a Pod object.
|
4982 |
+
if ( ! $this->pod instanceof Pods ) {
|
4983 |
+
return null;
|
4984 |
+
}
|
4985 |
+
|
4986 |
+
$pagination_params = array(
|
4987 |
+
'type' => $this->pagination_type,
|
4988 |
+
'page_var' => $this->num_prefix . 'pg' . $this->num,
|
4989 |
+
'format' => "{$this->num_prefix}pg{$this->num}=%#%",
|
4990 |
+
);
|
4991 |
+
|
4992 |
+
// Get global query args.
|
4993 |
+
global $pods_query_args;
|
4994 |
+
|
4995 |
+
// Store current args for reference.
|
4996 |
+
$old_query_args = isset( $pods_query_args ) ? $pods_query_args : null;
|
4997 |
+
|
4998 |
+
// Tell the pagination links what to include/exclude.
|
4999 |
+
$pods_query_args = [
|
5000 |
+
'allowed' => $allowed_query_args,
|
5001 |
+
'excluded' => $this->exclusion(),
|
5002 |
+
];
|
5003 |
+
|
5004 |
+
echo $this->pod->pagination( $pagination_params );
|
5005 |
+
|
5006 |
+
// Reset global query args.
|
5007 |
+
$pods_query_args = $old_query_args;
|
5008 |
+
|
5009 |
+
return;
|
5010 |
+
}
|
5011 |
+
|
5012 |
if ( false !== $this->pagination ) {
|
5013 |
if ( 1 < $total_pages ) {
|
5014 |
+
$first_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . $this->num_prefix . 'pg' . $this->num . '=1' );
|
5015 |
+
$prev_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . $this->num_prefix . 'pg' . $this->num . '=' . max( $this->page - 1, 1 ) );
|
5016 |
+
$next_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . $this->num_prefix . 'pg' . $this->num . '=' . min( $this->page + 1, $total_pages ) );
|
5017 |
+
$last_link = esc_url( $request_uri . ( $append ? '&' : '?' ) . $this->num_prefix . 'pg' . $this->num . '=' . $total_pages );
|
5018 |
|
5019 |
$classes = '';
|
5020 |
if ( 1 >= $this->page ) {
|
5024 |
$classes .= ' button';
|
5025 |
}
|
5026 |
?>
|
5027 |
+
<a class="first-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the first page', 'pods' ); ?>" href="<?php echo $first_link; ?>">«</a>
|
5028 |
+
<a class="prev-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the previous page', 'pods' ); ?>" href="<?php echo $prev_link; ?>">‹</a>
|
5029 |
<?php
|
5030 |
if ( true == $header ) {
|
5031 |
?>
|
5032 |
+
<span class="paging-input"><input class="current-page" title="<?php esc_attr_e( 'Current page', 'pods' ); ?>" type="text" name="<?php echo esc_attr( $this->num_prefix ); ?>pg<?php echo esc_attr( $this->num ); ?>" value="<?php esc_attr_e( absint( $this->page ) ); ?>" size="<?php esc_attr_e( strlen( $total_pages ) ); ?>"> <?php _e( 'of', 'pods' ); ?>
|
5033 |
<span class="total-pages"><?php echo absint( $total_pages ); ?></span></span>
|
5034 |
+
<script type="text/javascript">
|
5035 |
+
document.addEventListener( 'DOMContentLoaded', function( event ) {
|
5036 |
+
var pageInput = jQuery( 'input.current-page' );
|
|
|
5037 |
var currentPage = pageInput.val();
|
5038 |
pageInput.closest( 'form' ).submit( function ( e ) {
|
5039 |
+
if ( ( 1 > jQuery( 'select[name="<?php echo esc_attr( $this->num_prefix ); ?>action<?php echo esc_attr( $this->num ); ?>"]' ).length || jQuery( 'select[name="<?php echo esc_attr( $this->num_prefix ); ?>action<?php echo esc_attr( $this->num ); ?>"]' ).val() == -1 ) && ( 1 > jQuery( 'select[name="<?php echo esc_attr( $this->num_prefix ); ?>action_bulk<?php echo esc_attr( $this->num ); ?>"]' ).length || jQuery( 'select[name="<?php echo esc_attr( $this->num_prefix ); ?>action_bulk<?php echo esc_attr( $this->num ); ?>"]' ).val() == -1 ) && pageInput.val() == currentPage ) {
|
5040 |
pageInput.val( '1' );
|
5041 |
}
|
5042 |
} );
|
5057 |
$classes .= ' button';
|
5058 |
}
|
5059 |
?>
|
5060 |
+
<a class="next-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the next page', 'pods' ); ?>" href="<?php echo $next_link; ?>">›</a>
|
5061 |
+
<a class="last-page<?php echo esc_attr( $classes ); ?>" title="<?php esc_attr_e( 'Go to the last page', 'pods' ); ?>" href="<?php echo $last_link; ?>">»</a>
|
5062 |
<?php
|
5063 |
}//end if
|
5064 |
}//end if
|
5090 |
echo ' <a href="' . esc_url(
|
5091 |
pods_query_arg(
|
5092 |
array( 'limit' => $option ), array(
|
5093 |
+
$this->num_prefix . 'orderby' . $this->num,
|
5094 |
+
$this->num_prefix . 'orderby_dir' . $this->num,
|
5095 |
+
$this->num_prefix . 'search' . $this->num,
|
5096 |
'filter_*',
|
5097 |
+
'page',
|
5098 |
), $this->exclusion()
|
5099 |
)
|
5100 |
) . '">' . esc_html( $option ) . '</a>';
|
5205 |
}
|
5206 |
}
|
5207 |
foreach ( $get as $k => $v ) {
|
5208 |
+
if ( in_array( $k, $exclude, true ) ) {
|
5209 |
continue;
|
5210 |
}
|
5211 |
|
5212 |
if ( is_array( $v ) ) {
|
5213 |
foreach ( $v as $vk => $vv ) {
|
5214 |
?>
|
5215 |
+
<input type="hidden" name="<?php echo esc_attr( $k ); ?>[<?php echo esc_attr( $vk ); ?>]" value="<?php echo esc_attr( $vv ); ?>" />
|
5216 |
<?php
|
5217 |
}
|
5218 |
} else {
|
5219 |
?>
|
5220 |
+
<input type="hidden" name="<?php echo esc_attr( $k ); ?>" value="<?php echo esc_attr( $v ); ?>" />
|
5221 |
<?php
|
5222 |
}
|
5223 |
}
|
5231 |
$exclusion = self::$excluded;
|
5232 |
|
5233 |
foreach ( $exclusion as $k => $exclude ) {
|
5234 |
+
$exclusion[ $k ] = $this->num_prefix . $exclude . $this->num;
|
5235 |
}
|
5236 |
|
5237 |
return $exclusion;
|
5529 |
return $restricted;
|
5530 |
}
|
5531 |
|
5532 |
+
/**
|
5533 |
+
* Normalize and get the field data from a field.
|
5534 |
+
*
|
5535 |
+
* @since 2.7.28
|
5536 |
+
*
|
5537 |
+
* @param string|array $field The field data.
|
5538 |
+
*
|
5539 |
+
* @return array|false The field data or false if invalid / not found.
|
5540 |
+
*/
|
5541 |
+
public function get_field_data( $field, $which = 'manage' ) {
|
5542 |
+
$field_data = $field;
|
5543 |
+
|
5544 |
+
if ( ! is_array( $field_data ) ) {
|
5545 |
+
// Field is not set.
|
5546 |
+
if ( ! isset( $this->fields[ $which ][ $field ] ) ) {
|
5547 |
+
return false;
|
5548 |
+
}
|
5549 |
+
|
5550 |
+
$field_data = $this->fields[ $which ][ $field ];
|
5551 |
+
} elseif ( ! isset( $field_data['name'] ) ) {
|
5552 |
+
// Field name is required.
|
5553 |
+
return false;
|
5554 |
+
}
|
5555 |
+
|
5556 |
+
return $field_data;
|
5557 |
+
}
|
5558 |
+
|
5559 |
+
/**
|
5560 |
+
* Determine whether a field is searchable.
|
5561 |
+
*
|
5562 |
+
* @since 2.7.28
|
5563 |
+
*
|
5564 |
+
* @param string|array $field The field data.
|
5565 |
+
*
|
5566 |
+
* @return bool Whether a field is searchable.
|
5567 |
+
*/
|
5568 |
+
public function is_field_searchable( $field ) {
|
5569 |
+
$field_data = $this->get_field_data( $field );
|
5570 |
+
|
5571 |
+
// Field not valid.
|
5572 |
+
if ( ! $field_data ) {
|
5573 |
+
return false;
|
5574 |
+
}
|
5575 |
+
|
5576 |
+
$field = $field_data['name'];
|
5577 |
+
|
5578 |
+
// Provided as a search field.
|
5579 |
+
if ( isset( $this->fields['search'][ $field ] ) ) {
|
5580 |
+
return true;
|
5581 |
+
}
|
5582 |
+
|
5583 |
+
// Search is turned on individually and we don't have a list of search-only fields.
|
5584 |
+
return ! empty( $field_data['options']['search'] ) && empty( $this->fields['search'] );
|
5585 |
+
}
|
5586 |
+
|
5587 |
+
/**
|
5588 |
+
* Determine whether a field is sortable.
|
5589 |
+
*
|
5590 |
+
* @since 2.7.28
|
5591 |
+
*
|
5592 |
+
* @param string|array $field The field data.
|
5593 |
+
*
|
5594 |
+
* @return bool Whether a field is sortable.
|
5595 |
+
*/
|
5596 |
+
public function is_field_sortable( $field ) {
|
5597 |
+
$field_data = $this->get_field_data( $field );
|
5598 |
+
|
5599 |
+
// Field not valid.
|
5600 |
+
if ( ! $field_data ) {
|
5601 |
+
return false;
|
5602 |
+
}
|
5603 |
+
|
5604 |
+
$field = $field_data['name'];
|
5605 |
+
|
5606 |
+
// Provided as a sort field.
|
5607 |
+
if ( isset( $this->fields['sort'][ $field ] ) ) {
|
5608 |
+
return true;
|
5609 |
+
}
|
5610 |
+
|
5611 |
+
// Sort is turned on individually and we don't have a list of sort-only fields.
|
5612 |
+
return ! empty( $field_data['sortable'] ) && empty( $this->fields['sort'] );
|
5613 |
+
}
|
5614 |
+
|
5615 |
/**
|
5616 |
* Check for a custom action callback and run it
|
5617 |
*
|
@@ -304,7 +304,7 @@ class PodsField_Avatar extends PodsField_File {
|
|
304 |
public function allow_avatar_overwrite() {
|
305 |
|
306 |
// Don't replace for the Avatars section of the Discussion settings page.
|
307 |
-
if ( is_admin() && ! doing_action( 'admin_bar_menu' ) ) {
|
308 |
$current_screen = get_current_screen();
|
309 |
|
310 |
$screens = array(
|
304 |
public function allow_avatar_overwrite() {
|
305 |
|
306 |
// Don't replace for the Avatars section of the Discussion settings page.
|
307 |
+
if ( is_admin() && ! doing_action( 'admin_bar_menu' ) && function_exists( 'get_current_screen' ) ) {
|
308 |
$current_screen = get_current_screen();
|
309 |
|
310 |
$screens = array(
|
@@ -25,6 +25,12 @@ class PodsField_File extends PodsField {
|
|
25 |
*/
|
26 |
protected static $api = false;
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/**
|
29 |
* {@inheritdoc}
|
30 |
*/
|
@@ -95,6 +101,32 @@ class PodsField_File extends PodsField {
|
|
95 |
'browse' => __( 'Media Library', 'pods' ),
|
96 |
),
|
97 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
static::$type . '_edit_title' => array(
|
99 |
'label' => __( 'Editable Title', 'pods' ),
|
100 |
'default' => 1,
|
@@ -496,6 +528,14 @@ class PodsField_File extends PodsField {
|
|
496 |
'uri' => $uri_hash,
|
497 |
),
|
498 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
}//end if
|
500 |
|
501 |
return $options;
|
@@ -1141,8 +1181,68 @@ class PodsField_File extends PodsField {
|
|
1141 |
$custom_handler = apply_filters( 'pods_upload_handle', null, 'Filedata', $params->post_id, $params, $field );
|
1142 |
|
1143 |
if ( null === $custom_handler ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1144 |
$attachment_id = media_handle_upload( 'Filedata', $params->post_id );
|
1145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1146 |
if ( is_object( $attachment_id ) ) {
|
1147 |
$errors = array();
|
1148 |
|
@@ -1179,4 +1279,38 @@ class PodsField_File extends PodsField {
|
|
1179 |
// KBAI!
|
1180 |
}
|
1181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1182 |
}
|
25 |
*/
|
26 |
protected static $api = false;
|
27 |
|
28 |
+
/**
|
29 |
+
* Temporary upload directory.
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
private static $tmp_upload_dir;
|
33 |
+
|
34 |
/**
|
35 |
* {@inheritdoc}
|
36 |
*/
|
101 |
'browse' => __( 'Media Library', 'pods' ),
|
102 |
),
|
103 |
),
|
104 |
+
static::$type . '_upload_dir' => array(
|
105 |
+
'label' => __( 'Upload directory', 'pods' ),
|
106 |
+
'default' => 'wp',
|
107 |
+
'type' => 'pick',
|
108 |
+
'data' => array(
|
109 |
+
'wp' => __( 'WordPress Default', 'pods' ) . ' (/yyyy/mm/)',
|
110 |
+
'uploads' => __( 'Custom directory within the default uploads directory', 'pods' ),
|
111 |
+
),
|
112 |
+
'depends-on' => array( static::$type . '_uploader' => 'plupload' ),
|
113 |
+
'dependency' => true,
|
114 |
+
),
|
115 |
+
static::$type . '_upload_dir_custom' => array(
|
116 |
+
'label' => __( 'Custom upload directory', 'pods' ),
|
117 |
+
'help' => __( 'Magic tags are allowed for this field. The path is relative to the /wp-content/uploads/ folder on your site.', 'pods' ),
|
118 |
+
'placeholder' => 'my-custom-folder',
|
119 |
+
'depends-on' => array( static::$type . '_upload_dir' => 'uploads' ),
|
120 |
+
/**
|
121 |
+
* Allow filtering the custom upload directory used.
|
122 |
+
*
|
123 |
+
* @since 2.7.28
|
124 |
+
*
|
125 |
+
* @param string @default_directory The custom upload directory to use by default for new fields.
|
126 |
+
*/
|
127 |
+
'default' => apply_filters( "pods_form_ui_field_{$type}_upload_dir_custom", '' ),
|
128 |
+
'type' => 'text',
|
129 |
+
),
|
130 |
static::$type . '_edit_title' => array(
|
131 |
'label' => __( 'Editable Title', 'pods' ),
|
132 |
'default' => 1,
|
528 |
'uri' => $uri_hash,
|
529 |
),
|
530 |
);
|
531 |
+
|
532 |
+
// Pass post ID if we're in an add or edit post screen.
|
533 |
+
$post = get_post();
|
534 |
+
|
535 |
+
if ( $post instanceof WP_Post ) {
|
536 |
+
$options['plupload_init']['multipart_params']['post_id'] = $post->ID;
|
537 |
+
}
|
538 |
+
|
539 |
}//end if
|
540 |
|
541 |
return $options;
|
1181 |
$custom_handler = apply_filters( 'pods_upload_handle', null, 'Filedata', $params->post_id, $params, $field );
|
1182 |
|
1183 |
if ( null === $custom_handler ) {
|
1184 |
+
|
1185 |
+
// Start custom directory.
|
1186 |
+
$upload_dir = pods_v( $field['type'] . '_upload_dir', $field['options'], 'wp' );
|
1187 |
+
|
1188 |
+
if ( 'wp' !== $upload_dir ) {
|
1189 |
+
$custom_dir = pods_v( $field['type'] . '_upload_dir_custom', $field['options'], '' );
|
1190 |
+
$context_pod = null;
|
1191 |
+
|
1192 |
+
if ( $params->post_id ) {
|
1193 |
+
$post = get_post( $params->post_id );
|
1194 |
+
|
1195 |
+
if ( $post ) {
|
1196 |
+
$post_pod = pods( $post->post_type, $post->ID );
|
1197 |
+
|
1198 |
+
if ( $post_pod->exists() ) {
|
1199 |
+
$context_pod = $post_pod;
|
1200 |
+
}
|
1201 |
+
}
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
/**
|
1205 |
+
* Filter the custom upload directory Pod context.
|
1206 |
+
*
|
1207 |
+
* @since 2.7.28
|
1208 |
+
*
|
1209 |
+
* @param Pods $context_pod The Pods object of the associated pod for the post type.
|
1210 |
+
* @param array $params The POSTed parameters for the request.
|
1211 |
+
* @param array $field The field configuration associated to the upload field.
|
1212 |
+
* @param array $pod The pod configuration associated to the upload field.
|
1213 |
+
*/
|
1214 |
+
$context_pod = apply_filters( 'pods_upload_dir_custom_context_pod', $context_pod, $params, $field, $pod );
|
1215 |
+
|
1216 |
+
$custom_dir = pods_evaluate_tags( $custom_dir, array( 'pod' => $context_pod ) );
|
1217 |
+
|
1218 |
+
/**
|
1219 |
+
* Filter the custom Pod upload directory.
|
1220 |
+
*
|
1221 |
+
* @since 2.7.28
|
1222 |
+
*
|
1223 |
+
* @param string $custom_dir The directory to use for the uploaded file.
|
1224 |
+
* @param array $params The POSTed parameters for the request.
|
1225 |
+
* @param Pods $context_pod The Pods object of the associated pod for the post type.
|
1226 |
+
* @param array $field The field configuration associated to the upload field.
|
1227 |
+
* @param array $pod The pod configuration associated to the upload field.
|
1228 |
+
*/
|
1229 |
+
$custom_dir = apply_filters( 'pods_upload_dir_custom', $custom_dir, $params, $context_pod, $field, $pod );
|
1230 |
+
|
1231 |
+
self::$tmp_upload_dir = $custom_dir;
|
1232 |
+
|
1233 |
+
add_filter( 'upload_dir', array( $this, 'filter_upload_dir' ) );
|
1234 |
+
}
|
1235 |
+
|
1236 |
+
// Upload file.
|
1237 |
$attachment_id = media_handle_upload( 'Filedata', $params->post_id );
|
1238 |
|
1239 |
+
// End custom directory.
|
1240 |
+
if ( 'wp' !== $upload_dir ) {
|
1241 |
+
remove_filter( 'upload_dir', array( $this, 'filter_upload_dir' ) );
|
1242 |
+
|
1243 |
+
self::$tmp_upload_dir = null;
|
1244 |
+
}
|
1245 |
+
|
1246 |
if ( is_object( $attachment_id ) ) {
|
1247 |
$errors = array();
|
1248 |
|
1279 |
// KBAI!
|
1280 |
}
|
1281 |
|
1282 |
+
/**
|
1283 |
+
* Modify the upload directory.
|
1284 |
+
*
|
1285 |
+
* @since 2.7.28
|
1286 |
+
*
|
1287 |
+
* @see wp_upload_dir()
|
1288 |
+
*
|
1289 |
+
* @param array $uploads The uploads directory information.
|
1290 |
+
*
|
1291 |
+
* @return array The filtered uploads directory information.
|
1292 |
+
*/
|
1293 |
+
public function filter_upload_dir( $uploads ) {
|
1294 |
+
if ( empty( self::$tmp_upload_dir ) ) {
|
1295 |
+
return $uploads;
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
$dir = trim( self::$tmp_upload_dir, '/' );
|
1299 |
+
$subdir = trim( $uploads['subdir'], '/' );
|
1300 |
+
|
1301 |
+
foreach ( $uploads as $key => $val ) {
|
1302 |
+
if ( ! is_string( $val ) ) {
|
1303 |
+
continue;
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
if ( $subdir ) {
|
1307 |
+
$uploads[ $key ] = str_replace( $subdir, $dir, $val );
|
1308 |
+
} elseif ( in_array( $key, array( 'path', 'url', 'subdir' ), true ) ) {
|
1309 |
+
$uploads[ $key ] = trailingslashit( $val ) . $dir;
|
1310 |
+
}
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
return $uploads;
|
1314 |
+
}
|
1315 |
+
|
1316 |
}
|
@@ -1158,6 +1158,20 @@ function pods_query_arg( $array = null, $allowed = null, $excluded = null, $url
|
|
1158 |
$allowed = (array) $allowed;
|
1159 |
$excluded = (array) $excluded;
|
1160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1161 |
if ( ! isset( $_GET ) ) {
|
1162 |
$query_args = array();
|
1163 |
} else {
|
1158 |
$allowed = (array) $allowed;
|
1159 |
$excluded = (array) $excluded;
|
1160 |
|
1161 |
+
// Support for globally defined arguments.
|
1162 |
+
global $pods_query_args;
|
1163 |
+
|
1164 |
+
if ( empty( $pods_query_args ) ) {
|
1165 |
+
$pods_query_args = [
|
1166 |
+
'allowed' => [],
|
1167 |
+
'excluded' => [],
|
1168 |
+
];
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
// Merge any global args that we need to.
|
1172 |
+
$allowed = array_unique( array_merge( $pods_query_args['allowed'], $allowed ) );
|
1173 |
+
$excluded = array_unique( array_merge( $pods_query_args['excluded'], $excluded ) );
|
1174 |
+
|
1175 |
if ( ! isset( $_GET ) ) {
|
1176 |
$query_args = array();
|
1177 |
} else {
|
@@ -482,3 +482,85 @@ function pods_video( $url, $args = false ) {
|
|
482 |
return wp_video_shortcode( $video_args );
|
483 |
|
484 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
return wp_video_shortcode( $video_args );
|
483 |
|
484 |
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Get the image URL for a post for a specific pod field.
|
488 |
+
*
|
489 |
+
* @since 2.7.28
|
490 |
+
*
|
491 |
+
* @param string $field_name The field name.
|
492 |
+
* @param string $size The image size to use.
|
493 |
+
* @param int $default The default image ID to use if not found.
|
494 |
+
*
|
495 |
+
* @return string The image URL for a post for a specific pod field.
|
496 |
+
*/
|
497 |
+
function pods_image_url_for_post( $field_name, $size = 'full', $default = 0 ) {
|
498 |
+
// pods_field() will auto-detect the post type / post ID.
|
499 |
+
$value = pods_field( null, null, $field_name, true );
|
500 |
+
|
501 |
+
// No value found.
|
502 |
+
if ( empty( $value ) ) {
|
503 |
+
if ( $default ) {
|
504 |
+
// Maybe return default if it's set.
|
505 |
+
return pods_image_url( $default, $size );
|
506 |
+
} else {
|
507 |
+
// No value, no default to show.
|
508 |
+
return '';
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
if ( is_numeric( $value ) ) {
|
513 |
+
$attachment_id = $value;
|
514 |
+
} elseif ( is_array( $value ) && isset( $value['ID'] ) ) {
|
515 |
+
$attachment_id = $value['ID'];
|
516 |
+
} elseif ( $default ) {
|
517 |
+
// Maybe return default if it's set.
|
518 |
+
return pods_image_url( $default, $size );
|
519 |
+
} else {
|
520 |
+
// Unexpected value, no default to show.
|
521 |
+
return '';
|
522 |
+
}
|
523 |
+
|
524 |
+
return pods_image_url( $attachment_id, $size, $default );
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Get the image HTML for a post for a specific pod field.
|
529 |
+
*
|
530 |
+
* @since 2.7.28
|
531 |
+
*
|
532 |
+
* @param string $field_name The field name.
|
533 |
+
* @param string $size The image size to use.
|
534 |
+
* @param int $default The default image ID to use if not found.
|
535 |
+
*
|
536 |
+
* @return string The image HTML for a post for a specific pod field.
|
537 |
+
*/
|
538 |
+
function pods_image_for_post( $field_name, $size = 'full', $default = 0 ) {
|
539 |
+
// pods_field() will auto-detect the post type / post ID.
|
540 |
+
$value = pods_field( null, null, $field_name, true );
|
541 |
+
|
542 |
+
// No value found.
|
543 |
+
if ( empty( $value ) ) {
|
544 |
+
if ( $default ) {
|
545 |
+
// Maybe return default if it's set.
|
546 |
+
return pods_image( $default, $size );
|
547 |
+
} else {
|
548 |
+
// No value, no default to show.
|
549 |
+
return '';
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
if ( is_numeric( $value ) ) {
|
554 |
+
$attachment_id = $value;
|
555 |
+
} elseif ( is_array( $value ) && isset( $value['ID'] ) ) {
|
556 |
+
$attachment_id = $value['ID'];
|
557 |
+
} elseif ( $default ) {
|
558 |
+
// Maybe return default if it's set.
|
559 |
+
return pods_image( $default, $size );
|
560 |
+
} else {
|
561 |
+
// Unexpected value, no default to show.
|
562 |
+
return '';
|
563 |
+
}
|
564 |
+
|
565 |
+
return pods_image( $attachment_id, $size, $default );
|
566 |
+
}
|
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Pods - Custom Content Types and Fields
|
4 |
Plugin URI: https://pods.io/
|
5 |
Description: Pods is a framework for creating, managing, and deploying customized content types and fields
|
6 |
-
Version: 2.7.
|
7 |
Author: Pods Framework Team
|
8 |
Author URI: https://pods.io/about/
|
9 |
Text Domain: pods
|
@@ -37,7 +37,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
|
|
37 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
38 |
} else {
|
39 |
// Current version
|
40 |
-
define( 'PODS_VERSION', '2.7.
|
41 |
|
42 |
// Version tracking between DB updates themselves
|
43 |
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.28
|
7 |
Author: Pods Framework Team
|
8 |
Author URI: https://pods.io/about/
|
9 |
Text Domain: pods
|
37 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
38 |
} else {
|
39 |
// Current version
|
40 |
+
define( 'PODS_VERSION', '2.7.28' );
|
41 |
|
42 |
// Version tracking between DB updates themselves
|
43 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
@@ -1,11 +1,11 @@
|
|
1 |
=== Pods - Custom Content Types and Fields ===
|
2 |
-
Contributors: sc0ttkclark,
|
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.7.
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.7.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -190,6 +190,21 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he
|
|
190 |
|
191 |
== Changelog ==
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
= 2.7.27 - April 20th, 2021 =
|
194 |
|
195 |
* Added: Support taxonomy and other object field filters in Pods::find(). #5994 (@JoryHogeveen)
|
1 |
=== Pods - Custom Content Types and Fields ===
|
2 |
+
Contributors: sc0ttkclark, keraweb, jimtrue, pglewis, quasel, jamesgol, ramoonus, nicdford, Shelob9, clubduece, dan.stefan, Desertsnowman, curtismchale, mgibbs189, mikedamage, jchristopher, pcfreak30
|
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.7.2
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.7.28
|
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.28 - May 20th, 2021 =
|
194 |
+
|
195 |
+
* Added: New upload directory option for File fields using Plupload that lets you choose to customize which directory the files end up in. #6021 (@JoryHogeveen)
|
196 |
+
* Added: Relationship fields now support custom selectors in the REST API. You can specify `my_field.some_field` to output a specific field in your REST API options for each relationship field. (@sc0ttkclark)
|
197 |
+
* Added: New `pods_image_for_post()` and `pods_image_url_for_post()` functions have been added for certain page builders like Oxygen. (@sc0ttkclark)
|
198 |
+
* Added: New query variable prefix option (`num_prefix`) for PodsUI instances. (@sc0ttkclark)
|
199 |
+
* Added: `pagination_type` and `pagination_location` options for PodsUI instances to support more flexible pagination options. (@sc0ttkclark)
|
200 |
+
* Enhancement: Implement `search` and `sort` field sets for PodsUI instances to more easily specify which fields are searchable or sortable. (@sc0ttkclark)
|
201 |
+
* Fixed: PHP fatal errors no longer occur for avatar fields in certain situations. #6007 (@JoryHogeveen)
|
202 |
+
* Fixed: PHP fatal errors no longer occur for PHP 8 in certain situations. #6012 (@JoryHogeveen)
|
203 |
+
* Fixed: Resolved an issue with relationship fields not outputting their full data to the REST API when the related object is not a valid pod. (@sc0ttkclark)
|
204 |
+
* Fixed: Resolved an issue with not saving the fields for the extended Media pod when making update requests through the REST API. (@sc0ttkclark)
|
205 |
+
* Fixed: Implemented a temporary PHP 7.4+ fix for Freemius. (@sc0ttkclark)
|
206 |
+
* Fixed: Searching WP-based objects in PodsUI interfaces now resolves to the proper fields. (@sc0ttkclark)
|
207 |
+
|
208 |
= 2.7.27 - April 20th, 2021 =
|
209 |
|
210 |
* Added: Support taxonomy and other object field filters in Pods::find(). #5994 (@JoryHogeveen)
|
@@ -70,6 +70,11 @@
|
|
70 |
// Load all Freemius powered active plugins.
|
71 |
$fs_active_plugins = get_option( 'fs_active_plugins', new stdClass() );
|
72 |
|
|
|
|
|
|
|
|
|
|
|
73 |
if ( ! isset( $fs_active_plugins->plugins ) ) {
|
74 |
$fs_active_plugins->plugins = array();
|
75 |
}
|
70 |
// Load all Freemius powered active plugins.
|
71 |
$fs_active_plugins = get_option( 'fs_active_plugins', new stdClass() );
|
72 |
|
73 |
+
// Prevent potential PHP 7.4+ warnings when the option came back with a non-object.
|
74 |
+
if ( ! is_object( $fs_active_plugins ) ) {
|
75 |
+
$fs_active_plugins = new stdClass();
|
76 |
+
}
|
77 |
+
|
78 |
if ( ! isset( $fs_active_plugins->plugins ) ) {
|
79 |
$fs_active_plugins->plugins = array();
|
80 |
}
|