show local and remote diff

@param string $url the time original

@return string
437750
public function diffCommand($url = 'http://www.baidu.com')
    {
        $remote_ts = $this->_getRemoteTimestamp($url);
        $local_ts = time();
        if ($remote_ts === false) {
            return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]);
        } else {
            $this->console->writeLn(' local: ' . date('Y-m-d H:i:s', $local_ts));
            $this->console->writeLn('remote: ' . date('Y-m-d H:i:s', $remote_ts));
            $this->console->writeLn('  diff: ' . ($local_ts - $remote_ts));
            return 0;
        }
    }
628402
public function history($url){
    if ( !empty($url) &&
      ( $dir = $this->dir_from_url($url) ) &&
      ( $dir_cfg = $this->dir($dir) ) &&
      \defined('BBN_USER_PATH')
    ){
      $res = [];
      $all = [];
      // IDE backup path
      $path = BBN_USER_PATH."ide/backup/$dir";
      // Remove dir name from url
      $file = substr($url, \strlen($dir), \strlen($url));
      // MVC
      if ( !empty($dir_cfg['tabs']) ){
        foreach ( $dir_cfg['tabs'] as $t ){
          if ( empty($t['fixed']) ){
            // The file's backup path of the MVC's tab
            $p = $path . $t['path'] . $file . '/';
            // Get history
            $all = self::get_history($p, $t, $all, true);
          }
        }
      }
      else {
        // The file's backup path of the MVC's tab
        $p = $path . $file . '/';
        // Get history
        $all = self::get_history($p, $dir_cfg, $all);
      }
      if ( !empty($all) ){
        foreach ( $all as $i => $a ){
          if ( !empty($dir_cfg['tabs']) ){
            $tmp = [];
            foreach ( $a as $k => $b ){
              array_push($tmp, [
                'text' => $k,
                'items' => $b
              ]);
            }
          }
          array_push($res, [
            'text' => $i,
            'items' => !empty($tmp) ? $tmp : $a
          ]);
        }
      }
      return ['list' => $res];
    }
  }
44498
protected function timestamped_endpoint( $url ) {
		// Make string for cache with GMT.
		// This is for caching thus you get
		// unique request only for 1 time in 10 minutes.
		$time = substr( date_i18n( 'YmdHi', false, true ), 0, -1 ) . '0';
		return add_query_arg( [
			'timestamp' => $time,
		], $url );
	}
1189820
public function url($url)
    {
        if (is_string($url)) {
            $url = $this->localePrefix($url);
        }

        try {
            $url = Router::url($url, true);
        } catch (\Exception $ex) {
            $url = '';
        }

        return $url;
    }
1131335
public function localePrefix($url)
    {
        if (option('url_locale_prefix') &&
            str_starts_with($url, '/') &&
            !preg_match('/^\/' . $this->_localesPattern() . '/', $url)
        ) {
            $url = '/' . I18n::locale() . $url;
        }

        return $url;
    }
679241
private function cleanUrl($url)
    {
        if (strlen($url) > 1 && strrpos($url, '/') === strlen($url) - 1) {
            $url = substr($url, 0, -1);
        }
        if (strrpos($url, '.php') === strlen($url) - 4) {
            $url = substr($url, 0, -4);
        }
        return $url;
    }
32774
public function info($url)
    {
        $url = 'http://' . $this->ip . '/' . ltrim($url, '/');
        $options = [
            CURLOPT_URL            => $url,
            CURLOPT_PORT           => $this->port,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_VERBOSE        => WS::config()->get('debug', false)
        ];

        $ch = curl_init();
        curl_setopt_array($ch, $options);
        $response = curl_exec($ch);

        return $this->formatResponse($response);
    }
896898
private function transformSshUrlIntoHttp($url)
    {
        $pattern = '#git@' . $this->getDomain() . ':' . self::REGEX_USER . '/' . self::REGEX_REPOSITORY . '.git$#';

        if (preg_match($pattern, $url, $matches)) {
            return sprintf(
                'https://%s/%s/%s',
                $this->getDomain(),
                $matches['user'],
                $matches['repository']
            );
        }

        return $url;
    }
