本文整理汇总了PHP中Piwik_SitesManager_API::addSite方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_SitesManager_API::addSite方法的具体用法?PHP Piwik_SitesManager_API::addSite怎么用?PHP Piwik_SitesManager_API::addSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_SitesManager_API
的用法示例。
在下文中一共展示了Piwik_SitesManager_API::addSite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_setUserAccess_multipleCallOverwriteSingleUserOneSite
/**
* we set access for one user for one site several times and check that it is updated
*/
function test_setUserAccess_multipleCallOverwriteSingleUserOneSite()
{
Piwik_UsersManager_API::addUser("user1", "geqgegagae", "tegst@tesgt.com", "alias");
$id1 = Piwik_SitesManager_API::addSite("test1", array("http://piwik.net", "http://piwik.com/test/"));
$id2 = Piwik_SitesManager_API::addSite("test2", array("http://piwik.net", "http://piwik.com/test/"));
Piwik_UsersManager_API::setUserAccess("user1", "view", array($id1, $id2));
Piwik_UsersManager_API::setUserAccess("user1", "admin", array($id1));
$access1 = Piwik_UsersManager_API::getSitesAccessFromUser("user1");
$wanted1 = array($id1 => 'admin', $id2 => 'view');
$this->assertEqual($access1, $wanted1);
}
示例2: test_updateSite_severalUrls
/**
* several urls => both main and alias are updated
*/
function test_updateSite_severalUrls()
{
$urls = array("http://piwiknew.com", "http://piwiknew.net", "http://piwiknew.org", "http://piwiknew.fr");
$idsite = Piwik_SitesManager_API::addSite("site1", $urls);
$newurls = array("http://piwiknew2.com", "http://piwiknew2.net", "http://piwiknew2.org", "http://piwiknew2.fr");
Piwik_SitesManager_API::updateSite($idsite, "test toto@{}", $newurls);
$allUrls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite);
sort($allUrls);
sort($newurls);
$this->assertEqual($allUrls, $newurls);
}