PHP 클래스 Piwik\Site

**Data Cache** Site data can be cached in order to avoid performing too many queries. If a method needs many site entities, it is more efficient to query all of what you need beforehand via the **SitesManager** API, then cache it using {@link setSites()} or {@link setSitesFromArray()}. Subsequent calls to new Site($id) will use the data in the cache instead of querying the database. ### Examples **Basic usage** $site = new Site($idSite); $name = $site->getName(); **Without allocation** $name = Site::getNameFor($idSite);
파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$id integer | null
$infoSites array

공개 메소드들

메소드 설명
__construct ( integer $idsite ) Constructor.
__toString ( ) : string Returns a string representation of the site this instance references.
clearCache ( ) Clears the site data cache.
clearCacheForSite ( $idSite ) Clears the site data cache.
getCreationDate ( ) : Date Returns the creation date of the site.
getCreationDateFor ( integer $idsite ) : string Returns the creation date of the site with the specified ID.
getCurrency ( ) : string Returns the currency of the site.
getCurrencyFor ( integer $idsite ) : string Returns the currency of the site with the specified ID.
getCurrencyList ( ) : array Returns the list of all known currency symbols.
getCurrencySymbolFor ( integer $idsite ) : string Returns the currency of the site with the specified ID.
getExcludedIps ( ) : string Returns the excluded ips of the site.
getExcludedIpsFor ( integer $idsite ) : string Returns the excluded IP addresses of the site with the specified ID.
getExcludedQueryParameters ( ) : string Returns the excluded query parameters of the site.
getExcludedQueryParametersFor ( integer $idsite ) : string Returns the excluded query parameters for the site with the specified ID.
getGroupFor ( integer $idsite ) : string Returns the group of the site with the specified ID.
getId ( ) : integer Returns the id of the site.
getIdSitesFromIdSitesString ( string | array $ids, boolean | string $_restrictSitesToLogin = false ) : array Checks the given string for valid site IDs and returns them as an array.
getMainUrl ( ) : string Returns the main url of the site.
getMainUrlFor ( integer $idsite ) : string Returns the url for the site with the specified ID.
getMinMaxDateAcrossWebsites ( array $siteIds ) : Date[] The Multisites reports displays the first calendar date as the earliest day available for all websites.
getName ( ) : string Returns the name of the site.
getNameFor ( integer $idsite ) : string Returns the name of the site with the specified ID.
getSearchCategoryParameters ( ) : string Returns the site search category query parameters for the site.
getSearchKeywordParameters ( ) : string Returns the site search keyword query parameters for the site.
getSite ( $idsite )
getSites ( ) Returns all websites pre-cached
getTimezone ( ) : string Returns the timezone of the size.
getTimezoneFor ( integer $idsite ) : string Returns the timezone of the site with the specified ID.
getType ( ) : string Returns the website type (by default "website", which means it is a single website).
getTypeFor ( $idsite ) : string Returns the type of the site with the specified ID.
isEcommerceEnabled ( ) : boolean Returns whether ecommerce is enabled for the site.
isEcommerceEnabledFor ( integer $idsite ) : string Returns whether the site with the specified ID is ecommerce enabled or not.
isSiteSearchEnabled ( ) : boolean Returns whether Site Search Tracking is enabled for the site.
isSiteSearchEnabledFor ( integer $idsite ) : string Returns whether the site with the specified ID is Site Search enabled.
setSiteFromArray ( $idSite, $infoSite ) Sets a site information in memory (statically cached).
setSites ( array $sites ) Sets the cached site data with an array that associates site IDs with individual site data.
setSitesFromArray ( array $sites ) Sets the cached Site data with a non-associated array of site data.

보호된 메소드들

메소드 설명
get ( string $name ) : mixed Returns a site property by name.
getFor ( integer $idsite, string $field ) : string Utility function. Returns the value of the specified field for the site with the specified ID.

비공개 메소드들

메소드 설명
triggerSetSitesEvent ( &$sites )

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( integer $idsite )
$idsite integer The ID of the site we want data for.

__toString() 공개 메소드

Useful for debugging.
public __toString ( ) : string
리턴 string

clearCache() 공개 정적인 메소드

See also {@link setSites()} and {@link setSitesFromArray()}.
public static clearCache ( )

clearCacheForSite() 공개 정적인 메소드

See also {@link setSites()} and {@link setSitesFromArray()}.
public static clearCacheForSite ( $idSite )

get() 보호된 메소드

Returns a site property by name.
protected get ( string $name ) : mixed
$name string Name of the property to return (eg, `'main_url'` or `'name'`).
리턴 mixed

getCreationDate() 공개 메소드

Returns the creation date of the site.
public getCreationDate ( ) : Date
리턴 Date

getCreationDateFor() 공개 정적인 메소드

Returns the creation date of the site with the specified ID.
public static getCreationDateFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getCurrency() 공개 메소드

Returns the currency of the site.
public getCurrency ( ) : string
리턴 string

getCurrencyFor() 공개 정적인 메소드

Returns the currency of the site with the specified ID.
public static getCurrencyFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getCurrencyList() 공개 정적인 메소드

