public/wordpress/wp-content/plugins/backupbuddy/lib/xzipbuddy/zipbuddy.php
/**
		 *	derive_optional_int()
		 *
		 *	Utility function to derive the value of an optional integer based on either
		 *	a specifc value being given or the related global option being set or a given
		 *	default value otherise.
		 *	If the provided $value is null then this forces the use of the global option if
		 *	it is set (adjusted by any factor given) or otherwise the default value given.
		 *	If the global option is set but is not numeric (generally left empty) then we
		 *	use the provided $empty_option_value (which is _not_ adjusted by the factor but
		 *	assumed to be valid as it is - for example if the option is given in MB but
		 *	the required value to use is in bytes then we would adjust by multiplying by
		 *	1024*1024 but the empty option value is assumed to be provided in bytes and so
		 *	is not adjusted.
		 *	In the case of using the adjusted option value or the empty option value we also
		 *	apply any value may given so hat, for example, an option value of 0 can be
		 *	mapped to mean "infinite".
		 *	Note: integer 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 integer as this will return true for
		 *	any string that is a numerical value as well as the option being an integer value
		 *	in any case but crucually will return false for an empry string as this does not
		 *	represent any numerical value and hence that triggers the use of the empty option
		 *	default value.
		 *	We coerce any numeric string into an integer for assignment.
		 *
		 *	@param		string		$option					The option name in the global options array
		 *	@param		mixed		$value					Should be integer but could be null
		 * 	@param		int			$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		int			$empty_option_default	Default value to use if option is set but empty
		 *	@return		int									Derived integer value
		 *
		 */
derive_optional_int()
Utility function to derive the value of an optional integer based on either
a specifc value being given or the related global option being set or a given
default value otherise.
If the provided $value is null then this forces the use of the global option if
it is set (adjusted by any factor given) or otherwise the default value given.
If the global option is set but is not numeric (generally left empty) then we
use the provided $empty_option_value (which is _not_ adjusted by the factor but
assumed to be valid as it is - for example if the option is given in MB but
the required value to use is in bytes then we would adjust by multiplying by
1024*1024 but the empty option value is assumed to be provided in bytes and so
is not adjusted.
In the case of using the adjusted option value or the empty option value we also
apply any value may given so hat, for example, an option value of 0 can be
mapped to mean "infinite".
Note: integer 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 integer as this will return true for
any string that is a numerical value as well as the option being an integer value
in any case but crucually will return false for an empry string as this does not
represent any numerical value and hence that triggers the use of the empty option
default value.
We coerce any numeric string into an integer for assignment.


derive_optional_int () Utility function to derive the value of an optional integer based on either a specifc value being given or the related global option being set or a given default value otherise . If the provided $value is null then this forces the use of the global option if it is set ( adjusted by any factor given ) or otherwise the default value given . If the global option is set but is not numeric ( generally left empty ) then we use the provided $empty_option_value ( which is _not_ adjusted by the factor but assumed to be valid as it is - for example if the option is given in MB but the required value to use is in bytes then we would adjust by multiplying by 1024 * 1024 but the empty option value is assumed to be provided in bytes and so is not adjusted . In the case of using the adjusted option value or the empty option value we also apply any value may given so hat for example an option value of 0 can be mapped to mean " infinite " . Note : integer 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 integer as this will return true for any string that is a numerical value as well as the option being an integer value in any case but crucually will return false for an empry string as this does not represent any numerical value and hence that triggers the use of the empty option default value . We coerce any numeric string into an integer for assignment .
protected function derive_optional_int( $option, $value, $default, $option_value_map = array(), $option_value_factor = 1, $empty_option_default = PHP_INT_MAX ) {
		 	$result = PHP_INT_MAX;
		 	if ( is_int( $value )) {
		 		$result = $value;
		 	} elseif ( isset( pb_backupbuddy::$options[ $option ] ) ) {
		 		$result = ( is_numeric( pb_backupbuddy::$options[ $option ] ) ) ? (int)( pb_backupbuddy::$options[ $option ] * $option_value_factor ) : $empty_option_default ;
		 		$result = ( array_key_exists( $result, $option_value_map ) ) ? $option_value_map[ $result ] : $result ;
		 	} else {
		 		$result = $default;
		 	}
		 	return $result;
		 }
protected function derive_optional_int ( $ option , $ value , $ default , $ option_value_map = array ( ) , $ option_value_factor = 1 , $ empty_option_default = PHP_INT_MAX ) { $ result = PHP_INT_MAX ; if ( is_int ( $ value ) ) { $ result = $ value ; } elseif ( isset ( pb_backupbuddy :: $ options [ $ option ] ) ) { $ result = ( is_numeric ( pb_backupbuddy :: $ options [ $ option ] ) ) ? ( int ) ( pb_backupbuddy :: $ options [ $ option ] * $ option_value_factor ) : $ empty_option_default ; $ result = ( array_key_exists ( $ result , $ option_value_map ) ) ? $ option_value_map [ $ result ] : $ result ; } else { $ result = $ default ; } return $ result ; }
derive_optional_int()
      Utility function to derive the value of an optional integer based on either
      a specifc value being given or the related global option being set or a given
      default value otherise.
derive_optional_int () Utility function to derive the value of an optional integer based on either a specifc value being given or the related global option being set or a given default value otherise .