diff options
author | sgiehl <stefangiehl@gmail.com> | 2012-06-21 01:01:20 +0400 |
---|---|---|
committer | sgiehl <stefangiehl@gmail.com> | 2012-06-21 01:01:20 +0400 |
commit | c47c83a618f2ecc76f62d371a1091d4b66377ed1 (patch) | |
tree | a22184bdc0b68c356ae46ee81c38a9fd683f49e2 | |
parent | 8705104f303be4b6143db88e5fb060f568f263cf (diff) |
added/fixed doc blocks
git-svn-id: http://dev.piwik.org/svn/trunk@6486 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r-- | core/Archive.php | 37 | ||||
-rw-r--r-- | core/Common.php | 166 | ||||
-rw-r--r-- | core/PluginsFunctions/Sql.php | 4 | ||||
-rw-r--r-- | core/PluginsFunctions/WidgetsList.php | 71 | ||||
-rw-r--r-- | core/Tracker/Action.php | 13 | ||||
-rw-r--r-- | core/Tracker/Db.php | 58 | ||||
-rw-r--r-- | core/Tracker/Db/Exception.php | 20 | ||||
-rw-r--r-- | core/Tracker/Db/Mysqli.php | 18 | ||||
-rw-r--r-- | core/Tracker/Db/Pdo/Mysql.php | 32 | ||||
-rw-r--r-- | core/Tracker/Db/Pdo/Pgsql.php | 11 | ||||
-rw-r--r-- | core/Tracker/IgnoreCookie.php | 2 | ||||
-rw-r--r-- | core/View/Interface.php | 1 | ||||
-rw-r--r-- | core/View/OneClickDone.php | 2 |
13 files changed, 235 insertions, 200 deletions
diff --git a/core/Archive.php b/core/Archive.php index 2a6445cb7b..3c74fd9b63 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -169,11 +169,11 @@ abstract class Piwik_Archive /** * Builds an Archive object or returns the same archive if previously built. * - * @param int|string $idSite integer, or comma separated list of integer - * @param string $period 'week' 'day' etc. - * @param Piwik_Date|string $strDate 'YYYY-MM-DD' or magic keywords 'today' @see Piwik_Date::factory() - * @param bool|string $segment Segment definition - defaults to false for Backward Compatibility - * @param bool|string $_restrictSitesToLogin Used only when running as a scheduled task + * @param int|string $idSite integer, or comma separated list of integer + * @param string $period 'week' 'day' etc. + * @param Piwik_Date|string $strDate 'YYYY-MM-DD' or magic keywords 'today' @see Piwik_Date::factory() + * @param bool|string $segment Segment definition - defaults to false for Backward Compatibility + * @param bool|string $_restrictSitesToLogin Used only when running as a scheduled task * @return Piwik_Archive */ static public function build($idSite, $period, $strDate, $segment = false, $_restrictSitesToLogin = false ) @@ -248,8 +248,8 @@ abstract class Piwik_Archive * Returns the value of the element $name from the current archive * The value to be returned is a numeric value and is stored in the archive_numeric_* tables * - * @param string $name For example Referers_distinctKeywords - * @return float|int|false False if no value with the given name + * @param string $name For example Referers_distinctKeywords + * @return float|int|false False if no value with the given name */ abstract public function getNumeric( $name ); @@ -260,8 +260,8 @@ abstract class Piwik_Archive * * It can return anything from strings, to serialized PHP arrays or PHP objects, etc. * - * @param string $name For example Referers_distinctKeywords - * @return mixed False if no value with the given name + * @param string $name For example Referers_distinctKeywords + * @return mixed False if no value with the given name */ abstract public function getBlob( $name ); @@ -290,8 +290,8 @@ abstract class Piwik_Archive * all the subtables for the DataTable $name. * You can then access the subtables by using the Piwik_DataTable_Manager getTable() * - * @param string $name - * @param int $idSubTable or null if requesting the parent table + * @param string $name + * @param int|null $idSubTable null if requesting the parent table * @return Piwik_DataTable */ abstract public function getDataTableExpanded($name, $idSubTable = null); @@ -301,13 +301,14 @@ abstract class Piwik_Archive * Helper - Loads a DataTable from the Archive. * Optionally loads the table recursively, * or optionally fetches a given subtable with $idSubtable - * @param $name - * @param $idSite - * @param $period - * @param $date - * @param $segment - * @param $expanded - * @param null $idSubtable + * + * @param string $name + * @param int $idSite + * @param string $period + * @param Piwik_Date $date + * @param string $segment + * @param bool $expanded + * @param null $idSubtable * @return Piwik_DataTable */ static public function getDataTableFromArchive($name, $idSite, $period, $date, $segment, $expanded, $idSubtable = null ) diff --git a/core/Common.php b/core/Common.php index 2c345f009b..5bbcbf7343 100644 --- a/core/Common.php +++ b/core/Common.php @@ -41,8 +41,8 @@ class Piwik_Common /** * Hashes a string into an integer which should be very low collision risks - * @param string $string String to hash - * @return int Resulting int hash + * @param string $string String to hash + * @return int Resulting int hash */ static public function hashStringToInt($string) { @@ -54,8 +54,8 @@ class Piwik_Common * Returns the table name prefixed by the table prefix. * Works in both Tracker and UI mode. * - * @param string The table name to prefix, ie "log_visit" - * @return string The table name prefixed, ie "piwik-production_log_visit" + * @param string $table The table name to prefix, ie "log_visit" + * @return string The table name prefixed, ie "piwik-production_log_visit" */ static public function prefixTable($table) { @@ -85,7 +85,8 @@ class Piwik_Common /** * Returns the table name, after removing the table prefix - * @param string $table + * + * @param string $table * @return string */ static public function unprefixTable($table) @@ -166,7 +167,7 @@ class Piwik_Common /** * Returns array containing data about the website: goals, URLs, etc. * - * @param int $idSite + * @param int $idSite * @return array */ static function getCacheWebsiteAttributes( $idSite ) @@ -210,6 +211,7 @@ class Piwik_Common /** * Returns contents of general (global) cache + * * @return array */ static protected function getCacheGeneral() @@ -233,7 +235,7 @@ class Piwik_Common /** * Store data in general (global cache) * - * @param mixed $value + * @param mixed $value * @return bool */ static protected function setCacheGeneral($value) @@ -247,7 +249,7 @@ class Piwik_Common /** * Regenerate Tracker cache files * - * @param array $idSites Array of idSites to clear cache for + * @param array $idSites Array of idSites to clear cache for */ static public function regenerateCacheWebsiteAttributes($idSites = array()) { @@ -264,7 +266,7 @@ class Piwik_Common /** * Delete existing Tracker cache * - * @param string $idSite (website ID of the site to clear cache for + * @param string $idSite (website ID of the site to clear cache for */ static public function deleteCacheWebsiteAttributes( $idSite ) { @@ -289,7 +291,7 @@ class Piwik_Common * * This is similar to calling the API CoreAdminHome.runScheduledTasks (see misc/cron/archive.sh) * - * @param int $now Current timestamp + * @param int $now Current timestamp */ public static function runScheduledTasks($now) { @@ -351,7 +353,7 @@ class Piwik_Common * Returns the path and query part from a URL. * Eg. http://piwik.org/test/index.php?module=CoreHome will return /test/index.php?module=CoreHome * - * @param string $url either http://piwik.org/test or / + * @param string $url either http://piwik.org/test or / * @return string */ static function getPathAndQueryFromUrl($url) @@ -372,9 +374,9 @@ class Piwik_Common /** * Returns the value of a GET parameter $parameter in an URL query $urlQuery * - * @param string $urlQuery result of parse_url()['query'] and htmlentitied (& is &) eg. module=test&action=toto or ?page=test - * @param string $parameter - * @return string|bool Parameter value if found (can be the empty string!), null if not found + * @param string $urlQuery result of parse_url()['query'] and htmlentitied (& is &) eg. module=test&action=toto or ?page=test + * @param string $parameter + * @return string|bool Parameter value if found (can be the empty string!), null if not found */ static public function getParameterFromQueryString( $urlQuery, $parameter) { @@ -389,8 +391,8 @@ class Piwik_Common /** * Returns an URL query string in an array format * - * @param string urlQuery - * @return array array( param1=> value1, param2=>value2) + * @param string $urlQuery + * @return array array( param1=> value1, param2=>value2) */ static public function getArrayFromQueryString( $urlQuery ) { @@ -462,7 +464,7 @@ class Piwik_Common /** * Builds a URL from the result of parse_url function * Copied from the PHP comments at http://php.net/parse_url - * @param array $parsed + * @param array $parsed * @return bool|string */ static public function getParseUrlReverse($parsed) @@ -494,7 +496,7 @@ class Piwik_Common * We don't need a precise test here because the value comes from the website * tracked source code and the URLs may look very strange. * - * @param string $url + * @param string $url * @return bool */ static function isLookLikeUrl( $url ) @@ -509,6 +511,7 @@ class Piwik_Common /** * ending WITHOUT slash + * * @return string */ static public function getPathToPiwikRoot() @@ -519,8 +522,8 @@ class Piwik_Common /** * Create directory if permitted * - * @param string $path - * @param bool $denyAccess + * @param string $path + * @param bool $denyAccess */ static public function mkdir( $path, $denyAccess = true ) { @@ -553,8 +556,8 @@ class Piwik_Common * * Apache-specific; for IIS @see web.config * - * @param string $path without trailing slash - * @param string $content + * @param string $path without trailing slash + * @param string $content */ static public function createHtAccess( $path, $content = "<Files \"*\">\n<IfModule mod_access.c>\nDeny from all\n</IfModule>\n<IfModule !mod_access_compat>\n<IfModule mod_authz_host.c>\nDeny from all\n</IfModule>\n</IfModule>\n<IfModule mod_access_compat>\nDeny from all\n</IfModule>\n</Files>\n" ) { @@ -568,8 +571,8 @@ class Piwik_Common * Get canonicalized absolute path * See http://php.net/realpath * - * @param string $path - * @return string canonicalized absolute path + * @param string $path + * @return string canonicalized absolute path */ static public function realpath($path) { @@ -586,7 +589,7 @@ class Piwik_Common * File names beginning with anything but a-Z or 0-9 will be rejected (including .htaccess for example). * File names containing anything other than above mentioned will also be rejected (file names with spaces won't be accepted). * - * @param string filename + * @param string $filename * @return bool * */ @@ -602,9 +605,9 @@ class Piwik_Common /** * byte-oriented substr() - ASCII * - * @param string $string - * @param int $start - * @param int $length optional length + * @param string $string + * @param int $start + * @param int ... optional length * @return string */ static public function substr($string, $start) @@ -622,7 +625,7 @@ class Piwik_Common /** * byte-oriented strlen() - ASCII * - * @param string $string + * @param string $string * @return int */ static public function strlen($string) @@ -635,9 +638,9 @@ class Piwik_Common /** * multi-byte substr() - UTF-8 * - * @param string $string - * @param int $start - * @param int $length optional length + * @param string $string + * @param int $start + * @param int ... optional length * @return string */ static public function mb_substr($string, $start) @@ -657,7 +660,7 @@ class Piwik_Common /** * multi-byte strlen() - UTF-8 * - * @param string $string + * @param string $string * @return int */ static public function mb_strlen($string) @@ -673,7 +676,7 @@ class Piwik_Common /** * multi-byte strtolower() - UTF-8 * - * @param string $string + * @param string $string * @return string */ static public function mb_strtolower($string) @@ -709,9 +712,10 @@ class Piwik_Common * - It handles the magic_quotes setting. * - A non string value is returned without modification * - * @param mixed $value The variable to be cleaned + * @param mixed $value The variable to be cleaned + * @param bool $alreadyStripslashed * @throws Exception - * @return mixed The variable after cleaning + * @return mixed The variable after cleaning */ static public function sanitizeInputValues($value, $alreadyStripslashed = false) { @@ -754,8 +758,8 @@ class Piwik_Common /** * Sanitize a single input value * - * @param string $value - * @return string sanitized input + * @param string $value + * @return string sanitized input */ static public function sanitizeInputValue($value) { @@ -784,8 +788,8 @@ class Piwik_Common /** * Unsanitize a single input value * - * @param string $value - * @return string unsanitized input + * @param string $value + * @return string unsanitized input */ static public function unsanitizeInputValue($value) { @@ -795,8 +799,8 @@ class Piwik_Common /** * Unsanitize one or more values. * - * @param string|array $value - * @return string|array unsanitized input + * @param string|array $value + * @return string|array unsanitized input */ static public function unsanitizeInputValues($value) { @@ -819,7 +823,7 @@ class Piwik_Common * Undo the damage caused by magic_quotes; deprecated in php 5.3 but not removed until php 5.4 * * @param string - * @return string modified or not + * @return string modified or not */ static public function undoMagicQuotes($value) { @@ -836,10 +840,10 @@ class Piwik_Common * * @see sanitizeInputValues() for the applied sanitization * - * @param string $varName name of the variable - * @param string $varDefault default value. If '', and if the type doesn't match, exit() ! - * @param string $varType Expected type, the value must be one of the following: array, int, integer, string, json - * @param array $requestArrayToUse + * @param string $varName name of the variable + * @param string $varDefault default value. If '', and if the type doesn't match, exit() ! + * @param string $varType Expected type, the value must be one of the following: array, int, integer, string, json + * @param array $requestArrayToUse * * @throws Exception if the variable type is not known * or if the variable we want to read doesn't have neither a value nor a default value specified @@ -996,9 +1000,9 @@ class Piwik_Common /** * Generate random string * - * @param string $length string length - * @param string $alphabet characters allowed in random string - * @return string random string with given length + * @param int $length string length + * @param string $alphabet characters allowed in random string + * @return string random string with given length */ public static function getRandomString($length = 16, $alphabet = "abcdefghijklmnoprstuvwxyz0123456789") { @@ -1027,7 +1031,7 @@ class Piwik_Common * * @see http://php.net/bin2hex * - * @param string $str Hexadecimal representation + * @param string $str Hexadecimal representation * @return string */ static public function hex2bin($str) @@ -1044,9 +1048,9 @@ class Piwik_Common * * It would be simply to silent fail the pack() call above but in all other cases, we don't expect an error, * so better be safe and get the php error when something unexpected is happening - * @param string $id + * @param string $id * @throws Exception - * @return binary string + * @return string binary string */ static public function convertVisitorIdToBin($id) { @@ -1070,7 +1074,7 @@ class Piwik_Common * * @deprecated 1.4 * - * @param string $ip IP address in network address format + * @param string $ip IP address in network address format * @return string */ static public function long2ip($ip) @@ -1081,7 +1085,7 @@ class Piwik_Common /** * Should we use the replacement json_encode/json_decode functions? * - * @return bool True if broken; false otherwise + * @return bool True if broken; false otherwise */ static private function useJsonLibrary() { @@ -1116,7 +1120,7 @@ class Piwik_Common * JSON encode wrapper * - missing or broken in some php 5.x versions * - * @param mixed $value + * @param mixed $value * @return string */ static public function json_encode($value) @@ -1133,8 +1137,8 @@ class Piwik_Common * JSON decode wrapper * - missing or broken in some php 5.x versions * - * @param string $json - * @param bool $assoc + * @param string $json + * @param bool $assoc * @return mixed */ static public function json_decode($json, $assoc = false) @@ -1156,7 +1160,7 @@ class Piwik_Common * * @see core/DataFiles/Countries.php * - * @return array Array of 3 letter continent codes + * @return array Array of 3 letter continent codes */ static public function getContinentsList() { @@ -1171,8 +1175,8 @@ class Piwik_Common * * @see core/DataFiles/Countries.php * - * @param bool $includeInternalCodes - * @return array Array of (2 letter ISO codes => 3 letter continent code) + * @param bool $includeInternalCodes + * @return array Array of (2 letter ISO codes => 3 letter continent code) */ static public function getCountriesList($includeInternalCodes = false) { @@ -1193,7 +1197,7 @@ class Piwik_Common * * @see core/DataFiles/Languages.php * - * @return array Array of 2 letter ISO codes => Language name (in English) + * @return array Array of 2 letter ISO codes => Language name (in English) */ static public function getLanguagesList() { @@ -1208,7 +1212,7 @@ class Piwik_Common * * @see core/DataFiles/LanguageToCountry.php * - * @return array Array of ( 2 letter ISO language codes => 2 letter ISO country codes ) + * @return array Array of ( 2 letter ISO language codes => 2 letter ISO country codes ) */ static public function getLanguageToCountryList() { @@ -1223,7 +1227,7 @@ class Piwik_Common * * @see core/DataFiles/SearchEngines.php * - * @return array Array of ( URL => array( searchEngineName, keywordParameter, path, charset ) ) + * @return array Array of ( URL => array( searchEngineName, keywordParameter, path, charset ) ) */ static public function getSearchEngineUrls() { @@ -1238,7 +1242,7 @@ class Piwik_Common * * @see core/DataFiles/SearchEngines.php * - * @return array Array of ( searchEngineName => URL ) + * @return array Array of ( searchEngineName => URL ) */ static public function getSearchEngineNames() { @@ -1255,7 +1259,7 @@ class Piwik_Common /** * Returns the browser language code, eg. "en-gb,en;q=0.5" * - * @param string $browserLang Optional browser language, otherwise taken from the request header + * @param string $browserLang Optional browser language, otherwise taken from the request header * @return string */ static public function getBrowserLanguage($browserLang = NULL) @@ -1309,10 +1313,10 @@ class Piwik_Common * Returns the visitor country based on the Browser 'accepted language' * information, but provides a hook for geolocation via IP address. * - * @param string $lang browser lang - * @param bool $enableLanguageToCountryGuess If set to true, some assumption will be made and detection guessed more often, but accuracy could be affected - * @param string $ip - * @return string 2 letter ISO code + * @param string $lang browser lang + * @param bool $enableLanguageToCountryGuess If set to true, some assumption will be made and detection guessed more often, but accuracy could be affected + * @param string $ip + * @return string 2 letter ISO code */ static public function getCountry( $lang, $enableLanguageToCountryGuess, $ip ) { @@ -1335,9 +1339,9 @@ class Piwik_Common /** * Returns list of valid country codes * - * @param string $browserLanguage - * @param array $validCountries Arrayof valid countries - * @param bool $enableLanguageToCountryGuess (if true, will guess country based on language that lacks region information) + * @param string $browserLanguage + * @param array $validCountries Array of valid countries + * @param bool $enableLanguageToCountryGuess (if true, will guess country based on language that lacks region information) * @return array Array of 2 letter ISO codes */ static public function extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess) @@ -1373,9 +1377,9 @@ class Piwik_Common /** * Returns the visitor language based only on the Browser 'accepted language' information * - * @param $browserLanguage Browser's accepted langauge header - * @param $validLanguages array of valid language codes - * @return string 2 letter ISO 639 code + * @param $browserLanguage Browser's accepted langauge header + * @param $validLanguages array of valid language codes + * @return string 2 letter ISO 639 code */ static public function extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages) { @@ -1406,9 +1410,9 @@ class Piwik_Common /** * Returns the continent of a given country * - * @param string Country 2 letters isocode + * @param string $country 2 letters isocode * - * @return string Continent (3 letters code : afr, asi, eur, amn, ams, oce) + * @return string Continent (3 letters code : afr, asi, eur, amn, ams, oce) */ static public function getContinent($country) { @@ -1472,7 +1476,7 @@ class Piwik_Common * example.de -> example.{} * example.co.uk -> example.{} * - * @param string $url + * @param string $url * @return string */ static public function getLossyUrl($url) @@ -1513,7 +1517,7 @@ class Piwik_Common * as the google keyword parameter couldn't be found. * * @see unit tests in /tests/core/Common.test.php - * @param string URL referer URL, eg. $_SERVER['HTTP_REFERER'] + * @param string $referrerUrl URL referer URL, eg. $_SERVER['HTTP_REFERER'] * @return array|false false if a keyword couldn't be extracted, * or array( * 'name' => 'Google', @@ -1855,7 +1859,7 @@ class Piwik_Common * Takes a list of fields defining numeric values and returns the corresponding * unnamed parameters to be bound to the field names in the where clause of a SQL query * - * @param array|string $fields array( fieldName1, fieldName2, fieldName3) Names of the mysql table fields to load + * @param array|string $fields array( fieldName1, fieldName2, fieldName3) Names of the mysql table fields to load * @return string "?, ?, ?" */ public static function getSqlStringFieldsArray( $fields ) diff --git a/core/PluginsFunctions/Sql.php b/core/PluginsFunctions/Sql.php index 08d65df90f..248c25547e 100644 --- a/core/PluginsFunctions/Sql.php +++ b/core/PluginsFunctions/Sql.php @@ -107,8 +107,8 @@ class Piwik_Sql /** * Fetches result from the database query as an array of associative arrays. * - * @param string $sql SQL query - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql SQL query + * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) * @return array */ static public function fetchAssoc($sql, $parameters = array()) diff --git a/core/PluginsFunctions/WidgetsList.php b/core/PluginsFunctions/WidgetsList.php index ed55fffb51..eda6b8f8c4 100644 --- a/core/PluginsFunctions/WidgetsList.php +++ b/core/PluginsFunctions/WidgetsList.php @@ -23,7 +23,7 @@ class Piwik_WidgetsList static protected $widgets = null; /** - * Indicated whether the hook was posted or not + * Indicates whether the hook was posted or not * * @var bool */ @@ -42,7 +42,7 @@ class Piwik_WidgetsList self::$hookCalled = true; Piwik_PostEvent('WidgetsList.add'); } - uksort(self::$widgets, 'Piwik_sortWidgetCategories'); + uksort(self::$widgets, array('Piwik_WidgetsList', '_sortWidgetCategories')); $widgets = array(); foreach(self::$widgets as $key => $v) @@ -54,7 +54,39 @@ class Piwik_WidgetsList } return $widgets; } - + + /** + * Sorting method for widget categories + * + * @param string $a + * @param string $b + * @return bool + */ + protected static function _sortWidgetCategories($a, $b) + { + $order = array( + 'VisitsSummary_VisitsSummary', + 'Live!', + 'General_Visitors', + 'UserSettings_VisitorSettings', + 'Actions_Actions', + 'Referers_Referers', + 'Goals_Goals', + 'Goals_Ecommerce', + '_others_', + 'Example Widgets', + 'ExamplePlugin_exampleWidgets', + ); + + if(($oa = array_search($a, $order)) === false) { + $oa = array_search('_others_', $order); + } + if(($ob = array_search($b, $order)) === false) { + $ob = array_search('_others_', $order); + } + return $oa > $ob; + } + /** * Adds an widget to the list * @@ -66,7 +98,6 @@ class Piwik_WidgetsList */ static public function add($widgetCategory, $widgetName, $controllerName, $controllerAction, $customParameters) { - $widgetCategory = $widgetCategory; $widgetName = Piwik_Translate($widgetName); $widgetUniqueId = 'widget' . $controllerName . $controllerAction; foreach($customParameters as $name => $value) @@ -113,38 +144,6 @@ class Piwik_WidgetsList } } -/* - * @private - */ -function Piwik_sortWidgetCategories($a, $b) -{ - $order = array( - 'VisitsSummary_VisitsSummary', - 'Live!', - 'General_Visitors', - 'UserSettings_VisitorSettings', - 'Actions_Actions', - 'Referers_Referers', - 'Goals_Goals', - 'Goals_Ecommerce', - '_others_', - 'Example Widgets', - 'ExamplePlugin_exampleWidgets', - ); - - if(($oa = array_search($a, $order)) === false) { - $oa = array_search('_others_', $order); - } - if(($ob = array_search($b, $order)) === false) { - $ob = array_search('_others_', $order); - } -// var_dump($a); -// var_dump($b); - return $oa > $ob; -} - - - /** * Returns all available widgets * diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index 572534a7bd..bb9a676b31 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -59,12 +59,22 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface private $actionUrl; static private $queryParametersToExclude = array('phpsessid', 'jsessionid', 'sessionid', 'aspsessionid', 'fb_xd_fragment', 'fb_comment_id'); - + + /** + * Set request parameters + * + * @param array $requestArray + */ public function setRequest($requestArray) { $this->request = $requestArray; } + /** + * Returns the current set request parameters + * + * @return array + */ public function getRequest() { return $this->request; @@ -72,6 +82,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface /** * Returns URL of the page currently being tracked, or the file being downloaded, or the outlink being clicked + * * @return string */ public function getActionUrl() diff --git a/core/Tracker/Db.php b/core/Tracker/Db.php index 48e2eb1703..1c49fed5d1 100644 --- a/core/Tracker/Db.php +++ b/core/Tracker/Db.php @@ -24,6 +24,8 @@ abstract class Piwik_Tracker_Db protected $queriesProfiling = array(); + protected $connection = null; + /** * Enables the SQL profiling. * For each query, saves in the DB the time spent on this query. @@ -68,8 +70,8 @@ abstract class Piwik_Tracker_Db /** * Record query profile * - * @param string $query - * @param Piwik_Timer $timer + * @param string $query + * @param Piwik_Timer $timer */ protected function recordQueryProfile( $query, $timer ) { @@ -127,29 +129,30 @@ abstract class Piwik_Tracker_Db /** * Returns an array containing all the rows of a query result, using optional bound parameters. * - * @param string Query - * @param array Parameters to bind - * @see also query() - * @throws Piwik_Tracker_Db_Exception if an exception occured + * @param string $query Query + * @param array $parameters Parameters to bind + * @see query() + * @throws Piwik_Tracker_Db_Exception if an exception occurred */ abstract public function fetchAll( $query, $parameters = array() ); /** * Returns the first row of a query result, using optional bound parameters. * - * @param string Query - * @param array Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @see also query() * - * @throws Piwik_Tracker_Db_Exception if an exception occured + * @throws Piwik_Tracker_Db_Exception if an exception occurred */ abstract public function fetch( $query, $parameters = array() ); /** * This function is a proxy to fetch(), used to maintain compatibility with Zend_Db interface + * * @see fetch() - * @param $query - * @param array $parameters + * @param string $query Query + * @param array $parameters Parameters to bind * @return */ public function fetchRow( $query, $parameters = array() ) @@ -159,9 +162,10 @@ abstract class Piwik_Tracker_Db /** * This function is a proxy to fetch(), used to maintain compatibility with Zend_Db interface + * * @see fetch() - * @param string $query - * @param array $parameters + * @param string $query Query + * @param array $parameters Parameters to bind * @return bool|mixed */ public function fetchOne( $query, $parameters = array() ) @@ -172,9 +176,10 @@ abstract class Piwik_Tracker_Db /** * This function is a proxy to fetch(), used to maintain compatibility with Zend_Db + PDO interface + * * @see fetch() - * @param string $query - * @param array $parameters + * @param string $query Query + * @param array $parameters Parameters to bind * @return */ public function exec( $query, $parameters = array() ) @@ -185,7 +190,7 @@ abstract class Piwik_Tracker_Db /** * Return number of affected rows in last query * - * @param mixed $queryResult Result from query() + * @param mixed $queryResult Result from query() * @return int */ abstract public function rowCount($queryResult); @@ -193,11 +198,11 @@ abstract class Piwik_Tracker_Db /** * Executes a query, using optional bound parameters. * - * @param string Query - * @param array|string Parameters to bind array('idsite'=> 1) + * @param string $query Query + * @param array $parameters Parameters to bind array('idsite'=> 1) * * @return PDOStatement or false if failed - * @throws Piwik_Tracker_Db_Exception if an exception occured + * @throws Piwik_Tracker_Db_Exception if an exception occurred */ abstract public function query($query, $parameters = array()); @@ -212,16 +217,9 @@ abstract class Piwik_Tracker_Db /** * Test error number * - * @param Exception $e - * @param string $errno - * @return bool True if error number matches; false otherwise + * @param Exception $e + * @param string $errno + * @return bool True if error number matches; false otherwise */ abstract public function isErrNo($e, $errno); -} - -/** - * @package Piwik - * @subpackage Piwik_Tracker - */ -class Piwik_Tracker_Db_Exception extends Exception { -} +}
\ No newline at end of file diff --git a/core/Tracker/Db/Exception.php b/core/Tracker/Db/Exception.php new file mode 100644 index 0000000000..824d45fe1b --- /dev/null +++ b/core/Tracker/Db/Exception.php @@ -0,0 +1,20 @@ +<?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 + * @package Piwik + */ + +/** + * Database Exception + * + * @package Piwik + * @subpackage Piwik_Tracker + */ +class Piwik_Tracker_Db_Exception extends Exception { +} diff --git a/core/Tracker/Db/Mysqli.php b/core/Tracker/Db/Mysqli.php index e2724617af..0dbea800cd 100644 --- a/core/Tracker/Db/Mysqli.php +++ b/core/Tracker/Db/Mysqli.php @@ -19,13 +19,13 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db { protected $connection = null; - private $host; - private $port; - private $socket; - private $dbname; - private $username; - private $password; - private $charset; + protected $host; + protected $port; + protected $socket; + protected $dbname; + protected $username; + protected $password; + protected $charset; /** * Builds the DB object @@ -156,7 +156,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db * * @param string $query Query * @param array $parameters Parameters to bind - * @throws Piwik_Tracker_Db_Exception if an exception occured + * @throws Piwik_Tracker_Db_Exception if an exception occurred */ public function fetch( $query, $parameters = array() ) { @@ -193,7 +193,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db * @param array|string $parameters Parameters to bind array('idsite'=> 1) * * @return bool|resource false if failed - * @throws Piwik_Tracker_Db_Exception if an exception occured + * @throws Piwik_Tracker_Db_Exception if an exception occurred */ public function query($query, $parameters = array()) { diff --git a/core/Tracker/Db/Pdo/Mysql.php b/core/Tracker/Db/Pdo/Mysql.php index 42e213d640..81670e956f 100644 --- a/core/Tracker/Db/Pdo/Mysql.php +++ b/core/Tracker/Db/Pdo/Mysql.php @@ -19,15 +19,16 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db { protected $connection = null; - private $dsn; - private $username; - private $password; - private $charset; + protected $dsn; + protected $username; + protected $password; + protected $charset; /** * Builds the DB object - * @param array $dbInfo - * @param string $driverName + * + * @param array $dbInfo + * @param string $driverName */ public function __construct( $dbInfo, $driverName = 'mysql') { @@ -100,10 +101,10 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db /** * Returns an array containing all the rows of a query result, using optional bound parameters. * - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @return array|bool - * @see also query() + * @see query() * @throws Exception|Piwik_Tracker_Db_Exception if an exception occurred */ public function fetchAll( $query, $parameters = array() ) @@ -123,11 +124,10 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db /** * Returns the first row of a query result, using optional bound parameters. * - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @return bool|mixed - * @see also query() - * + * @see query() * @throws Exception|Piwik_Tracker_Db_Exception if an exception occurred */ public function fetch( $query, $parameters = array() ) @@ -198,8 +198,8 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db /** * Test error number * - * @param Exception $e - * @param string $errno + * @param Exception $e + * @param string $errno * @return bool */ public function isErrNo($e, $errno) @@ -214,7 +214,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db /** * Return number of affected rows in last query * - * @param mixed $queryResult Result from query() + * @param mixed $queryResult Result from query() * @return int */ public function rowCount($queryResult) diff --git a/core/Tracker/Db/Pdo/Pgsql.php b/core/Tracker/Db/Pdo/Pgsql.php index e97de54c26..e5146cb660 100644 --- a/core/Tracker/Db/Pdo/Pgsql.php +++ b/core/Tracker/Db/Pdo/Pgsql.php @@ -20,8 +20,9 @@ class Piwik_Tracker_Db_Pdo_Pgsql extends Piwik_Tracker_Db_Pdo_Mysql { /** * Builds the DB object - * @param $dbInfo - * @param string $driverName + * + * @param array $dbInfo + * @param string $driverName */ public function __construct( $dbInfo, $driverName = 'pgsql') { @@ -63,8 +64,8 @@ class Piwik_Tracker_Db_Pdo_Pgsql extends Piwik_Tracker_Db_Pdo_Mysql /** * Test error number * - * @param Exception $e - * @param string $errno + * @param Exception $e + * @param string $errno * @return bool */ public function isErrNo($e, $errno) @@ -110,7 +111,7 @@ class Piwik_Tracker_Db_Pdo_Pgsql extends Piwik_Tracker_Db_Pdo_Mysql /** * Return number of affected rows in last query * - * @param mixed $queryResult Result from query() + * @param mixed $queryResult Result from query() * @return int */ public function rowCount($queryResult) diff --git a/core/Tracker/IgnoreCookie.php b/core/Tracker/IgnoreCookie.php index e80458a49a..cef49065a3 100644 --- a/core/Tracker/IgnoreCookie.php +++ b/core/Tracker/IgnoreCookie.php @@ -67,7 +67,7 @@ class Piwik_Tracker_IgnoreCookie /** * Returns true if ignore (visit) cookie is present * - * @return bool True if ignore cookie found; false otherwise + * @return bool True if ignore cookie found; false otherwise */ static public function isIgnoreCookieFound() { diff --git a/core/View/Interface.php b/core/View/Interface.php index 99aa7c82cd..9ac2daca11 100644 --- a/core/View/Interface.php +++ b/core/View/Interface.php @@ -19,6 +19,7 @@ interface Piwik_View_Interface { /** * Outputs the data. + * * @return mixed (image, array, html...) */ function render(); diff --git a/core/View/OneClickDone.php b/core/View/OneClickDone.php index 4c38185c9a..053bb9b199 100644 --- a/core/View/OneClickDone.php +++ b/core/View/OneClickDone.php @@ -47,7 +47,7 @@ class Piwik_View_OneClickDone /** * Outputs the data. * - * @return string html + * @return string html */ public function render() { |