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

API.php « ExampleAPI « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bcddbb3ba6ab6e989f9cfad134ae86e8138e918a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?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$
 *
 * @category Piwik_Plugins
 * @package Piwik_ExampleAPI
 */

/**
 * ExampleAPI API
 *
 * <p><b>HOW TO VIEW THE API IN ACTION</b></p>
 * <p>Go to the API page in the Piwik user interface
 * and try the API of the plugin ExampleAPI</p>
 *
 * @package Piwik_ExampleAPI
 */
class Piwik_ExampleAPI_API
{
	static private $instance = null;

	/**
	 * Singleton
	 * @return Piwik_ExampleAPI_API
	 */
	static public function getInstance()
	{
		if (self::$instance == null)
		{
			$c = __CLASS__;
			self::$instance = new $c();
		}
		return self::$instance;
	}

	/**
	 * Get Piwik version
	 * @return string
	 */
	static public function getPiwikVersion()
	{
		Piwik::checkUserHasSomeViewAccess();
		return Piwik_Version::VERSION;
	}

	/**
	 * Get Answer to Life
	 * @return integer
	 */
	static public function getAnswerToLife()
	{
		return 42;
	}

	/**
	 * Get Golden Ratio
	 * @return float
	 */
	static public function getGoldenRatio()
	{
		//http://en.wikipedia.org/wiki/Golden_ratio
		return 1.618033988749894848204586834365;
	}

	/**
	 * Get object
	 * @return Piwik_MagicObject
	 */
	static public function getObject()
	{
		return new Piwik_MagicObject();
	}

	/**
	 * Get null
	 * @return null
	 */
	static public function getNull()
	{
		return null;
	}

	/**
	 * Get array of descriptive text
	 * @return array
	 */
	static public function getDescriptionArray()
	{
		return array('piwik','open source','web analytics','free');
	}

	/**
	 * Get data table
	 * @return Piwik_DataTable
	 */
	static 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;
	}

	/**
	 * Get more information on the Answer to Life...
	 * @return string
	 */
	static public function getMoreInformationAnswerToLife()
	{
		return "Check http://en.wikipedia.org/wiki/The_Answer_to_Life,_the_Universe,_and_Everything";
	}
}

/**
 * Magic Object
 *
 * @package Piwik_ExamplePlugin
 */
class Piwik_MagicObject
{
	function Incredible() { return 'Incroyable'; }
	protected $wonderful = 'magnifique';
	public $great = 'formidable';
}