public/wordpress/wp-content/plugins/backupbuddy/lib/xzipbuddy/zipbuddy.php
/**
		 *	derive_optional_double()
		 *
		 *	Utility function to derive the value of an optional double based on either
		 *	a specifc value being given or the related global option being set or a given
		 *	defautl value otherise. If the provided $value is null then this forces the use
		 *	of the global option if it is set or otherwise the default value given.
		 *	Note: double type options may be stored as strings so that we can use an empty
		 *	string to signal we want the default value to be used - so we need to check the
		 *	option value as being numeric rather than double as this will return true for
		 *	any string that is a numerical value as well as the option being an double value
		 *	in any case but crucually will return false for an emprt string as this does not
		 *	represent any numerical value and hence that triggers the use of the default value.
		 *	We coerce any numeric string into an double for assignment.
		 *
		 *	@param		string		$option					The option name in the global options array
		 *	@param		mixed		$value					Should be double but could be null
		 * 	@param		double		$default				The deafult value to use if no other provided/available
		 *	@param		array		$option_value_map		Any special treatment for option values
		 *	@param		int			$option_value_factor	Adjustment factor if option given in units
		 *	@param		double		$empty_option_default	Default value to use if option is set but empty
		 *	@return		double								Derived double value
		 *
		 */
derive_optional_double()
Utility function to derive the value of an optional double based on either
a specifc value being given or the related global option being set or a given
defautl value otherise. If the provided $value is null then this forces the use
of the global option if it is set or otherwise the default value given.
Note: double type options may be stored as strings so that we can use an empty
string to signal we want the default value to be used - so we need to check the
option value as being numeric rather than double as this will return true for
any string that is a numerical value as well as the option being an double value
in any case but crucually will return false for an emprt string as this does not
represent any numerical value and hence that triggers the use of the default value.
We coerce any numeric string into an double for assignment.


derive_optional_double () Utility function to derive the value of an optional double based on either a specifc value being given or the related global option being set or a given defautl value otherise . If the provided $value is null then this forces the use of the global option if it is set or otherwise the default value given . Note : double type options may be stored as strings so that we can use an empty string to signal we want the default value to be used - so we need to check the option value as being numeric rather than double as this will return true for any string that is a numerical value as well as the option being an double value in any case but crucually will return false for an emprt string as this does not represent any numerical value and hence that triggers the use of the default value . We coerce any numeric string into an double for assignment .
protected function derive_optional_double( $option, $value, $default, $option_value_map = array(), $option_value_factor = 1, $empty_option_default = null ) {
		 	$large_value = ( 4 == PHP_INT_SIZE ) ? (double)( pow(2, 63) - 1 ) : (double)PHP_INT_MAX ;
		 	$empty_option_default = ( is_null( $empty_option_default ) ) ? $large_value : $empty_option_default ;
		 	$value = ( is_numeric( $value ) ) ? (double)$value : $value ;
		 	if ( is_double( $value )) {
		 		$result = $value;
		 	} elseif ( isset( pb_backupbuddy::$options[ $option ] ) ) {
		 		$result = ( is_numeric( pb_backupbuddy::$options[ $option ] ) ) ? (double)( pb_backupbuddy::$options[ $option ] * $option_value_factor ) : (double)$empty_option_default ;
		 		$result = ( array_key_exists( (int)$result, $option_value_map ) ) ? $option_value_map[ (int)$result ] : $result ;
		 		$result = ( is_null( $result ) ) ? $large_value : $result ;
		 	} else {
		 		$result = (double)$default;
		 	}
		 	return $result;
		 }
protected function derive_optional_double ( $ option , $ value , $ default , $ option_value_map = array ( ) , $ option_value_factor = 1 , $ empty_option_default = null ) { $ large_value = ( 4 == PHP_INT_SIZE ) ? ( double ) ( pow ( 2 , 63 ) - 1 ) : ( double ) PHP_INT_MAX ; $ empty_option_default = ( is_null ( $ empty_option_default ) ) ? $ large_value : $ empty_option_default ; $ value = ( is_numeric ( $ value ) ) ? ( double ) $ value : $ value ; if ( is_double ( $ value ) ) { $ result = $ value ; } elseif ( isset ( pb_backupbuddy :: $ options [ $ option ] ) ) { $ result = ( is_numeric ( pb_backupbuddy :: $ options [ $ option ] ) ) ? ( double ) ( pb_backupbuddy :: $ options [ $ option ] * $ option_value_factor ) : ( double ) $ empty_option_default ; $ result = ( array_key_exists ( ( int ) $ result , $ option_value_map ) ) ? $ option_value_map [ ( int ) $ result ] : $ result ; $ result = ( is_null ( $ result ) ) ? $ large_value : $ result ; } else { $ result = ( double ) $ default ; } return $ result ; }
derive_optional_double()
      Utility function to derive the value of an optional double based on either
      a specifc value being given or the related global option being set or a given
      defautl value otherise.
derive_optional_double () Utility function to derive the value of an optional double based on either a specifc value being given or the related global option being set or a given defautl value otherise .
// Example of a "large" value on either a 32 or 64 bit system - we cannot set this // as the $empty_option_value default value in the function sig so post-process to // set it if indicated. // Need to convert $value to a double only if it is numeric // Array keys can only be string/int - for now we'll assume that we only map // values that can be cast as int - we may have to consider a different approach // later. // Special treatment - if the value was mapped to null then we want the derived "large" value