backupbuddy_backup/wp-content/plugins/backupbuddy/classes/core.php
/* determineLatestVersion()
	 *
	 * Latest version info. Array of latest major,minor. False on fail to get.
	 *
	 */
determineLatestVersion()
Latest version info. Array of latest major,minor. False on fail to get.
determineLatestVersion () Latest version info . Array of latest major minor . False on fail to get .
public static function determineLatestVersion( $bypassCache = false ) {
		$latest_backupbuddy_version_cache_minutes = 60*12; 
		function pb_backupbuddy_split2( $string,$needle,$nth ) {
			$max = strlen($string);
			$n = 0;
			for($i=0;$i<$max;$i++){
				if ($string[$i]==$needle){
					$n++;
					if($n>=$nth){
						break;
					}
				}
			}
			$arr[] = substr($string,0,$i);
			$arr[] = substr($string,$i+1,$max);
			return $arr;
		}
		if ( true === $bypassCache ) {
			$latest_backupbuddy_version = false;
		} else {
			$latest_backupbuddy_version = get_transient( 'pb_backupbuddy_latest_version' );
		}
		if ( ( false === $latest_backupbuddy_version ) || ( ! is_array( $latest_backupbuddy_version ) ) ) {
			$response = wp_remote_get( 'http://api.ithemes.com/product/version?apikey=ixho7dk0p244n0ob&package=backupbuddy&channel=stable', array(
					'method' => 'GET',
					'timeout' => 7,
					'redirection' => 3,
					'httpversion' => '1.0',
					'headers' => array(),
					'body' => null,
					'cookies' => array()
				)
			);
			if( is_wp_error( $response ) ) {
				$latest_backupbuddy_version = array( 0, 0 ); 
			} else {
				$minorVersion = $response['body'];
				$majorVersion = pb_backupbuddy_split2( $minorVersion, '.', 3 );
				$majorVersion = $majorVersion[0];
				$latest_backupbuddy_version = array( $minorVersion, $majorVersion );
			}
			set_transient( 'pb_backupbuddy_latest_version', $latest_backupbuddy_version, 60* $latest_backupbuddy_version_cache_minutes );
		} 
		if ( ( 0 == $latest_backupbuddy_version[0] ) && ( 0 == $latest_backupbuddy_version[1] ) ) { 
			return false;
		}
		return $latest_backupbuddy_version;
	}
public static function determineLatestVersion ( $ bypassCache = false ) { $ latest_backupbuddy_version_cache_minutes = 60 * 12 ; function pb_backupbuddy_split2 ( $ string , $ needle , $ nth ) { $ max = strlen ( $ string ) ; $ n = 0 ; for ( $ i = 0 ; $ i < $ max ; $ i ++ ) { if ( $ string [ $ i ] == $ needle ) { $ n ++ ; if ( $ n >= $ nth ) { break ; } } } $ arr [ ] = substr ( $ string , 0 , $ i ) ; $ arr [ ] = substr ( $ string , $ i + 1 , $ max ) ; return $ arr ; } if ( true === $ bypassCache ) { $ latest_backupbuddy_version = false ; } else { $ latest_backupbuddy_version = get_transient ( 'pb_backupbuddy_latest_version' ) ; } if ( ( false === $ latest_backupbuddy_version ) || ( ! is_array ( $ latest_backupbuddy_version ) ) ) { $ response = wp_remote_get ( 'http://api.ithemes.com/product/version?apikey=ixho7dk0p244n0ob&package=backupbuddy&channel=stable' , array ( 'method' => 'GET' , 'timeout' => 7 , 'redirection' => 3 , 'httpversion' => '1.0' , 'headers' => array ( ) , 'body' => null , 'cookies' => array ( ) ) ) ; if ( is_wp_error ( $ response ) ) { $ latest_backupbuddy_version = array ( 0 , 0 ) ; } else { $ minorVersion = $ response [ 'body' ] ; $ majorVersion = pb_backupbuddy_split2 ( $ minorVersion , '.' , 3 ) ; $ majorVersion = $ majorVersion [ 0 ] ; $ latest_backupbuddy_version = array ( $ minorVersion , $ majorVersion ) ; } set_transient ( 'pb_backupbuddy_latest_version' , $ latest_backupbuddy_version , 60 * $ latest_backupbuddy_version_cache_minutes ) ; } if ( ( 0 == $ latest_backupbuddy_version [ 0 ] ) && ( 0 == $ latest_backupbuddy_version [ 1 ] ) ) { return false ; } return $ latest_backupbuddy_version ; }
determineLatestVersion()
 Latest version info.
determineLatestVersion () Latest version info .
// Define how many minutes to cache the latest backupbuddy version number. //'blocking' => true, // Set to 0 for transient to prevent hitting server again for a bit since something went wrong. // end not cached. // Server not responding.