Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions classes/Pods.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function rewind() : void {
/**
* Get current Iterator row
*
* @return mixed|boolean
* @return mixed|bool
*
* @since 2.3.4
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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'] ) ) {
Expand Down
46 changes: 23 additions & 23 deletions classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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' );

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = (
(
Expand Down Expand Up @@ -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'] ) ) {
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ) ) {
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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'] );
}
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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 );

Expand All @@ -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.
*
Expand Down Expand Up @@ -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'] );
}
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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'] );
}
Expand Down Expand Up @@ -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.
*
Expand Down
2 changes: 1 addition & 1 deletion classes/PodsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/PodsArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
8 changes: 4 additions & 4 deletions classes/PodsComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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 );
Expand Down Expand Up @@ -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;
}
}
Expand Down
14 changes: 7 additions & 7 deletions classes/PodsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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__ );
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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 );

Expand Down
4 changes: 2 additions & 2 deletions classes/PodsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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.
*
Expand Down
Loading