927757
public static function getRequestClientIP($url='')
    {
        if (!$url || !is_string($url)){
            if (isset($_SERVER['REMOTE_ADDR']))
                $url = $_SERVER['REMOTE_ADDR'];
        }
        return (filter_var($url, FILTER_VALIDATE_IP)) ? $url : '';
    }
674495
public static function fixUri($url) {
        $url = preg_replace('#/+|\\\+#', '/', $url);

        if ($url[0] == '/') {
            $url = substr($url, 1, strlen($url));
        } if (substr($url, -1) == '/') {
            $url = substr($url, 0, strlen($url) - 1);
        }

        return $url;
    }
891944
public function getExposedPath($url)
    {
        $isExposedAs = '';
        list($host, $path) = $this->getUriHostAndPath($url);

        if ($host == $this->host) {
            foreach ($this->paths as $exposedPath => $exposedDirectory) {
                $relative = $this->getRelative($path, $exposedPath);
                if (!is_null($relative)) {
                    $isExposedAs = $exposedDirectory.$relative;
                    break;
                }
            }
        }

        return $isExposedAs;
    }
1344044
private function findSiteVersions($url = null)
    {
        if (!$url) {
            $url = 'home/wetter/messwerte/messwerte-an-stationen.html';
        }

        $html = $this->makeRequest($url);

        $regex = '/product\/output\/measured-values\/([a-z-]*)\/(version__[0-9]{6,8}_[0-9]{2,4})\/(de)/';
        $matches = Regex::matchAll($regex, $html);

        $versions = collect($matches->results())
            ->map(function (MatchResult $match) {
                return [
                    'parameter-name' => $match->group(1),
                    'version' => $match->group(2),
                    'lang' => $match->group(3)
                ];
            })
            ->unique('parameter-name');

        $parameterVersions = $versions;

        return collect($parameterVersions);
    }
520311
public function getDesiredUrl(?string $url = null)
  {
    if (isset($_GET['url'])) {
      $url = $_GET['url'] . (count($_GET) > 0 ? '?' : '');
      unset($_GET['url']);

      foreach ($_GET as $key => $value) {
        $url .= (ends_with($url, '?') ? '' : '&') . $key . '=' . $value;
      }
    }

    if ($url != null) return $url;
    return false;
  }
65091
public function share_url($url){
        if (empty($url)){
            if ($this->business_interface)$this->business_interface->log('share_url url is null');
            return null;
        }
        $js_api_ticket = $this->get_js_api_ticket();
        if (empty($js_api_ticket)){
            if ($this->business_interface)$this->business_interface->log('share_url js_api_ticket is null');
            return null;
        }
        $timestamp = time();
        $nonce_str = $this->get_nonce_Str(16);

        $str = "jsapi_ticket=$js_api_ticket&noncestr=$nonce_str&timestamp=$timestamp&url=$url";
        $signature = sha1($str);
        $sign_package = [
            'app_id'=>$this->config['app_id'],
            'nonce_str'=>$nonce_str,
            'timestamp'=>$timestamp,
            'url'=>$url,
            'signature'=>$signature,
            'raw_string'=>$str,
        ];
        return $sign_package;
    }
1357252
public function getRealUrl($url)
	{
		if (config('services.cdn.base_url')) {
			$s3_url = self::$s3_base_url . config('filesystems.disks.s3.bucket') . '/';

			return str_replace($s3_url, config('services.cdn.base_url'), $url);
		} else {
			return $url;
		}
	}
657345
public function get(string $url): string
    {
        $ch = curl_init($url);

        if ( ! ini_get('open_basedir')) {
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        }

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_VERBOSE, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36');
        curl_setopt($ch, CURLOPT_URL, $url);

        $content = curl_exec($ch);
        if ($content === false) {
            // there was a problem
            $error = curl_error($ch);
            throw new CurlException('Error retrieving "'.$url.'" ('.$error.')');
        }

        return $content;
    }
795606
public static function FindClockDiff() {
			$time = time();
			$pong = self::Ping();

			return ( $time - strtotime( $pong->timestamp ) );
		}