Returns the current organization according to the current site url.

@static array $urls An array of url => orgId values
@return array url => orgId
161675
public function getOrganizationUrls()
    {
        static $urls;

        if (! is_array($urls)) {
            if ($this->cache) {
                $cacheId = GEMS_PROJECT_NAME . '__' . strtr(get_class($this), '\\/', '__') . '__organizations_url';
                $urls = $this->cache->load($cacheId);
            } else {
                $cacheId = false;
            }

            // When we don't use cache or cache reports 'false' for a miss or expiration
            // then try to reload the data
            if ($cacheId === false || $urls === false) {
                $urls = array();
                try {
                    $data = $this->db->fetchPairs(
                            "SELECT gor_id_organization, gor_url_base
                                FROM gems__organizations
                                WHERE gor_active=1 AND gor_url_base IS NOT NULL"
                            );
                } catch (\Zend_Db_Exception $zde) {
                    // Table might not be filled
                    $data = array();
                }
                foreach ($data as $orgId => $urlsBase) {
                    foreach (explode(' ', $urlsBase) as $url) {
                        if ($url) {
                            $urls[$url] = $orgId;
                        }
                    }
                }

                if ($cacheId) {
                    $this->cache->save($urls, $cacheId, array('organization', 'organizations'));
                }
            }
            // \MUtil_Echo::track($urls);
        }

        return $urls;
    }
497510
public static function getCurrentPath()
    {
        if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
            $url = $_SERVER['HTTP_X_REWRITE_URL'];
        } elseif (isset($_SERVER['REQUEST_URI'])) {
            $url = $_SERVER['REQUEST_URI'];
        } elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
            $url = $_SERVER['ORIG_PATH_INFO'] . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
        } else {
            $url = '';
        }

        return strpos($url, '?') ? strstr($url, '?', true) : $url;
    }
1306335
public function getTopOrganizations()
    {
        try {
            $organizations = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 AND gor_has_login=1 AND (gor_accessible_by IS NULL OR gor_accessible_by = "::") ORDER BY gor_name');
        } catch (\Exception $e) {
            try {
                // 1.4 fallback
                $organizations = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 AND gor_accessible_by IS NULL ORDER BY gor_name');
            } catch (\Exception $e) {
                $organizations = array();
            }
        }

        natsort($organizations);

        return $organizations;
    }
885419
public static function collectionFromUrl($url)
    {
        $url = Collection::collect(parse_url($url));
        $url->set('query', static::collectionFromUrlQuery($url->get('query')));

        return $url;
    }
26413
public static function getCurrentRoute()
    {
        if (!static::$currentRoute) {
            $uri = Grav::instance()['uri'];
            static::$currentRoute = RouteFactory::createFromParts($uri->toArray());
        }

        return static::$currentRoute;
    }
870452
public function getTracksForOrgs(array $orgs)
    {
        $orgWhere = "(INSTR(gtr_organizations, '|" .
                implode("|') > 0 OR INSTR(gtr_organizations, '|", array_keys($orgs)) .
                "|') > 0)";

        $select = "SELECT gtr_id_track, gtr_track_name
                    FROM gems__tracks
                    WHERE gtr_track_class != 'SingleSurveyEngine' AND
                        $orgWhere
                    ORDER BY gtr_track_name";

        return $this->db->fetchPairs($select);
    }
373217
public function getCurrentTopOrganizationId()
    {
        $userLoader = $this->loader->getUserLoader();

        // Url determines organization first.
        if ($orgId = $userLoader->getOrganizationIdByUrl()) {
            $this->_organizationFromUrl = true;
            return ' ';
        }

        $request = $this->getRequest();
        if ($request->isPost() && ($orgId = $request->getParam($this->topOrganizationFieldName))) {
            \Gems_Cookies::set('gems_toporganization', $orgId);
            return $orgId;
        } else {
            $orgs = array_keys($this->getTopOrganizations());
            $firstId = reset($orgs);
            return \Gems_Cookies::get($this->getRequest(), 'gems_toporganization', $firstId);
        }
    }