Returns the list of all known currency symbols.
또한 보기: Piwik\Intl\Data\Provider\CurrencyDataProvider::getCurrencyList()
사용 중단: Use Piwik\Intl\Data\Provider\CurrencyDataProvider instead.
public static getCurrencyList ( ) : array
리턴 array An array mapping currency codes to their respective currency symbols and a description, eg, `array('USD' => array('$', 'US dollar'))`.

getCurrencySymbolFor() 공개 정적인 메소드

Returns the currency of the site with the specified ID.
public static getCurrencySymbolFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getExcludedIps() 공개 메소드

Returns the excluded ips of the site.
public getExcludedIps ( ) : string
리턴 string

getExcludedIpsFor() 공개 정적인 메소드

Returns the excluded IP addresses of the site with the specified ID.
public static getExcludedIpsFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getExcludedQueryParameters() 공개 메소드

Returns the excluded query parameters of the site.

getExcludedQueryParametersFor() 공개 정적인 메소드

Returns the excluded query parameters for the site with the specified ID.
public static getExcludedQueryParametersFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getFor() 보호된 정적인 메소드

Utility function. Returns the value of the specified field for the site with the specified ID.
protected static getFor ( integer $idsite, string $field ) : string
$idsite integer The ID of the site whose data is being accessed.
$field string The name of the field to get.
리턴 string

getGroupFor() 공개 정적인 메소드

Returns the group of the site with the specified ID.
public static getGroupFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getId() 공개 메소드

Returns the id of the site.
public getId ( ) : integer
리턴 integer

getIdSitesFromIdSitesString() 공개 정적인 메소드

Checks the given string for valid site IDs and returns them as an array.
public static getIdSitesFromIdSitesString ( string | array $ids, boolean | string $_restrictSitesToLogin = false ) : array
$ids string | array Comma separated idSite list, eg, `'1,2,3,4'` or an array of IDs, eg, `array(1, 2, 3, 4)`.
$_restrictSitesToLogin boolean | string Implementation detail. Used only when running as a scheduled task.
리턴 array An array of valid, unique integers.

getMainUrl() 공개 메소드

Returns the main url of the site.
public getMainUrl ( ) : string
리턴 string

getMainUrlFor() 공개 정적인 메소드

Returns the url for the site with the specified ID.
public static getMainUrlFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getMinMaxDateAcrossWebsites() 공개 정적인 메소드

Also, today is the later "today" available across all timezones.
public static getMinMaxDateAcrossWebsites ( array $siteIds ) : Date[]
$siteIds array Array of IDs for each site being displayed.
리턴 Date[] of two Date instances. First is the min-date & the second is the max date.

getName() 공개 메소드

Returns the name of the site.
public getName ( ) : string
리턴 string

getNameFor() 공개 정적인 메소드

Returns the name of the site with the specified ID.
public static getNameFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getSearchCategoryParameters() 공개 메소드

Returns the site search category query parameters for the site.

getSearchKeywordParameters() 공개 메소드

Returns the site search keyword query parameters for the site.

getSite() 공개 정적인 메소드

public static getSite ( $idsite )

getSites() 공개 정적인 메소드

Returns all websites pre-cached
public static getSites ( )

getTimezone() 공개 메소드

Returns the timezone of the size.
public getTimezone ( ) : string
리턴 string

getTimezoneFor() 공개 정적인 메소드

Returns the timezone of the site with the specified ID.
public static getTimezoneFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

getType() 공개 메소드

Returns the website type (by default "website", which means it is a single website).
public getType ( ) : string
리턴 string

getTypeFor() 공개 정적인 메소드

Returns the type of the site with the specified ID.
public static getTypeFor ( $idsite ) : string
$idsite
리턴 string

isEcommerceEnabled() 공개 메소드

Returns whether ecommerce is enabled for the site.
public isEcommerceEnabled ( ) : boolean
리턴 boolean

isEcommerceEnabledFor() 공개 정적인 메소드

Returns whether the site with the specified ID is ecommerce enabled or not.
public static isEcommerceEnabledFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

isSiteSearchEnabled() 공개 메소드

Returns whether Site Search Tracking is enabled for the site.
public isSiteSearchEnabled ( ) : boolean
리턴 boolean

isSiteSearchEnabledFor() 공개 정적인 메소드

Returns whether the site with the specified ID is Site Search enabled.
public static isSiteSearchEnabledFor ( integer $idsite ) : string
$idsite integer The site ID.
리턴 string

setSiteFromArray() 공개 정적인 메소드

Plugins can filter the website attributes before it is cached, eg. to change the website name, creation date, etc.
public static setSiteFromArray ( $idSite, $infoSite )
$idSite
$infoSite

setSites() 공개 정적인 메소드

Sets the cached site data with an array that associates site IDs with individual site data.
public static setSites ( array $sites )
$sites array The array of sites data. Indexed by site ID. eg, array('1' => array('name' => 'Site 1', ...), '2' => array('name' => 'Site 2', ...))`

setSitesFromArray() 공개 정적인 메소드

Sets the cached Site data with a non-associated array of site data.
public static setSitesFromArray ( array $sites )
$sites array The array of sites data. eg, array( array('idsite' => '1', 'name' => 'Site 1', ...), array('idsite' => '2', 'name' => 'Site 2', ...), )

프로퍼티 상세

$id 보호되어 있는 프로퍼티

protected int|null $id
리턴 integer | null

$infoSites 보호되어 있는 정적으로 프로퍼티

protected static array $infoSites
리턴 array