Return Link metrics from the (free) Mozscape (f.k.a. Seomoz) API.

@access        public
@param   cols  string     The bit flags you want returned.
@param   url   string     The URL to get metrics for.
490713
public static function getCols($cols, $url = false)
    {
        if ('' == Config\ApiKeys::getMozscapeAccessId() ||
            '' == Config\ApiKeys::getMozscapeSecretKey()) {
            throw new E('In order to use the Mozscape API, you must obtain
                and set an API key first (see SEOstats\Config\ApiKeys.php).');
            exit(0);
        }

        $expires = time() + 300;

        $apiEndpoint = sprintf(Config\Services::MOZSCAPE_API_URL,
            urlencode(Helper\Url::parseHost(parent::getUrl($url))),
            $cols,
            Config\ApiKeys::getMozscapeAccessId(),
            $expires,
            urlencode(self::_getUrlSafeSignature($expires))
        );

        $ret = static::_getPage($apiEndpoint);

        return (!$ret || empty($ret) || '{}' == (string)$ret)
                ? parent::noDataDefaultValue()
                : Helper\Json::decode($ret, true);
    }
637414
function getVisUrl(url) {
    var match = /https?:\/\/(\S+)\.cartodb\.com\/viz\/(\S+)\/(?:public_)?map/.exec(url);
    if (match) {
        var user = match[1],
            mapId = match[2];
        return 'https://' + user + '.cartodb.com/api/v2/viz/' + mapId + '/viz.json';
    }
}
76639
public function url($url = null)
    {
        if ($url) {
            $command = $this->getDriver()->factoryCommand('url', WebDriver_Command::METHOD_POST, ['url' => $url]);
            //protect slowest pages and lost selenium connection
            try {
                $this->getDriver()->curl($command);
            } catch (WebDriver_NoSeleniumException $mainException) {
                if (!$this->config()->get(WebDriver_Config::IMPROVED_URL_OPEN)) {
                    throw $mainException;
                }
                try {
                    $currentUrl = $this->url();
                    $partCheck = [PHP_URL_PATH, PHP_URL_QUERY, PHP_URL_HOST];
                    $isEqual = true;
                    foreach ($partCheck as $urlPart) {
                        if (parse_url($url, $urlPart) != parse_url($currentUrl, $urlPart)) {
                            var_dump(parse_url($url, $urlPart));
                            $isEqual = false;
                        }
                    }
                    if (!$isEqual) {
                        throw $mainException;
                    }
                } catch (WebDriver_NoSeleniumException $e) {
                    throw $mainException;
                }
            }
        } else {
            $result = $this->getDriver()->curl(
                $this->getDriver()->factoryCommand('url', WebDriver_Command::METHOD_GET)
            );
            return $result['value'];
        }
    }
619802
function(url) {

         var parts = url.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/);
         var result = {
             url : parts[0],
             scheme : parts[1],
             host : parts[3],
             port : parts[4],
             path : parts[5],
             query : parts[6],
             fragment : parts[7],
         };
         result.root =
            result.scheme + '://' +
            result.host +
            (result.port ? ':' + result.port : '');

         return result;

    }
392701
function (url) {
            if (this.$.width) {
                url += ",width=" + ImageService.normalizeImageSize(this.$.width);
            }

            if (this.$.height) {
                url += ",height=" + ImageService.normalizeImageSize(this.$.height);
            }

            return url;
        }
622120
function (url) {
	var result;

	LIST.some(function (state) {
		var params = state.pattern.match(url);

		if (params) {
			result       = state;
			state.params = params;
			return true;
		}
	});

	if (result) {
		var state        = result,
			parent_index = state.name.lastIndexOf('.'), parent_name;

		while (parent_index !== -1) {
			parent_name  = state.name.substring(0, parent_index);
			state.parent = STATES[parent_name];
			state        = state.parent;

			parent_index = state.name.lastIndexOf('.');
		}

		return result;
	}
}
1063185
protected function build_rest_url($url, $params = array()) {
        $base = '';
        if (substr($this->_url, 0, 4) !== 'http') {
            $base .= 'http://';
        }

        $base .= $this->_url;
        if ($this->_port != 80) {
            $base .= ':' . $this->_port;
        }

        $rurl = new \Rapid\URL($base . '/api/' . $url, $params);
        return $rurl->out();
    }
