diff --git a/classes/Pods.php b/classes/Pods.php index 766ca64116..bdb19364c1 100644 --- a/classes/Pods.php +++ b/classes/Pods.php @@ -284,7 +284,7 @@ public function rewind() : void { /** * Get current Iterator row * - * @return mixed|boolean + * @return mixed|bool * * @since 2.3.4 * @@ -487,7 +487,7 @@ public function row() { * list of text such as "Rick, John, and Gary" * * @param string|array|object $name The field name, or an associative array of parameters. - * @param boolean|array|object $single (optional) For tableless fields, to return an array or the first. + * @param bool|array|object $single (optional) For tableless fields, to return an array or the first. * * @return string|null|false The output from the field, null if the field doesn't exist, false if no value returned * for tableless fields @@ -542,7 +542,7 @@ public function display( $name, $single = null ) { * list of text such as "Rick, John, and Gary" * * @param string|array|object $name The field name, or an associative array of parameters. - * @param boolean|array|object $single (optional) For tableless fields, to return an array or the first. + * @param bool|array|object $single (optional) For tableless fields, to return an array or the first. * * @return string|null|false The output from the field, null if the field doesn't exist, false if no value returned * for tableless fields @@ -579,9 +579,9 @@ public function raw( $name, $single = null ) { * This function will return arrays for relationship and file fields. * * @param string|array|object $name The field name, or an associative array of parameters. - * @param boolean|array|object $single For tableless fields, to return the whole array or the just the first item, + * @param bool|array|object $single For tableless fields, to return the whole array or the just the first item, * or an associative array of parameters. - * @param boolean|array|object $raw Whether to return the raw value, or to run through the field type's display + * @param bool|array|object $raw Whether to return the raw value, or to run through the field type's display * method, or an associative array of parameters. * * @return mixed|null Value returned depends on the field type, null if the field doesn't exist, false if no value @@ -673,7 +673,7 @@ public function field( $name, $single = null, $raw = false ) { } if ( null !== $params->single ) { - $params->single = (boolean) $params->single; + $params->single = (bool) $params->single; } $params->name = trim( (string) $params->name ); @@ -2404,9 +2404,9 @@ public function find( $params = null, $limit = 15, $where = null, $sql = null ) 'offset' => null, 'page' => (int) $this->page, 'page_var' => $this->page_var, - 'pagination' => (boolean) $this->pagination, + 'pagination' => (bool) $this->pagination, // Search parameters. - 'search' => (boolean) $this->search, + 'search' => (bool) $this->search, 'search_var' => $this->search_var, 'search_query' => null, 'search_mode' => $this->search_mode, @@ -2449,8 +2449,8 @@ public function find( $params = null, $limit = 15, $where = null, $sql = null ) $this->offset = (int) $params->offset; $this->page = (int) $params->page; $this->page_var = $params->page_var; - $this->pagination = (boolean) $params->pagination; - $this->search = (boolean) $params->search; + $this->pagination = (bool) $params->pagination; + $this->search = (bool) $params->search; $this->search_var = $params->search_var; $this->filter_var = $params->filter_var; $params->join = (array) $params->join; @@ -3637,7 +3637,7 @@ public function helper( $helper, $value = null, $name = null ) { * * @since 2.8.0 */ - $include_obj = (boolean) apply_filters( 'pods_helper_include_obj', false, $params ); + $include_obj = (bool) apply_filters( 'pods_helper_include_obj', false, $params ); // Clean up helper callback (if string). if ( is_string( $params['helper'] ) ) { diff --git a/classes/PodsAPI.php b/classes/PodsAPI.php index 79aa9b72e1..a510cb86de 100644 --- a/classes/PodsAPI.php +++ b/classes/PodsAPI.php @@ -793,7 +793,7 @@ public function rename_wp_object_type( $object_type, $old_name, $new_name ) { * * @param string $object The pod type to look for, possible values: post_type, user, comment, taxonomy * @param array $pod Array of Pod data - * @param boolean $refresh Whether to force refresh the information + * @param bool $refresh Whether to force refresh the information * * @return array Array of fields * @@ -1808,7 +1808,7 @@ public function save_pod( $params, $sanitized = false, $db = true ) { $params->name = pods_clean_name( $params->name ); } - $params->overwrite = ! empty( $params->overwrite ) ? (boolean) $params->overwrite : false; + $params->overwrite = ! empty( $params->overwrite ) ? (bool) $params->overwrite : false; $order_group_fields = null; @@ -2621,7 +2621,7 @@ public function save_pod( $params, $sanitized = false, $db = true ) { * @param array $pod The pod configuration. * @param array $fields The list of fields on the pod. * @param array $old_info The old information to reference. - * @param boolean $overwrite_table_schema Whether to overwrite the table schema if it exists already. + * @param bool $overwrite_table_schema Whether to overwrite the table schema if it exists already. * * @return bool|WP_Error True if the schema changes were handled, false or an error if it failed to create/update. * @@ -3250,8 +3250,8 @@ public function save_field( $params, $table_operation = true, $sanitized = false $params->pod_id = $pod['id']; $params->pod = $pod['name']; - $params->is_new = isset( $params->is_new ) ? (boolean) $params->is_new : false; - $params->overwrite = isset( $params->overwrite ) ? (boolean) $params->overwrite : false; + $params->is_new = isset( $params->is_new ) ? (bool) $params->is_new : false; + $params->overwrite = isset( $params->overwrite ) ? (bool) $params->overwrite : false; $reserved_keywords = pods_reserved_keywords( 'wp-post' ); @@ -4268,13 +4268,13 @@ public function save_group( $params, $sanitized = false, $db = true ) { $id_required = false; if ( isset( $params->id_required ) ) { - $id_required = (boolean) $params->id_required; + $id_required = (bool) $params->id_required; unset( $params->id_required ); } - $params->is_new = isset( $params->is_new ) ? (boolean) $params->is_new : false; - $params->overwrite = isset( $params->overwrite ) ? (boolean) $params->overwrite : false; + $params->is_new = isset( $params->is_new ) ? (bool) $params->is_new : false; + $params->overwrite = isset( $params->overwrite ) ? (bool) $params->overwrite : false; if ( ! $pod && ( ! isset( $params->pod ) || empty( $params->pod ) ) && ( ! isset( $params->pod_id ) || empty( $params->pod_id ) ) ) { return pods_error( __( 'Pod ID or name is required', 'pods' ), $this ); @@ -4938,7 +4938,7 @@ public function save_pod_item( $params ) { } if ( isset( $params->is_new_item ) ) { - $is_new_item = (boolean) $params->is_new_item; + $is_new_item = (bool) $params->is_new_item; } // Allow Helpers to bypass subsequent helpers in recursive save_pod_item calls @@ -5448,7 +5448,7 @@ public function save_pod_item( $params ) { || in_array( pods_v( 'pick_object', $field_data ), $simple_tableless_objects, true ) ) ); - $simple = (boolean) $this->do_hook( 'tableless_custom', $simple, $field_data, $field, $fields, $pod, $params ); + $simple = (bool) $this->do_hook( 'tableless_custom', $simple, $field_data, $field, $fields, $pod, $params ); $is_repeatable_field = ( ( @@ -7049,7 +7049,7 @@ public function export_pod_item( $params, $pod = null ) { $params['fields'] = (array) pods_v( 'fields', $params, [], true ); $params['depth'] = (int) pods_v( 'depth', $params, 2, true ); $params['object_fields'] = (array) pods_v( 'object_fields', $pod->pod_data, [], true ); - $params['flatten'] = (boolean) pods_v( 'flatten', $params, false, true ); + $params['flatten'] = (bool) pods_v( 'flatten', $params, false, true ); $params['context'] = pods_v( 'context', $params, null, true ); if ( empty( $params['fields'] ) ) { @@ -7526,7 +7526,7 @@ public function delete_pod( $params, $strict = false, $delete_all = false ) { $params->delete_all = $delete_all; } - $params->delete_all = (boolean) $params->delete_all; + $params->delete_all = (bool) $params->delete_all; // Reset content if ( true === $params->delete_all ) { @@ -7740,7 +7740,7 @@ public function delete_field( $params, $table_operation = true ) { } $simple = ( 'pick' === $field['type'] && in_array( pods_v( 'pick_object', $field ), $simple_tableless_objects, true ) ); - $simple = (boolean) $this->do_hook( 'tableless_custom', $simple, $field, $pod, $params ); + $simple = (bool) $this->do_hook( 'tableless_custom', $simple, $field, $pod, $params ); // @todo Push this logic into pods_object_storage_delete_pod action. if ( $table_operation && $pod && 'table' === $pod['storage'] && ( ! in_array( $field['type'], $tableless_field_types, true ) || $simple ) ) { @@ -7820,7 +7820,7 @@ public function delete_group( $params, $strict = false, $delete_all = false ) { } if ( ! isset( $params->delete_all ) ) { - $params->delete_all = (boolean) $delete_all; + $params->delete_all = (bool) $delete_all; } $group = $this->load_group( $params, false ); @@ -8542,7 +8542,7 @@ public function load_pods( $params = [] ) { $include_internal = false; if ( isset( $params['include_internal'] ) ) { - $include_internal = (boolean) $params['include_internal']; + $include_internal = (bool) $params['include_internal']; unset( $params['include_internal'] ); } @@ -8583,7 +8583,7 @@ public function load_pods( $params = [] ) { * $params['name'] string The field name * * @param array $params An associative array of parameters - * @param boolean $allow_id Whether to allow the ID when checking if the group exists. + * @param bool $allow_id Whether to allow the ID when checking if the group exists. * * @return bool * @@ -8613,7 +8613,7 @@ public function field_exists( $params, $allow_id = true ) { } try { - return (boolean) $this->load_field( $load_params ); + return (bool) $this->load_field( $load_params ); } catch ( Exception $exception ) { pods_debug_log( $exception ); @@ -8634,7 +8634,7 @@ public function field_exists( $params, $allow_id = true ) { * @type boolean $bypass_cache Bypass the cache when getting data. * } * - * @param boolean $strict Whether to require a field exist or not when loading the info. + * @param bool $strict Whether to require a field exist or not when loading the info. * * @return Pods\Whatsit\Field|bool Field object or false if not found. * @@ -8889,7 +8889,7 @@ public function load_fields( $params = [] ) { $include_internal = false; if ( isset( $params['include_internal'] ) ) { - $include_internal = (boolean) $params['include_internal']; + $include_internal = (bool) $params['include_internal']; unset( $params['include_internal'] ); } @@ -8947,7 +8947,7 @@ public function load_fields( $params = [] ) { * @type boolean $bypass_cache Bypass the cache when getting data. * } * - * @param boolean $allow_id Whether to allow the ID when checking if the group exists. + * @param bool $allow_id Whether to allow the ID when checking if the group exists. * * @return bool * @@ -8977,7 +8977,7 @@ public function group_exists( $params, $allow_id = true ) { } try { - return (boolean) $this->load_group( $load_params ); + return (bool) $this->load_group( $load_params ); } catch ( Exception $exception ) { pods_debug_log( $exception ); @@ -9121,7 +9121,7 @@ public function load_groups( $params = [] ) { $include_internal = false; if ( isset( $params['include_internal'] ) ) { - $include_internal = (boolean) $params['include_internal']; + $include_internal = (bool) $params['include_internal']; unset( $params['include_internal'] ); } @@ -11824,7 +11824,7 @@ public function get_pods_object_from_wp_post( $post ) { * @type boolean $bypass_cache Bypass the cache when getting data. * } * - * @param boolean $strict Whether to require a field exist or not when loading the info. + * @param bool $strict Whether to require a field exist or not when loading the info. * * @return Pods\Whatsit|false Object or false if not found. * diff --git a/classes/PodsAdmin.php b/classes/PodsAdmin.php index 8956d3b0c4..8d03b883bd 100644 --- a/classes/PodsAdmin.php +++ b/classes/PodsAdmin.php @@ -2229,7 +2229,7 @@ public function admin_setup_add( $obj ) { /** * Get the edit page of an object * - * @param boolean $duplicate Whether the screen is for duplicating. + * @param bool $duplicate Whether the screen is for duplicating. * @param PodsUI $obj PodsUI object. */ public function admin_setup_edit( $duplicate, $obj ) { diff --git a/classes/PodsArray.php b/classes/PodsArray.php index 43ca6ee057..d2dce630f2 100644 --- a/classes/PodsArray.php +++ b/classes/PodsArray.php @@ -154,7 +154,7 @@ public function validate( $offset, $default = null, $type = null, $extra = null $value = abs( $value ); } } elseif ( 'boolean' === $type || 'bool' === $type ) { - $value = (boolean) $value; + $value = (bool) $value; } elseif ( 'in_array' === $type && is_array( $default ) ) { if ( is_array( $value ) ) { foreach ( $value as $k => $v ) { diff --git a/classes/PodsComponents.php b/classes/PodsComponents.php index 24cf41176e..2785b29528 100644 --- a/classes/PodsComponents.php +++ b/classes/PodsComponents.php @@ -681,7 +681,7 @@ public function deactivate_component( $component ) { * Toggle a component on or off * * @param string $component The component name to toggle. - * @param boolean $toggle_mode Force toggle on or off. + * @param bool $toggle_mode Force toggle on or off. * * @return bool * @@ -691,7 +691,7 @@ public function toggle( $component, $toggle_mode = false ) { $toggled = null; - $toggle_mode = (boolean) pods_v( 'toggle', 'get', $toggle_mode ); + $toggle_mode = (bool) pods_v( 'toggle', 'get', $toggle_mode ); if ( $toggle_mode ) { $toggled = $this->activate_component( $component ); @@ -720,11 +720,11 @@ public function admin_capabilities( $capabilities ) { } if ( ! pods_developer() ) { - if ( true === (boolean) pods_v( 'DeveloperMode', $component_data, false ) ) { + if ( true === (bool) pods_v( 'DeveloperMode', $component_data, false ) ) { continue; } - if ( true === (boolean) pods_v( 'TablelessMode', $component_data, false ) ) { + if ( true === (bool) pods_v( 'TablelessMode', $component_data, false ) ) { continue; } } diff --git a/classes/PodsData.php b/classes/PodsData.php index 75b2bb5c6f..928b116e6b 100644 --- a/classes/PodsData.php +++ b/classes/PodsData.php @@ -836,7 +836,7 @@ public function select( $params ) { /** * Filters whether the total_found should be calculated right away or not. * - * @param boolean $auto_calculate_total_found Whether to auto calculate total_found. + * @param bool $auto_calculate_total_found Whether to auto calculate total_found. * @param object $params Select parameters. * @param PodsData $instance The current PodsData instance. * @@ -953,7 +953,7 @@ public function build( $params ) { // Validate. $params->page = pods_absint( $params->page ); - $params->pagination = (boolean) $params->pagination; + $params->pagination = (bool) $params->pagination; if ( 0 === $params->page || ! $params->pagination ) { $params->page = 1; @@ -1167,7 +1167,7 @@ public function build( $params ) { $this->search_mode = $params->search_mode; } - $params->search = (boolean) $params->search; + $params->search = (bool) $params->search; if ( 1 === (int) pods_v( 'pods_debug_params_all', 'get', 0 ) && pods_is_admin( array( 'pods' ) ) ) { pods_debug( __METHOD__ . ':' . __LINE__ ); @@ -1969,7 +1969,7 @@ public function position() { * * @param string $table Table name. * @param string $fields - * @param boolean $if_not_exists Check if the table exists. + * @param bool $if_not_exists Check if the table exists. * * @return array|bool|mixed|null|void * @@ -2641,8 +2641,8 @@ public static function query( $sql, $error = 'Database Error', $results_error = * Gets all tables in the WP database, optionally exclude WP core * tables, and/or Pods table by settings the parameters to false. * - * @param boolean $wp_core - * @param boolean $pods_tables restrict Pods 2x tables. + * @param bool $wp_core + * @param bool $pods_tables restrict Pods 2x tables. * * @return array * @@ -2945,7 +2945,7 @@ public static function query_field( $field, $q, $pod = null, &$params = null ) { } $field_compare = strtoupper( trim( (string) pods_v( 'compare', $q, $field_compare, true ) ) ); - $field_sanitize = (boolean) pods_v( 'sanitize', $q, true ); + $field_sanitize = (bool) pods_v( 'sanitize', $q, true ); $field_sanitize_format = pods_v( 'sanitize_format', $q, null, true ); $field_cast = pods_v( 'cast', $q, null, true ); diff --git a/classes/PodsField.php b/classes/PodsField.php index 97ffea8339..03961cf1d0 100644 --- a/classes/PodsField.php +++ b/classes/PodsField.php @@ -227,7 +227,7 @@ public function is_empty( $value ) { * Check if the field values are empty. * * @param array|mixed $values Field values. - * @param boolean $strict Whether to check if any of the values are non-empty in an array. + * @param bool $strict Whether to check if any of the values are non-empty in an array. * * @return bool * @@ -686,7 +686,7 @@ public function build_dfv_field_item_data( $args ) { * @param array|null $options Field options. * @param array|null $pod Pod information. * @param int|string|null $id Current item ID. - * @param boolean $in_form Whether we are in the form context. + * @param bool $in_form Whether we are in the form context. * * @return array Array of possible field data. * diff --git a/classes/PodsForm.php b/classes/PodsForm.php index b4b6a9a5e2..0c5ca70319 100644 --- a/classes/PodsForm.php +++ b/classes/PodsForm.php @@ -1407,7 +1407,7 @@ public static function permission( $type, $name = null, $options = null, $fields * @since 2.0.0 * @deprecated 2.8.0 */ - return (boolean) apply_filters( 'pods_form_field_permission', $permission, $type, $name, $options, $fields, $pod, $id, $params ); + return (bool) apply_filters( 'pods_form_field_permission', $permission, $type, $name, $options, $fields, $pod, $id, $params ); } /** diff --git a/classes/PodsInit.php b/classes/PodsInit.php index 5acc5cd2db..d73b7251af 100644 --- a/classes/PodsInit.php +++ b/classes/PodsInit.php @@ -1178,18 +1178,18 @@ public function setup_content_types( $force = false ) { // Supported $cpt_supported = [ - 'title' => (boolean) pods_v( 'supports_title', $post_type, false ), - 'editor' => (boolean) pods_v( 'supports_editor', $post_type, false ), - 'author' => (boolean) pods_v( 'supports_author', $post_type, false ), - 'thumbnail' => (boolean) pods_v( 'supports_thumbnail', $post_type, false ), - 'excerpt' => (boolean) pods_v( 'supports_excerpt', $post_type, false ), - 'trackbacks' => (boolean) pods_v( 'supports_trackbacks', $post_type, false ), - 'custom-fields' => (boolean) pods_v( 'supports_custom_fields', $post_type, false ), - 'comments' => (boolean) pods_v( 'supports_comments', $post_type, false ), - 'revisions' => (boolean) pods_v( 'supports_revisions', $post_type, false ), - 'page-attributes' => (boolean) pods_v( 'supports_page_attributes', $post_type, false ), - 'post-formats' => (boolean) pods_v( 'supports_post_formats', $post_type, false ), - 'quick-edit' => (boolean) pods_v( 'supports_quick_edit', $post_type, true ), + 'title' => (bool) pods_v( 'supports_title', $post_type, false ), + 'editor' => (bool) pods_v( 'supports_editor', $post_type, false ), + 'author' => (bool) pods_v( 'supports_author', $post_type, false ), + 'thumbnail' => (bool) pods_v( 'supports_thumbnail', $post_type, false ), + 'excerpt' => (bool) pods_v( 'supports_excerpt', $post_type, false ), + 'trackbacks' => (bool) pods_v( 'supports_trackbacks', $post_type, false ), + 'custom-fields' => (bool) pods_v( 'supports_custom_fields', $post_type, false ), + 'comments' => (bool) pods_v( 'supports_comments', $post_type, false ), + 'revisions' => (bool) pods_v( 'supports_revisions', $post_type, false ), + 'page-attributes' => (bool) pods_v( 'supports_page_attributes', $post_type, false ), + 'post-formats' => (bool) pods_v( 'supports_post_formats', $post_type, false ), + 'quick-edit' => (bool) pods_v( 'supports_quick_edit', $post_type, true ), ]; // Custom Supported @@ -1206,20 +1206,20 @@ public function setup_content_types( $force = false ) { // Genesis Support if ( function_exists( 'genesis' ) ) { - $cpt_supported['genesis-seo'] = (boolean) pods_v( 'supports_genesis_seo', $post_type, false ); - $cpt_supported['genesis-layouts'] = (boolean) pods_v( 'supports_genesis_layouts', $post_type, false ); - $cpt_supported['genesis-simple-sidebars'] = (boolean) pods_v( 'supports_genesis_simple_sidebars', $post_type, false ); + $cpt_supported['genesis-seo'] = (bool) pods_v( 'supports_genesis_seo', $post_type, false ); + $cpt_supported['genesis-layouts'] = (bool) pods_v( 'supports_genesis_layouts', $post_type, false ); + $cpt_supported['genesis-simple-sidebars'] = (bool) pods_v( 'supports_genesis_simple_sidebars', $post_type, false ); } // YARPP Support if ( defined( 'YARPP_VERSION' ) ) { - $cpt_supported['yarpp_support'] = (boolean) pods_v( 'supports_yarpp_support', $post_type, false ); + $cpt_supported['yarpp_support'] = (bool) pods_v( 'supports_yarpp_support', $post_type, false ); } // Jetpack Support if ( class_exists( 'Jetpack' ) ) { - $cpt_supported['supports_jetpack_publicize'] = (boolean) pods_v( 'supports_jetpack_publicize', $post_type, false ); - $cpt_supported['supports_jetpack_markdown'] = (boolean) pods_v( 'supports_jetpack_markdown', $post_type, false ); + $cpt_supported['supports_jetpack_publicize'] = (bool) pods_v( 'supports_jetpack_publicize', $post_type, false ); + $cpt_supported['supports_jetpack_markdown'] = (bool) pods_v( 'supports_jetpack_markdown', $post_type, false ); } $cpt_supports = []; @@ -1239,12 +1239,12 @@ public function setup_content_types( $force = false ) { } // Rewrite - $cpt_rewrite = (boolean) pods_v( 'rewrite', $post_type, true ); + $cpt_rewrite = (bool) pods_v( 'rewrite', $post_type, true ); $cpt_rewrite_array = [ 'slug' => pods_v( 'rewrite_custom_slug', $post_type, str_replace( '_', '-', $post_type_name ), true ), - 'with_front' => (boolean) pods_v( 'rewrite_with_front', $post_type, true ), - 'feeds' => (boolean) pods_v( 'rewrite_feeds', $post_type, (boolean) pods_v( 'has_archive', $post_type, false ) ), - 'pages' => (boolean) pods_v( 'rewrite_pages', $post_type, true ), + 'with_front' => (bool) pods_v( 'rewrite_with_front', $post_type, true ), + 'feeds' => (bool) pods_v( 'rewrite_feeds', $post_type, (bool) pods_v( 'has_archive', $post_type, false ) ), + 'pages' => (bool) pods_v( 'rewrite_pages', $post_type, true ), ]; if ( false !== $cpt_rewrite ) { @@ -1260,7 +1260,7 @@ public function setup_content_types( $force = false ) { $capability_type = pods_v( 'capability_type_custom', $post_type, pods_v( 'name', $post_type, 'post', true ), true ); } - $show_in_menu = (boolean) pods_v( 'show_in_menu', $post_type, true ); + $show_in_menu = (bool) pods_v( 'show_in_menu', $post_type, true ); if ( $show_in_menu && 0 < strlen( (string) pods_v( 'menu_location_custom', $post_type ) ) ) { $show_in_menu = (string) pods_v( 'menu_location_custom', $post_type ); @@ -1277,31 +1277,31 @@ public function setup_content_types( $force = false ) { 'label' => $cpt_label, 'labels' => $cpt_labels, 'description' => esc_html( pods_v( 'description', $post_type ) ), - 'public' => (boolean) pods_v( 'public', $post_type, true ), - 'publicly_queryable' => (boolean) pods_v( 'publicly_queryable', $post_type, (boolean) pods_v( 'public', $post_type, true ) ), - 'exclude_from_search' => (boolean) pods_v( 'exclude_from_search', $post_type, ( (boolean) pods_v( 'public', $post_type, true ) ? false : true ) ), - 'show_ui' => (boolean) pods_v( 'show_ui', $post_type, (boolean) pods_v( 'public', $post_type, true ) ), + 'public' => (bool) pods_v( 'public', $post_type, true ), + 'publicly_queryable' => (bool) pods_v( 'publicly_queryable', $post_type, (bool) pods_v( 'public', $post_type, true ) ), + 'exclude_from_search' => (bool) pods_v( 'exclude_from_search', $post_type, ( (bool) pods_v( 'public', $post_type, true ) ? false : true ) ), + 'show_ui' => (bool) pods_v( 'show_ui', $post_type, (bool) pods_v( 'public', $post_type, true ) ), 'show_in_menu' => $show_in_menu, - 'show_in_nav_menus' => (boolean) pods_v( 'show_in_nav_menus', $post_type, (boolean) pods_v( 'public', $post_type, true ) ), - 'show_in_admin_bar' => (boolean) pods_v( 'show_in_admin_bar', $post_type, (boolean) pods_v( 'show_in_menu', $post_type, true ) ), + 'show_in_nav_menus' => (bool) pods_v( 'show_in_nav_menus', $post_type, (bool) pods_v( 'public', $post_type, true ) ), + 'show_in_admin_bar' => (bool) pods_v( 'show_in_admin_bar', $post_type, (bool) pods_v( 'show_in_menu', $post_type, true ) ), 'menu_position' => (int) pods_v( 'menu_position', $post_type, 0, true ), 'menu_icon' => $menu_icon, 'capability_type' => $capability_type, // 'capabilities' => $cpt_capabilities, - 'map_meta_cap' => (boolean) pods_v( 'capability_type_extra', $post_type, true ), - 'hierarchical' => (boolean) pods_v( 'hierarchical', $post_type, false ), - 'can_export' => (boolean) pods_v( 'can_export', $post_type, true ), + 'map_meta_cap' => (bool) pods_v( 'capability_type_extra', $post_type, true ), + 'hierarchical' => (bool) pods_v( 'hierarchical', $post_type, false ), + 'can_export' => (bool) pods_v( 'can_export', $post_type, true ), 'supports' => $cpt_supports, // 'register_meta_box_cb' => array($this, 'manage_meta_box'), // 'permalink_epmask' => EP_PERMALINK, - 'has_archive' => ( (boolean) pods_v( 'has_archive', $post_type, false ) ) ? pods_v( 'has_archive_slug', $post_type, true, true ) : false, + 'has_archive' => ( (bool) pods_v( 'has_archive', $post_type, false ) ) ? pods_v( 'has_archive_slug', $post_type, true, true ) : false, 'rewrite' => $cpt_rewrite, - 'query_var' => ( false !== (boolean) pods_v( 'query_var', $post_type, true ) ? pods_v( 'query_var_string', $post_type, $post_type_name, true ) : false ), - 'delete_with_user' => (boolean) pods_v( 'delete_with_user', $post_type, true ), + 'query_var' => ( false !== (bool) pods_v( 'query_var', $post_type, true ) ? pods_v( 'query_var_string', $post_type, $post_type_name, true ) : false ), + 'delete_with_user' => (bool) pods_v( 'delete_with_user', $post_type, true ), '_provider' => 'pods', ]; - if ( (boolean) pods_v( 'disable_create_posts', $post_type, false ) ) { + if ( (bool) pods_v( 'disable_create_posts', $post_type, false ) ) { $pods_post_types[ $post_type_name ]['capabilities'] = [ 'create_posts' => false, ]; @@ -1314,7 +1314,7 @@ public function setup_content_types( $force = false ) { } // REST API - $rest_enabled = (boolean) pods_v( 'rest_enable', $post_type, false ); + $rest_enabled = (bool) pods_v( 'rest_enable', $post_type, false ); if ( $rest_enabled ) { $rest_base = sanitize_title( pods_v( 'rest_base', $post_type, $post_type_name ) ); @@ -1375,7 +1375,7 @@ public function setup_content_types( $force = false ) { continue; } - if ( false !== (boolean) pods_v( 'built_in_taxonomies_' . $taxonomy, $post_type, false ) ) { + if ( false !== (bool) pods_v( 'built_in_taxonomies_' . $taxonomy, $post_type, false ) ) { $cpt_taxonomies[] = $taxonomy; if ( isset( $supported_post_types[ $taxonomy ] ) && ! in_array( $post_type_name, $supported_post_types[ $taxonomy ], true ) ) { @@ -1437,11 +1437,11 @@ public function setup_content_types( $force = false ) { $ct_labels['desc_field_description'] = pods_v( 'label_desc_field_description', $taxonomy, '', true ); // Rewrite - $ct_rewrite = (boolean) pods_v( 'rewrite', $taxonomy, true ); + $ct_rewrite = (bool) pods_v( 'rewrite', $taxonomy, true ); $ct_rewrite_array = [ 'slug' => pods_v( 'rewrite_custom_slug', $taxonomy, str_replace( '_', '-', $taxonomy_name ), true ), - 'with_front' => (boolean) pods_v( 'rewrite_with_front', $taxonomy, true ), - 'hierarchical' => (boolean) pods_v( 'rewrite_hierarchical', $taxonomy, (boolean) pods_v( 'hierarchical', $taxonomy, false ) ), + 'with_front' => (bool) pods_v( 'rewrite_with_front', $taxonomy, true ), + 'hierarchical' => (bool) pods_v( 'rewrite_hierarchical', $taxonomy, (bool) pods_v( 'hierarchical', $taxonomy, false ) ), ]; if ( false !== $ct_rewrite ) { @@ -1483,22 +1483,22 @@ public function setup_content_types( $force = false ) { 'label' => $ct_label, 'labels' => $ct_labels, 'description' => esc_html( pods_v( 'description', $taxonomy ) ), - 'public' => (boolean) pods_v( 'public', $taxonomy, true ), - 'publicly_queryable' => (boolean) pods_v( 'publicly_queryable', $taxonomy, (boolean) pods_v( 'public', $taxonomy, true ) ), - 'show_ui' => (boolean) pods_v( 'show_ui', $taxonomy, (boolean) pods_v( 'public', $taxonomy, true ) ), - 'show_in_menu' => (boolean) pods_v( 'show_in_menu', $taxonomy, (boolean) pods_v( 'public', $taxonomy, true ) ), - 'show_in_nav_menus' => (boolean) pods_v( 'show_in_nav_menus', $taxonomy, (boolean) pods_v( 'public', $taxonomy, true ) ), - 'show_tagcloud' => (boolean) pods_v( 'show_tagcloud', $taxonomy, (boolean) pods_v( 'show_ui', $taxonomy, (boolean) pods_v( 'public', $taxonomy, true ) ) ), - 'show_in_quick_edit' => (boolean) pods_v( 'show_in_quick_edit', $taxonomy, (boolean) pods_v( 'show_ui', $taxonomy, (boolean) pods_v( 'public', $taxonomy, true ) ) ), - 'hierarchical' => (boolean) pods_v( 'hierarchical', $taxonomy, false ), + 'public' => (bool) pods_v( 'public', $taxonomy, true ), + 'publicly_queryable' => (bool) pods_v( 'publicly_queryable', $taxonomy, (bool) pods_v( 'public', $taxonomy, true ) ), + 'show_ui' => (bool) pods_v( 'show_ui', $taxonomy, (bool) pods_v( 'public', $taxonomy, true ) ), + 'show_in_menu' => (bool) pods_v( 'show_in_menu', $taxonomy, (bool) pods_v( 'public', $taxonomy, true ) ), + 'show_in_nav_menus' => (bool) pods_v( 'show_in_nav_menus', $taxonomy, (bool) pods_v( 'public', $taxonomy, true ) ), + 'show_tagcloud' => (bool) pods_v( 'show_tagcloud', $taxonomy, (bool) pods_v( 'show_ui', $taxonomy, (bool) pods_v( 'public', $taxonomy, true ) ) ), + 'show_in_quick_edit' => (bool) pods_v( 'show_in_quick_edit', $taxonomy, (bool) pods_v( 'show_ui', $taxonomy, (bool) pods_v( 'public', $taxonomy, true ) ) ), + 'hierarchical' => (bool) pods_v( 'hierarchical', $taxonomy, false ), // 'capability_type' => $capability_type, 'capabilities' => $tax_capabilities, - // 'map_meta_cap' => (boolean) pods_v( 'capability_type_extra', $taxonomy, true ), + // 'map_meta_cap' => (bool) pods_v( 'capability_type_extra', $taxonomy, true ), 'update_count_callback' => pods_v( 'update_count_callback', $taxonomy, null, true ), - 'query_var' => ( false !== (boolean) pods_v( 'query_var', $taxonomy, true ) ? pods_v( 'query_var_string', $taxonomy, $taxonomy_name, true ) : false ), + 'query_var' => ( false !== (bool) pods_v( 'query_var', $taxonomy, true ) ? pods_v( 'query_var_string', $taxonomy, $taxonomy_name, true ) : false ), 'rewrite' => $ct_rewrite, - 'show_admin_column' => (boolean) pods_v( 'show_admin_column', $taxonomy, false ), - 'sort' => (boolean) pods_v( 'sort', $taxonomy, false ), + 'show_admin_column' => (bool) pods_v( 'show_admin_column', $taxonomy, false ), + 'sort' => (bool) pods_v( 'sort', $taxonomy, false ), '_provider' => 'pods', ]; @@ -1522,7 +1522,7 @@ public function setup_content_types( $force = false ) { } // REST API - $rest_enabled = (boolean) pods_v( 'rest_enable', $taxonomy, false ); + $rest_enabled = (bool) pods_v( 'rest_enable', $taxonomy, false ); if ( $rest_enabled ) { $rest_base = sanitize_title( pods_v( 'rest_base', $taxonomy, $taxonomy_name ) ); @@ -1551,8 +1551,8 @@ public function setup_content_types( $force = false ) { // Integration for Single Value Taxonomy UI if ( function_exists( 'tax_single_value_meta_box' ) ) { - $pods_taxonomies[ $taxonomy_name ]['single_value'] = (boolean) pods_v( 'single_value', $taxonomy, false ); - $pods_taxonomies[ $taxonomy_name ]['required'] = (boolean) pods_v( 'single_value_required', $taxonomy, false ); + $pods_taxonomies[ $taxonomy_name ]['single_value'] = (bool) pods_v( 'single_value', $taxonomy, false ); + $pods_taxonomies[ $taxonomy_name ]['required'] = (bool) pods_v( 'single_value_required', $taxonomy, false ); } // Post Types @@ -1566,7 +1566,7 @@ public function setup_content_types( $force = false ) { continue; } - if ( false !== (boolean) pods_v( 'built_in_post_types_' . $post_type, $taxonomy, false ) ) { + if ( false !== (bool) pods_v( 'built_in_post_types_' . $post_type, $taxonomy, false ) ) { $ct_post_types[] = $post_type; if ( isset( $supported_taxonomies[ $post_type ] ) && ! in_array( $taxonomy_name, $supported_taxonomies[ $post_type ], true ) ) { @@ -1755,7 +1755,7 @@ public function setup_content_types( $force = false ) { $pod = $post_types[ $post_type_name ]; // REST API - $rest_enabled = (boolean) pods_v( 'rest_enable', $pod, false ); + $rest_enabled = (bool) pods_v( 'rest_enable', $pod, false ); if ( $rest_enabled ) { if ( empty( $wp_post_types[ $post_type_name ]->show_in_rest ) ) { @@ -1784,7 +1784,7 @@ public function setup_content_types( $force = false ) { $pod = $taxonomies[ $taxonomy_name ]; // REST API - $rest_enabled = (boolean) pods_v( 'rest_enable', $pod, false ); + $rest_enabled = (bool) pods_v( 'rest_enable', $pod, false ); if ( $rest_enabled ) { if ( empty( $wp_taxonomies[ $taxonomy_name ]->show_in_rest ) ) { @@ -1802,7 +1802,7 @@ public function setup_content_types( $force = false ) { if ( ! empty( PodsMeta::$user ) ) { $pod = current( PodsMeta::$user ); - $rest_enabled = (boolean) pods_v( 'rest_enable', $pod, false ); + $rest_enabled = (bool) pods_v( 'rest_enable', $pod, false ); if ( $rest_enabled ) { new PodsRESTFields( $pod ); @@ -1812,7 +1812,7 @@ public function setup_content_types( $force = false ) { if ( ! empty( PodsMeta::$media ) ) { $pod = current( PodsMeta::$media ); - $rest_enabled = (boolean) pods_v( 'rest_enable', $pod, false ); + $rest_enabled = (bool) pods_v( 'rest_enable', $pod, false ); if ( $rest_enabled ) { new PodsRESTFields( $pod ); @@ -1857,7 +1857,7 @@ public function quick_edit_enabled_for_post_type( bool $enable, string $post_typ return $enable; } - return (boolean) pods_v( 'supports_quick_edit', PodsMeta::$post_types[ $post_type ], true ); + return (bool) pods_v( 'supports_quick_edit', PodsMeta::$post_types[ $post_type ], true ); } /** @@ -1879,7 +1879,7 @@ public function quick_edit_enabled_for_taxonomy( bool $enable, string $taxonomy return $enable; } - return (boolean) pods_v( 'supports_quick_edit', PodsMeta::$taxonomies[ $taxonomy ], true ); + return (bool) pods_v( 'supports_quick_edit', PodsMeta::$taxonomies[ $taxonomy ], true ); } /** @@ -1983,7 +1983,7 @@ public function setup_updated_messages( $messages ) { 10 => sprintf( __( '%1$s draft updated. Preview %3$s', 'pods' ), $labels['singular_name'], esc_url( $preview_post_link ), $labels['singular_name'] ), ]; - if ( false === (boolean) $pods_cpt_ct['post_types'][ $post_type['name'] ]['public'] ) { + if ( false === (bool) $pods_cpt_ct['post_types'][ $post_type['name'] ]['public'] ) { // translators: %s is the singular label. $messages[ $post_type['name'] ][1] = sprintf( __( '%s updated.', 'pods' ), $labels['singular_name'] ); // translators: %s is the singular label. diff --git a/classes/PodsMeta.php b/classes/PodsMeta.php index a23801a3c5..16a84ffea4 100644 --- a/classes/PodsMeta.php +++ b/classes/PodsMeta.php @@ -1505,7 +1505,7 @@ public function save_post( $post_id, $post, $update = null ) { $data = []; if ( $pod ) { - $rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data, false ); + $rest_enable = (bool) pods_v( 'rest_enable', $pod->pod_data, false ); // Block REST API saves, we handle those separately in PodsRESTHandlers if ( defined( 'REST_REQUEST' ) && REST_REQUEST && $rest_enable ) { @@ -1796,7 +1796,7 @@ public function save_media( $post, $attachment ) { } if ( $pod ) { - $rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data, false ); + $rest_enable = (bool) pods_v( 'rest_enable', $pod->pod_data, false ); // Block REST API saves, we handle those separately in PodsRESTHandlers if ( defined( 'REST_REQUEST' ) && REST_REQUEST && $rest_enable ) { @@ -2045,7 +2045,7 @@ public function save_taxonomy( $term_id, $term_taxonomy_id, $taxonomy ) { } if ( $pod ) { - $rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data, false ); + $rest_enable = (bool) pods_v( 'rest_enable', $pod->pod_data, false ); // Block REST API saves, we handle those separately in PodsRESTHandlers if ( defined( 'REST_REQUEST' ) && REST_REQUEST && $rest_enable ) { @@ -2283,7 +2283,7 @@ public function save_user( $user_id, $old_user_data = null ) { $data = []; if ( $pod ) { - $rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data, false ); + $rest_enable = (bool) pods_v( 'rest_enable', $pod->pod_data, false ); // Block REST API saves, we handle those separately in PodsRESTHandlers if ( defined( 'REST_REQUEST' ) && REST_REQUEST && $rest_enable ) { @@ -2758,7 +2758,7 @@ public function save_comment( $comment_id ) { } if ( $pod ) { - $rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data, false ); + $rest_enable = (bool) pods_v( 'rest_enable', $pod->pod_data, false ); // Block REST API saves, we handle those separately in PodsRESTHandlers if ( defined( 'REST_REQUEST' ) && REST_REQUEST && $rest_enable ) { diff --git a/classes/PodsRESTHandlers.php b/classes/PodsRESTHandlers.php index b369277898..f3c9ae2333 100755 --- a/classes/PodsRESTHandlers.php +++ b/classes/PodsRESTHandlers.php @@ -282,7 +282,7 @@ public static function save_handler( $object, $request, $creating ) { global $wp_rest_additional_fields; - $rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data, false ); + $rest_enable = (bool) pods_v( 'rest_enable', $pod->pod_data, false ); if ( $pod && $rest_enable && ! empty( $wp_rest_additional_fields[ $type ] ) ) { $fields = $pod->fields(); diff --git a/classes/fields/datetime.php b/classes/fields/datetime.php index 9c98b35a01..c665aa3196 100644 --- a/classes/fields/datetime.php +++ b/classes/fields/datetime.php @@ -721,7 +721,7 @@ public function get_time_formats_24( $js = false ) { * * @param string $format Format string. * @param string $date Defaults to time() if empty. - * @param boolean $return_timestamp Whether to return the strtotime() or createFromFormat result or not. + * @param bool $return_timestamp Whether to return the strtotime() or createFromFormat result or not. * * @return DateTime|null|int|false */ @@ -809,9 +809,9 @@ public function is_storage_format( $value ) { * @param string $value Field value. * @param string $new_format New format string. * @param string|array $original_format Original format string(s) (if known). - * @param boolean $return_timestamp Whether to return the strtotime() or createFromFormat result or not. + * @param bool $return_timestamp Whether to return the strtotime() or createFromFormat result or not. * - * @return string|int|boolean|DateTime + * @return string|int|bool|DateTime */ public function convert_date( $value, $new_format, $original_format = '', $return_timestamp = false ) { diff --git a/classes/fields/file.php b/classes/fields/file.php index 7cd1add3b6..13af1a9868 100644 --- a/classes/fields/file.php +++ b/classes/fields/file.php @@ -994,8 +994,8 @@ public function markup( $attributes, $limit = 1, $editable = true, $id = null, $ $link = '{{link}}'; } - $editable = (boolean) $editable; - $linked = (boolean) $linked; + $editable = (bool) $editable; + $linked = (bool) $linked; ?>