diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-01-12 04:10:43 +0300 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-01-12 04:10:43 +0300 |
commit | a2f0e87dc6d4d14507518bf34f22773387356529 (patch) | |
tree | 8035dbde57e7a52101a732c1a66afed588161f77 /plugins/SitesManager/API.php | |
parent | 506ecb7c354b623f04b7700e0c485bd46e1d9255 (diff) |
- added links to admin modules in the UI
- added new module displayJavascriptCode
- php renderer now renders a flat version of the datatable for more convenience
- XML/JSON/CSV have a simple output now :-)
- added automatic conversion of know php data structures into DataTable so any API returning not-so-complex data structure can automatically benefit from DataTable power and get the output in XML/JSON/CSV/HTML/PHP etc.
- added a nice helper page that lists all API methods, + links to examples
- did test all API calls with all formats. seems to work good. had to fix a looooot of problems but im happy with the final result :-)
enjoy!!!
Diffstat (limited to 'plugins/SitesManager/API.php')
-rwxr-xr-x | plugins/SitesManager/API.php | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index c8f52cb7cd..5d0b68eef8 100755 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -59,12 +59,12 @@ class Piwik_SitesManager_API extends Piwik_Apiable * @exception if the website ID doesn't exist or the user doesn't have access to it * @return array list of URLs */ - static public function getSiteUrlsFromId( $idsite ) + static public function getSiteUrlsFromId( $idSite ) { - Piwik::checkUserHasViewAccess($idsite); + Piwik::checkUserHasViewAccess($idSite); - $site = self::getSiteFromId($idsite); - $urls = self::getAliasSiteUrlsFromId($idsite); + $site = self::getSiteFromId($idSite); + $urls = self::getAliasSiteUrlsFromId($idSite); return array_merge(array($site['main_url']), $urls); } @@ -197,11 +197,11 @@ class Piwik_SitesManager_API extends Piwik_Apiable * * @return int the website ID created */ - static public function addSite( $name, $urls ) + static public function addSite( $siteName, $urls ) { Piwik::checkUserIsSuperUser(); - self::checkName($name); + self::checkName($siteName); $urls = self::cleanParameterUrls($urls); self::checkUrls($urls); self::checkAtLeastOneUrl($urls); @@ -212,7 +212,7 @@ class Piwik_SitesManager_API extends Piwik_Apiable $urls = array_slice($urls, 1); $db->insert(Piwik::prefixTable("site"), array( - 'name' => $name, + 'name' => $siteName, 'main_url' => $url, ) ); @@ -270,16 +270,16 @@ class Piwik_SitesManager_API extends Piwik_Apiable * * @return int the number of inserted URLs */ - static public function addSiteAliasUrls( $idsite, $urls) + static public function addSiteAliasUrls( $idSite, $urls) { - Piwik::checkUserHasAdminAccess( $idsite ); + Piwik::checkUserHasAdminAccess( $idSite ); $urls = self::cleanParameterUrls($urls); self::checkUrls($urls); - $urlsInit = self::getSiteUrlsFromId($idsite); + $urlsInit = self::getSiteUrlsFromId($idSite); $toInsert = array_diff($urls, $urlsInit); - self::insertSiteUrls($idsite, $toInsert); + self::insertSiteUrls($idSite, $toInsert); return count($toInsert); } @@ -332,11 +332,11 @@ class Piwik_SitesManager_API extends Piwik_Apiable * * @return bool true on success */ - static public function updateSite( $idSite, $name, $urls = null) + static public function updateSite( $idSite, $siteName, $urls = null) { Piwik::checkUserHasAdminAccess($idSite); - self::checkName($name); + self::checkName($siteName); // SQL fields to update $bind = array(); @@ -351,7 +351,7 @@ class Piwik_SitesManager_API extends Piwik_Apiable $bind['main_url'] = $url; } - $bind['name'] = $name; + $bind['name'] = $siteName; $db = Zend_Registry::get('db'); @@ -366,7 +366,8 @@ class Piwik_SitesManager_API extends Piwik_Apiable if(count($urls) > 1) { self::replaceSiteUrls($idSite, $urls); - } + }
+ } /** @@ -430,9 +431,9 @@ class Piwik_SitesManager_API extends Piwik_Apiable * * @exception if the website name is empty */ - static private function checkName($name) + static private function checkName($siteName) { - if(empty($name)) + if(empty($siteName)) { throw new Exception("The site name can't be empty."); } |