本文整理汇总了PHP中Piwik_Site::getMainUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Site::getMainUrl方法的具体用法?PHP Piwik_Site::getMainUrl怎么用?PHP Piwik_Site::getMainUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Site
的用法示例。
在下文中一共展示了Piwik_Site::getMainUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setGeneralVariablesView
/**
* Sets general variables to the view that are used by various templates and Javascript.
* If any error happens, displays the login screen
* @param Piwik_View $view
* @return void
*/
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$view->idSite = $this->idSite;
if(empty($this->site) || empty($this->idSite))
{
throw new Exception("The requested website idSite is not found in the request, or is invalid.
Please check that you are logged in Piwik and have permission to access the specified website.");
}
$this->setPeriodVariablesView($view);
$rawDate = Piwik_Common::getRequestVar('date');
$periodStr = Piwik_Common::getRequestVar('period');
if($periodStr != 'range')
{
$date = Piwik_Date::factory($this->strDate);
$period = Piwik_Period::factory($periodStr, $date);
}
else
{
$period = new Piwik_Period_Range($periodStr, $rawDate, $this->site->getTimezone());
}
$view->rawDate = $rawDate;
$view->prettyDate = $period->getPrettyString();
$view->siteName = $this->site->getName();
$view->siteMainUrl = $this->site->getMainUrl();
$datetimeMinDate = $this->site->getCreationDate()->getDatetime();
$minDate = Piwik_Date::factory($datetimeMinDate, $this->site->getTimezone());
$this->setMinDateView($minDate, $view);
$maxDate = Piwik_Date::factory('now', $this->site->getTimezone());
$this->setMaxDateView($maxDate, $view);
// Setting current period start & end dates, for pre-setting the calendar when "Date Range" is selected
$dateStart = $period->getDateStart();
if($dateStart->isEarlier($minDate)) { $dateStart = $minDate; }
$dateEnd = $period->getDateEnd();
if($dateEnd->isLater($maxDate)) { $dateEnd = $maxDate; }
$view->startDate = $dateStart;
$view->endDate = $dateEnd;
$this->setBasicVariablesView($view);
} catch(Exception $e) {
Piwik_ExitWithMessage($e->getMessage());
}
}
示例2: setGeneralVariablesView
/**
* Sets general variables to the view that are used by
* various templates and Javascript.
* If any error happens, displays the login screen
*
* @param Piwik_View $view
* @throws Exception
* @return void
*/
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$view->idSite = $this->idSite;
if (empty($this->site) || empty($this->idSite)) {
throw new Exception("The requested website idSite is not found in the request, or is invalid.\n\t\t\t\tPlease check that you are logged in Piwik and have permission to access the specified website.");
}
$this->setPeriodVariablesView($view);
$rawDate = Piwik_Common::getRequestVar('date');
$periodStr = Piwik_Common::getRequestVar('period');
if ($periodStr != 'range') {
$date = Piwik_Date::factory($this->strDate);
$period = Piwik_Period::factory($periodStr, $date);
} else {
$period = new Piwik_Period_Range($periodStr, $rawDate, $this->site->getTimezone());
}
$view->rawDate = $rawDate;
$view->prettyDate = self::getCalendarPrettyDate($period);
$view->siteName = $this->site->getName();
$view->siteMainUrl = $this->site->getMainUrl();
$datetimeMinDate = $this->site->getCreationDate()->getDatetime();
$minDate = Piwik_Date::factory($datetimeMinDate, $this->site->getTimezone());
$this->setMinDateView($minDate, $view);
$maxDate = Piwik_Date::factory('now', $this->site->getTimezone());
$this->setMaxDateView($maxDate, $view);
// Setting current period start & end dates, for pre-setting the calendar when "Date Range" is selected
$dateStart = $period->getDateStart();
if ($dateStart->isEarlier($minDate)) {
$dateStart = $minDate;
}
$dateEnd = $period->getDateEnd();
if ($dateEnd->isLater($maxDate)) {
$dateEnd = $maxDate;
}
$view->startDate = $dateStart;
$view->endDate = $dateEnd;
$language = Piwik_LanguagesManager::getLanguageForSession();
$view->language = !empty($language) ? $language : Piwik_LanguagesManager::getLanguageCodeForCurrentUser();
$view->config_action_url_category_delimiter = Piwik_Config::getInstance()->General['action_url_category_delimiter'];
$this->setBasicVariablesView($view);
$view->topMenu = Piwik_GetTopMenu();
} catch (Exception $e) {
Piwik_ExitWithMessage($e->getMessage(), '');
}
}
示例3: getRank
function getRank()
{
$idSite = Piwik_Common::getRequestVar('idSite');
$site = new Piwik_Site($idSite);
$url = urldecode(Piwik_Common::getRequestVar('url', '', 'string'));
if (!empty($url) && strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
$url = 'http://' . $url;
}
if (empty($url) || !Piwik_Common::isLookLikeUrl($url)) {
$url = $site->getMainUrl();
}
$dataTable = Piwik_SEO_API::getInstance()->getRank($url);
$view = Piwik_View::factory('index');
$view->urlToRank = Piwik_SEO_RankChecker::extractDomainFromUrl($url);
$renderer = Piwik_DataTable_Renderer::factory('php');
$renderer->setSerialize(false);
$view->ranks = $renderer->render($dataTable);
echo $view->render();
}
示例4: getRank
function getRank()
{
$idSite = Piwik_Common::getRequestVar('idSite');
$site = new Piwik_Site($idSite);
$url = urldecode(Piwik_Common::getRequestVar('url', '', 'string'));
if(empty($url) || @parse_url($url) === false)
{
$url = $site->getMainUrl();
}
$dataTable = Piwik_SEO_API::getInstance()->getRank($url);
$view = Piwik_View::factory('index');
$view->urlToRank = $url;
$renderer = Piwik_DataTable_Renderer::factory('php');
$renderer->setSerialize(false);
$view->ranks = $renderer->render($dataTable);
echo $view->render();
}
示例5: setGeneralVariablesView
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$this->setPeriodVariablesView($view);
$period = Piwik_Period::factory(Piwik_Common::getRequestVar('period'), Piwik_Date::factory($this->strDate));
$view->prettyDate = $period->getLocalizedLongString();
$idSite = Piwik_Common::getRequestVar('idSite');
$view->idSite = $idSite;
$site = new Piwik_Site($idSite);
$view->siteName = $site->getName();
$view->siteMainUrl = $site->getMainUrl();
$minDate = $site->getCreationDate();
$view->minDateYear = $minDate->toString('Y');
$view->minDateMonth = $minDate->toString('m');
$view->minDateDay = $minDate->toString('d');
} catch (Exception $e) {
self::redirectToIndex(Piwik::getModule(), Piwik::getAction());
}
}
示例6: getSiteUrlsFromId
/**
* Returns the list of all URLs registered for the given idSite (main_url + alias URLs).
*
* @exception if the website ID doesn't exist or the user doesn't have access to it
* @return array list of URLs
*/
public function getSiteUrlsFromId( $idSite )
{
Piwik::checkUserHasViewAccess($idSite);
$site = new Piwik_Site($idSite);
$urls = $this->getAliasSiteUrlsFromId($idSite);
return array_merge(array($site->getMainUrl()), $urls);
}
示例7: setGeneralVariablesView
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$this->setPeriodVariablesView($view);
$period = Piwik_Period::factory(Piwik_Common::getRequestVar('period'), Piwik_Date::factory($this->strDate));
$view->prettyDate = $period->getLocalizedLongString();
$idSite = Piwik_Common::getRequestVar('idSite');
$view->idSite = $idSite;
$site = new Piwik_Site($idSite);
$view->siteName = $site->getName();
$view->siteMainUrl = $site->getMainUrl();
$minDate = $site->getCreationDate();
$view->minDateYear = $minDate->toString('Y');
$view->minDateMonth = $minDate->toString('m');
$view->minDateDay = $minDate->toString('d');
$maxDate = Piwik_Date::factory('today');
$view->maxDateYear = $maxDate->toString('Y');
$view->maxDateMonth = $maxDate->toString('m');
$view->maxDateDay = $maxDate->toString('d');
$view->debugTrackVisitsInsidePiwikUI = Zend_Registry::get('config')->Debug->track_visits_inside_piwik_ui;
$view->isSuperUser = Zend_Registry::get('access')->isSuperUser();
} catch(Exception $e) {
self::redirectToIndex(Piwik::getModule(), Piwik::getAction());
}
}