702783
public static function getCurrentUrlNoParam(){
		$url = self::getCurrentUrl();
		if(strstr($url,"#")){
			$url = substr($url,0,strpos($url,"#"));
		}
		
		if(strstr($url,"?")){
			$url = substr($url,0,strpos($url,"?"));
		}
		return $url;
		
	}
732386
private function currentURL() {
        $pageURL = 'http';
        if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
            $pageURL .= "s";
        }
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80") {
            $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
        } else {
            $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        }
        return $pageURL;
    }
153327
public static function getCurrentUrl() 
    {
        $pageURL = 'http';
        
        if (isset($_SERVER["HTTPS"])) 
        {
            $pageURL .= "s";
        }
        
        $pageURL .= "://";

        if ($_SERVER["SERVER_PORT"] != "80") 
        {
            $pageURL .= $_SERVER["SERVER_NAME"] . ":" . 
                        $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
        } 
        else 
        {
            $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        }

        return $pageURL;
    }
792617
public function getUrls()
    {
        $entities = [];
        if ($this->entity->getUrls()) {
            foreach ($this->entity->getUrls() as $entity) {
                $entities[] = $entity;
            }
        }

        return $entities;
    }
360351
public function getAction($url)
    {
        // Current route holder
        $current =  false;

        // Get requested method
        $method = $this->app->request->method() ? : 'GET';
        $method = strtolower($method);

        // Check all routes until one matches
        foreach ($this->routes[$method] as $route) {
            $matches = [];
            if (preg_match($route['pattern'], $url, $matches)) {
                if (!empty($matches)) {
                    array_shift($matches);
                    $route['params'] = array_combine(
                        $route['params'],
                        $matches
                    );
                }
                $current = $route;
                break;
            }
        }

        // Abort if none of the routes matched
        if (!$current) {
            throw new \Exception('Route not found', 404);
        }

        // Return current route
        return $current;
    }
424047
public static function getSubDomain($url)
    {
        $urlInfo = static::info($url);

        return ArrayHelper::get($urlInfo, 'sub', null, true);
    }
24222
public function getSitesIdFromSiteUrl($url)
    {
        $url = $this->removeTrailingSlash($url);
        $normalisedUrls = $this->getNormalizedUrls($url);

        if (Piwik::hasUserSuperUserAccess()) {
            $ids   = $this->getModel()->getAllSitesIdFromSiteUrl($normalisedUrls);
        } else {
            $login = Piwik::getCurrentUserLogin();
            $ids   = $this->getModel()->getSitesIdFromSiteUrlHavingAccess($login, $normalisedUrls);
        }

        return $ids;
    }
1176495
public function getAll($urls)
    {
        $this->wildCardHosts = array_filter(array_keys($this->services), function($key) {
            return (strpos($key, '*') !== false);
        });

        return $this->findServices((array) $urls);
    }
829181
protected function getCurrentUrl() {
    $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
      ? 'https://'
      : 'http://';
    $currentUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $parts = parse_url($currentUrl);

    // drop known fb params
    $query = '';
    if (!empty($parts['query'])) {
      $params = array();
      parse_str($parts['query'], $params);
      foreach(self::$DROP_QUERY_PARAMS as $key) {
        unset($params[$key]);
      }
      if (!empty($params)) {
        $query = '?' . http_build_query($params, null, '&');
      }
    }

    // use port if non default
    $port =
      isset($parts['port']) &&
      (($protocol === 'http://' && $parts['port'] !== 80) ||
       ($protocol === 'https://' && $parts['port'] !== 443))
      ? ':' . $parts['port'] : '';

    // rebuild
    return $protocol . $parts['host'] . $port . $parts['path'] . $query;
  }
400561
private function getCurrentPath()
    {
        if (is_null($this->currentPath)) {
            $this->currentPath = $this->str($this->httpRequest()->getCurrentUrl(true)->getPath());
        }

        return $this->currentPath;
    }