Piwik\Site::getMainUrlFor PHP Method

getMainUrlFor() public static method

Returns the url for the site with the specified ID.
public static getMainUrlFor ( integer $idsite ) : string
$idsite integer The site ID.
return string
    public static function getMainUrlFor($idsite)
    {
        return self::getFor($idsite, 'main_url');
    }

Usage Example

 private function formatQueryLabelForDisplay($idSite, $apiModule, $apiAction, $label)
 {
     // rows with subtables do not contain URL metadata. this hack makes sure the label titles in row
     // evolution popovers look like URLs.
     if ($apiModule == 'Actions' && in_array($apiAction, self::$actionsUrlReports)) {
         $mainUrl = Site::getMainUrlFor($idSite);
         $mainUrlHost = @parse_url($mainUrl, PHP_URL_HOST);
         $replaceRegex = "/\\s*" . preg_quote(LabelFilter::SEPARATOR_RECURSIVE_LABEL) . "\\s*/";
         $cleanLabel = preg_replace($replaceRegex, '/', $label);
         return $mainUrlHost . '/' . $cleanLabel . '/';
     } else {
         return str_replace(LabelFilter::SEPARATOR_RECURSIVE_LABEL, ' - ', $label);
     }
 }
All Usage Examples Of Piwik\Site::getMainUrlFor