public static function get() {
        if ($data = @file_get_contents("https://raw.github.com/tobie/ua-parser/master/regexes.yaml")) {
            if (file_exists(__DIR__."/resources/regexes.yaml")) {
                if (!self::$nobackup) { 
                    if (!self::$silent) { print("backing up old YAML file...\n"); }
                        if (!copy(__DIR__."/resources/regexes.yaml", __DIR__."/resources/regexes.".date("Ymdhis").".yaml")) {
                            if (!self::$silent) { print("back-up failed...\n"); }
                                exit;
                        }
                }
            }
            $fp = fopen(__DIR__."/resources/regexes.yaml", "w");
            fwrite($fp, $data);
            fclose($fp);
            if (!self::$silent) { print("success...\n"); }
        } else {
            if (!self::$silent) { print("failed to get the file...\n"); }
        }
    }
public static function get() {
        if ($data = @file_get_contents("https://raw.github.com/tobie/ua-parser/master/regexes.yaml")) {
            if (file_exists(__DIR__."/resources/regexes.yaml")) {
                if (!self::$nobackup) { 
                    if (!self::$silent) { print("backing up old YAML file...\n"); }
                        if (!copy(__DIR__."/resources/regexes.yaml", __DIR__."/resources/regexes.".date("Ymdhis").".yaml")) {
                            if (!self::$silent) { print("back-up failed...\n"); }
                                exit;
                        }
                }
            }
            $fp = fopen(__DIR__."/resources/regexes.yaml", "w");
            fwrite($fp, $data);
            fclose($fp);
            if (!self::$silent) { print("success...\n"); }
        } else {
            if (!self::$silent) { print("failed to get the file...\n"); }
        }
    }
public static function get ( ) { if ( $ data = @ file_get_contents ( "https://raw.github.com/tobie/ua-parser/master/regexes.yaml" ) ) { if ( file_exists ( __DIR__ . "/resources/regexes.yaml" ) ) { if ( ! self :: $ nobackup ) { if ( ! self :: $ silent ) { print ( "backing up old YAML file...\n" ) ; } if ( ! copy ( __DIR__ . "/resources/regexes.yaml" , __DIR__ . "/resources/regexes." . date ( "Ymdhis" ) . ".yaml" ) ) { if ( ! self :: $ silent ) { print ( "back-up failed...\n" ) ; } exit ; } } } $ fp = fopen ( __DIR__ . "/resources/regexes.yaml" , "w" ) ; fwrite ( $ fp , $ data ) ; fclose ( $ fp ) ; if ( ! self :: $ silent ) { print ( "success...\n" ) ; } } else { if ( ! self :: $ silent ) { print ( "failed to get the file...\n" ) ; } } }
Gets the latest user agent. Back-ups the old version first. it will fail silently if something is wrong...
Gets the latest user agent . Back - ups the old version first . it will fail silently if something is wrong ...