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:
authormattpiwik <matthieu.aubry@gmail.com>2008-07-28 03:07:52 +0400
committermattpiwik <matthieu.aubry@gmail.com>2008-07-28 03:07:52 +0400
commit9bcf3f24892e3ce52e0ce9cb4c38465b9084059c (patch)
tree6f5c6359390128afa87da03e68eed0a3fd5ddaf2 /plugins/ExampleAPI
parente33f6ef1b6bb66a040dea3dc824f85eb51b5f777 (diff)
- Adding description to each plugin
- cleaning plugins listing, splitting ExamplePlugin in multiple small plugins, renamed Home -> CoreHome PluginsAdmin -> CorePluginsAdmin AdminHome -> CoreAdminHome - simplified authentication classes (not using Zend_Auth_Db anymore) - adding a new widget listing the last posts on Piwik.org/blog git-svn-id: http://dev.piwik.org/svn/trunk@581 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/ExampleAPI')
-rw-r--r--plugins/ExampleAPI/API.php92
-rw-r--r--plugins/ExampleAPI/ExampleAPI.php15
2 files changed, 107 insertions, 0 deletions
diff --git a/plugins/ExampleAPI/API.php b/plugins/ExampleAPI/API.php
new file mode 100644
index 0000000000..0907e0a125
--- /dev/null
+++ b/plugins/ExampleAPI/API.php
@@ -0,0 +1,92 @@
+<?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: API.php 482 2008-05-18 17:22:35Z matt $
+ *
+ * @package Piwik_ExamplePlugin
+ */
+
+/**
+ * HOW TO VIEW THE API IN ACTION
+ * =============================
+ * Go to the API page in the Piwik Interface
+ * And try the API of the plugin ExamplePlugin
+ */
+
+/**
+ *
+ * @package Piwik_ExamplePlugin
+ */
+class Piwik_ExampleAPI_API extends Piwik_Apiable
+{
+ static private $instance = null;
+ static public function getInstance()
+ {
+ if (self::$instance == null)
+ {
+ $c = __CLASS__;
+ self::$instance = new $c();
+ }
+ return self::$instance;
+ }
+
+ public function getAnswerToLife()
+ {
+ return 42;
+ }
+
+ public function getGoldenRatio()
+ {
+ //http://en.wikipedia.org/wiki/Golden_ratio
+ return 1.618033988749894848204586834365;
+ }
+
+ public function getObject()
+ {
+ return new MagicObject();
+ }
+
+ public function getNull()
+ {
+ return null;
+ }
+
+ public function getDescriptionArray()
+ {
+ return array('piwik','open source','web analytics','free');
+ }
+
+ public function getCompetitionDatatable()
+ {
+ $dataTable = new Piwik_DataTable();
+
+ $row1 = new Piwik_DataTable_Row;
+ $row1->setColumns( array('name' => 'piwik', 'license' => 'GPL'));
+ $dataTable->addRow($row1);
+
+ $dataTable->addRowFromSimpleArray( array('name' => 'google analytics', 'license' => 'commercial') );
+
+ return $dataTable;
+ }
+
+ public function getMoreInformationAnswerToLife()
+ {
+ return "Check http://en.wikipedia.org/wiki/The_Answer_to_Life,_the_Universe,_and_Everything";
+ }
+
+}
+
+
+/**
+ *
+ * @package Piwik_ExamplePlugin
+ */
+class MagicObject
+{
+ function Incredible(){ return 'Incroyable'; }
+ protected $wonderful = 'magnifique';
+ public $great = 'formidable';
+}
diff --git a/plugins/ExampleAPI/ExampleAPI.php b/plugins/ExampleAPI/ExampleAPI.php
new file mode 100644
index 0000000000..b9e24f1e9e
--- /dev/null
+++ b/plugins/ExampleAPI/ExampleAPI.php
@@ -0,0 +1,15 @@
+<?php
+class Piwik_ExampleAPI extends Piwik_Plugin
+{
+ public function getInformation()
+ {
+ return array(
+ // name must be the className prefix!
+ 'name' => 'ExampleAPI',
+ 'description' => 'Example Plugin: How to create an API for your plugin, to export your data in multiple formats without any special coding? Visit the <a href="index.php?module=CoreAdminHome&action=showInContext&moduleToLoad=API&actionToLoad=listAllAPI&module=CoreAdminHome&action=showInContext#ExampleAPI">ExampleAPI example methods</a>.',
+ 'author' => 'Piwik',
+ 'homepage' => 'http://piwik.org/',
+ 'version' => '0.1',
+ );
+ }
+} \ No newline at end of file