965347
public static String getRequestLink(String url) {

        if (CmsStringUtil.isEmpty(url)) {
            return null;
        }
        int pos = url.indexOf(URL_DELIMITER);
        if (pos >= 0) {
            return url.substring(0, pos);
        }
        return url;

    }
967840
def get_urls(self, order="total_clicks desc", offset=None, count=None):
        
        req_data = [ None, order, fmt_paging(offset, count) ]
        return self.request("query:Message_Url", req_data)
740433
public static List<String> extractUriParams(String url) {
		List<String> outParams = new ArrayList<>();
		if (StringUtils.hasText(url)) {
			String[] split = StringUtils.split(url, "/");
			for (String part : split) {
				int indexOfStart = part.indexOf("{");
				int indexOfEnd = part.indexOf("}");
				if (indexOfStart != -1 && indexOfEnd != -1 && indexOfStart < indexOfEnd) {
					outParams.add(part.substring(indexOfStart + 1, indexOfEnd));
				}
			}

		}
		return outParams;
	}
792676
function toUrl(mId) {
  const parsed = parse(mId);
  let url = parsed.bareId;
  if (url[0] !== '/' && !url.match(/^https?:\/\//)) url = _baseUrl + url;
  if (!parsed.ext) {
    // no known ext, add .js
    url += '.js';
  }
  return url;
}
1351126
public function url_stat($uri, $flags)
    {
        try {
            $parts = Uri::parse($uri);

            $resource = $this->getRepository($parts['scheme'])->get($parts['path']);

            if ($resource instanceof FilesystemResource) {
                $path = $resource->getFilesystemPath();

                if ($flags & STREAM_URL_STAT_LINK) {
                    return lstat($path);
                }

                return stat($path);
            }

            $stat = self::$defaultStat;

            $metadata = $resource->getMetadata();

            $stat[self::SIZE_NUM] = $stat[self::SIZE_ASSOC] = $metadata->getSize();
            $stat[self::ACCESS_TIME_NUM] = $stat[self::ACCESS_TIME_ASSOC] = $metadata->getAccessTime();
            $stat[self::MODIFY_TIME_NUM] = $stat[self::MODIFY_TIME_ASSOC] = $metadata->getModificationTime();

            return $stat;
        } catch (ResourceNotFoundException $e) {
            if ($flags & STREAM_URL_STAT_QUIET) {
                // Same result as stat() returns on error
                // file_exists() returns false for this resource
                return false;
            }

            throw $e;
        }
    }
93803
function(object) {
      if (object instanceof ModelClass) {
        return object.url();
      }
      if (object instanceof ModelInstance || isFunc(object.$model)) {
        var model = object.$model();
        return expr(object, model.$config().identity + '.href').get() || model.url();
      }
      throw new Error('Could not get URL for ' + typeof object);
    }
433660
public static String decodeUri(String url)
	{
		int index1 = url.indexOf(sessUrlRewritePrefix);
		int index2 = url.indexOf(qMark);

		String tmp = null;
		if (index2 != -1 && index2 > index1)
		{
			tmp = url.substring(index2);
		}
		if (index1 != -1)
		{
			url = url.substring(0, index1);
			if (tmp != null)
			{
				url = url + tmp;
			}
		}
		return url;
	}
300386
public static String doGet(final String url, final int retryTimes) {

    try {
      return doGetByLoop(url, retryTimes);
    } catch (HttpException e) {
      throw new HttpException(format("Failed to download content for url: '%s'. Tried '%s' times",
        url, Math.max(retryTimes + 1, 1)));
    }
  }
250539
function(url) {
        url = url || window.location.href;
        var parameters = OpenLayers.Util.getParameters(url);

        // If we have an anchor in the url use it to split the url
        var index = url.indexOf('#');
        if (index > 0) {
            // create an url to parse on the getParameters
            url = '?' + url.substring(index + 1, url.length);

            OpenLayers.Util.extend(parameters,
                    OpenLayers.Util.getParameters(url));
        }
        return parameters;
    }
967625
public static function segmentizeUrl($url)
        {
            $url = self::normalizeUrl($url);
            $segments = explode('/', $url);

            $result = array();

            foreach ($segments as $segment) {
                if (strlen($segment)) $result[] = $segment;
            }

            return $result;
        }