Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-04-17 02:28:03 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-04-17 02:28:03 +0400
commitf85e6caa77c092cfb736b4d0250bec92a0d973a3 (patch)
tree87b870466b3ae7e36f3bddca06b3dbc82ec37c31 /plugins/API
parent48187389f65599017f4f1fabcc8054069015e445 (diff)
[mauser]- refs #62 commited huge work by Maciej ZawadziƄski: thanks! still some work to do + QA but looks really good :)
[mauser]- refs #116 commited partial fix [mauser]- refs #65 commited partial fix - fixed broken tests
Diffstat (limited to 'plugins/API')
-rw-r--r--plugins/API/API.php54
-rw-r--r--plugins/API/Controller.php143
-rw-r--r--plugins/API/lang/en.php12
3 files changed, 109 insertions, 100 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php
index 44931991ca..e99674c821 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -1,27 +1,27 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id: ExamplePlugin.php 169 2008-01-14 05:41:15Z matt $
- *
- * @package Piwik_PluginsAdmin
- */
-
-class Piwik_API extends Piwik_Plugin
-{
- public function getInformation()
- {
- return array(
- // name must be the className prefix!
- 'name' => 'API',
- 'description' => '',
- 'author' => 'Piwik',
- 'homepage' => 'http://piwik.org/',
- 'version' => '0.1',
- 'translationAvailable' => false,
- );
- }
-}
-
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
+ * @version $Id: ExamplePlugin.php 169 2008-01-14 05:41:15Z matt $
+ *
+ * @package Piwik_PluginsAdmin
+ */
+
+class Piwik_API extends Piwik_Plugin
+{
+ public function getInformation()
+ {
+ return array(
+ // name must be the className prefix!
+ 'name' => 'API',
+ 'description' => '',
+ 'author' => 'Piwik',
+ 'homepage' => 'http://piwik.org/',
+ 'version' => '0.1',
+ 'translationAvailable' => true,
+ );
+ }
+}
+
diff --git a/plugins/API/Controller.php b/plugins/API/Controller.php
index 3b1804bb0f..f57e2a107f 100644
--- a/plugins/API/Controller.php
+++ b/plugins/API/Controller.php
@@ -1,73 +1,70 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_API
- */
-
-require_once "API/Request.php";
-
-
-/**
- *
- * @package Piwik_API
- */
-class Piwik_API_Controller extends Piwik_Controller
-{
- function index()
- {
-// sleep(1);
- $request = new Piwik_API_Request();
- echo $request->process();
- }
-
- protected function init()
- {
- $plugins = Piwik_PluginsManager::getInstance()->getLoadedPluginsName();
-
- $loaded = 0;
- foreach( $plugins as $plugin )
- {
- $plugin = Piwik::unprefixClass($plugin);
-
- try {
- Piwik_API_Proxy::getInstance()->registerClass($plugin);
- $loaded++;
- }
- catch(Exception $e){
-// $errors .= "<br>\n" . $e->getMessage();
- }
- }
- return $loaded;
- }
-
- function listAllMethods()
- {
- $this->init();
- echo Piwik_API_Proxy::getInstance()->getAllInterfaceString( $outputExampleUrls = true, $prefixUrls = Piwik_Common::getRequestVar('prefixUrl', '') );
- }
-
-
- function listAllAPI()
- {
- $token_auth = Zend_Registry::get('auth')->getTokenAuth();
- echo "<style>body{ font-family:georgia,arial; font-size:0.95em;} </style>";
- echo "<h1>API quick documentation</h1>";
- echo "<p>If you don't have data for today you can first <a href='misc/generateVisits.php' target=_blank>generate some data</a> using the Visits Generator script.</p>";
- echo "<p>You can try the different formats available for every method. It is very easy to extract any data you want from piwik!</p>";
- echo "<p>If you want to <b>request the data without being logged in to Piwik</b> you need to add the parameter <code><u>&token_auth=$token_auth</u></code> to the API calls URLs that require authentication.</p>";
- echo "<p><b>For more information have a look at the <a href='http://dev.piwik.org/trac/wiki/API'>official API Documentation</a> or the <a href='http://dev.piwik.org/trac/wiki/API/Reference'>API Reference</a>.</b></P>";
-
- $loaded = $this->init();
- echo "<p><i> Loaded successfully $loaded APIs</i></p>\n";
-
- echo Piwik_API_Proxy::getInstance()->getAllInterfaceString();
- echo "<p><a href='?module=Home'>Back to Piwik homepage</a></p>";
- }
-
-}
-
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
+ * @version $Id$
+ *
+ * @package Piwik_API
+ */
+
+require_once "API/Request.php";
+
+
+/**
+ *
+ * @package Piwik_API
+ */
+class Piwik_API_Controller extends Piwik_Controller
+{
+ function index()
+ {
+// sleep(1);
+ $request = new Piwik_API_Request();
+ echo $request->process();
+ }
+
+ protected function init()
+ {
+ $plugins = Piwik_PluginsManager::getInstance()->getLoadedPluginsName();
+
+ $loaded = 0;
+ foreach( $plugins as $plugin )
+ {
+ $plugin = Piwik::unprefixClass($plugin);
+
+ try {
+ Piwik_API_Proxy::getInstance()->registerClass($plugin);
+ $loaded++;
+ }
+ catch(Exception $e){
+// $errors .= "<br>\n" . $e->getMessage();
+ }
+ }
+ return $loaded;
+ }
+
+ function listAllMethods()
+ {
+ $this->init();
+ echo Piwik_API_Proxy::getInstance()->getAllInterfaceString( $outputExampleUrls = true, $prefixUrls = Piwik_Common::getRequestVar('prefixUrl', '') );
+ }
+
+
+ function listAllAPI()
+ {
+ $token_auth = Zend_Registry::get('auth')->getTokenAuth();
+ echo "<style>body{ font-family:georgia,arial; font-size:0.95em;} </style>";
+ echo sprintf(Piwik_Translate('API_QuickDocumentation'),$token_auth);
+
+
+ $loaded = $this->init();
+ echo "<p><i> ".sprintf(Piwik_Translate('API_LoadedAPIs'),$loaded)."</i></p>\n";
+
+ echo Piwik_API_Proxy::getInstance()->getAllInterfaceString();
+ echo "<p><a href='?module=Home'>".Piwik_Translate('General_BackToHomepage')."</a></p>";
+ }
+
+}
+
diff --git a/plugins/API/lang/en.php b/plugins/API/lang/en.php
new file mode 100644
index 0000000000..c60c8498d3
--- /dev/null
+++ b/plugins/API/lang/en.php
@@ -0,0 +1,12 @@
+<?php
+$translations = array(
+ 'API_QuickDocumentation' =>
+ "<h1>API quick documentation</h1>".
+ "<p>If you don't have data for today you can first <a href='misc/generateVisits.php' target=_blank>generate some data</a> using the Visits Generator script.</p>".
+ "<p>You can try the different formats available for every method. It is very easy to extract any data you want from piwik!</p>".
+ "<p>If you want to <b>request the data without being logged in to Piwik</b> you need to add the parameter <code><u>&token_auth=%s</u></code> to the API calls URLs that require authentication.</p>".
+ "<p><b>For more information have a look at the <a href='http://dev.piwik.org/trac/wiki/API'>official API Documentation</a> or the <a href='http://dev.piwik.org/trac/wiki/API/Reference'>API Reference</a>.</b></P>",
+ 'API_LoadedAPIs' => 'Loaded successfully %s APIs',
+
+
+);