Changeset 3339401
- Timestamp:
- 08/05/2025 06:03:23 AM (4 months ago)
- Location:
- custom-post-types
- Files:
-
- 51 edited
- 1 copied
-
assets/banner-1544x500.png (modified) (1 prop) (previous)
-
assets/banner-772x250.png (modified) (1 prop) (previous)
-
assets/icon-256x256.png (modified) (1 prop) (previous)
-
assets/screenshot-1.png (modified) (1 prop) (previous)
-
assets/screenshot-2.png (modified) (1 prop) (previous)
-
assets/screenshot-3.png (modified) (1 prop) (previous)
-
assets/screenshot-4.png (modified) (1 prop) (previous)
-
tags/5.0.7 (copied) (copied from custom-post-types/trunk)
-
tags/5.0.7/custom-post-types.php (modified) (1 diff)
-
tags/5.0.7/includes/abstracts/class-cpt-field.php (modified) (2 diffs)
-
tags/5.0.7/includes/class-cpt-admin-notices.php (modified) (3 diffs)
-
tags/5.0.7/includes/class-cpt-admin-pages.php (modified) (1 diff)
-
tags/5.0.7/includes/class-cpt-core.php (modified) (1 diff)
-
tags/5.0.7/includes/class-cpt-field-groups.php (modified) (3 diffs)
-
tags/5.0.7/includes/class-cpt-fields.php (modified) (1 diff)
-
tags/5.0.7/includes/class-cpt-plugin.php (modified) (1 diff)
-
tags/5.0.7/includes/class-cpt-post-types.php (modified) (5 diffs)
-
tags/5.0.7/includes/class-cpt-taxonomies.php (modified) (3 diffs)
-
tags/5.0.7/includes/class-cpt-ui.php (modified) (4 diffs)
-
tags/5.0.7/includes/class-cpt-utils.php (modified) (7 diffs)
-
tags/5.0.7/includes/compatibilities/saswp.php (modified) (2 diffs)
-
tags/5.0.7/includes/fields/class-cpt-field-color.php (modified) (1 diff)
-
tags/5.0.7/includes/fields/class-cpt-field-file.php (modified) (1 diff)
-
tags/5.0.7/includes/fields/class-cpt-field-post-rel.php (modified) (1 diff)
-
tags/5.0.7/includes/fields/class-cpt-field-radio.php (modified) (1 diff)
-
tags/5.0.7/includes/fields/class-cpt-field-repeater.php (modified) (3 diffs)
-
tags/5.0.7/includes/fields/class-cpt-field-select.php (modified) (4 diffs)
-
tags/5.0.7/includes/fields/class-cpt-field-tax-rel.php (modified) (1 diff)
-
tags/5.0.7/includes/templates/page-tools.php (modified) (1 diff)
-
tags/5.0.7/readme.txt (modified) (2 diffs)
-
trunk/custom-post-types.php (modified) (1 diff)
-
trunk/includes/abstracts/class-cpt-field.php (modified) (2 diffs)
-
trunk/includes/class-cpt-admin-notices.php (modified) (3 diffs)
-
trunk/includes/class-cpt-admin-pages.php (modified) (1 diff)
-
trunk/includes/class-cpt-core.php (modified) (1 diff)
-
trunk/includes/class-cpt-field-groups.php (modified) (3 diffs)
-
trunk/includes/class-cpt-fields.php (modified) (1 diff)
-
trunk/includes/class-cpt-plugin.php (modified) (1 diff)
-
trunk/includes/class-cpt-post-types.php (modified) (5 diffs)
-
trunk/includes/class-cpt-taxonomies.php (modified) (3 diffs)
-
trunk/includes/class-cpt-ui.php (modified) (4 diffs)
-
trunk/includes/class-cpt-utils.php (modified) (7 diffs)
-
trunk/includes/compatibilities/saswp.php (modified) (2 diffs)
-
trunk/includes/fields/class-cpt-field-color.php (modified) (1 diff)
-
trunk/includes/fields/class-cpt-field-file.php (modified) (1 diff)
-
trunk/includes/fields/class-cpt-field-post-rel.php (modified) (1 diff)
-
trunk/includes/fields/class-cpt-field-radio.php (modified) (1 diff)
-
trunk/includes/fields/class-cpt-field-repeater.php (modified) (3 diffs)
-
trunk/includes/fields/class-cpt-field-select.php (modified) (4 diffs)
-
trunk/includes/fields/class-cpt-field-tax-rel.php (modified) (1 diff)
-
trunk/includes/templates/page-tools.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-post-types/assets/banner-1544x500.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
custom-post-types/assets/banner-772x250.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
custom-post-types/assets/icon-256x256.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
custom-post-types/assets/screenshot-1.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
custom-post-types/assets/screenshot-2.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
custom-post-types/assets/screenshot-3.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
custom-post-types/assets/screenshot-4.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
custom-post-types/tags/5.0.7/custom-post-types.php
r3206477 r3339401 8 8 Text Domain: custom-post-types 9 9 Domain Path: /languages/ 10 Version: 5.0. 610 Version: 5.0.7 11 11 */ 12 12 -
custom-post-types/tags/5.0.7/includes/abstracts/class-cpt-field.php
r2989869 r3339401 14 14 /** @var CPT_Field $field_class */ 15 15 $field_class = get_called_class(); 16 if ( $field_class::get_type() == $meta_type ) { //phpcs:ignore Universal.Operators.StrictComparisons16 if ( $field_class::get_type() === $meta_type ) { 17 17 return $field_class::sanitize( $meta_value ); 18 18 } … … 30 30 /** @var CPT_Field $field_class */ 31 31 $field_class = get_called_class(); 32 if ( $field_class::get_type() == $meta_type ) { //phpcs:ignore Universal.Operators.StrictComparisons32 if ( $field_class::get_type() === $meta_type ) { 33 33 return $field_class::get( $meta_value ); 34 34 } -
custom-post-types/tags/5.0.7/includes/class-cpt-admin-notices.php
r3055467 r3339401 26 26 $notice = $params['key']; 27 27 $duration = $params['duration']; 28 $this->dismiss_notice( $notice, ( 'lifetime' == $duration ? -1 : intval( $duration ) ) ); //phpcs:ignore Universal.Operators.StrictComparisons28 $this->dismiss_notice( $notice, ( 'lifetime' === $duration ? -1 : intval( $duration ) ) ); 29 29 return 'OK'; 30 30 }, … … 96 96 ! empty( $button['target'] ) ? $button['target'] : '_self', 97 97 ! empty( $button['label'] ) ? esc_html( $button['label'] ) : '', 98 ! empty( $button['target'] ) && '_blank' == $button['target'] && ! $is_cta ? '<span class="dashicons dashicons-external"></span>' : '' //phpcs:ignore Universal.Operators.StrictComparisons98 ! empty( $button['target'] ) && '_blank' === $button['target'] && ! $is_cta ? '<span class="dashicons dashicons-external"></span>' : '' 99 99 ); 100 100 } 101 101 } 102 102 if ( $dismissible ) { 103 $button_label = true === $dismissible ? __( 'Dismiss notice', 'custom-post-types' ) : sprintf( __( 'Dismiss notice for %s days', 'custom-post-types' ), (int) $dismissible ); //phpcs:ignore Universal.Operators.StrictComparisons103 $button_label = true === $dismissible ? __( 'Dismiss notice', 'custom-post-types' ) : sprintf( __( 'Dismiss notice for %s days', 'custom-post-types' ), (int) $dismissible ); 104 104 $notice_buttons[] = sprintf( 105 105 '<a href="#" class="cpt-dismiss-notice" data-notice="%1$s" data-duration="%2$s" title="%3$s" aria-label="%3$s">%3$s</a>', 106 106 $id, 107 ( true === $dismissible ? 'lifetime' : $dismissible ), //phpcs:ignore Universal.Operators.StrictComparisons107 ( true === $dismissible ? 'lifetime' : $dismissible ), 108 108 $button_label 109 109 ); … … 146 146 $type = ! empty( get_post_meta( $notice->ID, 'type', true ) ) ? get_post_meta( $notice->ID, 'type', true ) : 'info'; 147 147 $dismissable = ! empty( get_post_meta( $notice->ID, 'dismissible', true ) ) ? get_post_meta( $notice->ID, 'dismissible', true ) : false; 148 $admin_only = 'true' == get_post_meta( $notice->ID, 'admin_only', true ); //phpcs:ignore Universal.Operators.StrictComparisons148 $admin_only = true === filter_var( get_post_meta( $notice->ID, 'admin_only', true ), FILTER_VALIDATE_BOOLEAN ); 149 149 $buttons = ! empty( get_post_meta( $notice->ID, 'buttons', true ) ) ? get_post_meta( $notice->ID, 'buttons', true ) : false; 150 150 if ( $dismissable < 0 ) { -
custom-post-types/tags/5.0.7/includes/class-cpt-admin-pages.php
r3055467 r3339401 63 63 $page_order = is_numeric( get_post_meta( $page->ID, 'order', true ) ) ? get_post_meta( $page->ID, 'order', true ) : null; 64 64 $page_icon = ! empty( get_post_meta( $page->ID, 'menu_icon', true ) ) ? get_post_meta( $page->ID, 'menu_icon', true ) : ''; 65 $admin_only = 'true' == get_post_meta( $page->ID, 'admin_only', true ); //phpcs:ignore Universal.Operators.StrictComparisons65 $admin_only = true === filter_var( get_post_meta( $page->ID, 'admin_only', true ), FILTER_VALIDATE_BOOLEAN ); 66 66 if ( $page_parent && stripos( $page_parent, '/' ) !== false ) { 67 67 $page_parent = explode( '/', $page_parent ); -
custom-post-types/tags/5.0.7/includes/class-cpt-core.php
r2989869 r3339401 108 108 109 109 include_once CPT_PATH . '/includes/compatibilities/v4.php'; 110 //include_once CPT_PATH . '/includes/compatibilities/acf.php';111 //include_once CPT_PATH . '/includes/compatibilities/saswp.php';110 // include_once CPT_PATH . '/includes/compatibilities/acf.php'; 111 // include_once CPT_PATH . '/includes/compatibilities/saswp.php'; 112 112 } 113 113 -
custom-post-types/tags/5.0.7/includes/class-cpt-field-groups.php
r3036818 r3339401 28 28 */ 29 29 private function sanitize_field_args( $field = array() ) { 30 $field['required'] = ! empty( $field['required'] ) && 'true' == $field['required']; //phpcs:ignore Universal.Operators.StrictComparisons30 $field['required'] = ! empty( $field['required'] ) && true === filter_var( $field['required'], FILTER_VALIDATE_BOOLEAN ); 31 31 if ( ! empty( $field['extra']['options'] ) && ! is_array( $field['extra']['options'] ) ) { 32 32 $field['extra']['options'] = cpt_utils()->get_options_from_string( $field['extra']['options'] ); 33 33 } 34 34 foreach ( $field as $key => $value ) { 35 if ( substr( $key, 0, 5 ) == 'wrap_' ) { //phpcs:ignore Universal.Operators.StrictComparisons35 if ( 'wrap_' === substr( $key, 0, 5 ) ) { 36 36 if ( ! empty( $value ) ) { 37 37 $field['wrap'][ str_replace( 'wrap_', '', $key ) ] = $value; … … 39 39 unset( $field[ $key ] ); 40 40 } 41 } 42 if ( ! empty( $field['extra']['fields'] ) ) { 43 $fields = array_map( 44 array( $this, 'sanitize_field_args' ), 45 $field['extra']['fields'] 46 ); 47 $field['extra']['fields'] = $fields; 41 48 } 42 49 return $field; … … 77 84 $position = ! empty( get_post_meta( $group->ID, 'position', true ) ) ? get_post_meta( $group->ID, 'position', true ) : 'normal'; 78 85 $order = get_post_meta( $group->ID, 'order', true ); 79 $admin_only = 'true' == get_post_meta( $group->ID, 'admin_only', true ); //phpcs:ignore Universal.Operators.StrictComparisons80 $show_in_rest = 'true' == get_post_meta( $group->ID, 'show_in_rest', true ); //phpcs:ignore Universal.Operators.StrictComparisons86 $admin_only = true === filter_var( get_post_meta( $group->ID, 'admin_only', true ), FILTER_VALIDATE_BOOLEAN ); 87 $show_in_rest = true === filter_var( get_post_meta( $group->ID, 'show_in_rest', true ), FILTER_VALIDATE_BOOLEAN ); 81 88 $fields = ! empty( get_post_meta( $group->ID, 'fields', true ) ) ? array_map( 82 89 array( $this, 'sanitize_field_args' ), -
custom-post-types/tags/5.0.7/includes/class-cpt-fields.php
r3055467 r3339401 625 625 return $meta_value; 626 626 } 627 if ( ! is_string( $meta_value ) && ( ! cpt_utils()->is_rest() || 'the_content' == current_filter() ) ) { //phpcs:ignore Universal.Operators.StrictComparisons627 if ( ! is_string( $meta_value ) && ( ! cpt_utils()->is_rest() || 'the_content' === current_filter() ) ) { 628 628 if ( current_user_can( 'edit_posts' ) ) { 629 629 return sprintf( -
custom-post-types/tags/5.0.7/includes/class-cpt-plugin.php
r3206477 r3339401 54 54 */ 55 55 public function plugin_links( $actions, $plugin_file ) { 56 if ( 'custom-post-types/custom-post-types.php' == $plugin_file ) { //phpcs:ignore Universal.Operators.StrictComparisons56 if ( 'custom-post-types/custom-post-types.php' === $plugin_file ) { 57 57 $actions[] = sprintf( 58 58 '<a href="%1$s" target="_blank" aria-label="%2$s"> %2$s </a>', -
custom-post-types/tags/5.0.7/includes/class-cpt-post-types.php
r3055467 r3339401 16 16 public function __construct() { 17 17 if ( empty( $this->default_args ) ) { 18 $this->default_args = cpt_utils()->get_args( 'post-types-default-args' ); 18 add_action( 19 'init', 20 function () { 21 $this->default_args = cpt_utils()->get_args( 'post-types-default-args' ); 22 } 23 ); 19 24 } 20 25 if ( empty( $this->default_labels ) ) { 21 $this->default_labels = cpt_utils()->get_args( 'post-types-default-labels' ); 26 add_action( 27 'init', 28 function () { 29 $this->default_labels = cpt_utils()->get_args( 'post-types-default-labels' ); 30 } 31 ); 22 32 } 23 33 } … … 79 89 } 80 90 global $pagenow; 81 if ( 'edit.php' == $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] == $post_type ) { //phpcs:ignore Universal.Operators.StrictComparisons, WordPress.Security.NonceVerification91 if ( 'edit.php' === $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] === $post_type ) { 82 92 add_filter( 83 93 'manage_posts_columns', … … 89 99 90 100 foreach ( $columns as $key => $args ) { 91 if ( 'title' == $key && empty( $args['label'] ) ) { //phpcs:ignore Universal.Operators.StrictComparisons101 if ( 'title' === $key && empty( $args['label'] ) ) { 92 102 $args['label'] = $stored_title_label; 93 103 } 94 if ( 'date' == $key && empty( $args['label'] ) ) { //phpcs:ignore Universal.Operators.StrictComparisons104 if ( 'date' === $key && empty( $args['label'] ) ) { 95 105 $args['label'] = $stored_date_label; 96 106 } … … 142 152 foreach ( $post_metas as $key => $value ) { 143 153 $single_meta = get_post_meta( $post_type->ID, $key, true ); 144 if ( substr( $key, 0, 7 ) == 'labels_' ) { //phpcs:ignore Universal.Operators.StrictComparisons154 if ( 'labels_' === substr( $key, 0, 7 ) ) { 145 155 if ( ! empty( $single_meta ) ) { 146 156 $post_type_labels[ str_replace( 'labels_', '', $key ) ] = $single_meta; 147 157 } 148 } elseif ( substr( $key, 0, 1 ) == '_' || empty( $single_meta ) ) { //phpcs:ignore Universal.Operators.StrictComparisons158 } elseif ( '_' === substr( $key, 0, 1 ) || empty( $single_meta ) ) { 149 159 unset( $post_metas[ $key ] ); 150 160 } else { 151 $post_type_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( 'true' == $single_meta ) : $single_meta; //phpcs:ignore Universal.Operators.StrictComparisons161 $post_type_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( true === filter_var( $single_meta, FILTER_VALIDATE_BOOLEAN ) ) : $single_meta; 152 162 } 153 163 unset( $post_metas[ $key ] ); … … 286 296 } 287 297 $id = ! empty( $post_type['id'] ) && is_string( $post_type['id'] ) ? $post_type['id'] : false; 288 if ( $id == $post_type_id ) {298 if ( $id === $post_type_id ) { 289 299 $flush_rewrite_rules = true; 290 300 } -
custom-post-types/tags/5.0.7/includes/class-cpt-taxonomies.php
r2989869 r3339401 12 12 public function __construct() { 13 13 if ( empty( $this->default_args ) ) { 14 $this->default_args = cpt_utils()->get_args( 'taxonomies-default-args' ); 14 add_action( 15 'init', 16 function () { 17 $this->default_args = cpt_utils()->get_args( 'taxonomies-default-args' ); 18 } 19 ); 15 20 } 16 21 if ( empty( $this->default_labels ) ) { 17 $this->default_labels = cpt_utils()->get_args( 'taxonomies-default-labels' ); 22 add_action( 23 'init', 24 function () { 25 $this->default_labels = cpt_utils()->get_args( 'taxonomies-default-labels' ); 26 } 27 ); 18 28 } 19 29 } … … 89 99 foreach ( $post_metas as $key => $value ) { 90 100 $single_meta = get_post_meta( $taxonomy->ID, $key, true ); 91 if ( substr( $key, 0, 7 ) == 'labels_' ) { //phpcs:ignore Universal.Operators.StrictComparisons101 if ( 'labels_' === substr( $key, 0, 7 ) ) { 92 102 if ( ! empty( $single_meta ) ) { 93 103 $taxonomy_labels[ str_replace( 'labels_', '', $key ) ] = $single_meta; 94 104 } 95 } elseif ( substr( $key, 0, 1 ) == '_' || empty( $single_meta ) ) { //phpcs:ignore Universal.Operators.StrictComparisons105 } elseif ( '_' === substr( $key, 0, 1 ) || empty( $single_meta ) ) { 96 106 unset( $post_metas[ $key ] ); 97 107 } else { 98 $taxonomy_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( 'true' == $single_meta ) : $single_meta; //phpcs:ignore Universal.Operators.StrictComparisons108 $taxonomy_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( true === filter_var( $single_meta, FILTER_VALIDATE_BOOLEAN ) ) : $single_meta; 99 109 } 100 110 unset( $post_metas[ $key ] ); … … 229 239 } 230 240 $id = ! empty( $taxonomy['id'] ) && is_string( $taxonomy['id'] ) ? $taxonomy['id'] : false; 231 if ( $id == $taxonomy_id ) {241 if ( $id === $taxonomy_id ) { 232 242 $flush_rewrite_rules = true; 233 243 } -
custom-post-types/tags/5.0.7/includes/class-cpt-ui.php
r3206477 r3339401 31 31 */ 32 32 public function add_feedback_modal() { 33 if ( get_current_screen()->id == 'plugins' ) { //phpcs:ignore Universal.Operators.StrictComparisons33 if ( 'plugins' === get_current_screen()->id ) { 34 34 require_once CPT_PATH . '/includes/templates/modal-feedback.php'; 35 35 } … … 87 87 } 88 88 89 $action = ! empty( $_GET['action'] ) && 'cpt-feedback' == $_GET['action'] ? $_GET['action'] : false; //phpcs:ignore Universal.Operators.StrictComparisons89 $action = ! empty( $_GET['action'] ) && 'cpt-feedback' === $_GET['action'] ? $_GET['action'] : false; 90 90 if ( ! $action ) { 91 91 return; … … 129 129 $field_group_id = $field_group['id']; 130 130 if ( 131 'id' == $meta_key && //phpcs:ignore Universal.Operators.StrictComparisons131 'id' === $meta_key && 132 132 in_array( $field_group_id, array( CPT_UI_PREFIX, CPT_UI_PREFIX . '_tax', CPT_UI_PREFIX . '_field', CPT_UI_PREFIX . '_page', CPT_UI_PREFIX . '_notice' ), true ) 133 133 ) { … … 145 145 $post_type = get_post( $post_id )->post_type; 146 146 $post_status = get_post( $post_id )->post_status; 147 if ( ! in_array( $post_type, $this->no_title_post_types, true ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || 'trash' == $post_status ) { //phpcs:ignore Universal.Operators.StrictComparisons147 if ( ! in_array( $post_type, $this->no_title_post_types, true ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || 'trash' === $post_status ) { 148 148 return $post_id; 149 149 } -
custom-post-types/tags/5.0.7/includes/class-cpt-utils.php
r3055467 r3339401 196 196 public function get_post_title_with_parents( $post_id = 0, $title = '' ) { 197 197 $post = get_post( $post_id ); 198 if ( 0 == $post_id || ! $post ) { //phpcs:ignore Universal.Operators.StrictComparisons198 if ( 0 === $post_id || ! $post ) { 199 199 return $title; 200 200 } 201 201 $title = empty( $title ) ? $post->post_title : $title; 202 if ( 0 == $post->post_parent ) { //phpcs:ignore Universal.Operators.StrictComparisons202 if ( 0 === $post->post_parent ) { 203 203 return $title; 204 204 } … … 215 215 public function get_term_title_with_parents( $term_id = 0, $title = '' ) { 216 216 $term = get_term( $term_id ); 217 if ( 0 == $term_id || ! $term ) { //phpcs:ignore Universal.Operators.StrictComparisons217 if ( 0 === $term_id || ! $term ) { 218 218 return $title; 219 219 } 220 220 $title = empty( $title ) ? $term->name : $title; 221 if ( 0 == $term->parent ) { //phpcs:ignore Universal.Operators.StrictComparisons221 if ( 0 === $term->parent ) { 222 222 return $title; 223 223 } … … 232 232 $prefix = rest_get_url_prefix(); 233 233 if ( 234 defined( 'REST_REQUEST' ) && 235 REST_REQUEST || 236 isset( $_GET['rest_route'] ) && //phpcs:ignore WordPress.Security.NonceVerification 237 0 === strpos( trim( $_GET['rest_route'], '\\/' ), $prefix ) //phpcs:ignore WordPress.Security.NonceVerification 234 ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || 235 ( isset( $_GET['rest_route'] ) && 0 === strpos( trim( $_GET['rest_route'], '\\/' ), $prefix ) ) //phpcs:ignore WordPress.Security.NonceVerification 238 236 ) { 239 237 return true; … … 456 454 empty( $registered_menu[2] ) || // error 457 455 strpos( $registered_menu[2], '.php' ) !== false || // core page 458 ( ! empty( $registered_menu[4] ) && 'wp-menu-separator' == $registered_menu[4] ) //phpcs:ignore Universal.Operators.StrictComparisons456 ( ! empty( $registered_menu[4] ) && 'wp-menu-separator' === $registered_menu[4] ) 459 457 ) { 460 458 continue; … … 598 596 'type' => 'select', 599 597 'extra' => array( 600 'placeholder' => ( 'NO' == $default_value ? $no : $yes ) . $default_label, //phpcs:ignore Universal.Operators.StrictComparisons598 'placeholder' => ( 'NO' === $default_value ? $no : $yes ) . $default_label, 601 599 'multiple' => false, 602 600 'options' => array( 603 'true' => $yes . ( 'NO' == $default_value ? '' : $default_label ), //phpcs:ignore Universal.Operators.StrictComparisons604 'false' => $no . ( 'NO' == $default_value ? $default_label : '' ), //phpcs:ignore Universal.Operators.StrictComparisons601 'true' => $yes . ( 'NO' === $default_value ? '' : $default_label ), 602 'false' => $no . ( 'NO' === $default_value ? $default_label : '' ), 605 603 ), 606 604 ), … … 643 641 */ 644 642 public function get_ui_min_field( $wrap_width = '', $type = 'number' ) { 645 $extra = 'number' == $type ? array(643 $extra = 'number' === $type ? array( 646 644 'min' => '0', 647 645 'placeholder' => '0', … … 670 668 */ 671 669 public function get_ui_max_field( $wrap_width = '', $type = 'number' ) { 672 $extra = 'number' == $type ? array( 'min' => '0' ) : array();670 $extra = 'number' === $type ? array( 'min' => '0' ) : array(); 673 671 return array( 674 672 'key' => 'max', -
custom-post-types/tags/5.0.7/includes/compatibilities/saswp.php
r2989869 r3339401 22 22 foreach ( $fields as $field_config ) { 23 23 if ( 24 'file' == $field_config['type'] &&24 'file' === $field_config['type'] && 25 25 2 > count( $field_config['extra']['types'] ) && 26 26 ( 27 27 empty( $field_config['extra']['types'][0] ) || 28 'image' == $field_config['extra']['types'][0]28 'image' === $field_config['extra']['types'][0] 29 29 ) 30 30 ) { … … 76 76 $field_object = cpt_fields()->get_field_object( $field, \CPT_Field_Groups::SUPPORT_TYPE_CPT, $post->post_type ); 77 77 if ( 78 'file' == $field_object['type'] &&78 'file' === $field_object['type'] && 79 79 2 > count( $field_object['extra']['types'] ) && 80 80 ( 81 81 empty( $field_object['extra']['types'][0] ) || 82 'image' == $field_object['extra']['types'][0]82 'image' === $field_object['extra']['types'][0] 83 83 ) 84 84 ) { -
custom-post-types/tags/5.0.7/includes/fields/class-cpt-field-color.php
r2989869 r3339401 48 48 $input_id, 49 49 $field_config['value'], 50 ! empty( $field_config['extra']['alpha'] ) && 'true' == $field_config['extra']['alpha'] ? ' data-alpha-enabled="true" data-alpha-color-type="hex"' : '', //phpcs:ignore Universal.Operators.StrictComparisons50 ! empty( $field_config['extra']['alpha'] ) && true === filter_var( $field_config['extra']['alpha'], FILTER_VALIDATE_BOOLEAN ) ? ' data-alpha-enabled="true" data-alpha-color-type="hex"' : '', 51 51 ! empty( $field_config['required'] ) ? ' required' : '' 52 52 ); -
custom-post-types/tags/5.0.7/includes/fields/class-cpt-field-file.php
r3055467 r3339401 113 113 $file_types = explode( '/', $file_type ); 114 114 $main_type = isset( $file_types[0] ) ? $file_types[0] : false; 115 if ( $main_type && 'image' == $main_type ) { //phpcs:ignore Universal.Operators.StrictComparisons115 if ( $main_type && 'image' === $main_type ) { 116 116 return wp_get_attachment_image( $meta_value, 'full' ); 117 117 } -
custom-post-types/tags/5.0.7/includes/fields/class-cpt-field-post-rel.php
r2989869 r3339401 79 79 } 80 80 81 $multiple = ! empty( $field_config['extra']['multiple'] ) && true === filter_var( $field_config['extra']['multiple'], FILTER_VALIDATE_BOOLEAN ); 82 81 83 return sprintf( 82 84 '<select name="%s" id="%s" autocomplete="off" aria-autocomplete="none" style="width: 100%%;"%s%s data-type="%s"%s>%s</select>', 83 $input_name . ( ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? '[]' : '' ), //phpcs:ignore Universal.Operators.StrictComparisons85 $input_name . ( $multiple ? '[]' : '' ), 84 86 $input_id, 85 87 ! empty( $field_config['extra']['placeholder'] ) ? ' placeholder="' . $field_config['extra']['placeholder'] . '"' : '', 86 ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? ' multiple' : '', //phpcs:ignore Universal.Operators.StrictComparisons88 $multiple ? ' multiple' : '', 87 89 ! empty( $field_config['extra']['post_type'] ) ? $field_config['extra']['post_type'] : 'post', 88 90 ! empty( $field_config['required'] ) ? ' required' : '', -
custom-post-types/tags/5.0.7/includes/fields/class-cpt-field-radio.php
r3055467 r3339401 54 54 $input_name, //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 55 55 $value, //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 56 $value == $field_config['value'] ? ' checked="checked"' : '', //phpcs:ignore Universal.Operators.StrictComparisons56 $value === $field_config['value'] ? ' checked="checked"' : '', 57 57 ! empty( $field_config['required'] ) ? ' required' : '', 58 58 $label //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -
custom-post-types/tags/5.0.7/includes/fields/class-cpt-field-repeater.php
r3055467 r3339401 42 42 data-fields="<?php echo htmlspecialchars( wp_json_encode( $fields ), ENT_QUOTES, 'UTF-8' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" 43 43 data-parent="<?php echo $parent_base; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" 44 data-fields-group="<?php e sc_attr_e( $fields_group_id ); ?>"44 data-fields-group="<?php echo esc_attr( $fields_group_id ); ?>" 45 45 > 46 46 <?php … … 86 86 <?php 87 87 foreach ( $fields as $i => $field ) { 88 if ( CPT_UI_PREFIX . '_field' == $fields_group_id && 5 == $i ) { //phpcs:ignore Universal.Operators.StrictComparisons88 if ( CPT_UI_PREFIX . '_field' === $fields_group_id && 5 === $i ) { 89 89 ?> 90 90 <div class="cpt-repeater-extra"> … … 228 228 $field_group_id = $field_group['id']; 229 229 if ( 230 'fields' == $meta_key && //phpcs:ignore Universal.Operators.StrictComparisons231 CPT_UI_PREFIX . '_field' == $field_group_id && //phpcs:ignore Universal.Operators.StrictComparisons230 'fields' === $meta_key && 231 CPT_UI_PREFIX . '_field' === $field_group_id && 232 232 ! empty( $meta_value ) 233 233 ) { -
custom-post-types/tags/5.0.7/includes/fields/class-cpt-field-select.php
r2989869 r3339401 59 59 public static function render( $input_name, $input_id, $field_config ) { 60 60 $options = ''; 61 if ( 'true' != $field_config['extra']['multiple'] ) { 61 62 $multiple = ! empty( $field_config['extra']['multiple'] ) && true === filter_var( $field_config['extra']['multiple'], FILTER_VALIDATE_BOOLEAN ); 63 64 if ( ! $multiple ) { 62 65 $options .= '<option value=""></option>'; 63 66 } … … 70 73 $child_value, 71 74 ( is_array( $field_config['value'] ) && in_array( $child_value, $field_config['value'], true ) ) || 72 ( ! is_array( $field_config['value'] ) && $child_value == $field_config['value'] ) ? //phpcs:ignore Universal.Operators.StrictComparisons75 ( ! is_array( $field_config['value'] ) && $child_value === $field_config['value'] ) ? 73 76 ' selected="selected"' : 74 77 '', … … 86 89 $value, 87 90 ( is_array( $field_config['value'] ) && in_array( $value, $field_config['value'], true ) ) || 88 ( ! is_array( $field_config['value'] ) && $value == $field_config['value'] ) ? //phpcs:ignore Universal.Operators.StrictComparisons91 ( ! is_array( $field_config['value'] ) && $value === $field_config['value'] ) ? 89 92 ' selected="selected"' : 90 93 '', … … 93 96 } 94 97 } 98 95 99 return sprintf( 96 100 '<select name="%s" id="%s" autocomplete="off" aria-autocomplete="none" style="width: 100%%;"%s%s%s>%s</select>', 97 $input_name . ( ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? '[]' : '' ), //phpcs:ignore Universal.Operators.StrictComparisons101 $input_name . ( $multiple ? '[]' : '' ), 98 102 $input_id, 99 103 ! empty( $field_config['extra']['placeholder'] ) ? ' placeholder="' . $field_config['extra']['placeholder'] . '"' : '', 100 ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? ' multiple' : '', //phpcs:ignore Universal.Operators.StrictComparisons104 $multiple ? ' multiple' : '', 101 105 ! empty( $field_config['required'] ) ? ' required' : '', 102 106 $options -
custom-post-types/tags/5.0.7/includes/fields/class-cpt-field-tax-rel.php
r2989869 r3339401 79 79 } 80 80 81 $multiple = ! empty( $field_config['extra']['multiple'] ) && true === filter_var( $field_config['extra']['multiple'], FILTER_VALIDATE_BOOLEAN ); 82 81 83 return sprintf( 82 84 '<select name="%s" id="%s" autocomplete="off" aria-autocomplete="none" style="width: 100%%;"%s%s data-type="%s"%s>%s</select>', 83 $input_name . ( ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? '[]' : '' ), //phpcs:ignore Universal.Operators.StrictComparisons85 $input_name . ( $multiple ? '[]' : '' ), 84 86 $input_id, 85 87 ! empty( $field_config['extra']['placeholder'] ) ? ' placeholder="' . $field_config['extra']['placeholder'] . '"' : '', 86 ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? ' multiple' : '', //phpcs:ignore Universal.Operators.StrictComparisons88 $multiple ? ' multiple' : '', 87 89 ! empty( $field_config['extra']['taxonomy'] ) ? $field_config['extra']['taxonomy'] : 'category', 88 90 ! empty( $field_config['required'] ) ? ' required' : '', -
custom-post-types/tags/5.0.7/includes/templates/page-tools.php
r3055467 r3339401 25 25 26 26 $is_current = function ( $current ) use ( $requested_page ) { 27 return $current == $requested_page; //phpcs:ignore Universal.Operators.StrictComparisons27 return $current === $requested_page; 28 28 }; 29 29 ?> -
custom-post-types/tags/5.0.7/readme.txt
r3206479 r3339401 4 4 Donate link: https://totalpress.org/donate?utm_source=wordpress_org&utm_medium=plugin_page&utm_campaign=custom_post_types 5 5 Requires at least: 4.0 6 Tested up to: 6. 77 Stable tag: 5.0. 66 Tested up to: 6.8 7 Stable tag: 5.0.7 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 188 188 == Changelog == 189 189 190 = 5.0.6 - 2024-04-03 = 190 = 5.0.7 - 2025-08-04 = 191 * FIX: sanitize dropdown options on field groups; 192 193 = 5.0.6 - 2024-12-11 = 191 194 * FIX: version_compare first argument null; 192 195 * FIX: check if class exist before short load using functions.php; -
custom-post-types/trunk/custom-post-types.php
r3206477 r3339401 8 8 Text Domain: custom-post-types 9 9 Domain Path: /languages/ 10 Version: 5.0. 610 Version: 5.0.7 11 11 */ 12 12 -
custom-post-types/trunk/includes/abstracts/class-cpt-field.php
r2989869 r3339401 14 14 /** @var CPT_Field $field_class */ 15 15 $field_class = get_called_class(); 16 if ( $field_class::get_type() == $meta_type ) { //phpcs:ignore Universal.Operators.StrictComparisons16 if ( $field_class::get_type() === $meta_type ) { 17 17 return $field_class::sanitize( $meta_value ); 18 18 } … … 30 30 /** @var CPT_Field $field_class */ 31 31 $field_class = get_called_class(); 32 if ( $field_class::get_type() == $meta_type ) { //phpcs:ignore Universal.Operators.StrictComparisons32 if ( $field_class::get_type() === $meta_type ) { 33 33 return $field_class::get( $meta_value ); 34 34 } -
custom-post-types/trunk/includes/class-cpt-admin-notices.php
r3055467 r3339401 26 26 $notice = $params['key']; 27 27 $duration = $params['duration']; 28 $this->dismiss_notice( $notice, ( 'lifetime' == $duration ? -1 : intval( $duration ) ) ); //phpcs:ignore Universal.Operators.StrictComparisons28 $this->dismiss_notice( $notice, ( 'lifetime' === $duration ? -1 : intval( $duration ) ) ); 29 29 return 'OK'; 30 30 }, … … 96 96 ! empty( $button['target'] ) ? $button['target'] : '_self', 97 97 ! empty( $button['label'] ) ? esc_html( $button['label'] ) : '', 98 ! empty( $button['target'] ) && '_blank' == $button['target'] && ! $is_cta ? '<span class="dashicons dashicons-external"></span>' : '' //phpcs:ignore Universal.Operators.StrictComparisons98 ! empty( $button['target'] ) && '_blank' === $button['target'] && ! $is_cta ? '<span class="dashicons dashicons-external"></span>' : '' 99 99 ); 100 100 } 101 101 } 102 102 if ( $dismissible ) { 103 $button_label = true === $dismissible ? __( 'Dismiss notice', 'custom-post-types' ) : sprintf( __( 'Dismiss notice for %s days', 'custom-post-types' ), (int) $dismissible ); //phpcs:ignore Universal.Operators.StrictComparisons103 $button_label = true === $dismissible ? __( 'Dismiss notice', 'custom-post-types' ) : sprintf( __( 'Dismiss notice for %s days', 'custom-post-types' ), (int) $dismissible ); 104 104 $notice_buttons[] = sprintf( 105 105 '<a href="#" class="cpt-dismiss-notice" data-notice="%1$s" data-duration="%2$s" title="%3$s" aria-label="%3$s">%3$s</a>', 106 106 $id, 107 ( true === $dismissible ? 'lifetime' : $dismissible ), //phpcs:ignore Universal.Operators.StrictComparisons107 ( true === $dismissible ? 'lifetime' : $dismissible ), 108 108 $button_label 109 109 ); … … 146 146 $type = ! empty( get_post_meta( $notice->ID, 'type', true ) ) ? get_post_meta( $notice->ID, 'type', true ) : 'info'; 147 147 $dismissable = ! empty( get_post_meta( $notice->ID, 'dismissible', true ) ) ? get_post_meta( $notice->ID, 'dismissible', true ) : false; 148 $admin_only = 'true' == get_post_meta( $notice->ID, 'admin_only', true ); //phpcs:ignore Universal.Operators.StrictComparisons148 $admin_only = true === filter_var( get_post_meta( $notice->ID, 'admin_only', true ), FILTER_VALIDATE_BOOLEAN ); 149 149 $buttons = ! empty( get_post_meta( $notice->ID, 'buttons', true ) ) ? get_post_meta( $notice->ID, 'buttons', true ) : false; 150 150 if ( $dismissable < 0 ) { -
custom-post-types/trunk/includes/class-cpt-admin-pages.php
r3055467 r3339401 63 63 $page_order = is_numeric( get_post_meta( $page->ID, 'order', true ) ) ? get_post_meta( $page->ID, 'order', true ) : null; 64 64 $page_icon = ! empty( get_post_meta( $page->ID, 'menu_icon', true ) ) ? get_post_meta( $page->ID, 'menu_icon', true ) : ''; 65 $admin_only = 'true' == get_post_meta( $page->ID, 'admin_only', true ); //phpcs:ignore Universal.Operators.StrictComparisons65 $admin_only = true === filter_var( get_post_meta( $page->ID, 'admin_only', true ), FILTER_VALIDATE_BOOLEAN ); 66 66 if ( $page_parent && stripos( $page_parent, '/' ) !== false ) { 67 67 $page_parent = explode( '/', $page_parent ); -
custom-post-types/trunk/includes/class-cpt-core.php
r2989869 r3339401 108 108 109 109 include_once CPT_PATH . '/includes/compatibilities/v4.php'; 110 //include_once CPT_PATH . '/includes/compatibilities/acf.php';111 //include_once CPT_PATH . '/includes/compatibilities/saswp.php';110 // include_once CPT_PATH . '/includes/compatibilities/acf.php'; 111 // include_once CPT_PATH . '/includes/compatibilities/saswp.php'; 112 112 } 113 113 -
custom-post-types/trunk/includes/class-cpt-field-groups.php
r3036818 r3339401 28 28 */ 29 29 private function sanitize_field_args( $field = array() ) { 30 $field['required'] = ! empty( $field['required'] ) && 'true' == $field['required']; //phpcs:ignore Universal.Operators.StrictComparisons30 $field['required'] = ! empty( $field['required'] ) && true === filter_var( $field['required'], FILTER_VALIDATE_BOOLEAN ); 31 31 if ( ! empty( $field['extra']['options'] ) && ! is_array( $field['extra']['options'] ) ) { 32 32 $field['extra']['options'] = cpt_utils()->get_options_from_string( $field['extra']['options'] ); 33 33 } 34 34 foreach ( $field as $key => $value ) { 35 if ( substr( $key, 0, 5 ) == 'wrap_' ) { //phpcs:ignore Universal.Operators.StrictComparisons35 if ( 'wrap_' === substr( $key, 0, 5 ) ) { 36 36 if ( ! empty( $value ) ) { 37 37 $field['wrap'][ str_replace( 'wrap_', '', $key ) ] = $value; … … 39 39 unset( $field[ $key ] ); 40 40 } 41 } 42 if ( ! empty( $field['extra']['fields'] ) ) { 43 $fields = array_map( 44 array( $this, 'sanitize_field_args' ), 45 $field['extra']['fields'] 46 ); 47 $field['extra']['fields'] = $fields; 41 48 } 42 49 return $field; … … 77 84 $position = ! empty( get_post_meta( $group->ID, 'position', true ) ) ? get_post_meta( $group->ID, 'position', true ) : 'normal'; 78 85 $order = get_post_meta( $group->ID, 'order', true ); 79 $admin_only = 'true' == get_post_meta( $group->ID, 'admin_only', true ); //phpcs:ignore Universal.Operators.StrictComparisons80 $show_in_rest = 'true' == get_post_meta( $group->ID, 'show_in_rest', true ); //phpcs:ignore Universal.Operators.StrictComparisons86 $admin_only = true === filter_var( get_post_meta( $group->ID, 'admin_only', true ), FILTER_VALIDATE_BOOLEAN ); 87 $show_in_rest = true === filter_var( get_post_meta( $group->ID, 'show_in_rest', true ), FILTER_VALIDATE_BOOLEAN ); 81 88 $fields = ! empty( get_post_meta( $group->ID, 'fields', true ) ) ? array_map( 82 89 array( $this, 'sanitize_field_args' ), -
custom-post-types/trunk/includes/class-cpt-fields.php
r3055467 r3339401 625 625 return $meta_value; 626 626 } 627 if ( ! is_string( $meta_value ) && ( ! cpt_utils()->is_rest() || 'the_content' == current_filter() ) ) { //phpcs:ignore Universal.Operators.StrictComparisons627 if ( ! is_string( $meta_value ) && ( ! cpt_utils()->is_rest() || 'the_content' === current_filter() ) ) { 628 628 if ( current_user_can( 'edit_posts' ) ) { 629 629 return sprintf( -
custom-post-types/trunk/includes/class-cpt-plugin.php
r3206477 r3339401 54 54 */ 55 55 public function plugin_links( $actions, $plugin_file ) { 56 if ( 'custom-post-types/custom-post-types.php' == $plugin_file ) { //phpcs:ignore Universal.Operators.StrictComparisons56 if ( 'custom-post-types/custom-post-types.php' === $plugin_file ) { 57 57 $actions[] = sprintf( 58 58 '<a href="%1$s" target="_blank" aria-label="%2$s"> %2$s </a>', -
custom-post-types/trunk/includes/class-cpt-post-types.php
r3055467 r3339401 16 16 public function __construct() { 17 17 if ( empty( $this->default_args ) ) { 18 $this->default_args = cpt_utils()->get_args( 'post-types-default-args' ); 18 add_action( 19 'init', 20 function () { 21 $this->default_args = cpt_utils()->get_args( 'post-types-default-args' ); 22 } 23 ); 19 24 } 20 25 if ( empty( $this->default_labels ) ) { 21 $this->default_labels = cpt_utils()->get_args( 'post-types-default-labels' ); 26 add_action( 27 'init', 28 function () { 29 $this->default_labels = cpt_utils()->get_args( 'post-types-default-labels' ); 30 } 31 ); 22 32 } 23 33 } … … 79 89 } 80 90 global $pagenow; 81 if ( 'edit.php' == $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] == $post_type ) { //phpcs:ignore Universal.Operators.StrictComparisons, WordPress.Security.NonceVerification91 if ( 'edit.php' === $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] === $post_type ) { 82 92 add_filter( 83 93 'manage_posts_columns', … … 89 99 90 100 foreach ( $columns as $key => $args ) { 91 if ( 'title' == $key && empty( $args['label'] ) ) { //phpcs:ignore Universal.Operators.StrictComparisons101 if ( 'title' === $key && empty( $args['label'] ) ) { 92 102 $args['label'] = $stored_title_label; 93 103 } 94 if ( 'date' == $key && empty( $args['label'] ) ) { //phpcs:ignore Universal.Operators.StrictComparisons104 if ( 'date' === $key && empty( $args['label'] ) ) { 95 105 $args['label'] = $stored_date_label; 96 106 } … … 142 152 foreach ( $post_metas as $key => $value ) { 143 153 $single_meta = get_post_meta( $post_type->ID, $key, true ); 144 if ( substr( $key, 0, 7 ) == 'labels_' ) { //phpcs:ignore Universal.Operators.StrictComparisons154 if ( 'labels_' === substr( $key, 0, 7 ) ) { 145 155 if ( ! empty( $single_meta ) ) { 146 156 $post_type_labels[ str_replace( 'labels_', '', $key ) ] = $single_meta; 147 157 } 148 } elseif ( substr( $key, 0, 1 ) == '_' || empty( $single_meta ) ) { //phpcs:ignore Universal.Operators.StrictComparisons158 } elseif ( '_' === substr( $key, 0, 1 ) || empty( $single_meta ) ) { 149 159 unset( $post_metas[ $key ] ); 150 160 } else { 151 $post_type_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( 'true' == $single_meta ) : $single_meta; //phpcs:ignore Universal.Operators.StrictComparisons161 $post_type_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( true === filter_var( $single_meta, FILTER_VALIDATE_BOOLEAN ) ) : $single_meta; 152 162 } 153 163 unset( $post_metas[ $key ] ); … … 286 296 } 287 297 $id = ! empty( $post_type['id'] ) && is_string( $post_type['id'] ) ? $post_type['id'] : false; 288 if ( $id == $post_type_id ) {298 if ( $id === $post_type_id ) { 289 299 $flush_rewrite_rules = true; 290 300 } -
custom-post-types/trunk/includes/class-cpt-taxonomies.php
r2989869 r3339401 12 12 public function __construct() { 13 13 if ( empty( $this->default_args ) ) { 14 $this->default_args = cpt_utils()->get_args( 'taxonomies-default-args' ); 14 add_action( 15 'init', 16 function () { 17 $this->default_args = cpt_utils()->get_args( 'taxonomies-default-args' ); 18 } 19 ); 15 20 } 16 21 if ( empty( $this->default_labels ) ) { 17 $this->default_labels = cpt_utils()->get_args( 'taxonomies-default-labels' ); 22 add_action( 23 'init', 24 function () { 25 $this->default_labels = cpt_utils()->get_args( 'taxonomies-default-labels' ); 26 } 27 ); 18 28 } 19 29 } … … 89 99 foreach ( $post_metas as $key => $value ) { 90 100 $single_meta = get_post_meta( $taxonomy->ID, $key, true ); 91 if ( substr( $key, 0, 7 ) == 'labels_' ) { //phpcs:ignore Universal.Operators.StrictComparisons101 if ( 'labels_' === substr( $key, 0, 7 ) ) { 92 102 if ( ! empty( $single_meta ) ) { 93 103 $taxonomy_labels[ str_replace( 'labels_', '', $key ) ] = $single_meta; 94 104 } 95 } elseif ( substr( $key, 0, 1 ) == '_' || empty( $single_meta ) ) { //phpcs:ignore Universal.Operators.StrictComparisons105 } elseif ( '_' === substr( $key, 0, 1 ) || empty( $single_meta ) ) { 96 106 unset( $post_metas[ $key ] ); 97 107 } else { 98 $taxonomy_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( 'true' == $single_meta ) : $single_meta; //phpcs:ignore Universal.Operators.StrictComparisons108 $taxonomy_args[ $key ] = in_array( $single_meta, array( 'true', 'false' ), true ) ? ( true === filter_var( $single_meta, FILTER_VALIDATE_BOOLEAN ) ) : $single_meta; 99 109 } 100 110 unset( $post_metas[ $key ] ); … … 229 239 } 230 240 $id = ! empty( $taxonomy['id'] ) && is_string( $taxonomy['id'] ) ? $taxonomy['id'] : false; 231 if ( $id == $taxonomy_id ) {241 if ( $id === $taxonomy_id ) { 232 242 $flush_rewrite_rules = true; 233 243 } -
custom-post-types/trunk/includes/class-cpt-ui.php
r3206477 r3339401 31 31 */ 32 32 public function add_feedback_modal() { 33 if ( get_current_screen()->id == 'plugins' ) { //phpcs:ignore Universal.Operators.StrictComparisons33 if ( 'plugins' === get_current_screen()->id ) { 34 34 require_once CPT_PATH . '/includes/templates/modal-feedback.php'; 35 35 } … … 87 87 } 88 88 89 $action = ! empty( $_GET['action'] ) && 'cpt-feedback' == $_GET['action'] ? $_GET['action'] : false; //phpcs:ignore Universal.Operators.StrictComparisons89 $action = ! empty( $_GET['action'] ) && 'cpt-feedback' === $_GET['action'] ? $_GET['action'] : false; 90 90 if ( ! $action ) { 91 91 return; … … 129 129 $field_group_id = $field_group['id']; 130 130 if ( 131 'id' == $meta_key && //phpcs:ignore Universal.Operators.StrictComparisons131 'id' === $meta_key && 132 132 in_array( $field_group_id, array( CPT_UI_PREFIX, CPT_UI_PREFIX . '_tax', CPT_UI_PREFIX . '_field', CPT_UI_PREFIX . '_page', CPT_UI_PREFIX . '_notice' ), true ) 133 133 ) { … … 145 145 $post_type = get_post( $post_id )->post_type; 146 146 $post_status = get_post( $post_id )->post_status; 147 if ( ! in_array( $post_type, $this->no_title_post_types, true ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || 'trash' == $post_status ) { //phpcs:ignore Universal.Operators.StrictComparisons147 if ( ! in_array( $post_type, $this->no_title_post_types, true ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || 'trash' === $post_status ) { 148 148 return $post_id; 149 149 } -
custom-post-types/trunk/includes/class-cpt-utils.php
r3055467 r3339401 196 196 public function get_post_title_with_parents( $post_id = 0, $title = '' ) { 197 197 $post = get_post( $post_id ); 198 if ( 0 == $post_id || ! $post ) { //phpcs:ignore Universal.Operators.StrictComparisons198 if ( 0 === $post_id || ! $post ) { 199 199 return $title; 200 200 } 201 201 $title = empty( $title ) ? $post->post_title : $title; 202 if ( 0 == $post->post_parent ) { //phpcs:ignore Universal.Operators.StrictComparisons202 if ( 0 === $post->post_parent ) { 203 203 return $title; 204 204 } … … 215 215 public function get_term_title_with_parents( $term_id = 0, $title = '' ) { 216 216 $term = get_term( $term_id ); 217 if ( 0 == $term_id || ! $term ) { //phpcs:ignore Universal.Operators.StrictComparisons217 if ( 0 === $term_id || ! $term ) { 218 218 return $title; 219 219 } 220 220 $title = empty( $title ) ? $term->name : $title; 221 if ( 0 == $term->parent ) { //phpcs:ignore Universal.Operators.StrictComparisons221 if ( 0 === $term->parent ) { 222 222 return $title; 223 223 } … … 232 232 $prefix = rest_get_url_prefix(); 233 233 if ( 234 defined( 'REST_REQUEST' ) && 235 REST_REQUEST || 236 isset( $_GET['rest_route'] ) && //phpcs:ignore WordPress.Security.NonceVerification 237 0 === strpos( trim( $_GET['rest_route'], '\\/' ), $prefix ) //phpcs:ignore WordPress.Security.NonceVerification 234 ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || 235 ( isset( $_GET['rest_route'] ) && 0 === strpos( trim( $_GET['rest_route'], '\\/' ), $prefix ) ) //phpcs:ignore WordPress.Security.NonceVerification 238 236 ) { 239 237 return true; … … 456 454 empty( $registered_menu[2] ) || // error 457 455 strpos( $registered_menu[2], '.php' ) !== false || // core page 458 ( ! empty( $registered_menu[4] ) && 'wp-menu-separator' == $registered_menu[4] ) //phpcs:ignore Universal.Operators.StrictComparisons456 ( ! empty( $registered_menu[4] ) && 'wp-menu-separator' === $registered_menu[4] ) 459 457 ) { 460 458 continue; … … 598 596 'type' => 'select', 599 597 'extra' => array( 600 'placeholder' => ( 'NO' == $default_value ? $no : $yes ) . $default_label, //phpcs:ignore Universal.Operators.StrictComparisons598 'placeholder' => ( 'NO' === $default_value ? $no : $yes ) . $default_label, 601 599 'multiple' => false, 602 600 'options' => array( 603 'true' => $yes . ( 'NO' == $default_value ? '' : $default_label ), //phpcs:ignore Universal.Operators.StrictComparisons604 'false' => $no . ( 'NO' == $default_value ? $default_label : '' ), //phpcs:ignore Universal.Operators.StrictComparisons601 'true' => $yes . ( 'NO' === $default_value ? '' : $default_label ), 602 'false' => $no . ( 'NO' === $default_value ? $default_label : '' ), 605 603 ), 606 604 ), … … 643 641 */ 644 642 public function get_ui_min_field( $wrap_width = '', $type = 'number' ) { 645 $extra = 'number' == $type ? array(643 $extra = 'number' === $type ? array( 646 644 'min' => '0', 647 645 'placeholder' => '0', … … 670 668 */ 671 669 public function get_ui_max_field( $wrap_width = '', $type = 'number' ) { 672 $extra = 'number' == $type ? array( 'min' => '0' ) : array();670 $extra = 'number' === $type ? array( 'min' => '0' ) : array(); 673 671 return array( 674 672 'key' => 'max', -
custom-post-types/trunk/includes/compatibilities/saswp.php
r2989869 r3339401 22 22 foreach ( $fields as $field_config ) { 23 23 if ( 24 'file' == $field_config['type'] &&24 'file' === $field_config['type'] && 25 25 2 > count( $field_config['extra']['types'] ) && 26 26 ( 27 27 empty( $field_config['extra']['types'][0] ) || 28 'image' == $field_config['extra']['types'][0]28 'image' === $field_config['extra']['types'][0] 29 29 ) 30 30 ) { … … 76 76 $field_object = cpt_fields()->get_field_object( $field, \CPT_Field_Groups::SUPPORT_TYPE_CPT, $post->post_type ); 77 77 if ( 78 'file' == $field_object['type'] &&78 'file' === $field_object['type'] && 79 79 2 > count( $field_object['extra']['types'] ) && 80 80 ( 81 81 empty( $field_object['extra']['types'][0] ) || 82 'image' == $field_object['extra']['types'][0]82 'image' === $field_object['extra']['types'][0] 83 83 ) 84 84 ) { -
custom-post-types/trunk/includes/fields/class-cpt-field-color.php
r2989869 r3339401 48 48 $input_id, 49 49 $field_config['value'], 50 ! empty( $field_config['extra']['alpha'] ) && 'true' == $field_config['extra']['alpha'] ? ' data-alpha-enabled="true" data-alpha-color-type="hex"' : '', //phpcs:ignore Universal.Operators.StrictComparisons50 ! empty( $field_config['extra']['alpha'] ) && true === filter_var( $field_config['extra']['alpha'], FILTER_VALIDATE_BOOLEAN ) ? ' data-alpha-enabled="true" data-alpha-color-type="hex"' : '', 51 51 ! empty( $field_config['required'] ) ? ' required' : '' 52 52 ); -
custom-post-types/trunk/includes/fields/class-cpt-field-file.php
r3055467 r3339401 113 113 $file_types = explode( '/', $file_type ); 114 114 $main_type = isset( $file_types[0] ) ? $file_types[0] : false; 115 if ( $main_type && 'image' == $main_type ) { //phpcs:ignore Universal.Operators.StrictComparisons115 if ( $main_type && 'image' === $main_type ) { 116 116 return wp_get_attachment_image( $meta_value, 'full' ); 117 117 } -
custom-post-types/trunk/includes/fields/class-cpt-field-post-rel.php
r2989869 r3339401 79 79 } 80 80 81 $multiple = ! empty( $field_config['extra']['multiple'] ) && true === filter_var( $field_config['extra']['multiple'], FILTER_VALIDATE_BOOLEAN ); 82 81 83 return sprintf( 82 84 '<select name="%s" id="%s" autocomplete="off" aria-autocomplete="none" style="width: 100%%;"%s%s data-type="%s"%s>%s</select>', 83 $input_name . ( ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? '[]' : '' ), //phpcs:ignore Universal.Operators.StrictComparisons85 $input_name . ( $multiple ? '[]' : '' ), 84 86 $input_id, 85 87 ! empty( $field_config['extra']['placeholder'] ) ? ' placeholder="' . $field_config['extra']['placeholder'] . '"' : '', 86 ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? ' multiple' : '', //phpcs:ignore Universal.Operators.StrictComparisons88 $multiple ? ' multiple' : '', 87 89 ! empty( $field_config['extra']['post_type'] ) ? $field_config['extra']['post_type'] : 'post', 88 90 ! empty( $field_config['required'] ) ? ' required' : '', -
custom-post-types/trunk/includes/fields/class-cpt-field-radio.php
r3055467 r3339401 54 54 $input_name, //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 55 55 $value, //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 56 $value == $field_config['value'] ? ' checked="checked"' : '', //phpcs:ignore Universal.Operators.StrictComparisons56 $value === $field_config['value'] ? ' checked="checked"' : '', 57 57 ! empty( $field_config['required'] ) ? ' required' : '', 58 58 $label //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -
custom-post-types/trunk/includes/fields/class-cpt-field-repeater.php
r3055467 r3339401 42 42 data-fields="<?php echo htmlspecialchars( wp_json_encode( $fields ), ENT_QUOTES, 'UTF-8' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" 43 43 data-parent="<?php echo $parent_base; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" 44 data-fields-group="<?php e sc_attr_e( $fields_group_id ); ?>"44 data-fields-group="<?php echo esc_attr( $fields_group_id ); ?>" 45 45 > 46 46 <?php … … 86 86 <?php 87 87 foreach ( $fields as $i => $field ) { 88 if ( CPT_UI_PREFIX . '_field' == $fields_group_id && 5 == $i ) { //phpcs:ignore Universal.Operators.StrictComparisons88 if ( CPT_UI_PREFIX . '_field' === $fields_group_id && 5 === $i ) { 89 89 ?> 90 90 <div class="cpt-repeater-extra"> … … 228 228 $field_group_id = $field_group['id']; 229 229 if ( 230 'fields' == $meta_key && //phpcs:ignore Universal.Operators.StrictComparisons231 CPT_UI_PREFIX . '_field' == $field_group_id && //phpcs:ignore Universal.Operators.StrictComparisons230 'fields' === $meta_key && 231 CPT_UI_PREFIX . '_field' === $field_group_id && 232 232 ! empty( $meta_value ) 233 233 ) { -
custom-post-types/trunk/includes/fields/class-cpt-field-select.php
r2989869 r3339401 59 59 public static function render( $input_name, $input_id, $field_config ) { 60 60 $options = ''; 61 if ( 'true' != $field_config['extra']['multiple'] ) { 61 62 $multiple = ! empty( $field_config['extra']['multiple'] ) && true === filter_var( $field_config['extra']['multiple'], FILTER_VALIDATE_BOOLEAN ); 63 64 if ( ! $multiple ) { 62 65 $options .= '<option value=""></option>'; 63 66 } … … 70 73 $child_value, 71 74 ( is_array( $field_config['value'] ) && in_array( $child_value, $field_config['value'], true ) ) || 72 ( ! is_array( $field_config['value'] ) && $child_value == $field_config['value'] ) ? //phpcs:ignore Universal.Operators.StrictComparisons75 ( ! is_array( $field_config['value'] ) && $child_value === $field_config['value'] ) ? 73 76 ' selected="selected"' : 74 77 '', … … 86 89 $value, 87 90 ( is_array( $field_config['value'] ) && in_array( $value, $field_config['value'], true ) ) || 88 ( ! is_array( $field_config['value'] ) && $value == $field_config['value'] ) ? //phpcs:ignore Universal.Operators.StrictComparisons91 ( ! is_array( $field_config['value'] ) && $value === $field_config['value'] ) ? 89 92 ' selected="selected"' : 90 93 '', … … 93 96 } 94 97 } 98 95 99 return sprintf( 96 100 '<select name="%s" id="%s" autocomplete="off" aria-autocomplete="none" style="width: 100%%;"%s%s%s>%s</select>', 97 $input_name . ( ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? '[]' : '' ), //phpcs:ignore Universal.Operators.StrictComparisons101 $input_name . ( $multiple ? '[]' : '' ), 98 102 $input_id, 99 103 ! empty( $field_config['extra']['placeholder'] ) ? ' placeholder="' . $field_config['extra']['placeholder'] . '"' : '', 100 ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? ' multiple' : '', //phpcs:ignore Universal.Operators.StrictComparisons104 $multiple ? ' multiple' : '', 101 105 ! empty( $field_config['required'] ) ? ' required' : '', 102 106 $options -
custom-post-types/trunk/includes/fields/class-cpt-field-tax-rel.php
r2989869 r3339401 79 79 } 80 80 81 $multiple = ! empty( $field_config['extra']['multiple'] ) && true === filter_var( $field_config['extra']['multiple'], FILTER_VALIDATE_BOOLEAN ); 82 81 83 return sprintf( 82 84 '<select name="%s" id="%s" autocomplete="off" aria-autocomplete="none" style="width: 100%%;"%s%s data-type="%s"%s>%s</select>', 83 $input_name . ( ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? '[]' : '' ), //phpcs:ignore Universal.Operators.StrictComparisons85 $input_name . ( $multiple ? '[]' : '' ), 84 86 $input_id, 85 87 ! empty( $field_config['extra']['placeholder'] ) ? ' placeholder="' . $field_config['extra']['placeholder'] . '"' : '', 86 ! empty( $field_config['extra']['multiple'] ) && 'true' == $field_config['extra']['multiple'] ? ' multiple' : '', //phpcs:ignore Universal.Operators.StrictComparisons88 $multiple ? ' multiple' : '', 87 89 ! empty( $field_config['extra']['taxonomy'] ) ? $field_config['extra']['taxonomy'] : 'category', 88 90 ! empty( $field_config['required'] ) ? ' required' : '', -
custom-post-types/trunk/includes/templates/page-tools.php
r3055467 r3339401 25 25 26 26 $is_current = function ( $current ) use ( $requested_page ) { 27 return $current == $requested_page; //phpcs:ignore Universal.Operators.StrictComparisons27 return $current === $requested_page; 28 28 }; 29 29 ?> -
custom-post-types/trunk/readme.txt
r3206479 r3339401 4 4 Donate link: https://totalpress.org/donate?utm_source=wordpress_org&utm_medium=plugin_page&utm_campaign=custom_post_types 5 5 Requires at least: 4.0 6 Tested up to: 6. 77 Stable tag: 5.0. 66 Tested up to: 6.8 7 Stable tag: 5.0.7 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 188 188 == Changelog == 189 189 190 = 5.0.6 - 2024-04-03 = 190 = 5.0.7 - 2025-08-04 = 191 * FIX: sanitize dropdown options on field groups; 192 193 = 5.0.6 - 2024-12-11 = 191 194 * FIX: version_compare first argument null; 192 195 * FIX: check if class exist before short load using functions.php;
Note: See TracChangeset
for help on using the changeset viewer.