diff --git a/core/API/DataTableGenericFilter.php b/core/API/DataTableGenericFilter.php index 9561c26ee542d76c8271254947b770eccf7c0376..22f691c5055f95f7bd444ec302cc1f1981405699 100644 --- a/core/API/DataTableGenericFilter.php +++ b/core/API/DataTableGenericFilter.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Piwik diff --git a/core/API/DataTableManipulator/LabelFilter.php b/core/API/DataTableManipulator/LabelFilter.php index 43f43ce05612a077adbb0f96947366c1813338f6..20ba5b273f387685560bd03457041b68c2329423 100644 --- a/core/API/DataTableManipulator/LabelFilter.php +++ b/core/API/DataTableManipulator/LabelFilter.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * This class is responsible for handling the label parameter that can be diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php index 0f40826e220b8503a496554fcc315ab1114ce2ec..76c7b2f15603a6731efec093807176a392c8b665 100644 --- a/core/API/DocumentationGenerator.php +++ b/core/API/DocumentationGenerator.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik diff --git a/core/API/Proxy.php b/core/API/Proxy.php index ae07892e3d1dd3181cc560195905317e1bef9547..723820e1eef804f796db5b6b8fc4a87765ce0301 100644 --- a/core/API/Proxy.php +++ b/core/API/Proxy.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * To differentiate between "no value" and default value of null diff --git a/core/API/Request.php b/core/API/Request.php index 184a566d09dfe748f3cb5bcab36aa3689bd8ff04..503481f1852b83f0ad043738c79760897eaffa25 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * An API request is the object used to make a call to the API and get the result. diff --git a/core/API/ResponseBuilder.php b/core/API/ResponseBuilder.php index f826319fca1fef84a10d13e6ac7f44908f77e7c4..3935f267f7ae2dbce778c1657b464319e15ff26c 100644 --- a/core/API/ResponseBuilder.php +++ b/core/API/ResponseBuilder.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik diff --git a/core/Access.php b/core/Access.php index 10f798e9378ba95f0de44081a911c73872f97d79..715b96aae015377ae4c07001fc9d361c1cc21989 100644 --- a/core/Access.php +++ b/core/Access.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * Class to handle User Access: diff --git a/core/Archive.php b/core/Archive.php index 9afd5870f153ebb2b48c5f2952a2552f47168eb7..3e661b7a9ea8d3d2e457ab87ebce58d3f0016568 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * The archive object is used to query specific data for a day or a period of statistics for a given website. diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php index bb42ca1b5866e5afb044a8b4eed917a1b19b8d06..bcbfcc1de2b7346a88f0ffd8c4f6d903d048291d 100644 --- a/core/ArchiveProcessor.php +++ b/core/ArchiveProcessor.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; +use Piwik\Config; +use Piwik\Piwik; /** * The ArchiveProcessor class is used by the Archive object to make sure the given Archive is processed and available in the DB. diff --git a/core/ArchiveProcessor/Period.php b/core/ArchiveProcessor/Period.php index 8a25b5d38568a96ef74ac774491361ad26dcb063..a53182a2af5b321b9577115f59a7eacaa6ec6cf2 100644 --- a/core/ArchiveProcessor/Period.php +++ b/core/ArchiveProcessor/Period.php @@ -8,7 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; +use Piwik\Common; /** * This class provides generic methods to archive data for a period (week / month / year). @@ -85,7 +86,7 @@ class Piwik_ArchiveProcessor_Period extends Piwik_ArchiveProcessor $nameToCount[$recordName]['recursive'] = $table->getRowsCountRecursive(); $blob = $table->getSerialized($maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation); - destroy($table); + Common::destroy($table); $this->insertBlobRecord($recordName, $blob); } Piwik_DataTable_Manager::getInstance()->deleteAll($latestUsedTableId); diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php index 34abbec5364b88de0b86544171278c570f8d67d8..a4ddd03e350fcd4fa8922225fc4bcec3ea3ab0f2 100644 --- a/core/ArchiveProcessor/Rules.php +++ b/core/ArchiveProcessor/Rules.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * This class contains Archiving rules/logic which are used in several places diff --git a/core/AssetManager.php b/core/AssetManager.php index 1c50f69ce663d15a7fba4cb099959129ca6ce40c..322ab4ab200a32a17b5cf64647b06395e0284716 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * @see libs/jsmin/jsmin.php diff --git a/core/CacheFile.php b/core/CacheFile.php index 21dafedf6502521850b6b6840e401e5a26d5ad48..7458588dc3f81c1b63797bda92c8c3619d94c5a4 100644 --- a/core/CacheFile.php +++ b/core/CacheFile.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Code originally inspired from OpenX diff --git a/core/Common.php b/core/Common.php index bad3bf28eddc55cde530d1695257390499b4b993..2f12f3e48894c2b94af7703387ddce20dc2ddb0e 100644 --- a/core/Common.php +++ b/core/Common.php @@ -1,1580 +1,1568 @@ <?php -namespace Piwik\Core { - use Exception; - use Piwik_IP; - use Piwik_PluginsManager; - use Piwik_Tracker; - use Piwik_Tracker_Cache; - use Piwik_UserCountry_LocationProvider_Default; - - /** - * Static class providing functions used by both the CORE of Piwik and the visitor Tracking engine. - * - * This is the only external class loaded by the /piwik.php file. - * This class should contain only the functions that are used in - * both the CORE and the piwik.php statistics logging engine. - * - * @package Piwik - */ - class Common - { - const CLASSES_PREFIX = 'Piwik_'; - - /** - * Const used to map the referer type to an integer in the log_visit table - */ - const REFERER_TYPE_DIRECT_ENTRY = 1; - const REFERER_TYPE_SEARCH_ENGINE = 2; - const REFERER_TYPE_WEBSITE = 3; - const REFERER_TYPE_CAMPAIGN = 6; - - /** - * Flag used with htmlspecialchar - * See php.net/htmlspecialchars - */ - const HTML_ENCODING_QUOTE_STYLE = ENT_QUOTES; - - /* - * Database - */ - - /** - * Hashes a string into an integer which should be very low collision risks - * @param string $string String to hash - * @return int Resulting int hash - */ - public static function hashStringToInt($string) - { - $stringHash = substr(md5($string), 0, 8); - return base_convert($stringHash, 16, 10); - } - - public static $cachedTablePrefix = null; - - /** - * Returns the table name prefixed by the table prefix. - * Works in both Tracker and UI mode. - * - * @param string $table The table name to prefix, ie "log_visit" - * @return string The table name prefixed, ie "piwik-production_log_visit" - */ - public static function prefixTable($table) - { - $prefix = Config::getInstance()->database['tables_prefix']; - return $prefix . $table; - } - - /** - * Returns an array containing the prefixed table names of every passed argument. - * - * @param string ... The table names to prefix, ie "log_visit" - * @return array The prefixed names in an array. - */ - public static function prefixTables() - { - $result = array(); - foreach (func_get_args() as $table) { - $result[] = \Piwik\Core\self::prefixTable($table); - } - return $result; +namespace Piwik; + +use Exception; +use Piwik_IP; +use Piwik_PluginsManager; +use Piwik_Tracker; +use Piwik_Tracker_Cache; +use Piwik_UserCountry_LocationProvider_Default; + +/** + * Static class providing functions used by both the CORE of Piwik and the visitor Tracking engine. + * + * This is the only external class loaded by the /piwik.php file. + * This class should contain only the functions that are used in + * both the CORE and the piwik.php statistics logging engine. + * + * @package Piwik + */ +class Common +{ + const CLASSES_PREFIX = 'Piwik_'; + + /** + * Const used to map the referer type to an integer in the log_visit table + */ + const REFERER_TYPE_DIRECT_ENTRY = 1; + const REFERER_TYPE_SEARCH_ENGINE = 2; + const REFERER_TYPE_WEBSITE = 3; + const REFERER_TYPE_CAMPAIGN = 6; + + /** + * Flag used with htmlspecialchar + * See php.net/htmlspecialchars + */ + const HTML_ENCODING_QUOTE_STYLE = ENT_QUOTES; + + /* + * Database + */ + + /** + * Hashes a string into an integer which should be very low collision risks + * @param string $string String to hash + * @return int Resulting int hash + */ + public static function hashStringToInt($string) + { + $stringHash = substr(md5($string), 0, 8); + return base_convert($stringHash, 16, 10); + } + + public static $cachedTablePrefix = null; + + /** + * Returns the table name prefixed by the table prefix. + * Works in both Tracker and UI mode. + * + * @param string $table The table name to prefix, ie "log_visit" + * @return string The table name prefixed, ie "piwik-production_log_visit" + */ + public static function prefixTable($table) + { + $prefix = Config::getInstance()->database['tables_prefix']; + return $prefix . $table; + } + + /** + * Returns an array containing the prefixed table names of every passed argument. + * + * @param string ... The table names to prefix, ie "log_visit" + * @return array The prefixed names in an array. + */ + public static function prefixTables() + { + $result = array(); + foreach (func_get_args() as $table) { + $result[] = self::prefixTable($table); + } + return $result; + } + + /** + * Returns the table name, after removing the table prefix + * + * @param string $table + * @return string + */ + public static function unprefixTable($table) + { + static $prefixTable = null; + if (is_null($prefixTable)) { + $prefixTable = Config::getInstance()->database['tables_prefix']; + } + if (empty($prefixTable) + || strpos($table, $prefixTable) !== 0 + ) { + return $table; + } + $count = 1; + return str_replace($prefixTable, '', $table, $count); + } + + /* + * Tracker + */ + public static function isGoalPluginEnabled() + { + return Piwik_PluginsManager::getInstance()->isPluginActivated('Goals'); + } + + /* + * URLs + */ + + /** + * 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 / + * @return string + */ + public static function getPathAndQueryFromUrl($url) + { + $parsedUrl = parse_url($url); + $result = ''; + if (isset($parsedUrl['path'])) { + $result .= substr($parsedUrl['path'], 1); } + if (isset($parsedUrl['query'])) { + $result .= '?' . $parsedUrl['query']; + } + return $result; + } - /** - * Returns the table name, after removing the table prefix - * - * @param string $table - * @return string - */ - public static function unprefixTable($table) - { - static $prefixTable = null; - if (is_null($prefixTable)) { - $prefixTable = Config::getInstance()->database['tables_prefix']; + /** + * 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 + */ + public static function getParameterFromQueryString($urlQuery, $parameter) + { + $nameToValue = self::getArrayFromQueryString($urlQuery); + if (isset($nameToValue[$parameter])) { + return $nameToValue[$parameter]; + } + return null; + } + + /** + * Returns an URL query string in an array format + * + * @param string $urlQuery + * @return array array( param1=> value1, param2=>value2) + */ + public static function getArrayFromQueryString($urlQuery) + { + if (strlen($urlQuery) == 0) { + return array(); + } + if ($urlQuery[0] == '?') { + $urlQuery = substr($urlQuery, 1); + } + $separator = '&'; + + $urlQuery = $separator . $urlQuery; + // $urlQuery = str_replace(array('%20'), ' ', $urlQuery); + $refererQuery = trim($urlQuery); + + $values = explode($separator, $refererQuery); + + $nameToValue = array(); + + foreach ($values as $value) { + $pos = strpos($value, '='); + if ($pos !== false) { + $name = substr($value, 0, $pos); + $value = substr($value, $pos + 1); + if ($value === false) { + $value = ''; + } + } else { + $name = $value; + $value = false; } - if (empty($prefixTable) - || strpos($table, $prefixTable) !== 0 - ) { - return $table; + if (!empty($name)) { + $name = self::sanitizeInputValue($name); } - $count = 1; - return str_replace($prefixTable, '', $table, $count); - } - - /* - * Tracker - */ - public static function isGoalPluginEnabled() - { - return Piwik_PluginsManager::getInstance()->isPluginActivated('Goals'); - } - - /* - * URLs - */ - - /** - * 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 / - * @return string - */ - public static function getPathAndQueryFromUrl($url) - { - $parsedUrl = parse_url($url); - $result = ''; - if (isset($parsedUrl['path'])) { - $result .= substr($parsedUrl['path'], 1); + if (!empty($value)) { + $value = self::sanitizeInputValue($value); } - if (isset($parsedUrl['query'])) { - $result .= '?' . $parsedUrl['query']; + + // if array without indexes + $count = 0; + $tmp = preg_replace('/(\[|%5b)(]|%5d)$/i', '', $name, -1, $count); + if (!empty($tmp) && $count) { + $name = $tmp; + if (isset($nameToValue[$name]) == false || is_array($nameToValue[$name]) == false) { + $nameToValue[$name] = array(); + } + array_push($nameToValue[$name], $value); + } else if (!empty($name)) { + $nameToValue[$name] = $value; } - return $result; } + return $nameToValue; + } - /** - * 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 - */ - public static function getParameterFromQueryString($urlQuery, $parameter) - { - $nameToValue = \Piwik\Core\self::getArrayFromQueryString($urlQuery); - if (isset($nameToValue[$parameter])) { - return $nameToValue[$parameter]; - } - return null; - } - - /** - * Returns an URL query string in an array format - * - * @param string $urlQuery - * @return array array( param1=> value1, param2=>value2) - */ - public static function getArrayFromQueryString($urlQuery) - { - if (strlen($urlQuery) == 0) { - return array(); + /** + * Builds a URL from the result of parse_url function + * Copied from the PHP comments at http://php.net/parse_url + * @param array $parsed + * @return bool|string + */ + public static function getParseUrlReverse($parsed) + { + if (!is_array($parsed)) { + return false; + } + + $uri = !empty($parsed['scheme']) ? $parsed['scheme'] . ':' . (!strcasecmp($parsed['scheme'], 'mailto') ? '' : '//') : ''; + $uri .= !empty($parsed['user']) ? $parsed['user'] . (!empty($parsed['pass']) ? ':' . $parsed['pass'] : '') . '@' : ''; + $uri .= !empty($parsed['host']) ? $parsed['host'] : ''; + $uri .= !empty($parsed['port']) ? ':' . $parsed['port'] : ''; + + if (!empty($parsed['path'])) { + $uri .= (!strncmp($parsed['path'], '/', 1)) + ? $parsed['path'] + : ((!empty($uri) ? '/' : '') . $parsed['path']); + } + + $uri .= !empty($parsed['query']) ? '?' . $parsed['query'] : ''; + $uri .= !empty($parsed['fragment']) ? '#' . $parsed['fragment'] : ''; + return $uri; + } + + /** + * Returns true if the string passed may be a URL. + * 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 + * @return bool + */ + public static function isLookLikeUrl($url) + { + return preg_match('~^(ftp|news|http|https)?://(.*)$~D', $url, $matches) !== 0 + && strlen($matches[2]) > 0; + } + + /* + * File operations + */ + + /** + * ending WITHOUT slash + * + * @return string + */ + public static function getPathToPiwikRoot() + { + return realpath(dirname(__FILE__) . "/.."); + } + + /** + * Create directory if permitted + * + * @param string $path + * @param bool $denyAccess + */ + public static function mkdir($path, $denyAccess = true) + { + if (!is_dir($path)) { + // the mode in mkdir is modified by the current umask + @mkdir($path, $mode = 0755, $recursive = true); + } + + // try to overcome restrictive umask (mis-)configuration + if (!is_writable($path)) { + @chmod($path, 0755); + if (!is_writable($path)) { + @chmod($path, 0775); + + // enough! we're not going to make the directory world-writeable } - if ($urlQuery[0] == '?') { - $urlQuery = substr($urlQuery, 1); + } + + if ($denyAccess) { + self::createHtAccess($path, $overwrite = false); + } + } + + /** + * Create .htaccess file in specified directory + * + * Apache-specific; for IIS @see web.config + * + * @param string $path without trailing slash + * @param bool $overwrite whether to overwrite an existing file or not + * @param string $content + */ + public static function createHtAccess($path, $overwrite = true, $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") + { + if (self::isApache()) { + $file = $path . '/.htaccess'; + if ($overwrite || !file_exists($file)) { + @file_put_contents($file, $content); } - $separator = '&'; + } + } - $urlQuery = $separator . $urlQuery; - // $urlQuery = str_replace(array('%20'), ' ', $urlQuery); - $refererQuery = trim($urlQuery); + /** + * Get canonicalized absolute path + * See http://php.net/realpath + * + * @param string $path + * @return string canonicalized absolute path + */ + public static function realpath($path) + { + if (file_exists($path)) { + return realpath($path); + } + return $path; + } - $values = explode($separator, $refererQuery); + /** + * Returns true if the string is a valid filename + * File names that start with a-Z or 0-9 and contain a-Z, 0-9, underscore(_), dash(-), and dot(.) will be accepted. + * 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 + * @return bool + * + */ + public static function isValidFilename($filename) + { + return (0 !== preg_match('/(^[a-zA-Z0-9]+([a-zA-Z_0-9.-]*))$/D', $filename)); + } - $nameToValue = array(); + /* + * String operations + */ - foreach ($values as $value) { - $pos = strpos($value, '='); - if ($pos !== false) { - $name = substr($value, 0, $pos); - $value = substr($value, $pos + 1); - if ($value === false) { - $value = ''; - } - } else { - $name = $value; - $value = false; - } - if (!empty($name)) { - $name = \Piwik\Core\Common::sanitizeInputValue($name); - } - if (!empty($value)) { - $value = \Piwik\Core\Common::sanitizeInputValue($value); + /** + * byte-oriented substr() - ASCII + * + * @param string $string + * @param int $start + * @param int ... optional length + * @return string + */ + public static function substr($string, $start) + { + // in case mbstring overloads substr function + $substr = function_exists('mb_orig_substr') ? 'mb_orig_substr' : 'substr'; + + $length = func_num_args() > 2 + ? func_get_arg(2) + : self::strlen($string); + + return $substr($string, $start, $length); + } + + /** + * byte-oriented strlen() - ASCII + * + * @param string $string + * @return int + */ + public static function strlen($string) + { + // in case mbstring overloads strlen function + $strlen = function_exists('mb_orig_strlen') ? 'mb_orig_strlen' : 'strlen'; + return $strlen($string); + } + + /** + * multi-byte substr() - UTF-8 + * + * @param string $string + * @param int $start + * @param int ... optional length + * @return string + */ + public static function mb_substr($string, $start) + { + $length = func_num_args() > 2 + ? func_get_arg(2) + : self::mb_strlen($string); + + if (function_exists('mb_substr')) { + return mb_substr($string, $start, $length, 'UTF-8'); + } + + return substr($string, $start, $length); + } + + /** + * multi-byte strlen() - UTF-8 + * + * @param string $string + * @return int + */ + public static function mb_strlen($string) + { + if (function_exists('mb_strlen')) { + return mb_strlen($string, 'UTF-8'); + } + + return strlen($string); + } + + /** + * multi-byte strtolower() - UTF-8 + * + * @param string $string + * @return string + */ + public static function mb_strtolower($string) + { + if (function_exists('mb_strtolower')) { + return mb_strtolower($string, 'UTF-8'); + } + + return strtolower($string); + } + + /* + * Escaping input + */ + + /** + * Returns the variable after cleaning operations. + * NB: The variable still has to be escaped before going into a SQL Query! + * + * If an array is passed the cleaning is done recursively on all the sub-arrays. + * The array's keys are filtered as well! + * + * How this method works: + * - The variable returned has been htmlspecialchars to avoid the XSS security problem. + * - The single quotes are not protected so "Piwik's amazing" will still be "Piwik's amazing". + * + * - Transformations are: + * - '&' (ampersand) becomes '&' + * - '"'(double quote) becomes '"' + * - '<' (less than) becomes '<' + * - '>' (greater than) becomes '>' + * - It handles the magic_quotes setting. + * - A non string value is returned without modification + * + * @param mixed $value The variable to be cleaned + * @param bool $alreadyStripslashed + * @throws Exception + * @return mixed The variable after cleaning + */ + public static function sanitizeInputValues($value, $alreadyStripslashed = false) + { + if (is_numeric($value)) { + return $value; + } elseif (is_string($value)) { + $value = self::sanitizeInputValue($value); + + if (!$alreadyStripslashed) // a JSON array was already stripslashed, don't do it again for each value + { + $value = self::undoMagicQuotes($value); + } + } elseif (is_array($value)) { + foreach (array_keys($value) as $key) { + $newKey = $key; + $newKey = self::sanitizeInputValues($newKey, $alreadyStripslashed); + if ($key != $newKey) { + $value[$newKey] = $value[$key]; + unset($value[$key]); } - // if array without indexes - $count = 0; - $tmp = preg_replace('/(\[|%5b)(]|%5d)$/i', '', $name, -1, $count); - if (!empty($tmp) && $count) { - $name = $tmp; - if (isset($nameToValue[$name]) == false || is_array($nameToValue[$name]) == false) { - $nameToValue[$name] = array(); - } - array_push($nameToValue[$name], $value); - } else if (!empty($name)) { - $nameToValue[$name] = $value; + $value[$newKey] = self::sanitizeInputValues($value[$newKey], $alreadyStripslashed); + } + } elseif (!is_null($value) + && !is_bool($value) + ) { + throw new Exception("The value to escape has not a supported type. Value = " . var_export($value, true)); + } + return $value; + } + + /** + * Sanitize a single input value + * + * @param string $value + * @return string sanitized input + */ + public static function sanitizeInputValue($value) + { + // $_GET and $_REQUEST already urldecode()'d + // decode + // note: before php 5.2.7, htmlspecialchars() double encodes &#x hex items + $value = html_entity_decode($value, \Piwik\Common::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); + + // filter + $value = str_replace(array("\n", "\r", "\0"), '', $value); + + // escape + $tmp = @htmlspecialchars($value, self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); + + // note: php 5.2.5 and above, htmlspecialchars is destructive if input is not UTF-8 + if ($value != '' && $tmp == '') { + // convert and escape + $value = utf8_encode($value); + $tmp = htmlspecialchars($value, self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); + } + return $tmp; + } + + /** + * Unsanitize a single input value + * + * @param string $value + * @return string unsanitized input + */ + public static function unsanitizeInputValue($value) + { + return htmlspecialchars_decode($value, self::HTML_ENCODING_QUOTE_STYLE); + } + + /** + * Unsanitize one or more values. + * + * @param string|array $value + * @return string|array unsanitized input + */ + public static function unsanitizeInputValues($value) + { + if (is_array($value)) { + $result = array(); + foreach ($value as $key => $arrayValue) { + $result[$key] = self::unsanitizeInputValues($arrayValue); + } + return $result; + } else { + return self::unsanitizeInputValue($value); + } + } + + /** + * 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 + */ + public static function undoMagicQuotes($value) + { + return version_compare(PHP_VERSION, '5.4', '<') + && get_magic_quotes_gpc() + ? stripslashes($value) + : $value; + } + + /** + * Returns a sanitized variable value from the $_GET and $_POST superglobal. + * If the variable doesn't have a value or an empty value, returns the defaultValue if specified. + * If the variable doesn't have neither a value nor a default value provided, an exception is raised. + * + * @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 + * + * @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 + * + * @return mixed The variable after cleaning + */ + public static function getRequestVar($varName, $varDefault = null, $varType = null, $requestArrayToUse = null) + { + if (is_null($requestArrayToUse)) { + $requestArrayToUse = $_GET + $_POST; + } + $varDefault = self::sanitizeInputValues($varDefault); + if ($varType === 'int') { + // settype accepts only integer + // 'int' is simply a shortcut for 'integer' + $varType = 'integer'; + } + + // there is no value $varName in the REQUEST so we try to use the default value + if (empty($varName) + || !isset($requestArrayToUse[$varName]) + || (!is_array($requestArrayToUse[$varName]) + && strlen($requestArrayToUse[$varName]) === 0 + ) + ) { + if (is_null($varDefault)) { + throw new Exception("The parameter '$varName' isn't set in the Request, and a default value wasn't provided."); + } else { + if (!is_null($varType) + && in_array($varType, array('string', 'integer', 'array')) + ) { + settype($varDefault, $varType); } + return $varDefault; } - return $nameToValue; - } - - /** - * Builds a URL from the result of parse_url function - * Copied from the PHP comments at http://php.net/parse_url - * @param array $parsed - * @return bool|string - */ - public static function getParseUrlReverse($parsed) - { - if (!is_array($parsed)) { - return false; + } + + // Normal case, there is a value available in REQUEST for the requested varName: + + // we deal w/ json differently + if ($varType == 'json') { + $value = self::undoMagicQuotes($requestArrayToUse[$varName]); + $value = self::json_decode($value, $assoc = true); + return self::sanitizeInputValues($value, $alreadyStripslashed = true); + } + + $value = self::sanitizeInputValues($requestArrayToUse[$varName]); + if (!is_null($varType)) { + $ok = false; + + if ($varType === 'string') { + if (is_string($value)) $ok = true; + } elseif ($varType === 'integer') { + if ($value == (string)(int)$value) $ok = true; + } elseif ($varType === 'float') { + if ($value == (string)(float)$value) $ok = true; + } elseif ($varType === 'array') { + if (is_array($value)) $ok = true; + } else { + throw new Exception("\$varType specified is not known. It should be one of the following: array, int, integer, float, string"); + } + + // The type is not correct + if ($ok === false) { + if ($varDefault === null) { + throw new Exception("The parameter '$varName' doesn't have a correct type, and a default value wasn't provided."); + } // we return the default value with the good type set + else { + settype($varDefault, $varType); + return $varDefault; + } } + settype($value, $varType); + } + return $value; + } + + /* + * Generating unique strings + */ + + /** + * Returns a 32 characters long uniq ID + * + * @return string 32 chars + */ + public static function generateUniqId() + { + return md5(uniqid(rand(), true)); + } + + /** + * Get salt from [superuser] section + * + * @return string + */ + public static function getSalt() + { + static $salt = null; + if (is_null($salt)) { + $salt = @Config::getInstance()->superuser['salt']; + } + return $salt; + } + + /** + * Configureable hash() algorithm (defaults to md5) + * + * @param string $str String to be hashed + * @param bool $raw_output + * @return string Hash string + */ + public static function hash($str, $raw_output = false) + { + static $hashAlgorithm = null; + if (is_null($hashAlgorithm)) { + $hashAlgorithm = @Config::getInstance()->General['hash_algorithm']; + } + + if ($hashAlgorithm) { + $hash = @hash($hashAlgorithm, $str, $raw_output); + if ($hash !== false) + return $hash; + } + + return md5($str, $raw_output); + } + + /** + * Generate random string + * + * @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") + { + $chars = $alphabet; + $str = ''; + + list($usec, $sec) = explode(" ", microtime()); + $seed = ((float)$sec + (float)$usec) * 100000; + mt_srand($seed); + + for ($i = 0; $i < $length; $i++) { + $rand_key = mt_rand(0, strlen($chars) - 1); + $str .= substr($chars, $rand_key, 1); + } + return str_shuffle($str); + } + + /* + * Conversions + */ + + /** + * Convert hexadecimal representation into binary data. + * !! Will emit warning if input string is not hex!! + * + * @see http://php.net/bin2hex + * + * @param string $str Hexadecimal representation + * @return string + */ + public static function hex2bin($str) + { + return pack("H*", $str); + } + + /** + * This function will convert the input string to the binary representation of the ID + * but it will throw an Exception if the specified input ID is not correct + * + * This is used when building segments containing visitorId which could be an invalid string + * therefore throwing Unexpected PHP error [pack(): Type H: illegal hex digit i] severity [E_WARNING] + * + * 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 + * @throws Exception + * @return string binary string + */ + public static function convertVisitorIdToBin($id) + { + if (strlen($id) !== Piwik_Tracker::LENGTH_HEX_ID_STRING + || @bin2hex(self::hex2bin($id)) != $id + ) { + throw new Exception("visitorId is expected to be a " . Piwik_Tracker::LENGTH_HEX_ID_STRING . " hex char string"); + } + return self::hex2bin($id); + } + + /** + * Convert IP address (in network address format) to presentation format. + * This is a backward compatibility function for code that only expects + * IPv4 addresses (i.e., doesn't support IPv6). + * + * @see Piwik_IP::N2P() + * + * This function does not support the long (or its string representation) + * returned by the built-in ip2long() function, from Piwik 1.3 and earlier. + * + * @deprecated 1.4 + * + * @param string $ip IP address in network address format + * @return string + */ + public static function long2ip($ip) + { + return Piwik_IP::long2ip($ip); + } + + /** + * Should we use the replacement json_encode/json_decode functions? + * + * @return bool True if broken; false otherwise + */ + private static function useJsonLibrary() + { + static $useLib; + + if (!isset($useLib)) { + /* + * 5.1.x - doesn't have json extension; we use lib/upgradephp instead + * 5.2 to 5.2.4 - broken in various ways, including: + * + * @see https://bugs.php.net/bug.php?id=38680 'json_decode cannot decode basic types' + * @see https://bugs.php.net/bug.php?id=41403 'json_decode cannot decode floats' + * @see https://bugs.php.net/bug.php?id=42785 'json_encode outputs numbers according to locale' + */ + $useLib = false; + if (version_compare(PHP_VERSION, '5.2.1') < 0) { + $useLib = true; + } else if (version_compare(PHP_VERSION, '5.2.5') < 0) { + $info = localeconv(); + $useLib = $info['decimal_point'] != '.'; + } + } + + return $useLib; + } + + /** + * JSON encode wrapper + * - missing or broken in some php 5.x versions + * + * @param mixed $value + * @return string + */ + public static function json_encode($value) + { + if (self::useJsonLibrary()) { + return _json_encode($value); + } + + return @json_encode($value); + } + + /** + * JSON decode wrapper + * - missing or broken in some php 5.x versions + * + * @param string $json + * @param bool $assoc + * @return mixed + */ + public static function json_decode($json, $assoc = false) + { + if (self::useJsonLibrary()) { + return _json_decode($json, $assoc); + } + + return json_decode($json, $assoc); + } + + /* + * DataFiles + */ + + /** + * Returns list of continent codes + * + * @see core/DataFiles/Countries.php + * + * @return array Array of 3 letter continent codes + */ + public static function getContinentsList() + { + require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php'; + + $continentsList = $GLOBALS['Piwik_ContinentList']; + return $continentsList; + } + + /** + * Returns list of valid country codes + * + * @see core/DataFiles/Countries.php + * + * @param bool $includeInternalCodes + * @return array Array of (2 letter ISO codes => 3 letter continent code) + */ + public static function getCountriesList($includeInternalCodes = false) + { + require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php'; + + $countriesList = $GLOBALS['Piwik_CountryList']; + $extras = $GLOBALS['Piwik_CountryList_Extras']; + + if ($includeInternalCodes) { + return array_merge($countriesList, $extras); + } + return $countriesList; + } + + /** + * Returns list of valid language codes + * + * @see core/DataFiles/Languages.php + * + * @return array Array of 2 letter ISO codes => Language name (in English) + */ + public static function getLanguagesList() + { + require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Languages.php'; + + $languagesList = $GLOBALS['Piwik_LanguageList']; + return $languagesList; + } + + /** + * Returns list of language to country mappings + * + * @see core/DataFiles/LanguageToCountry.php + * + * @return array Array of ( 2 letter ISO language codes => 2 letter ISO country codes ) + */ + public static function getLanguageToCountryList() + { + require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/LanguageToCountry.php'; + + $languagesList = $GLOBALS['Piwik_LanguageToCountry']; + return $languagesList; + } + + /** + * Returns list of search engines by URL + * + * @see core/DataFiles/SearchEngines.php + * + * @return array Array of ( URL => array( searchEngineName, keywordParameter, path, charset ) ) + */ + public static function getSearchEngineUrls() + { + require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php'; + + $searchEngines = $GLOBALS['Piwik_SearchEngines']; + return $searchEngines; + } + + /** + * Returns list of search engines by name + * + * @see core/DataFiles/SearchEngines.php + * + * @return array Array of ( searchEngineName => URL ) + */ + public static function getSearchEngineNames() + { + require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php'; + + $searchEngines = $GLOBALS['Piwik_SearchEngines_NameToUrl']; + return $searchEngines; + } + + /** + * Returns list of provider names + * + * @see core/DataFiles/Providers.php + * + * @return array Array of ( dnsName => providerName ) + */ + public static function getProviderNames() + { + require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Providers.php'; + + $providers = $GLOBALS['Piwik_ProviderNames']; + return $providers; + } + + /* + * Language, country, continent + */ - $uri = !empty($parsed['scheme']) ? $parsed['scheme'] . ':' . (!strcasecmp($parsed['scheme'], 'mailto') ? '' : '//') : ''; - $uri .= !empty($parsed['user']) ? $parsed['user'] . (!empty($parsed['pass']) ? ':' . $parsed['pass'] : '') . '@' : ''; - $uri .= !empty($parsed['host']) ? $parsed['host'] : ''; - $uri .= !empty($parsed['port']) ? ':' . $parsed['port'] : ''; + /** + * Returns the browser language code, eg. "en-gb,en;q=0.5" + * + * @param string|null $browserLang Optional browser language, otherwise taken from the request header + * @return string + */ + public static function getBrowserLanguage($browserLang = NULL) + { + static $replacementPatterns = array( + // extraneous bits of RFC 3282 that we ignore + '/(\\\\.)/', // quoted-pairs + '/(\s+)/', // CFWcS white space + '/(\([^)]*\))/', // CFWS comments + '/(;q=[0-9.]+)/', // quality - if (!empty($parsed['path'])) { - $uri .= (!strncmp($parsed['path'], '/', 1)) - ? $parsed['path'] - : ((!empty($uri) ? '/' : '') . $parsed['path']); - } + // found in the LANG environment variable + '/\.(.*)/', // charset (e.g., en_CA.UTF-8) + '/^C$/', // POSIX 'C' locale + ); - $uri .= !empty($parsed['query']) ? '?' . $parsed['query'] : ''; - $uri .= !empty($parsed['fragment']) ? '#' . $parsed['fragment'] : ''; - return $uri; - } - - /** - * Returns true if the string passed may be a URL. - * 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 - * @return bool - */ - public static function isLookLikeUrl($url) - { - return preg_match('~^(ftp|news|http|https)?://(.*)$~D', $url, $matches) !== 0 - && strlen($matches[2]) > 0; - } - - /* - * File operations - */ - - /** - * ending WITHOUT slash - * - * @return string - */ - public static function getPathToPiwikRoot() - { - return realpath(dirname(__FILE__) . "/.."); - } - - /** - * Create directory if permitted - * - * @param string $path - * @param bool $denyAccess - */ - public static function mkdir($path, $denyAccess = true) - { - if (!is_dir($path)) { - // the mode in mkdir is modified by the current umask - @mkdir($path, $mode = 0755, $recursive = true); + if (is_null($browserLang)) { + $browserLang = self::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']); + if (empty($browserLang) && self::isPhpCliMode()) { + $browserLang = @getenv('LANG'); } + } - // try to overcome restrictive umask (mis-)configuration - if (!is_writable($path)) { - @chmod($path, 0755); - if (!is_writable($path)) { - @chmod($path, 0775); + if (is_null($browserLang)) { + // a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build) + $browserLang = ""; + } else { + // language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1; + // underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066), + // but we guard against a bad user agent which naively uses its locale + $browserLang = strtolower(str_replace('_', '-', $browserLang)); - // enough! we're not going to make the directory world-writeable - } - } + // filters + $browserLang = preg_replace($replacementPatterns, '', $browserLang); - if ($denyAccess) { - \Piwik\Core\self::createHtAccess($path, $overwrite = false); - } - } + $browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1); // Firefox bug + $browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1); // unregistered language tag - /** - * Create .htaccess file in specified directory - * - * Apache-specific; for IIS @see web.config - * - * @param string $path without trailing slash - * @param bool $overwrite whether to overwrite an existing file or not - * @param string $content - */ - public static function createHtAccess($path, $overwrite = true, $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") - { - if (\Piwik\Core\self::isApache()) { - $file = $path . '/.htaccess'; - if ($overwrite || !file_exists($file)) { - @file_put_contents($file, $content); - } - } + $browserLang = str_replace('sr-sp', 'sr-rs', $browserLang); // unofficial (proposed) code in the wild } - /** - * Get canonicalized absolute path - * See http://php.net/realpath - * - * @param string $path - * @return string canonicalized absolute path - */ - public static function realpath($path) - { - if (file_exists($path)) { - return realpath($path); - } - return $path; - } - - /** - * Returns true if the string is a valid filename - * File names that start with a-Z or 0-9 and contain a-Z, 0-9, underscore(_), dash(-), and dot(.) will be accepted. - * 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 - * @return bool - * - */ - public static function isValidFilename($filename) - { - return (0 !== preg_match('/(^[a-zA-Z0-9]+([a-zA-Z_0-9.-]*))$/D', $filename)); - } - - /* - * String operations - */ - - /** - * byte-oriented substr() - ASCII - * - * @param string $string - * @param int $start - * @param int ... optional length - * @return string - */ - public static function substr($string, $start) - { - // in case mbstring overloads substr function - $substr = function_exists('mb_orig_substr') ? 'mb_orig_substr' : 'substr'; - - $length = func_num_args() > 2 - ? func_get_arg(2) - : \Piwik\Core\self::strlen($string); - - return $substr($string, $start, $length); - } - - /** - * byte-oriented strlen() - ASCII - * - * @param string $string - * @return int - */ - public static function strlen($string) - { - // in case mbstring overloads strlen function - $strlen = function_exists('mb_orig_strlen') ? 'mb_orig_strlen' : 'strlen'; - return $strlen($string); - } - - /** - * multi-byte substr() - UTF-8 - * - * @param string $string - * @param int $start - * @param int ... optional length - * @return string - */ - public static function mb_substr($string, $start) - { - $length = func_num_args() > 2 - ? func_get_arg(2) - : \Piwik\Core\self::mb_strlen($string); - - if (function_exists('mb_substr')) { - return mb_substr($string, $start, $length, 'UTF-8'); - } + return $browserLang; + } - return substr($string, $start, $length); + /** + * 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 + */ + public static function getCountry($lang, $enableLanguageToCountryGuess, $ip) + { + $country = null; + Piwik_PostEvent('Common.getCountry', array(&$country, $ip)); + if (!empty($country)) { + return strtolower($country); } - /** - * multi-byte strlen() - UTF-8 - * - * @param string $string - * @return int - */ - public static function mb_strlen($string) - { - if (function_exists('mb_strlen')) { - return mb_strlen($string, 'UTF-8'); - } - - return strlen($string); + if (empty($lang) || strlen($lang) < 2 || $lang == 'xx') { + return 'xx'; } - /** - * multi-byte strtolower() - UTF-8 - * - * @param string $string - * @return string - */ - public static function mb_strtolower($string) - { - if (function_exists('mb_strtolower')) { - return mb_strtolower($string, 'UTF-8'); - } + $validCountries = self::getCountriesList(); + return self::extractCountryCodeFromBrowserLanguage($lang, $validCountries, $enableLanguageToCountryGuess); + } - return strtolower($string); - } - - /* - * Escaping input - */ - - /** - * Returns the variable after cleaning operations. - * NB: The variable still has to be escaped before going into a SQL Query! - * - * If an array is passed the cleaning is done recursively on all the sub-arrays. - * The array's keys are filtered as well! - * - * How this method works: - * - The variable returned has been htmlspecialchars to avoid the XSS security problem. - * - The single quotes are not protected so "Piwik's amazing" will still be "Piwik's amazing". - * - * - Transformations are: - * - '&' (ampersand) becomes '&' - * - '"'(double quote) becomes '"' - * - '<' (less than) becomes '<' - * - '>' (greater than) becomes '>' - * - It handles the magic_quotes setting. - * - A non string value is returned without modification - * - * @param mixed $value The variable to be cleaned - * @param bool $alreadyStripslashed - * @throws Exception - * @return mixed The variable after cleaning - */ - public static function sanitizeInputValues($value, $alreadyStripslashed = false) - { - if (is_numeric($value)) { - return $value; - } elseif (is_string($value)) { - $value = \Piwik\Core\self::sanitizeInputValue($value); - - if (!$alreadyStripslashed) // a JSON array was already stripslashed, don't do it again for each value - { - $value = \Piwik\Core\self::undoMagicQuotes($value); - } - } elseif (is_array($value)) { - foreach (array_keys($value) as $key) { - $newKey = $key; - $newKey = \Piwik\Core\self::sanitizeInputValues($newKey, $alreadyStripslashed); - if ($key != $newKey) { - $value[$newKey] = $value[$key]; - unset($value[$key]); - } + /** + * Returns list of valid country codes + * + * @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 + */ + public static function extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess) + { + $langToCountry = self::getLanguageToCountryList(); - $value[$newKey] = \Piwik\Core\self::sanitizeInputValues($value[$newKey], $alreadyStripslashed); + if ($enableLanguageToCountryGuess) { + if (preg_match('/^([a-z]{2,3})(?:,|;|$)/', $browserLanguage, $matches)) { + // match language (without region) to infer the country of origin + if (array_key_exists($matches[1], $langToCountry)) { + return $langToCountry[$matches[1]]; } - } elseif (!is_null($value) - && !is_bool($value) - ) { - throw new Exception("The value to escape has not a supported type. Value = " . var_export($value, true)); } - return $value; } - /** - * Sanitize a single input value - * - * @param string $value - * @return string sanitized input - */ - public static function sanitizeInputValue($value) - { - // $_GET and $_REQUEST already urldecode()'d - // decode - // note: before php 5.2.7, htmlspecialchars() double encodes &#x hex items - $value = html_entity_decode($value, \Piwik\Core\Common::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); - - // filter - $value = str_replace(array("\n", "\r", "\0"), '', $value); - - // escape - $tmp = @htmlspecialchars($value, \Piwik\Core\self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); - - // note: php 5.2.5 and above, htmlspecialchars is destructive if input is not UTF-8 - if ($value != '' && $tmp == '') { - // convert and escape - $value = utf8_encode($value); - $tmp = htmlspecialchars($value, \Piwik\Core\self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); - } - return $tmp; - } - - /** - * Unsanitize a single input value - * - * @param string $value - * @return string unsanitized input - */ - public static function unsanitizeInputValue($value) - { - return htmlspecialchars_decode($value, \Piwik\Core\self::HTML_ENCODING_QUOTE_STYLE); - } - - /** - * Unsanitize one or more values. - * - * @param string|array $value - * @return string|array unsanitized input - */ - public static function unsanitizeInputValues($value) - { - if (is_array($value)) { - $result = array(); - foreach ($value as $key => $arrayValue) { - $result[$key] = \Piwik\Core\self::unsanitizeInputValues($arrayValue); + if (!empty($validCountries) && preg_match_all('/[-]([a-z]{2})/', $browserLanguage, $matches, PREG_SET_ORDER)) { + foreach ($matches as $parts) { + // match location; we don't make any inferences from the language + if (array_key_exists($parts[1], $validCountries)) { + return $parts[1]; } - return $result; - } else { - return \Piwik\Core\self::unsanitizeInputValue($value); } } + return 'xx'; + } - /** - * 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 - */ - public static function undoMagicQuotes($value) - { - return version_compare(PHP_VERSION, '5.4', '<') - && get_magic_quotes_gpc() - ? stripslashes($value) - : $value; - } - - /** - * Returns a sanitized variable value from the $_GET and $_POST superglobal. - * If the variable doesn't have a value or an empty value, returns the defaultValue if specified. - * If the variable doesn't have neither a value nor a default value provided, an exception is raised. - * - * @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 - * - * @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 - * - * @return mixed The variable after cleaning - */ - public static function getRequestVar($varName, $varDefault = null, $varType = null, $requestArrayToUse = null) - { - if (is_null($requestArrayToUse)) { - $requestArrayToUse = $_GET + $_POST; - } - $varDefault = \Piwik\Core\self::sanitizeInputValues($varDefault); - if ($varType === 'int') { - // settype accepts only integer - // 'int' is simply a shortcut for 'integer' - $varType = 'integer'; - } - - // there is no value $varName in the REQUEST so we try to use the default value - if (empty($varName) - || !isset($requestArrayToUse[$varName]) - || (!is_array($requestArrayToUse[$varName]) - && strlen($requestArrayToUse[$varName]) === 0 - ) - ) { - if (is_null($varDefault)) { - throw new Exception("The parameter '$varName' isn't set in the Request, and a default value wasn't provided."); - } else { - if (!is_null($varType) - && in_array($varType, array('string', 'integer', 'array')) - ) { - settype($varDefault, $varType); + /** + * Returns the visitor language based only on the Browser 'accepted language' information + * + * @param string $browserLanguage Browser's accepted langauge header + * @param array $validLanguages array of valid language codes + * @return string 2 letter ISO 639 code + */ + public static function extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages) + { + // assumes language preference is sorted; + // does not handle language-script-region tags or language range (*) + if (!empty($validLanguages) && preg_match_all('/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/', $browserLanguage, $matches, PREG_SET_ORDER)) { + foreach ($matches as $parts) { + if (count($parts) == 3) { + // match locale (language and location) + if (in_array($parts[1] . $parts[2], $validLanguages)) { + return $parts[1] . $parts[2]; } - return $varDefault; - } - } - - // Normal case, there is a value available in REQUEST for the requested varName: - - // we deal w/ json differently - if ($varType == 'json') { - $value = \Piwik\Core\self::undoMagicQuotes($requestArrayToUse[$varName]); - $value = \Piwik\Core\Common::json_decode($value, $assoc = true); - return \Piwik\Core\self::sanitizeInputValues($value, $alreadyStripslashed = true); - } - - $value = \Piwik\Core\self::sanitizeInputValues($requestArrayToUse[$varName]); - if (!is_null($varType)) { - $ok = false; - - if ($varType === 'string') { - if (is_string($value)) $ok = true; - } elseif ($varType === 'integer') { - if ($value == (string)(int)$value) $ok = true; - } elseif ($varType === 'float') { - if ($value == (string)(float)$value) $ok = true; - } elseif ($varType === 'array') { - if (is_array($value)) $ok = true; - } else { - throw new Exception("\$varType specified is not known. It should be one of the following: array, int, integer, float, string"); } - - // The type is not correct - if ($ok === false) { - if ($varDefault === null) { - throw new Exception("The parameter '$varName' doesn't have a correct type, and a default value wasn't provided."); - } // we return the default value with the good type set - else { - settype($varDefault, $varType); - return $varDefault; - } + // match language only (where no region provided) + if (in_array($parts[1], $validLanguages)) { + return $parts[1]; } - settype($value, $varType); } - return $value; } + return 'xx'; + } - /* - * Generating unique strings - */ - - /** - * Returns a 32 characters long uniq ID - * - * @return string 32 chars - */ - public static function generateUniqId() - { - return md5(uniqid(rand(), true)); - } - - /** - * Get salt from [superuser] section - * - * @return string - */ - public static function getSalt() - { - static $salt = null; - if (is_null($salt)) { - $salt = @Config::getInstance()->superuser['salt']; - } - return $salt; - } - - /** - * Configureable hash() algorithm (defaults to md5) - * - * @param string $str String to be hashed - * @param bool $raw_output - * @return string Hash string - */ - public static function hash($str, $raw_output = false) - { - static $hashAlgorithm = null; - if (is_null($hashAlgorithm)) { - $hashAlgorithm = @Config::getInstance()->General['hash_algorithm']; - } - - if ($hashAlgorithm) { - $hash = @hash($hashAlgorithm, $str, $raw_output); - if ($hash !== false) - return $hash; - } - - return md5($str, $raw_output); + /** + * Returns the continent of a given country + * + * @param string $country 2 letters isocode + * + * @return string Continent (3 letters code : afr, asi, eur, amn, ams, oce) + */ + public static function getContinent($country) + { + $countryList = self::getCountriesList(); + if (isset($countryList[$country])) { + return $countryList[$country]; } + return 'unk'; + } - /** - * Generate random string - * - * @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") - { - $chars = $alphabet; - $str = ''; - - list($usec, $sec) = explode(" ", microtime()); - $seed = ((float)$sec + (float)$usec) * 100000; - mt_srand($seed); + /* + * Campaign + */ - for ($i = 0; $i < $length; $i++) { - $rand_key = mt_rand(0, strlen($chars) - 1); - $str .= substr($chars, $rand_key, 1); - } - return str_shuffle($str); - } - - /* - * Conversions - */ - - /** - * Convert hexadecimal representation into binary data. - * !! Will emit warning if input string is not hex!! - * - * @see http://php.net/bin2hex - * - * @param string $str Hexadecimal representation - * @return string - */ - public static function hex2bin($str) - { - return pack("H*", $str); - } - - /** - * This function will convert the input string to the binary representation of the ID - * but it will throw an Exception if the specified input ID is not correct - * - * This is used when building segments containing visitorId which could be an invalid string - * therefore throwing Unexpected PHP error [pack(): Type H: illegal hex digit i] severity [E_WARNING] - * - * 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 - * @throws Exception - * @return string binary string - */ - public static function convertVisitorIdToBin($id) - { - if (strlen($id) !== Piwik_Tracker::LENGTH_HEX_ID_STRING - || @bin2hex(\Piwik\Core\self::hex2bin($id)) != $id - ) { - throw new Exception("visitorId is expected to be a " . Piwik_Tracker::LENGTH_HEX_ID_STRING . " hex char string"); - } - return \Piwik\Core\self::hex2bin($id); - } - - /** - * Convert IP address (in network address format) to presentation format. - * This is a backward compatibility function for code that only expects - * IPv4 addresses (i.e., doesn't support IPv6). - * - * @see Piwik_IP::N2P() - * - * This function does not support the long (or its string representation) - * returned by the built-in ip2long() function, from Piwik 1.3 and earlier. - * - * @deprecated 1.4 - * - * @param string $ip IP address in network address format - * @return string - */ - public static function long2ip($ip) - { - return Piwik_IP::long2ip($ip); - } - - /** - * Should we use the replacement json_encode/json_decode functions? - * - * @return bool True if broken; false otherwise - */ - private static function useJsonLibrary() - { - static $useLib; - - if (!isset($useLib)) { - /* - * 5.1.x - doesn't have json extension; we use lib/upgradephp instead - * 5.2 to 5.2.4 - broken in various ways, including: - * - * @see https://bugs.php.net/bug.php?id=38680 'json_decode cannot decode basic types' - * @see https://bugs.php.net/bug.php?id=41403 'json_decode cannot decode floats' - * @see https://bugs.php.net/bug.php?id=42785 'json_encode outputs numbers according to locale' - */ - $useLib = false; - if (version_compare(PHP_VERSION, '5.2.1') < 0) { - $useLib = true; - } else if (version_compare(PHP_VERSION, '5.2.5') < 0) { - $info = localeconv(); - $useLib = $info['decimal_point'] != '.'; - } + /** + * Returns the list of Campaign parameter names that will be read to classify + * a visit as coming from a Campaign + * + * @return array array( + * 0 => array( ... ) // campaign names parameters + * 1 => array( ... ) // campaign keyword parameters + * ); + */ + public static function getCampaignParameters() + { + $return = array( + Config::getInstance()->Tracker['campaign_var_name'], + Config::getInstance()->Tracker['campaign_keyword_var_name'], + ); + + foreach ($return as &$list) { + if (strpos($list, ',') !== false) { + $list = explode(',', $list); + } else { + $list = array($list); } - - return $useLib; } - /** - * JSON encode wrapper - * - missing or broken in some php 5.x versions - * - * @param mixed $value - * @return string - */ - public static function json_encode($value) - { - if (\Piwik\Core\self::useJsonLibrary()) { - return _json_encode($value); - } + array_walk_recursive($return, 'trim'); + return $return; + } - return @json_encode($value); - } - - /** - * JSON decode wrapper - * - missing or broken in some php 5.x versions - * - * @param string $json - * @param bool $assoc - * @return mixed - */ - public static function json_decode($json, $assoc = false) - { - if (\Piwik\Core\self::useJsonLibrary()) { - return _json_decode($json, $assoc); - } + /* + * Referrer + */ - return json_decode($json, $assoc); - } - - /* - * DataFiles - */ - - /** - * Returns list of continent codes - * - * @see core/DataFiles/Countries.php - * - * @return array Array of 3 letter continent codes - */ - public static function getContinentsList() - { - require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php'; - - $continentsList = $GLOBALS['Piwik_ContinentList']; - return $continentsList; - } - - /** - * Returns list of valid country codes - * - * @see core/DataFiles/Countries.php - * - * @param bool $includeInternalCodes - * @return array Array of (2 letter ISO codes => 3 letter continent code) - */ - public static function getCountriesList($includeInternalCodes = false) - { - require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php'; - - $countriesList = $GLOBALS['Piwik_CountryList']; - $extras = $GLOBALS['Piwik_CountryList_Extras']; - - if ($includeInternalCodes) { - return array_merge($countriesList, $extras); - } - return $countriesList; - } - - /** - * Returns list of valid language codes - * - * @see core/DataFiles/Languages.php - * - * @return array Array of 2 letter ISO codes => Language name (in English) - */ - public static function getLanguagesList() - { - require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Languages.php'; - - $languagesList = $GLOBALS['Piwik_LanguageList']; - return $languagesList; - } - - /** - * Returns list of language to country mappings - * - * @see core/DataFiles/LanguageToCountry.php - * - * @return array Array of ( 2 letter ISO language codes => 2 letter ISO country codes ) - */ - public static function getLanguageToCountryList() - { - require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/LanguageToCountry.php'; - - $languagesList = $GLOBALS['Piwik_LanguageToCountry']; - return $languagesList; - } - - /** - * Returns list of search engines by URL - * - * @see core/DataFiles/SearchEngines.php - * - * @return array Array of ( URL => array( searchEngineName, keywordParameter, path, charset ) ) - */ - public static function getSearchEngineUrls() - { - require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php'; - - $searchEngines = $GLOBALS['Piwik_SearchEngines']; - return $searchEngines; - } - - /** - * Returns list of search engines by name - * - * @see core/DataFiles/SearchEngines.php - * - * @return array Array of ( searchEngineName => URL ) - */ - public static function getSearchEngineNames() - { - require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php'; - - $searchEngines = $GLOBALS['Piwik_SearchEngines_NameToUrl']; - return $searchEngines; - } - - /** - * Returns list of provider names - * - * @see core/DataFiles/Providers.php - * - * @return array Array of ( dnsName => providerName ) - */ - public static function getProviderNames() - { - require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Providers.php'; - - $providers = $GLOBALS['Piwik_ProviderNames']; - return $providers; - } - - /* - * Language, country, continent - */ - - /** - * Returns the browser language code, eg. "en-gb,en;q=0.5" - * - * @param string|null $browserLang Optional browser language, otherwise taken from the request header - * @return string - */ - public static function getBrowserLanguage($browserLang = NULL) - { - static $replacementPatterns = array( - // extraneous bits of RFC 3282 that we ignore - '/(\\\\.)/', // quoted-pairs - '/(\s+)/', // CFWcS white space - '/(\([^)]*\))/', // CFWS comments - '/(;q=[0-9.]+)/', // quality - - // found in the LANG environment variable - '/\.(.*)/', // charset (e.g., en_CA.UTF-8) - '/^C$/', // POSIX 'C' locale - ); - - if (is_null($browserLang)) { - $browserLang = \Piwik\Core\self::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']); - if (empty($browserLang) && \Piwik\Core\self::isPhpCliMode()) { - $browserLang = @getenv('LANG'); - } - } + /** + * Reduce URL to more minimal form. 2 letter country codes are + * replaced by '{}', while other parts are simply removed. + * + * Examples: + * www.example.com -> example.com + * search.example.com -> example.com + * m.example.com -> example.com + * de.example.com -> {}.example.com + * example.de -> example.{} + * example.co.uk -> example.{} + * + * @param string $url + * @return string + */ + public static function getLossyUrl($url) + { + static $countries; + if (!isset($countries)) { + $countries = implode('|', array_keys(self::getCountriesList(true))); + } + + return preg_replace( + array( + '/^(w+[0-9]*|search)\./', + '/(^|\.)m\./', + '/(\.(com|org|net|co|it|edu))?\.(' . $countries . ')(\/|$)/', + '/(^|\.)(' . $countries . ')\./', + ), + array( + '', + '$1', + '.{}$4', + '$1{}.', + ), + $url); + } - if (is_null($browserLang)) { - // a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build) - $browserLang = ""; + /** + * Extracts a keyword from a raw not encoded URL. + * Will only extract keyword if a known search engine has been detected. + * Returns the keyword: + * - in UTF8: automatically converted from other charsets when applicable + * - strtolowered: "QUErY test!" will return "query test!" + * - trimmed: extra spaces before and after are removed + * + * Lists of supported search engines can be found in /core/DataFiles/SearchEngines.php + * The function returns false when a keyword couldn't be found. + * eg. if the url is "http://www.google.com/partners.html" this will return false, + * as the google keyword parameter couldn't be found. + * + * @see unit tests in /tests/core/Common.test.php + * @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', + * 'keywords' => 'my searched keywords') + */ + public static function extractSearchEngineInformationFromUrl($referrerUrl) + { + $refererParsed = @parse_url($referrerUrl); + $refererHost = ''; + if (isset($refererParsed['host'])) { + $refererHost = $refererParsed['host']; + } + if (empty($refererHost)) { + return false; + } + // some search engines (eg. Bing Images) use the same domain + // as an existing search engine (eg. Bing), we must also use the url path + $refererPath = ''; + if (isset($refererParsed['path'])) { + $refererPath = $refererParsed['path']; + } + + // no search query + if (!isset($refererParsed['query'])) { + $refererParsed['query'] = ''; + } + $query = $refererParsed['query']; + + // Google Referrers URLs sometimes have the fragment which contains the keyword + if (!empty($refererParsed['fragment'])) { + $query .= '&' . $refererParsed['fragment']; + } + + $searchEngines = self::getSearchEngineUrls(); + + $hostPattern = self::getLossyUrl($refererHost); + if (array_key_exists($refererHost . $refererPath, $searchEngines)) { + $refererHost = $refererHost . $refererPath; + } elseif (array_key_exists($hostPattern . $refererPath, $searchEngines)) { + $refererHost = $hostPattern . $refererPath; + } elseif (array_key_exists($hostPattern, $searchEngines)) { + $refererHost = $hostPattern; + } elseif (!array_key_exists($refererHost, $searchEngines)) { + if (!strncmp($query, 'cx=partner-pub-', 15)) { + // Google custom search engine + $refererHost = 'google.com/cse'; + } elseif (!strncmp($refererPath, '/pemonitorhosted/ws/results/', 28)) { + // private-label search powered by InfoSpace Metasearch + $refererHost = 'wsdsold.infospace.com'; + } elseif (strpos($refererHost, '.images.search.yahoo.com') != false) { + // Yahoo! Images + $refererHost = 'images.search.yahoo.com'; + } elseif (strpos($refererHost, '.search.yahoo.com') != false) { + // Yahoo! + $refererHost = 'search.yahoo.com'; } else { - // language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1; - // underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066), - // but we guard against a bad user agent which naively uses its locale - $browserLang = strtolower(str_replace('_', '-', $browserLang)); - - // filters - $browserLang = preg_replace($replacementPatterns, '', $browserLang); - - $browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1); // Firefox bug - $browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1); // unregistered language tag - - $browserLang = str_replace('sr-sp', 'sr-rs', $browserLang); // unofficial (proposed) code in the wild + return false; } + } + $searchEngineName = $searchEngines[$refererHost][0]; + $variableNames = null; + if (isset($searchEngines[$refererHost][1])) { + $variableNames = $searchEngines[$refererHost][1]; + } + if (!$variableNames) { + $searchEngineNames = self::getSearchEngineNames(); + $url = $searchEngineNames[$searchEngineName]; + $variableNames = $searchEngines[$url][1]; + } + if (!is_array($variableNames)) { + $variableNames = array($variableNames); + } - return $browserLang; - } - - /** - * 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 - */ - public static function getCountry($lang, $enableLanguageToCountryGuess, $ip) - { - $country = null; - Piwik_PostEvent('Common.getCountry', array(&$country, $ip)); - if (!empty($country)) { - return strtolower($country); + $key = null; + if ($searchEngineName === 'Google Images' + || ($searchEngineName === 'Google' && strpos($referrerUrl, '/imgres') !== false) + ) { + if (strpos($query, '&prev') !== false) { + $query = urldecode(trim(self::getParameterFromQueryString($query, 'prev'))); + $query = str_replace('&', '&', strstr($query, '?')); } - - if (empty($lang) || strlen($lang) < 2 || $lang == 'xx') { - return 'xx'; + $searchEngineName = 'Google Images'; + } else if ($searchEngineName === 'Google' + && (strpos($query, '&as_') !== false || strpos($query, 'as_') === 0) + ) { + $keys = array(); + $key = self::getParameterFromQueryString($query, 'as_q'); + if (!empty($key)) { + array_push($keys, $key); } - - $validCountries = \Piwik\Core\self::getCountriesList(); - return \Piwik\Core\self::extractCountryCodeFromBrowserLanguage($lang, $validCountries, $enableLanguageToCountryGuess); - } - - /** - * Returns list of valid country codes - * - * @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 - */ - public static function extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess) - { - $langToCountry = \Piwik\Core\self::getLanguageToCountryList(); - - if ($enableLanguageToCountryGuess) { - if (preg_match('/^([a-z]{2,3})(?:,|;|$)/', $browserLanguage, $matches)) { - // match language (without region) to infer the country of origin - if (array_key_exists($matches[1], $langToCountry)) { - return $langToCountry[$matches[1]]; - } - } + $key = self::getParameterFromQueryString($query, 'as_oq'); + if (!empty($key)) { + array_push($keys, str_replace('+', ' OR ', $key)); + } + $key = self::getParameterFromQueryString($query, 'as_epq'); + if (!empty($key)) { + array_push($keys, "\"$key\""); + } + $key = self::getParameterFromQueryString($query, 'as_eq'); + if (!empty($key)) { + array_push($keys, "-$key"); } + $key = trim(urldecode(implode(' ', $keys))); + } - if (!empty($validCountries) && preg_match_all('/[-]([a-z]{2})/', $browserLanguage, $matches, PREG_SET_ORDER)) { - foreach ($matches as $parts) { - // match location; we don't make any inferences from the language - if (array_key_exists($parts[1], $validCountries)) { - return $parts[1]; - } - } + if ($searchEngineName === 'Google') { + // top bar menu + $tbm = self::getParameterFromQueryString($query, 'tbm'); + switch ($tbm) { + case 'isch': + $searchEngineName = 'Google Images'; + break; + case 'vid': + $searchEngineName = 'Google Video'; + break; + case 'shop': + $searchEngineName = 'Google Shopping'; + break; } - return 'xx'; } - /** - * Returns the visitor language based only on the Browser 'accepted language' information - * - * @param string $browserLanguage Browser's accepted langauge header - * @param array $validLanguages array of valid language codes - * @return string 2 letter ISO 639 code - */ - public static function extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages) - { - // assumes language preference is sorted; - // does not handle language-script-region tags or language range (*) - if (!empty($validLanguages) && preg_match_all('/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/', $browserLanguage, $matches, PREG_SET_ORDER)) { - foreach ($matches as $parts) { - if (count($parts) == 3) { - // match locale (language and location) - if (in_array($parts[1] . $parts[2], $validLanguages)) { - return $parts[1] . $parts[2]; - } + if (empty($key)) { + foreach ($variableNames as $variableName) { + if ($variableName[0] == '/') { + // regular expression match + if (preg_match($variableName, $referrerUrl, $matches)) { + $key = trim(urldecode($matches[1])); + break; + } + } else { + // search for keywords now &vname=keyword + $key = self::getParameterFromQueryString($query, $variableName); + $key = trim(urldecode($key)); + + // Special case: Google & empty q parameter + if (empty($key) + && $variableName == 'q' + + && ( + // Google search with no keyword + ($searchEngineName == 'Google' + && ( // First, they started putting an empty q= parameter + strpos($query, '&q=') !== false + || strpos($query, '?q=') !== false + // then they started sending the full host only (no path/query string) + || (empty($query) && (empty($refererPath) || $refererPath == '/') && empty($refererParsed['fragment'])) + ) + ) + // search engines with no keyword + || $searchEngineName == 'Google Images' + || $searchEngineName == 'DuckDuckGo') + ) { + $key = false; } - // match language only (where no region provided) - if (in_array($parts[1], $validLanguages)) { - return $parts[1]; + if (!empty($key) + || $key === false + ) { + break; } } } - return 'xx'; } - /** - * Returns the continent of a given country - * - * @param string $country 2 letters isocode - * - * @return string Continent (3 letters code : afr, asi, eur, amn, ams, oce) - */ - public static function getContinent($country) - { - $countryList = \Piwik\Core\self::getCountriesList(); - if (isset($countryList[$country])) { - return $countryList[$country]; - } - return 'unk'; - } - - /* - * Campaign - */ - - /** - * Returns the list of Campaign parameter names that will be read to classify - * a visit as coming from a Campaign - * - * @return array array( - * 0 => array( ... ) // campaign names parameters - * 1 => array( ... ) // campaign keyword parameters - * ); - */ - public static function getCampaignParameters() - { - $return = array( - Config::getInstance()->Tracker['campaign_var_name'], - Config::getInstance()->Tracker['campaign_keyword_var_name'], - ); - - foreach ($return as &$list) { - if (strpos($list, ',') !== false) { - $list = explode(',', $list); - } else { - $list = array($list); + // $key === false is the special case "No keyword provided" which is a Search engine match + if ($key === null + || $key === '' + ) { + return false; + } + + if (!empty($key)) { + if (function_exists('iconv') + && isset($searchEngines[$refererHost][3]) + ) { + // accepts string, array, or comma-separated list string in preferred order + $charsets = $searchEngines[$refererHost][3]; + if (!is_array($charsets)) { + $charsets = explode(',', $charsets); } - } - array_walk_recursive($return, 'trim'); - return $return; - } - - /* - * Referrer - */ - - /** - * Reduce URL to more minimal form. 2 letter country codes are - * replaced by '{}', while other parts are simply removed. - * - * Examples: - * www.example.com -> example.com - * search.example.com -> example.com - * m.example.com -> example.com - * de.example.com -> {}.example.com - * example.de -> example.{} - * example.co.uk -> example.{} - * - * @param string $url - * @return string - */ - public static function getLossyUrl($url) - { - static $countries; - if (!isset($countries)) { - $countries = implode('|', array_keys(\Piwik\Core\self::getCountriesList(true))); - } + if (!empty($charsets)) { + $charset = $charsets[0]; + if (count($charsets) > 1 + && function_exists('mb_detect_encoding') + ) { + $charset = mb_detect_encoding($key, $charsets); + if ($charset === false) { + $charset = $charsets[0]; + } + } - return preg_replace( - array( - '/^(w+[0-9]*|search)\./', - '/(^|\.)m\./', - '/(\.(com|org|net|co|it|edu))?\.(' . $countries . ')(\/|$)/', - '/(^|\.)(' . $countries . ')\./', - ), - array( - '', - '$1', - '.{}$4', - '$1{}.', - ), - $url); - } - - /** - * Extracts a keyword from a raw not encoded URL. - * Will only extract keyword if a known search engine has been detected. - * Returns the keyword: - * - in UTF8: automatically converted from other charsets when applicable - * - strtolowered: "QUErY test!" will return "query test!" - * - trimmed: extra spaces before and after are removed - * - * Lists of supported search engines can be found in /core/DataFiles/SearchEngines.php - * The function returns false when a keyword couldn't be found. - * eg. if the url is "http://www.google.com/partners.html" this will return false, - * as the google keyword parameter couldn't be found. - * - * @see unit tests in /tests/core/Common.test.php - * @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', - * 'keywords' => 'my searched keywords') - */ - public static function extractSearchEngineInformationFromUrl($referrerUrl) - { - $refererParsed = @parse_url($referrerUrl); - $refererHost = ''; - if (isset($refererParsed['host'])) { - $refererHost = $refererParsed['host']; - } - if (empty($refererHost)) { - return false; - } - // some search engines (eg. Bing Images) use the same domain - // as an existing search engine (eg. Bing), we must also use the url path - $refererPath = ''; - if (isset($refererParsed['path'])) { - $refererPath = $refererParsed['path']; + $newkey = @iconv($charset, 'UTF-8//IGNORE', $key); + if (!empty($newkey)) { + $key = $newkey; + } + } } - // no search query - if (!isset($refererParsed['query'])) { - $refererParsed['query'] = ''; - } - $query = $refererParsed['query']; + $key = self::mb_strtolower($key); + } - // Google Referrers URLs sometimes have the fragment which contains the keyword - if (!empty($refererParsed['fragment'])) { - $query .= '&' . $refererParsed['fragment']; - } + return array( + 'name' => $searchEngineName, + 'keywords' => $key, + ); + } - $searchEngines = \Piwik\Core\self::getSearchEngineUrls(); - - $hostPattern = \Piwik\Core\self::getLossyUrl($refererHost); - if (array_key_exists($refererHost . $refererPath, $searchEngines)) { - $refererHost = $refererHost . $refererPath; - } elseif (array_key_exists($hostPattern . $refererPath, $searchEngines)) { - $refererHost = $hostPattern . $refererPath; - } elseif (array_key_exists($hostPattern, $searchEngines)) { - $refererHost = $hostPattern; - } elseif (!array_key_exists($refererHost, $searchEngines)) { - if (!strncmp($query, 'cx=partner-pub-', 15)) { - // Google custom search engine - $refererHost = 'google.com/cse'; - } elseif (!strncmp($refererPath, '/pemonitorhosted/ws/results/', 28)) { - // private-label search powered by InfoSpace Metasearch - $refererHost = 'wsdsold.infospace.com'; - } elseif (strpos($refererHost, '.images.search.yahoo.com') != false) { - // Yahoo! Images - $refererHost = 'images.search.yahoo.com'; - } elseif (strpos($refererHost, '.search.yahoo.com') != false) { - // Yahoo! - $refererHost = 'search.yahoo.com'; - } else { - return false; - } - } - $searchEngineName = $searchEngines[$refererHost][0]; - $variableNames = null; - if (isset($searchEngines[$refererHost][1])) { - $variableNames = $searchEngines[$refererHost][1]; - } - if (!$variableNames) { - $searchEngineNames = \Piwik\Core\self::getSearchEngineNames(); - $url = $searchEngineNames[$searchEngineName]; - $variableNames = $searchEngines[$url][1]; - } - if (!is_array($variableNames)) { - $variableNames = array($variableNames); - } + /* + * System environment + */ - $key = null; - if ($searchEngineName === 'Google Images' - || ($searchEngineName === 'Google' && strpos($referrerUrl, '/imgres') !== false) - ) { - if (strpos($query, '&prev') !== false) { - $query = urldecode(trim(\Piwik\Core\self::getParameterFromQueryString($query, 'prev'))); - $query = str_replace('&', '&', strstr($query, '?')); - } - $searchEngineName = 'Google Images'; - } else if ($searchEngineName === 'Google' - && (strpos($query, '&as_') !== false || strpos($query, 'as_') === 0) - ) { - $keys = array(); - $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_q'); - if (!empty($key)) { - array_push($keys, $key); - } - $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_oq'); - if (!empty($key)) { - array_push($keys, str_replace('+', ' OR ', $key)); - } - $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_epq'); - if (!empty($key)) { - array_push($keys, "\"$key\""); - } - $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_eq'); - if (!empty($key)) { - array_push($keys, "-$key"); - } - $key = trim(urldecode(implode(' ', $keys))); - } + /** + * Returns true if PHP was invoked from command-line interface (shell) + * + * @since added in 0.4.4 + * @return bool true if PHP invoked as a CGI or from CLI + */ + public static function isPhpCliMode() + { + $remoteAddr = @$_SERVER['REMOTE_ADDR']; + return PHP_SAPI == 'cli' || + (!strncmp(PHP_SAPI, 'cgi', 3) && empty($remoteAddr)); + } - if ($searchEngineName === 'Google') { - // top bar menu - $tbm = \Piwik\Core\self::getParameterFromQueryString($query, 'tbm'); - switch ($tbm) { - case 'isch': - $searchEngineName = 'Google Images'; - break; - case 'vid': - $searchEngineName = 'Google Video'; - break; - case 'shop': - $searchEngineName = 'Google Shopping'; - break; - } - } + /** + * Is the current script execution triggered by misc/cron/archive.php ? + * + * Helpful for error handling: directly throw error without HTML (eg. when DB is down) + * @return bool + */ + public static function isArchivePhpTriggered() + { + return !empty($_GET['trigger']) + && $_GET['trigger'] == 'archivephp'; + } - if (empty($key)) { - foreach ($variableNames as $variableName) { - if ($variableName[0] == '/') { - // regular expression match - if (preg_match($variableName, $referrerUrl, $matches)) { - $key = trim(urldecode($matches[1])); - break; - } - } else { - // search for keywords now &vname=keyword - $key = \Piwik\Core\self::getParameterFromQueryString($query, $variableName); - $key = trim(urldecode($key)); - - // Special case: Google & empty q parameter - if (empty($key) - && $variableName == 'q' - - && ( - // Google search with no keyword - ($searchEngineName == 'Google' - && ( // First, they started putting an empty q= parameter - strpos($query, '&q=') !== false - || strpos($query, '?q=') !== false - // then they started sending the full host only (no path/query string) - || (empty($query) && (empty($refererPath) || $refererPath == '/') && empty($refererParsed['fragment'])) - ) - ) - // search engines with no keyword - || $searchEngineName == 'Google Images' - || $searchEngineName == 'DuckDuckGo') - ) { - $key = false; - } - if (!empty($key) - || $key === false - ) { - break; - } - } - } + /** + * Assign CLI parameters as if they were REQUEST or GET parameters. + * You can trigger Piwik from the command line by + * # /usr/bin/php5 /path/to/piwik/index.php -- "module=API&method=Actions.getActions&idSite=1&period=day&date=previous8&format=php" + */ + public static function assignCliParametersToRequest() + { + if (isset($_SERVER['argc']) + && $_SERVER['argc'] > 0 + ) { + for ($i = 1; $i < $_SERVER['argc']; $i++) { + parse_str($_SERVER['argv'][$i], $tmp); + $_GET = array_merge($_GET, $tmp); } + } + } - // $key === false is the special case "No keyword provided" which is a Search engine match - if ($key === null - || $key === '' - ) { - return false; - } + /** + * Returns true if running on a Windows operating system + * + * @since 0.6.5 + * @return bool true if PHP detects it is running on Windows; else false + */ + public static function isWindows() + { + return DIRECTORY_SEPARATOR === '\\'; + } - if (!empty($key)) { - if (function_exists('iconv') - && isset($searchEngines[$refererHost][3]) - ) { - // accepts string, array, or comma-separated list string in preferred order - $charsets = $searchEngines[$refererHost][3]; - if (!is_array($charsets)) { - $charsets = explode(',', $charsets); - } + /** + * Returns true if running on MacOS + * + * @return bool true if PHP detects it is running on MacOS; else false + */ + public static function isMacOS() + { + return PHP_OS === 'Darwin'; + } - if (!empty($charsets)) { - $charset = $charsets[0]; - if (count($charsets) > 1 - && function_exists('mb_detect_encoding') - ) { - $charset = mb_detect_encoding($key, $charsets); - if ($charset === false) { - $charset = $charsets[0]; - } - } + /** + * Returns true if running on an Apache web server + * + * @return bool + */ + public static function isApache() + { + $apache = isset($_SERVER['SERVER_SOFTWARE']) && + !strncmp($_SERVER['SERVER_SOFTWARE'], 'Apache', 6); - $newkey = @iconv($charset, 'UTF-8//IGNORE', $key); - if (!empty($newkey)) { - $key = $newkey; - } - } - } + return $apache; + } - $key = \Piwik\Core\self::mb_strtolower($key); - } + /** + * Returns true if running on Microsoft IIS 7 (or above) + * + * @return bool + */ + public static function isIIS() + { + $iis = isset($_SERVER['SERVER_SOFTWARE']) && + preg_match('/^Microsoft-IIS\/(.+)/', $_SERVER['SERVER_SOFTWARE'], $matches) && + version_compare($matches[1], '7') >= 0; - return array( - 'name' => $searchEngineName, - 'keywords' => $key, - ); - } - - /* - * System environment - */ - - /** - * Returns true if PHP was invoked from command-line interface (shell) - * - * @since added in 0.4.4 - * @return bool true if PHP invoked as a CGI or from CLI - */ - public static function isPhpCliMode() - { - $remoteAddr = @$_SERVER['REMOTE_ADDR']; - return PHP_SAPI == 'cli' || - (!strncmp(PHP_SAPI, 'cgi', 3) && empty($remoteAddr)); - } - - /** - * Is the current script execution triggered by misc/cron/archive.php ? - * - * Helpful for error handling: directly throw error without HTML (eg. when DB is down) - * @return bool - */ - public static function isArchivePhpTriggered() - { - return !empty($_GET['trigger']) - && $_GET['trigger'] == 'archivephp'; - } - - /** - * Assign CLI parameters as if they were REQUEST or GET parameters. - * You can trigger Piwik from the command line by - * # /usr/bin/php5 /path/to/piwik/index.php -- "module=API&method=Actions.getActions&idSite=1&period=day&date=previous8&format=php" - */ - public static function assignCliParametersToRequest() - { - if (isset($_SERVER['argc']) - && $_SERVER['argc'] > 0 - ) { - for ($i = 1; $i < $_SERVER['argc']; $i++) { - parse_str($_SERVER['argv'][$i], $tmp); - $_GET = array_merge($_GET, $tmp); - } - } - } + return $iis; + } - /** - * Returns true if running on a Windows operating system - * - * @since 0.6.5 - * @return bool true if PHP detects it is running on Windows; else false - */ - public static function isWindows() - { - return DIRECTORY_SEPARATOR === '\\'; - } - - /** - * Returns true if running on MacOS - * - * @return bool true if PHP detects it is running on MacOS; else false - */ - public static function isMacOS() - { - return PHP_OS === 'Darwin'; - } - - /** - * Returns true if running on an Apache web server - * - * @return bool - */ - public static function isApache() - { - $apache = isset($_SERVER['SERVER_SOFTWARE']) && - !strncmp($_SERVER['SERVER_SOFTWARE'], 'Apache', 6); - - return $apache; - } - - /** - * Returns true if running on Microsoft IIS 7 (or above) - * - * @return bool - */ - public static function isIIS() - { - $iis = isset($_SERVER['SERVER_SOFTWARE']) && - preg_match('/^Microsoft-IIS\/(.+)/', $_SERVER['SERVER_SOFTWARE'], $matches) && - version_compare($matches[1], '7') >= 0; - - return $iis; - } - - /** - * 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 - * @return string "?, ?, ?" - */ - public static function getSqlStringFieldsArray($fields) - { - if (is_string($fields)) { - $fields = array($fields); - } - $count = count($fields); - if ($count == 0) { - return "''"; - } - return '?' . str_repeat(',?', $count - 1); - } - - /** - * Sets outgoing header. - * - * @param string $header The header. - * @param bool $replace Whether to replace existing or not. - */ - public static function sendHeader($header, $replace = true) - { - if (isset($GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) && $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) { - @header($header, $replace); - } else { - header($header, $replace); - } + /** + * 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 + * @return string "?, ?, ?" + */ + public static function getSqlStringFieldsArray($fields) + { + if (is_string($fields)) { + $fields = array($fields); } - - /** - * Returns the ID of the current LocationProvider (see UserCountry plugin code) from - * the Tracker cache. - */ - public static function getCurrentLocationProviderId() - { - $cache = Piwik_Tracker_Cache::getCacheGeneral(); - return empty($cache['currentLocationProviderId']) - ? Piwik_UserCountry_LocationProvider_Default::ID - : $cache['currentLocationProviderId']; - } - - /** - * Unprefix class name (if needed) - * - * @param string $class - * @return string - */ - public static function unprefixClass($class) - { - $lenPrefix = strlen(\Piwik\Core\self::CLASSES_PREFIX); - if (!strncmp($class, \Piwik\Core\self::CLASSES_PREFIX, $lenPrefix)) { - return substr($class, $lenPrefix); - } - return $class; + $count = count($fields); + if ($count == 0) { + return "''"; } + return '?' . str_repeat(',?', $count - 1); } -} -namespace { + /** - * Piwik - Open source web analytics + * Sets outgoing header. * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * @param string $header The header. + * @param bool $replace Whether to replace existing or not. + */ + public static function sendHeader($header, $replace = true) + { + if (isset($GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) && $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) { + @header($header, $replace); + } else { + header($header, $replace); + } + } + + /** + * Returns the ID of the current LocationProvider (see UserCountry plugin code) from + * the Tracker cache. + */ + public static function getCurrentLocationProviderId() + { + $cache = Piwik_Tracker_Cache::getCacheGeneral(); + return empty($cache['currentLocationProviderId']) + ? Piwik_UserCountry_LocationProvider_Default::ID + : $cache['currentLocationProviderId']; + } + + /** + * Unprefix class name (if needed) * - * @category Piwik - * @package Piwik + * @param string $class + * @return string */ - use Piwik\Core\Config; + public static function unprefixClass($class) + { + $lenPrefix = strlen(self::CLASSES_PREFIX); + if (!strncmp($class, self::CLASSES_PREFIX, $lenPrefix)) { + return substr($class, $lenPrefix); + } + return $class; + } /** @@ -1583,7 +1571,7 @@ namespace { * For more information: @link http://dev.piwik.org/trac/ticket/374 * @param $var */ - function destroy(&$var) + static public function destroy(&$var) { if (is_object($var) && method_exists($var, '__destruct')) { $var->__destruct(); @@ -1592,18 +1580,17 @@ namespace { $var = null; } - if (!function_exists('printDebug')) { - function printDebug($info = '') - { - if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) { - if (is_array($info) || is_object($info)) { - print("<pre>"); - print(htmlspecialchars(var_export($info, true), ENT_QUOTES)); - print("</pre>"); - } else { - print(htmlspecialchars($info, ENT_QUOTES) . "<br />\n"); - } + static public function printDebug($info = '') + { + if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) { + if (is_array($info) || is_object($info)) { + print("<pre>"); + print(htmlspecialchars(var_export($info, true), ENT_QUOTES)); + print("</pre>"); + } else { + print(htmlspecialchars($info, ENT_QUOTES) . "<br />\n"); } } } } + diff --git a/core/Config.php b/core/Config.php index b5c5fb05fda5a6278985ea993b032e8fb748c4ae..542b518a6f5fe1fe79c4cba7007df05eca130757 100644 --- a/core/Config.php +++ b/core/Config.php @@ -9,7 +9,7 @@ * @package Piwik */ -namespace Piwik\Core; +namespace Piwik; use Exception; /** @@ -48,7 +48,7 @@ class Config /** * Returns the singleton Piwik_Config * - * @return \Piwik\Core\Config + * @return \Piwik\Config */ public static function getInstance() { diff --git a/core/Controller.php b/core/Controller.php index 651351be5fdd21a61039b7a8b2cbd432cdc69326..999e7488b39ed4bd3dc9ebb63f55a4e5117b894b 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * Parent class of all plugins Controllers (located in /plugins/PluginName/Controller.php diff --git a/core/Controller/Admin.php b/core/Controller/Admin.php index 91341107f5d99fde05a0b31b0f927ecc9a57f784..7e62499cd1133e7476f6c829feaa5e9eb4681696 100644 --- a/core/Controller/Admin.php +++ b/core/Controller/Admin.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; +use Piwik\Config; +use Piwik\Piwik; /** * Parent class of all plugins Controllers with admin functions diff --git a/core/Cookie.php b/core/Cookie.php index d68d97a28eb30b92a0cea795368fb157a8368e94..24bd7c8ba275ffb561f1e1529fe60232799ebb55 100644 --- a/core/Cookie.php +++ b/core/Cookie.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Simple class to handle the cookies: diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php index f0241bd06fabd0efa91ec4f24359c98d6ad32796..1eac19955c827dc4254841562901c349e3bccf67 100644 --- a/core/DataAccess/ArchiveSelector.php +++ b/core/DataAccess/ArchiveSelector.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Data Access object used to query archives diff --git a/core/DataAccess/ArchiveTableCreator.php b/core/DataAccess/ArchiveTableCreator.php index cbcb25c8ace217e1123893325654a8daa0044ff0..d36206d1fee57856a0e3c2d324b1f5a670253c42 100644 --- a/core/DataAccess/ArchiveTableCreator.php +++ b/core/DataAccess/ArchiveTableCreator.php @@ -1,6 +1,6 @@ <?php -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Piwik - Open source web analytics diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php index edf6c1ffac68caa1b0f5fc923e4099b5ed7da3a2..f864af9ae19c3b48b9a12907c92fc655a9a6208b 100644 --- a/core/DataAccess/ArchiveWriter.php +++ b/core/DataAccess/ArchiveWriter.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * This class is used to create a new Archive. diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php index 1378a59c3fc6d55c7c299375e1aeee625302945c..8be8a516f24c296e4e529d89a41ca8fba3716cb2 100644 --- a/core/DataAccess/LogAggregator.php +++ b/core/DataAccess/LogAggregator.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * This class queries the Visitor logs tables (visits, actions, conversions, ecommerce) diff --git a/core/DataTable.php b/core/DataTable.php index 370dc8b35dca72a1b6116c60ca4269c1be58a731..c92935868c55a69507b7a6cb80358568cf382fd1 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -9,8 +9,10 @@ * @package Piwik */ +use Piwik\Common; + /** - * @see destroy() + * @see Common::destroy() */ require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; @@ -249,7 +251,7 @@ class Piwik_DataTable /** * The operations that should be used when aggregating columns from multiple rows. - * @see self::addDataTable() and Piwik_DataTable_Row::sumRow() + * @see self::addDataTable() and Piwik_DataTable_Row::sumRow() */ protected $columnAggregationOperations = array(); @@ -277,7 +279,7 @@ class Piwik_DataTable ) { $depth++; foreach ($this->getRows() as $row) { - destroy($row); + Common::destroy($row); } unset($this->rows); Piwik_DataTable_Manager::getInstance()->setTableDeleted($this->getId()); @@ -371,7 +373,7 @@ class Piwik_DataTable $className($this); return; } - + if (!class_exists($className, false)) { $className = "Piwik_DataTable_Filter_" . $className; } @@ -686,19 +688,19 @@ class Piwik_DataTable $columnValues = array(); foreach ($this->getRows() as $row) { $columns = $row->getColumns(); - foreach($columns as $column => $value) { - if(strpos($column, $name) === 0) { + foreach ($columns as $column => $value) { + if (strpos($column, $name) === 0) { $columnValues[] = $row->getColumn($column); } } } return $columnValues; } - + /** * Returns the list of columns the rows in this datatable contain. This will return the * columns of the first row with data and assume they occur in every other row as well. - * + * * @return array */ public function getColumns() @@ -857,7 +859,7 @@ class Piwik_DataTable /** * Deletes the ith row * - * @param int $id + * @param int $id * * @throws Exception if the row $id cannot be found * @return void @@ -1122,7 +1124,6 @@ class Piwik_DataTable "; you will get the original php data structure serialized." . " The data structure looks like this: \n \$data = " . var_export($array, true) . "; "); - // first pass to see if the array has the structure // array(col1_name => val1, col2_name => val2, etc.) // with val* that are never arrays (only strings/numbers/bool/etc.) @@ -1296,12 +1297,12 @@ class Piwik_DataTable * a subtable is encountered w/o the queried label, a new row is created * with the label, and a subtable is added to the row. * - * @param array $path The path to walk. An array of label values. - * @param array|bool $missingRowColumns + * @param array $path The path to walk. An array of label values. + * @param array|bool $missingRowColumns * The default columns to use when creating new arrays. * If this parameter is supplied, new rows will be * created if labels cannot be found. - * @param int $maxSubtableRows The maximum number of allowed rows in new + * @param int $maxSubtableRows The maximum number of allowed rows in new * subtables. * * @return array First element is the found row or false. Second element is @@ -1363,11 +1364,11 @@ class Piwik_DataTable /** * Returns a new DataTable that contains the rows of each of this table's subtables. * - * @param string|bool $labelColumn If supplied the label of the parent row will be + * @param string|bool $labelColumn If supplied the label of the parent row will be * added to a new column in each subtable row. If set to, * 'label' each subtable row's label will be prepended w/ * the parent row's label. - * @param bool $useMetadataColumn If true and if $labelColumn is supplied, the parent row's + * @param bool $useMetadataColumn If true and if $labelColumn is supplied, the parent row's * label will be added as metadata. * * @return Piwik_DataTable @@ -1430,11 +1431,11 @@ class Piwik_DataTable $dataTable->addRowsFromSimpleArray($array); return $dataTable; } - + /** * Set the aggregation operation for a column, e.g. "min". * @see self::addDataTable() and Piwik_DataTable_Row::sumRow() - * + * * @param string $columnName * @param string $operation */ @@ -1442,7 +1443,7 @@ class Piwik_DataTable { $this->columnAggregationOperations[$columnName] = $operation; } - + /** * Set multiple aggregation operations at once. * @param array $operations format: column name => operation @@ -1453,7 +1454,7 @@ class Piwik_DataTable $this->setColumnAggregationOperation($columnName, $operation); } } - + /** * Get the configured column aggregation operations */ @@ -1461,10 +1462,10 @@ class Piwik_DataTable { return $this->columnAggregationOperations; } - + /** * Creates a new DataTable instance from a serialize()'d array of rows. - * + * * @param string $data * @return Piwik_DataTable */ diff --git a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php index b2fd046254fa9cffab611844c37716999b6654e0..21468628f6073bd0a539c1cd6b87827efb9abfe3 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @package Piwik diff --git a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php index 191f9146b3401b2f012f9bcbc7377a9c178ef7a6..5ac99ce678af65364ba5ae78011d87d91540b04c 100644 --- a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php +++ b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * Add a new column to the table which is a percentage based on the value resulting diff --git a/core/DataTable/Filter/ReplaceColumnNames.php b/core/DataTable/Filter/ReplaceColumnNames.php index 85fb633194f70115365c4da46c82f9ce27af8559..f0255a8086f5d500c2d2b550fa45f1760d386c14 100644 --- a/core/DataTable/Filter/ReplaceColumnNames.php +++ b/core/DataTable/Filter/ReplaceColumnNames.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * This filter replaces column names using a mapping table that maps from the old name to the new name. diff --git a/core/DataTable/Manager.php b/core/DataTable/Manager.php index eab94df8f88d41da1f1cd4b61bbd9c799290d3d9..21dc600481c1c5298c1e0196ce394c0579858f21 100644 --- a/core/DataTable/Manager.php +++ b/core/DataTable/Manager.php @@ -9,6 +9,8 @@ * @package Piwik */ +use Piwik\Common; + /** * The DataTable_Manager registers all the instanciated DataTable and provides an * easy way to access them. This is used to store all the DataTable during the archiving process. @@ -112,7 +114,7 @@ class Piwik_DataTable_Manager public function deleteTable($id) { if (isset($this->tables[$id])) { - destroy($this->tables[$id]); + Common::destroy($this->tables[$id]); $this->setTableDeleted($id); } } diff --git a/core/DataTable/Renderer.php b/core/DataTable/Renderer.php index 74f4785e9040a9a78c89a7a523924dde887added..c8f353a64e0292788b540501dc8cd47c8a36310d 100644 --- a/core/DataTable/Renderer.php +++ b/core/DataTable/Renderer.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * A DataTable Renderer can produce an output given a DataTable object. diff --git a/core/DataTable/Renderer/Csv.php b/core/DataTable/Renderer/Csv.php index 38c97fa2fc3efcd6e7fc301f7b941dd64f4a71ff..0e1a3f39d49c253b01c0ba11273b2aa8d2b66c48 100644 --- a/core/DataTable/Renderer/Csv.php +++ b/core/DataTable/Renderer/Csv.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * CSV export diff --git a/core/DataTable/Renderer/Json.php b/core/DataTable/Renderer/Json.php index 2d408d7fda7915c04b09cbd272a8bc287e9d9440..92e0830316714a2d97d066be37919e63037682c6 100644 --- a/core/DataTable/Renderer/Json.php +++ b/core/DataTable/Renderer/Json.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * JSON export. diff --git a/core/DataTable/Renderer/Php.php b/core/DataTable/Renderer/Php.php index 1dc7ee501bc4d4fce567db0f52664c56042cc6b1..ec66701cbe192051360d750372a3e5f1f77fe514 100644 --- a/core/DataTable/Renderer/Php.php +++ b/core/DataTable/Renderer/Php.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * Returns the equivalent PHP array for a given DataTable. diff --git a/core/DataTable/Renderer/Rss.php b/core/DataTable/Renderer/Rss.php index 662ad0ad827b9962011c139c98459510a8beb174..2c1fd0511445c3230b41b6105145cc1936e9eaac 100644 --- a/core/DataTable/Renderer/Rss.php +++ b/core/DataTable/Renderer/Rss.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * RSS Feed. diff --git a/core/DataTable/Renderer/Xml.php b/core/DataTable/Renderer/Xml.php index adbe5e7206136a38cfad16504621010f3a09b63a..ba00e6d39eae06c59dde1d007922d5f7375d623b 100644 --- a/core/DataTable/Renderer/Xml.php +++ b/core/DataTable/Renderer/Xml.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * XML export of a given DataTable. diff --git a/core/Db/Adapter/Mysqli.php b/core/Db/Adapter/Mysqli.php index c20800e2eadbbd7ab4f5cb12f80c968b5851a83e..38495a23575abb23dc56170a3aca6198f0c36b37 100644 --- a/core/Db/Adapter/Mysqli.php +++ b/core/Db/Adapter/Mysqli.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * @package Piwik diff --git a/core/Db/Adapter/Pdo/Mssql.php b/core/Db/Adapter/Pdo/Mssql.php index 2e9def183441325a81036d312057f50c10dd67f7..458a99fcc5114c1d241e1b27feb9fb2d226be508 100644 --- a/core/Db/Adapter/Pdo/Mssql.php +++ b/core/Db/Adapter/Pdo/Mssql.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * @package Piwik diff --git a/core/Db/Adapter/Pdo/Mysql.php b/core/Db/Adapter/Pdo/Mysql.php index 33f52df232db4602d1db7cf5063e0202e5d3d1d3..c2ad0ea2d8996f5b78cb513b973f26ded3d175f7 100644 --- a/core/Db/Adapter/Pdo/Mysql.php +++ b/core/Db/Adapter/Pdo/Mysql.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * @package Piwik diff --git a/core/Db/Adapter/Pdo/Pgsql.php b/core/Db/Adapter/Pdo/Pgsql.php index 1b671036332074c858e37b970d64675cb5e63479..f4e68dfde9128ae46c48913aa343847952d760b6 100644 --- a/core/Db/Adapter/Pdo/Pgsql.php +++ b/core/Db/Adapter/Pdo/Pgsql.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * @package Piwik diff --git a/core/Db/Schema.php b/core/Db/Schema.php index ad972e910d9479090e9e4b260a23664e271387f4..fed20dfe286bb4b1b30126a62cb64c23473c1a83 100644 --- a/core/Db/Schema.php +++ b/core/Db/Schema.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * Schema abstraction diff --git a/core/Db/Schema/Myisam.php b/core/Db/Schema/Myisam.php index 1758ee384b8576e9404c8296e8f9d48c754d09a7..a0eb2a70384bedc10dedfc8e8df82d833367e255 100644 --- a/core/Db/Schema/Myisam.php +++ b/core/Db/Schema/Myisam.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * MySQL schema diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php index 105caf90582cb8fcee319cf1d4ef57ccca4a4133..c06bc3d5af0823e15f0ef8fb25df470948c3c2e8 100644 --- a/core/ExceptionHandler.php +++ b/core/ExceptionHandler.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * Exception handler used to display nicely exceptions in Piwik diff --git a/core/FrontController.php b/core/FrontController.php index 683657867047b4bb723116477f2c22bff150d17f..a90f4b8554b96f1395da8bd89e431655714bbec4 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * @see core/PluginsManager.php @@ -20,6 +20,7 @@ use Piwik\Core\Common; require_once PIWIK_INCLUDE_PATH . '/core/PluginsManager.php'; require_once PIWIK_INCLUDE_PATH . '/core/Translate.php'; require_once PIWIK_INCLUDE_PATH . '/core/Option.php'; +require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php'; /** * Front controller. @@ -275,7 +276,7 @@ class Piwik_FrontController Piwik_PluginsManager::getInstance()->installLoadedPlugins(); // ensure the current Piwik URL is known for later use - if (method_exists('Piwik\Core\Piwik', 'getPiwikUrl')) { + if (method_exists('Piwik\Piwik', 'getPiwikUrl')) { $host = Piwik::getPiwikUrl(); } diff --git a/core/Http.php b/core/Http.php index cc536477f2ffefa0c0eaeb17593ffbb315e22ed9..de30bf3b2f91a48aeb465ab50c7f3e9f29fb5784 100644 --- a/core/Http.php +++ b/core/Http.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * Server-side http client to retrieve content from remote servers, and optionally save to a local file. diff --git a/core/IP.php b/core/IP.php index 64ca6072ff135b7b41c9b4553d7ab6b733af2d53..2fa60ca33d3e4ba1237b87c1b5d2cd47bd6cd5dd 100644 --- a/core/IP.php +++ b/core/IP.php @@ -9,8 +9,8 @@ * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; if (Common::isWindows() || !function_exists('inet_ntop')) { function _inet_ntop($in_addr) diff --git a/core/Log.php b/core/Log.php index 6f0dee20475ca3672b4523f67f7c060351120ead..2228ec9daeab0b9085bb1abdfc143b69f59390c5 100644 --- a/core/Log.php +++ b/core/Log.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * @@ -176,7 +176,7 @@ class Piwik_Log_Formatter_ScreenFormatter implements Zend_Log_Formatter_Interfac function formatEvent($event) { // no injection in error messages, backtrace when displayed on screen - return array_map(array('Piwik\Core\Common', 'sanitizeInputValue'), $event); + return array_map(array('Piwik\Common', 'sanitizeInputValue'), $event); } function format($string) diff --git a/core/Log/Exception.php b/core/Log/Exception.php index b86a3dd6c7a58bc685d98b60ae56d875ff84bc0a..b71479e57570979b5bebb8f40daf08cbc615fb7c 100644 --- a/core/Log/Exception.php +++ b/core/Log/Exception.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Class used to log an exception event. diff --git a/core/Log/Message.php b/core/Log/Message.php index cc425116be4c3a139ca796998b8c7942913e2a36..eb200a3b682c5b95a97b1053c9982a32493748a0 100644 --- a/core/Log/Message.php +++ b/core/Log/Message.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Class used to log a standard message event. diff --git a/core/Mail.php b/core/Mail.php index b907f4c63db08163174482de2772c3431d8f041f..d9f917e464fa9e0fa5c106f0653235a6963e4e6f 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; +use Piwik\Config; +use Piwik\Piwik; /** * Class for sending mails, for more information see: diff --git a/core/Menu/Abstract.php b/core/Menu/Abstract.php index 35e677875ddda64ee6293b9c035de60f0e68c790..14574847bf09d976e314c19ee90e6b99a9814b69 100644 --- a/core/Menu/Abstract.php +++ b/core/Menu/Abstract.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik_Menu */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Piwik_Menu diff --git a/core/Menu/Admin.php b/core/Menu/Admin.php index 0ee8965a249a76c51d232058694dd4fc84e724fb..7af69b3255130a507813a0a9d5fef9c4a9aff6fc 100644 --- a/core/Menu/Admin.php +++ b/core/Menu/Admin.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik_Menu */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @package Piwik_Menu diff --git a/core/Metrics.php b/core/Metrics.php index 4ba67595825c40654f2ff1e6c2361b52b119e5e2..90560e17d05222f61d8ee568e66823f7010a81e1 100644 --- a/core/Metrics.php +++ b/core/Metrics.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * This class holds the various mappings we use to internally store and manipulate metrics. diff --git a/core/Nonce.php b/core/Nonce.php index 49f52a29b5c78b967fb17218f64bcbe082b25a89..23e447f949dd18dc6e320943d820191ac187179a 100644 --- a/core/Nonce.php +++ b/core/Nonce.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Nonce class. diff --git a/core/Option.php b/core/Option.php index 424d9e1a05e3f8d2fbfe8f1621ca2d4ec86269a1..11f541bd5596d1d2f5a6e5acacc24f0de2dc127a 100644 --- a/core/Option.php +++ b/core/Option.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Piwik_Option provides a very simple mechanism to save/retrieve key-values pair diff --git a/core/Period.php b/core/Period.php index a086711e1fadb0a02514a27017ed3891d42626ad..01705ccbe7f19aaff1c5c5d416d12b0c0f63e155 100644 --- a/core/Period.php +++ b/core/Period.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * Creating a new Piwik_Period subclass: diff --git a/core/Period/Range.php b/core/Period/Range.php index f23e3dce6922273e3eb2842af784b1a0f8db6723..f69a0d304e4fa278e39eb9207c95349659652732 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * from a starting date to an ending date diff --git a/core/Piwik.php b/core/Piwik.php index 6f9ceb3bcedc355777cc4203d07785cb660d252e..f788d50f89673a04931730a914dd073a8073a265 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -8,15 +8,14 @@ * @category Piwik * @package Piwik */ -namespace Piwik\Core; +namespace Piwik; + use Exception; -use false; -use Manifest; -use Piwik\Core\Config; +use Piwik\Config; use Piwik_Access; use Piwik_Access_NoAccessException; use Piwik_AssetManager; -use Piwik\Core\Common; +use Piwik\Common; use Piwik_Db_Adapter; use Piwik_Db_Schema; use Piwik_Log_APICall; @@ -41,6 +40,8 @@ use Zend_Registry; * @see core/Translate.php */ require_once PIWIK_INCLUDE_PATH . '/core/Translate.php'; +require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; +require_once PIWIK_INCLUDE_PATH . '/core/Config.php'; /** * Main piwik helper class. diff --git a/core/Plugin.php b/core/Plugin.php index 51a21b604918c88b88044012d7948a7255e32e65..bec854cd9ed7bbd0273caca26158c7eab2ce5f54 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * @see core/Plugin/MetadataLoader.php diff --git a/core/Plugin/MetadataLoader.php b/core/Plugin/MetadataLoader.php index 5b514b8610e9a890133b96f64b4b4aca6c8210a6..6e8e16ebb4dd9057ac108b573f35b62e8df388a8 100644 --- a/core/Plugin/MetadataLoader.php +++ b/core/Plugin/MetadataLoader.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * @see core/Version.php diff --git a/core/PluginsArchiver.php b/core/PluginsArchiver.php index ad0579e3327ef9b34e1ce4ad0c7f1b2a4bfe0ae2..aac3b936da3c3f1970f8dc683eeb11417382d8ce 100644 --- a/core/PluginsArchiver.php +++ b/core/PluginsArchiver.php @@ -9,8 +9,8 @@ * @category Piwik * @package Piwik_PluginArchiver */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * Plugins that archive metrics for websites can implement an Archiver that extends this class diff --git a/core/PluginsFunctions/Sql.php b/core/PluginsFunctions/Sql.php index fef08121e162208b46dbf2960f8295340e7dc1e1..2a0d3665bad8cb36e76edafae899eb1161ccee6b 100644 --- a/core/PluginsFunctions/Sql.php +++ b/core/PluginsFunctions/Sql.php @@ -8,7 +8,7 @@ * @category Piwik * @package PluginsFunctions */ -use Piwik\Core\Config; +use Piwik\Config; /** * SQL wrapper diff --git a/core/PluginsManager.php b/core/PluginsManager.php index ffad1670c2e5444286e0fc496f05551305b354ad..5147ed21780c111ff941e8c9eba269acb3597ecf 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * @see core/Menu/Abstract.php diff --git a/core/ProxyHeaders.php b/core/ProxyHeaders.php index ae319b986d3ae363d367225d1a33dc541bb45dd9..5b18bcfbc36c714a60c6cb11202fddab26a31e2c 100644 --- a/core/ProxyHeaders.php +++ b/core/ProxyHeaders.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Proxy headers diff --git a/core/ReportRenderer.php b/core/ReportRenderer.php index da27590652461025e8f4f8ce00f350369480c512..e4125cf18f51f18767d98ca18100b10faf9e3391 100644 --- a/core/ReportRenderer.php +++ b/core/ReportRenderer.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * A Report Renderer produces user friendly renderings of any given Piwik report. diff --git a/core/ReportRenderer/Html.php b/core/ReportRenderer/Html.php index 0edf422dabacd5b9460e4cddc495fc04fe5718cd..0f72de2aafb77a34e24d056fa93d7f88d06fbf0c 100644 --- a/core/ReportRenderer/Html.php +++ b/core/ReportRenderer/Html.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik_ReportRenderer */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php index 2b20ecb1694ca6ee453283116f83cd4c526beeeb..7e7e6069f052fbcc8fd6952557cba2dddce21239 100644 --- a/core/ReportRenderer/Pdf.php +++ b/core/ReportRenderer/Pdf.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik_ReportRenderer */ -use Piwik\Core\Common; +use Piwik\Common; /** * @see libs/tcpdf diff --git a/core/Segment.php b/core/Segment.php index 1e2da61f2de6f290e82fd4df224ea11555ed11c9..35ada3d8783606ff1e877199c3fd652c1e61af6a 100644 --- a/core/Segment.php +++ b/core/Segment.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/core/Session.php b/core/Session.php index 5f2d362b6b1059f4f3eba7bcf2a537af4be932ba..1db8458cb773fa02905cf862458ef93baa86eecd 100644 --- a/core/Session.php +++ b/core/Session.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * Session initialization. diff --git a/core/Session/Namespace.php b/core/Session/Namespace.php index 22199fdfd62b178c9d921d618de4a72813f62d1d..f2fb04b131f537d307880ac61fa16cc18735346d 100644 --- a/core/Session/Namespace.php +++ b/core/Session/Namespace.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Session namespace. diff --git a/core/Timer.php b/core/Timer.php index 43edaa78ec7cc59b393d7562038efeee6bb394e1..236787db672d11768548790f4d2bb4520d90225e 100644 --- a/core/Timer.php +++ b/core/Timer.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/core/Tracker.php b/core/Tracker.php index e82e88f053ce6100643bf1142b1d284543dd71f7..d3d9a765b61fe7dd3bfc6f582b60551006cf76fd 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * Class used by the logging script piwik.php called by the javascript tag. @@ -227,10 +227,10 @@ class Piwik_Tracker $visit->handle(); unset($visit); } else { - printDebug("The request is invalid: empty request, or maybe tracking is disabled in the config.ini.php via record_statistics=0"); + Common::printDebug("The request is invalid: empty request, or maybe tracking is disabled in the config.ini.php via record_statistics=0"); } } catch (Piwik_Tracker_Db_Exception $e) { - printDebug("<b>" . $e->getMessage() . "</b>"); + Common::printDebug("<b>" . $e->getMessage() . "</b>"); $this->exitWithException($e, $isAuthenticated); } catch (Piwik_Tracker_Visit_Excluded $e) { } catch (Exception $e) { @@ -290,7 +290,7 @@ class Piwik_Tracker if ($minimumInterval <= 0 || empty($cache['isBrowserTriggerArchivingEnabled']) ) { - printDebug("-> Scheduled tasks not running in Tracker: Browser archiving is disabled."); + Common::printDebug("-> Scheduled tasks not running in Tracker: Browser archiving is disabled."); return; } $nextRunTime = $cache['lastTrackerCronRun'] + $minimumInterval; @@ -302,7 +302,7 @@ class Piwik_Tracker Piwik_Tracker_Cache::setCacheGeneral($cache); self::initCorePiwikInTrackerMode(); Piwik_SetOption('lastTrackerCronRun', $cache['lastTrackerCronRun']); - printDebug('-> Scheduled Tasks: Starting...'); + Common::printDebug('-> Scheduled Tasks: Starting...'); // save current user privilege and temporarily assume super user privilege $isSuperUser = Piwik::isUserIsSuperUser(); @@ -319,12 +319,12 @@ class Piwik_Tracker // restore original user privilege Piwik::setUserIsSuperUser($isSuperUser); - printDebug($resultTasks); - printDebug('Finished Scheduled Tasks.'); + Common::printDebug($resultTasks); + Common::printDebug('Finished Scheduled Tasks.'); } else { - printDebug("-> Scheduled tasks not triggered."); + Common::printDebug("-> Scheduled tasks not triggered."); } - printDebug("Next run will be from: " . date('Y-m-d H:i:s', $nextRunTime) . ' UTC'); + Common::printDebug("Next run will be from: " . date('Y-m-d H:i:s', $nextRunTime) . ' UTC'); } static public $initTrackerMode = false; @@ -417,7 +417,7 @@ class Piwik_Tracker $this->handleDisabledTracker(); $this->handleEmptyRequest($request); - printDebug("Current datetime: " . date("Y-m-d H:i:s", $request->getCurrentTimestamp())); + Common::printDebug("Current datetime: " . date("Y-m-d H:i:s", $request->getCurrentTimestamp())); } /** @@ -428,11 +428,11 @@ class Piwik_Tracker switch ($this->getState()) { case self::STATE_LOGGING_DISABLE: $this->outputTransparentGif(); - printDebug("Logging disabled, display transparent logo"); + Common::printDebug("Logging disabled, display transparent logo"); break; case self::STATE_EMPTY_REQUEST: - printDebug("Empty request => Piwik page"); + Common::printDebug("Empty request => Piwik page"); echo "<a href='/'>Piwik</a> is a free open source web <a href='http://piwik.org'>analytics</a> that lets you keep control of your data."; break; @@ -440,10 +440,10 @@ class Piwik_Tracker case self::STATE_NOTHING_TO_NOTICE: default: $this->outputTransparentGif(); - printDebug("Nothing to notice => default behaviour"); + Common::printDebug("Nothing to notice => default behaviour"); break; } - printDebug("End of the page."); + Common::printDebug("End of the page."); if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) { if (isset(self::$db)) { @@ -606,10 +606,10 @@ class Piwik_Tracker Piwik_PluginsManager::getInstance()->loadPlugins($pluginsTracker); - printDebug("Loading plugins: { " . implode(",", $pluginsTracker) . " }"); + Common::printDebug("Loading plugins: { " . implode(",", $pluginsTracker) . " }"); } } catch (Exception $e) { - printDebug("ERROR: " . $e->getMessage()); + Common::printDebug("ERROR: " . $e->getMessage()); } } diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index ddba2c0dccfe38179c89ccd8a3f367d4219e2330..1fee863928c2776aa5043720b19178bb05463190 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * Interface of the Action object. @@ -388,7 +388,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface : array(); if (!empty($excludedParameters)) { - printDebug('Excluding parameters "' . implode(',', $excludedParameters) . '" from URL'); + Common::printDebug('Excluding parameters "' . implode(',', $excludedParameters) . '" from URL'); } $parametersToExclude = array_merge($excludedParameters, @@ -446,8 +446,8 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface $info['url'] = self::excludeQueryParametersFromUrl($originalUrl, $this->request->getIdSite()); if ($originalUrl != $info['url']) { - printDebug(' Before was "' . $originalUrl . '"'); - printDebug(' After is "' . $info['url'] . '"'); + Common::printDebug(' Before was "' . $originalUrl . '"'); + Common::printDebug(' After is "' . $info['url'] . '"'); } // Set Final attributes for this Action (Pageview, Search, etc.) @@ -547,7 +547,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface Piwik_Tracker::getDatabase()->query($sql, array($name, $name, $type, $urlPrefix)); $actionId = Piwik_Tracker::getDatabase()->lastInsertId(); - printDebug("Recorded a new action (" . self::getActionTypeName($type) . ") in the lookup table: " . $name . " (idaction = " . $actionId . ")"); + Common::printDebug("Recorded a new action (" . self::getActionTypeName($type) . ") in the lookup table: " . $name . " (idaction = " . $actionId . ")"); $actionNamesAndTypes[$actionToInsert][] = $actionId; } @@ -706,7 +706,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface 'idRefererActionName' => $idRefererActionName, 'timeSpentRefererAction' => $timeSpentRefererAction, ); - printDebug($insertWithoutNulls); + Common::printDebug($insertWithoutNulls); /* * send the Action object ($this) and the list of ids ($info) as arguments to the event @@ -721,22 +721,22 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface // Enrich Site Search actions with Custom Variables, overwriting existing values if (!empty($this->searchCategory)) { if (!empty($customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_CATEGORY])) { - printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_CATEGORY . " for this page view"); + Common::printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_CATEGORY . " for this page view"); } $customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_CATEGORY] = self::CVAR_KEY_SEARCH_CATEGORY; $customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_CATEGORY] = Piwik_Tracker_Request::truncateCustomVariable($this->searchCategory); } if ($this->searchCount !== false) { if (!empty($customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_COUNT])) { - printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_COUNT . " for this page view"); + Common::printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_COUNT . " for this page view"); } $customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_COUNT] = self::CVAR_KEY_SEARCH_COUNT; $customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_COUNT] = (int)$this->searchCount; } if (!empty($customVariables)) { - printDebug("Page level Custom Variables: "); - printDebug($customVariables); + Common::printDebug("Page level Custom Variables: "); + Common::printDebug($customVariables); } return $customVariables; } @@ -805,7 +805,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface $url = self::cleanupString($url); if (!Common::isLookLikeUrl($url)) { - printDebug("WARNING: URL looks invalid and is discarded"); + Common::printDebug("WARNING: URL looks invalid and is discarded"); $url = ''; } @@ -833,7 +833,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface { $website = Piwik_Tracker_Cache::getCacheWebsiteAttributes($this->request->getIdSite()); if (empty($website['sitesearch'])) { - printDebug("Internal 'Site Search' tracking is not enabled for this site. "); + Common::printDebug("Internal 'Site Search' tracking is not enabled for this site. "); return false; } $actionName = $url = $categoryName = $count = false; @@ -873,19 +873,19 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface } if (empty($actionName)) { - printDebug("(this is not a Site Search request)"); + Common::printDebug("(this is not a Site Search request)"); return false; } - printDebug("Detected Site Search keyword '$actionName'. "); + Common::printDebug("Detected Site Search keyword '$actionName'. "); if (!empty($categoryName)) { - printDebug("- Detected Site Search Category '$categoryName'. "); + Common::printDebug("- Detected Site Search Category '$categoryName'. "); } if ($count !== false) { - printDebug("- Search Results Count was '$count'. "); + Common::printDebug("- Search Results Count was '$count'. "); } if ($url != $originalUrl) { - printDebug("NOTE: The Page URL was changed / removed, during the Site Search detection, was '$originalUrl', now is '$url'"); + Common::printDebug("NOTE: The Page URL was changed / removed, during the Site Search detection, was '$originalUrl', now is '$url'"); } if (!empty($categoryName) || $count !== false) { diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php index eb0b90cd8605afc8222118d78efe5a5a1357439f..4f7e5809f3e88c47607f0b4c4aa74f785d340b3c 100644 --- a/core/Tracker/Cache.php +++ b/core/Tracker/Cache.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; +use Piwik\Config; +use Piwik\Piwik; /** * Simple cache mechanism used in Tracker to avoid requesting settings from mysql on every request diff --git a/core/Tracker/Config.php b/core/Tracker/Config.php index 1ce66aaa5576d7c2ae6f7e021cae2af7130feab2..e3e35fd7e0bb605aabca6fb2b52b979ac3478e2c 100644 --- a/core/Tracker/Config.php +++ b/core/Tracker/Config.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * Backward compatibility layer diff --git a/core/Tracker/Db.php b/core/Tracker/Db.php index 6d33bc39c533db37e498ac1a7f005eb35b7ce1bf..5b7cbde2cc25f7423f50a55ddea1ef3290ce7d1a 100644 --- a/core/Tracker/Db.php +++ b/core/Tracker/Db.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Simple database wrapper. diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index fb22e339e7c34ff553295401010a402a221f804c..719639619d44f0d8eab64e0a84d3e7d7d103e50c 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * @package Piwik @@ -355,7 +355,7 @@ class Piwik_Tracker_GoalManager ); if ($this->isThereExistingCartInVisit) { - printDebug("There is an existing cart for this visit"); + Common::printDebug("There is an existing cart for this visit"); } if ($this->isGoalAnOrder) { $orderIdNumeric = Common::hashStringToInt($this->orderId); @@ -376,7 +376,7 @@ class Piwik_Tracker_GoalManager } $goal['revenue'] = $this->getRevenue($this->request->getGoalRevenue( $defaultRevenue = 0)); - printDebug($debugMessage . ':' . var_export($goal, true)); + Common::printDebug($debugMessage . ':' . var_export($goal, true)); // INSERT or Sync items in the Cart / Order for this visit & order $items = $this->getEcommerceItemsFromRequest(); @@ -409,13 +409,13 @@ class Piwik_Tracker_GoalManager { $items = Common::unsanitizeInputValue($this->request->getParam('ec_items')); if (empty($items)) { - printDebug("There are no Ecommerce items in the request"); + Common::printDebug("There are no Ecommerce items in the request"); // we still record an Ecommerce order without any item in it return array(); } $items = Common::json_decode($items, $assoc = true); if (!is_array($items)) { - printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true)); + Common::printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true)); return false; } @@ -451,8 +451,8 @@ class Piwik_Tracker_GoalManager $itemsInDb = Piwik_Tracker::getDatabase()->fetchAll($sql, $bind); - printDebug("Items found in current cart, for conversion_item (visit,idorder)=" . var_export($bind, true)); - printDebug($itemsInDb); + Common::printDebug("Items found in current cart, for conversion_item (visit,idorder)=" . var_export($bind, true)); + Common::printDebug($itemsInDb); // Look at which items need to be deleted, which need to be added or updated, based on the SKU $skuFoundInDb = $itemsToUpdate = array(); foreach ($itemsInDb as $itemInDb) { @@ -475,8 +475,8 @@ class Piwik_Tracker_GoalManager ); $itemsToUpdate[] = $itemToUpdate; - printDebug("Item found in the previous Cart, but no in the current cart/order"); - printDebug($itemToUpdate); + Common::printDebug("Item found in the previous Cart, but no in the current cart/order"); + Common::printDebug($itemToUpdate); continue; } @@ -484,14 +484,14 @@ class Piwik_Tracker_GoalManager $newItem = $this->getItemRowCast($newItem); if (count($itemInDb) != count($newItem)) { - printDebug("ERROR: Different format in items from cart and DB"); + Common::printDebug("ERROR: Different format in items from cart and DB"); throw new Exception(" Item in DB and Item in cart have a different format, this is not expected... " . var_export($itemInDb, true) . var_export($newItem, true)); } - printDebug("Item has changed since the last cart. Previous item stored in cart in database:"); - printDebug($itemInDb); - printDebug("New item to UPDATE the previous row:"); + Common::printDebug("Item has changed since the last cart. Previous item stored in cart in database:"); + Common::printDebug($itemInDb); + Common::printDebug("New item to UPDATE the previous row:"); $newItem['idorder_original_value'] = $itemInDbOriginal['idorder_original_value']; - printDebug($newItem); + Common::printDebug($newItem); $itemsToUpdate[] = $newItem; } @@ -649,12 +649,12 @@ class Piwik_Tracker_GoalManager if (empty($itemsToUpdate)) { return; } - printDebug("Goal data used to update ecommerce items:"); - printDebug($goal); + Common::printDebug("Goal data used to update ecommerce items:"); + Common::printDebug($goal); foreach ($itemsToUpdate as $item) { $newRow = $this->getItemRowEnriched($goal, $item); - printDebug($newRow); + Common::printDebug($newRow); $updateParts = $sqlBind = array(); foreach ($newRow AS $name => $value) { $updateParts[] = $name . " = ?"; @@ -686,8 +686,8 @@ class Piwik_Tracker_GoalManager if (empty($itemsToInsert)) { return; } - printDebug("Ecommerce items that are added to the cart/order"); - printDebug($itemsToInsert); + Common::printDebug("Ecommerce items that are added to the cart/order"); + Common::printDebug($itemsToInsert); $sql = "INSERT INTO " . Common::prefixTable('log_conversion_item') . " (idaction_sku, idaction_name, idaction_category, idaction_category2, idaction_category3, idaction_category4, idaction_category5, price, quantity, deleted, @@ -705,8 +705,8 @@ class Piwik_Tracker_GoalManager $bind = array_merge($bind, $newRow); } Piwik_Tracker::getDatabase()->query($sql, $bind); - printDebug($sql); - printDebug($bind); + Common::printDebug($sql); + Common::printDebug($bind); } protected function getItemRowEnriched($goal, $item) @@ -741,7 +741,7 @@ class Piwik_Tracker_GoalManager protected function recordStandardGoals($goal, $action, $visitorInformation) { foreach ($this->convertedGoals as $convertedGoal) { - printDebug("- Goal " . $convertedGoal['idgoal'] . " matched. Recording..."); + Common::printDebug("- Goal " . $convertedGoal['idgoal'] . " matched. Recording..."); $newGoal = $goal; $newGoal['idgoal'] = $convertedGoal['idgoal']; $newGoal['url'] = $convertedGoal['url']; @@ -775,7 +775,7 @@ class Piwik_Tracker_GoalManager { $newGoalDebug = $newGoal; $newGoalDebug['idvisitor'] = bin2hex($newGoalDebug['idvisitor']); - printDebug($newGoalDebug); + Common::printDebug($newGoalDebug); $fields = implode(", ", array_keys($newGoal)); $bindFields = Common::getSqlStringFieldsArray($newGoal); diff --git a/core/Tracker/IgnoreCookie.php b/core/Tracker/IgnoreCookie.php index 7fd2cc9fb3914973fb015b4a912a5ec2b3f85a92..7253c255200b2298965ba08453b2e704a26e8cbe 100644 --- a/core/Tracker/IgnoreCookie.php +++ b/core/Tracker/IgnoreCookie.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * Tracking cookies. diff --git a/core/Tracker/Referer.php b/core/Tracker/Referer.php index 1c8469f3f0717f5eb639fe93c54deac24c32fd03..b1389c256bab6bba97e5c52fbf6369ec3bc3aa65 100644 --- a/core/Tracker/Referer.php +++ b/core/Tracker/Referer.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Piwik diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index e27e2eadedd6ed1a3a44746743c140caed44141b..c27ebe6b9a6a60904e2bd4c3f4c68b7422f1f59f 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -1,6 +1,6 @@ <?php -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * Piwik - Open source web analytics @@ -69,10 +69,10 @@ class Piwik_Tracker_Request if (!$this->isAuthenticated) { return; } - printDebug("token_auth is authenticated!"); + Common::printDebug("token_auth is authenticated!"); } else { $this->isAuthenticated = true; - printDebug("token_auth authentication not required"); + Common::printDebug("token_auth authentication not required"); } } @@ -97,7 +97,7 @@ class Piwik_Tracker_Request return true; } } - printDebug("WARNING! token_auth = $tokenAuth is not valid, Super User / Admin was NOT authenticated"); + Common::printDebug("WARNING! token_auth = $tokenAuth is not valid, Super User / Admin was NOT authenticated"); return false; } @@ -296,7 +296,7 @@ class Piwik_Tracker_Request || count($keyValue) != 2 || (!is_string($keyValue[0]) && !is_numeric($keyValue[0])) ) { - printDebug("Invalid custom variables detected (id=$id)"); + Common::printDebug("Invalid custom variables detected (id=$id)"); continue; } if (strlen($keyValue[1]) == 0) { @@ -332,7 +332,7 @@ class Piwik_Tracker_Request if (!$this->shouldUseThirdPartyCookie()) { return; } - printDebug("We manage the cookie..."); + Common::printDebug("We manage the cookie..."); $cookie = $this->makeThirdPartyCookie(); // idcookie has been generated in handleNewVisit or we simply propagate the old value @@ -346,7 +346,7 @@ class Piwik_Tracker_Request $this->getCookieName(), $this->getCookieExpire(), $this->getCookiePath()); - printDebug($cookie); + Common::printDebug($cookie); return $cookie; } @@ -379,7 +379,7 @@ class Piwik_Tracker_Request if (strlen($idVisitor) != Piwik_Tracker::LENGTH_HEX_ID_STRING) { throw new Exception("Visitor ID (cid) $idVisitor must be " . Piwik_Tracker::LENGTH_HEX_ID_STRING . " characters long"); } - printDebug("Request will be recorded for this idvisitor = " . $idVisitor); + Common::printDebug("Request will be recorded for this idvisitor = " . $idVisitor); $found = true; } diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index c04d7f5a002cd06b12715c937b2817a9d25dc5ca..d2d87d121e9aeba40a4953027d1bbfb327e7c945 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * @package Piwik @@ -95,8 +95,8 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface $this->visitorCustomVariables = $this->request->getCustomVariables($scope = 'visit'); if (!empty($this->visitorCustomVariables)) { - printDebug("Visit level Custom Variables: "); - printDebug($this->visitorCustomVariables); + Common::printDebug("Visit level Custom Variables: "); + Common::printDebug($this->visitorCustomVariables); } $this->goalManager = new Piwik_Tracker_GoalManager($this->request); @@ -120,7 +120,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface $visitIsConverted = $someGoalsConverted; // if we find a idgoal in the URL, but then the goal is not valid, this is most likely a fake request if (!$someGoalsConverted) { - printDebug('Invalid goal tracking request for goal id = ' . $this->goalManager->idGoal); + Common::printDebug('Invalid goal tracking request for goal id = ' . $this->goalManager->idGoal); unset($this->goalManager); return; } @@ -129,11 +129,11 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface $action = $this->newAction(); if ($this->detectActionIsOutlinkOnAliasHost($action)) { - printDebug("INFO: The outlink URL host is one of the known host for this website. "); + Common::printDebug("INFO: The outlink URL host is one of the known host for this website. "); } if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) { $type = Piwik_Tracker_Action::getActionTypeName($action->getActionType()); - printDebug("Action is a $type, + Common::printDebug("Action is a $type, Action name = " . $action->getActionName() . ", Action URL = " . $action->getActionUrl()); } @@ -155,7 +155,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface $isLastActionInTheSameVisit = $this->isLastActionInTheSameVisit(); if (!$isLastActionInTheSameVisit) { - printDebug("Visitor detected, but last action was more than 30 minutes ago..."); + Common::printDebug("Visitor detected, but last action was more than 30 minutes ago..."); } // Known visit when: // ( - the visitor has the Piwik cookie with the idcookie ID used by Piwik to match the visitor @@ -268,7 +268,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface if ($incrementActions) { $sqlActionUpdate .= "visit_total_actions = visit_total_actions + 1, "; } - printDebug("Visit is known (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")"); + Common::printDebug("Visit is known (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")"); $datetimeServer = Piwik_Tracker::getDatetimeFromTimestamp($this->request->getCurrentTimestamp()); $valuesToUpdate['visit_last_action_time'] = $datetimeServer; @@ -332,12 +332,12 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface if (isset($valuesToUpdate['idvisitor'])) { $valuesToUpdate['idvisitor'] = bin2hex($valuesToUpdate['idvisitor']); } - printDebug('Updating existing visit: ' . var_export($valuesToUpdate, true)); + Common::printDebug('Updating existing visit: ' . var_export($valuesToUpdate, true)); if (Piwik_Tracker::getDatabase()->rowCount($result) == 0) { - printDebug("Visitor with this idvisit wasn't found in the DB."); - printDebug("$sqlQuery --- "); - printDebug($sqlBind); + Common::printDebug("Visitor with this idvisit wasn't found in the DB."); + Common::printDebug("$sqlQuery --- "); + Common::printDebug($sqlBind); throw new Piwik_Tracker_Visit_VisitorNotFoundInDatabase( "The visitor with idvisitor=" . bin2hex($this->visitorInfo['idvisitor']) . " and idvisit=" . $this->visitorInfo['idvisit'] . " wasn't found in the DB, we fallback to a new visitor"); @@ -373,7 +373,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface */ protected function handleNewVisit($idActionUrl, $idActionName, $actionType, $visitIsConverted) { - printDebug("New Visit (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")"); + Common::printDebug("New Visit (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")"); $daysSinceFirstVisit = $this->request->getDaysSinceFirstVisit(); $visitCount = $this->request->getVisitCount(); @@ -468,7 +468,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface $debugVisitInfo = $this->visitorInfo; $debugVisitInfo['idvisitor'] = bin2hex($debugVisitInfo['idvisitor']); $debugVisitInfo['config_id'] = bin2hex($debugVisitInfo['config_id']); - printDebug($debugVisitInfo); + Common::printDebug($debugVisitInfo); $this->saveVisitorInformation(); } @@ -643,9 +643,9 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface if ($isVisitorIdToLookup) { $this->visitorInfo['idvisitor'] = $idVisitor; - printDebug("Matching visitors with: visitorId=" . bin2hex($this->visitorInfo['idvisitor']) . " OR configId=" . bin2hex($configId)); + Common::printDebug("Matching visitors with: visitorId=" . bin2hex($this->visitorInfo['idvisitor']) . " OR configId=" . bin2hex($configId)); } else { - printDebug("Visitor doesn't have the piwik cookie..."); + Common::printDebug("Visitor doesn't have the piwik cookie..."); } $selectCustomVariables = ''; @@ -813,14 +813,14 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface } $this->visitorKnown = true; - printDebug("The visitor is known (idvisitor = " . bin2hex($this->visitorInfo['idvisitor']) . ", + Common::printDebug("The visitor is known (idvisitor = " . bin2hex($this->visitorInfo['idvisitor']) . ", config_id = " . bin2hex($configId) . ", idvisit = {$this->visitorInfo['idvisit']}, last action = " . date("r", $this->visitorInfo['visit_last_action_time']) . ", first action = " . date("r", $this->visitorInfo['visit_first_action_time']) . ", visit_goal_buyer' = " . $this->visitorInfo['visit_goal_buyer'] . ")"); } else { - printDebug("The visitor was not matched with an existing visitor..."); + Common::printDebug("The visitor was not matched with an existing visitor..."); } } diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php index b405d435cf603258a71c41327589e3c60d1dcffa..fc9fbfe52fa550ef98f8fad17e50ada33f94639d 100644 --- a/core/Tracker/VisitExcluded.php +++ b/core/Tracker/VisitExcluded.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * This class contains the logic to exclude some visitors from being tracked as per user settings @@ -45,7 +45,7 @@ class Piwik_Tracker_VisitExcluded $excluded = false; if ($this->isNonHumanBot()) { - printDebug('Search bot detected, visit excluded'); + Common::printDebug('Search bot detected, visit excluded'); $excluded = true; } @@ -57,9 +57,9 @@ class Piwik_Tracker_VisitExcluded if (!$excluded) { $toRecord = $this->request->getParam($parameterForceRecord = 'rec'); if (!$toRecord) { - printDebug(@$_SERVER['REQUEST_METHOD'] . ' parameter ' . $parameterForceRecord . ' not found in URL, request excluded'); + Common::printDebug(@$_SERVER['REQUEST_METHOD'] . ' parameter ' . $parameterForceRecord . ' not found in URL, request excluded'); $excluded = true; - printDebug("'$parameterForceRecord' parameter not found."); + Common::printDebug("'$parameterForceRecord' parameter not found."); } } @@ -75,7 +75,7 @@ class Piwik_Tracker_VisitExcluded if (!$excluded) { $excluded = $this->isIgnoreCookieFound(); if ($excluded) { - printDebug("Ignore cookie found."); + Common::printDebug("Ignore cookie found."); } } @@ -83,7 +83,7 @@ class Piwik_Tracker_VisitExcluded if (!$excluded) { $excluded = $this->isVisitorIpExcluded(); if ($excluded) { - printDebug("IP excluded."); + Common::printDebug("IP excluded."); } } @@ -91,19 +91,19 @@ class Piwik_Tracker_VisitExcluded if (!$excluded) { $excluded = $this->isUserAgentExcluded(); if ($excluded) { - printDebug("User agent excluded."); + Common::printDebug("User agent excluded."); } } if (!$excluded) { if ($this->isPrefetchDetected()) { $excluded = true; - printDebug("Prefetch request detected, not a real visit so we Ignore this visit/pageview"); + Common::printDebug("Prefetch request detected, not a real visit so we Ignore this visit/pageview"); } } if ($excluded) { - printDebug("Visitor excluded."); + Common::printDebug("Visitor excluded."); return true; } @@ -167,7 +167,7 @@ class Piwik_Tracker_VisitExcluded protected function isIgnoreCookieFound() { if (Piwik_Tracker_IgnoreCookie::isIgnoreCookieFound()) { - printDebug('Piwik ignore cookie was found, visit not tracked.'); + Common::printDebug('Piwik ignore cookie was found, visit not tracked.'); return true; } return false; @@ -183,7 +183,7 @@ class Piwik_Tracker_VisitExcluded $websiteAttributes = Piwik_Tracker_Cache::getCacheWebsiteAttributes($this->idSite); if (!empty($websiteAttributes['excluded_ips'])) { if (Piwik_IP::isIpInRange($this->ip, $websiteAttributes['excluded_ips'])) { - printDebug('Visitor IP ' . Piwik_IP::N2P($this->ip) . ' is excluded from being tracked'); + Common::printDebug('Visitor IP ' . Piwik_IP::N2P($this->ip) . ' is excluded from being tracked'); return true; } } diff --git a/core/Translate.php b/core/Translate.php index 95a2f58771436c7430bd67e879231855de357832..ce736265e989e0dc7b94d45804c1880eed06c639 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * @package Piwik diff --git a/core/TranslationWriter.php b/core/TranslationWriter.php index 5cec03e0060e3bc93eec73e9affba85f40397975..a103799d33b089496754d5eea9855e0c83280306 100644 --- a/core/TranslationWriter.php +++ b/core/TranslationWriter.php @@ -9,7 +9,7 @@ * @package Piwik * */ -use Piwik\Core\Common; +use Piwik\Common; /** * Write translations to file diff --git a/core/Twig.php b/core/Twig.php index 57f1b00ee672c6b0368da8a823cf15843cf8f525..57e2c67605fc3f27cbfecb6e17590d0d1aae835a 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** diff --git a/core/UpdateCheck.php b/core/UpdateCheck.php index 0f35a966d982f050c8cd3fcc91637e7eb2c68725..85d1716f29ec05ae0820ebd96a8aa58e15857444 100644 --- a/core/UpdateCheck.php +++ b/core/UpdateCheck.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * Class to check if a newer version of Piwik is available diff --git a/core/Updater.php b/core/Updater.php index b048dc6d0ae9275d99bba92146d233e57af32775..bc62eca14772f633485ae2bf637e205ecbfa0f91 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * @see core/Option.php diff --git a/core/Updates.php b/core/Updates.php index 16e5f0d7e970cb24c8ecb019edd94057a14cc9c3..e4387d06340980448fa6cc15cb858789b85a61a2 100644 --- a/core/Updates.php +++ b/core/Updates.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; +use Piwik\Config; /** * Abstract class for update scripts diff --git a/core/Updates/0.2.10.php b/core/Updates/0.2.10.php index bb4358e411076766509fa72b656a6ad72b735654..a85bcb88a851c967e5ac9811f5e5d8572ee46c41 100644 --- a/core/Updates/0.2.10.php +++ b/core/Updates/0.2.10.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.12.php b/core/Updates/0.2.12.php index 5712a132ff1bd203f09e6d107bde4e28dd1b0c5b..378ad1c7249a3bb94b4a89c8663762e2acbc389a 100644 --- a/core/Updates/0.2.12.php +++ b/core/Updates/0.2.12.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.13.php b/core/Updates/0.2.13.php index d5487612229f32aa4a43942aa2595e3b41d7b96a..15c510bb25d0862a139f57cf1985d17f4b199c6d 100644 --- a/core/Updates/0.2.13.php +++ b/core/Updates/0.2.13.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.24.php b/core/Updates/0.2.24.php index 4533832d908ee8e46e23c08d95884aad519e2992..e6515309b1c31779c79e2a66535da0eab225cc59 100644 --- a/core/Updates/0.2.24.php +++ b/core/Updates/0.2.24.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.27.php b/core/Updates/0.2.27.php index 92a738f90302d4d717b84903f684a7cc42264f6a..e88ab68ffbab67946de0450c47d9532977c364e3 100644 --- a/core/Updates/0.2.27.php +++ b/core/Updates/0.2.27.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.32.php b/core/Updates/0.2.32.php index f14b5a58925dec65df335129081d19c1efba02f2..b13a40ad187b44fe37509e2267b122ca36119daa 100644 --- a/core/Updates/0.2.32.php +++ b/core/Updates/0.2.32.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.33.php b/core/Updates/0.2.33.php index c203db12d4da23969171d15dd305fbe71a3d80e7..50d6a2eea3e19329ae65458da5727471d32d99be 100644 --- a/core/Updates/0.2.33.php +++ b/core/Updates/0.2.33.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.34.php b/core/Updates/0.2.34.php index 4af164a129b2ec24ee805143f73cd65bb14eb026..bfefb5b5011e1dc1541943ddbf73dc7e85330176 100644 --- a/core/Updates/0.2.34.php +++ b/core/Updates/0.2.34.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @package Updates diff --git a/core/Updates/0.2.35.php b/core/Updates/0.2.35.php index 90f1b8fd6d8e152add7114efbd469c4b697f5a92..c5377fb43fe1bfe43e374bca18f82d1d848821af 100644 --- a/core/Updates/0.2.35.php +++ b/core/Updates/0.2.35.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.2.37.php b/core/Updates/0.2.37.php index 1b3e9ad28ee1d38ebb4ea8eaad23df682574449d..a415ebbe58d996327df1e895f39495ee9c12701d 100644 --- a/core/Updates/0.2.37.php +++ b/core/Updates/0.2.37.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.4.1.php b/core/Updates/0.4.1.php index 17d5b27910a9f87150a82510f067723562941cca..1e06dd7fb35b4c46bb927482601531cd9cfc3652 100644 --- a/core/Updates/0.4.1.php +++ b/core/Updates/0.4.1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.4.2.php b/core/Updates/0.4.2.php index ac931d63576dfdffcc0cedd05a6bb99ad8ac3b28..f03b4431636d40a5c884dcf05c5d2285d1d5fbf7 100644 --- a/core/Updates/0.4.2.php +++ b/core/Updates/0.4.2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.4.php b/core/Updates/0.4.php index 2ccecc2c165fe5d8651a0bd88463781030070afe..9e9e1ee0b0de48c3c4282c78d74f8c43a437b794 100644 --- a/core/Updates/0.4.php +++ b/core/Updates/0.4.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.5.4.php b/core/Updates/0.5.4.php index f5fc2fb90ab8ab5198a367b115311049d5b5f6a0..2a48de630f568e7d21fbc5e11a4debbbace7f4d5 100644 --- a/core/Updates/0.5.4.php +++ b/core/Updates/0.5.4.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.5.5.php b/core/Updates/0.5.5.php index 1cba67d7a977cb26945b8d15634456bd397ba51e..8ad736b81d5d6fd476c39c9a6daff30d9952b06f 100644 --- a/core/Updates/0.5.5.php +++ b/core/Updates/0.5.5.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.5.php b/core/Updates/0.5.php index d465f9c22588d4aafbd40d4aa735fa45e977fd92..f38c38aa46bd90b1678b97a021ba7bcc0e20b012 100644 --- a/core/Updates/0.5.php +++ b/core/Updates/0.5.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.6-rc1.php b/core/Updates/0.6-rc1.php index bde19cff94df7eccf8f0a62bec39aa33111ced6f..505df64ab2a113c3c561a63848b01cfb609c8cca 100644 --- a/core/Updates/0.6-rc1.php +++ b/core/Updates/0.6-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.6.2.php b/core/Updates/0.6.2.php index d00ed5c91cbb62fc716989cf79a36732201cdf2e..a3625a479ca48cb709a4648a6648ca9b86473e65 100644 --- a/core/Updates/0.6.2.php +++ b/core/Updates/0.6.2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @package Updates diff --git a/core/Updates/0.6.3.php b/core/Updates/0.6.3.php index 7b2c21accc8180ad432e08675e1f39ebd21cd164..b20fd756278bb2ef7461ca2c9374eaa767a5e950 100644 --- a/core/Updates/0.6.3.php +++ b/core/Updates/0.6.3.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.7.php b/core/Updates/0.7.php index d50796fc20f9280a752e1060286c15264309d355..6e00fc9f7f77d4c5a12b648dce36bbf133694b2a 100644 --- a/core/Updates/0.7.php +++ b/core/Updates/0.7.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/0.9.1.php b/core/Updates/0.9.1.php index f76928c31438c0bfae73d38618c24471c44ae4d3..4bc4aab764acbb558594ebbd828dfac831ef331d 100644 --- a/core/Updates/0.9.1.php +++ b/core/Updates/0.9.1.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.1.php b/core/Updates/1.1.php index cae7b1f40732c428de1faa659db82eba03fe5893..de74d8c71316b9390a825cb30365e3de4fc025d4 100644 --- a/core/Updates/1.1.php +++ b/core/Updates/1.1.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; +use Piwik\Config; +use Piwik\Piwik; /** * @package Updates diff --git a/core/Updates/1.10.2-b1.php b/core/Updates/1.10.2-b1.php index f6c09c6e476207e9b0cdbcdf34afaf437be19af0..e2d9f2130f276b1f2e0ca171b4abeb5c89b89da8 100755 --- a/core/Updates/1.10.2-b1.php +++ b/core/Updates/1.10.2-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.10.2-b2.php b/core/Updates/1.10.2-b2.php index fd0907ab97aae51ddc43a5449377b03d721d1895..8e57c75297b71c1f38652218a987aa0f7ccb5349 100644 --- a/core/Updates/1.10.2-b2.php +++ b/core/Updates/1.10.2-b2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.12-b1.php b/core/Updates/1.12-b1.php index 44c9eccd9d98bcacde18bf94798d7c633b99a1ba..75c69e38397ceb104c41c7709e718afd9be9269a 100644 --- a/core/Updates/1.12-b1.php +++ b/core/Updates/1.12-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.12-b16.php b/core/Updates/1.12-b16.php index 29cfa8848958c68ff157f2a2d338e6ed121b1859..b3956fc6cede705adfed008b2658a2fd40f9ffcd 100644 --- a/core/Updates/1.12-b16.php +++ b/core/Updates/1.12-b16.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.2-rc1.php b/core/Updates/1.2-rc1.php index beb3b970342fe64d55f7af1e444bcdb08fea8036..02101697e72f050891c3b21ebad63fbe419f9c73 100644 --- a/core/Updates/1.2-rc1.php +++ b/core/Updates/1.2-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.2.3.php b/core/Updates/1.2.3.php index c7cc2ce03c3d6d11f63b02685fac1340afcabd33..f479dff100e0e74d0b7b881e68b7b5b2f238ab7c 100644 --- a/core/Updates/1.2.3.php +++ b/core/Updates/1.2.3.php @@ -8,8 +8,8 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.2.5-rc1.php b/core/Updates/1.2.5-rc1.php index 7eafdd9ad944b022ffa64d90985f13a4fea43f44..14d4e29a607c5170e93acd52ec0e142fbacc55f2 100644 --- a/core/Updates/1.2.5-rc1.php +++ b/core/Updates/1.2.5-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.2.5-rc7.php b/core/Updates/1.2.5-rc7.php index f1b8805228e93e3e463f951d2b86d7075b97b43f..dc613a7f83c1afdc2a98a683696e458ec4e2958d 100644 --- a/core/Updates/1.2.5-rc7.php +++ b/core/Updates/1.2.5-rc7.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.4-rc1.php b/core/Updates/1.4-rc1.php index 794c512e6759b174bb337d3eab34de07a6168975..6a1029a455cc8ddb5c11fe884a93734e31fc6b69 100644 --- a/core/Updates/1.4-rc1.php +++ b/core/Updates/1.4-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.4-rc2.php b/core/Updates/1.4-rc2.php index a25e69ffc7e07905c005a6ffe4eb6d9af5239ba3..c1b52dd079298aa32a81e544485e08857a4166cd 100644 --- a/core/Updates/1.4-rc2.php +++ b/core/Updates/1.4-rc2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.5-b1.php b/core/Updates/1.5-b1.php index a8c7b76d3155faafcb40a538f5c1fada4d64bc91..71670a7c6eef020f6d80e5525ff0bcfb581585c9 100644 --- a/core/Updates/1.5-b1.php +++ b/core/Updates/1.5-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.5-b2.php b/core/Updates/1.5-b2.php index 9544271bce4538656972ac86b6bb239c3cadccff..26ca5fdd3889a8c22e23cdc7f9cdfd3f24fe7159 100644 --- a/core/Updates/1.5-b2.php +++ b/core/Updates/1.5-b2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.5-b3.php b/core/Updates/1.5-b3.php index 6f72eb6ac5b56049ee85ce5b30ecb9318aca3b21..48af21fc132a55e0b820b7df0b4ccdd47f4d6ab9 100644 --- a/core/Updates/1.5-b3.php +++ b/core/Updates/1.5-b3.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.5-b4.php b/core/Updates/1.5-b4.php index 5a869301edc814531968710d219ea8965a42949d..5f0c46dfec830ddd8a85886f7055933c3385c415 100644 --- a/core/Updates/1.5-b4.php +++ b/core/Updates/1.5-b4.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.5-b5.php b/core/Updates/1.5-b5.php index 76729f4270dc8932bb7572be2cf796253ab305bf..bea0539c39d1869e5509b5895d082bf68ed28ab1 100644 --- a/core/Updates/1.5-b5.php +++ b/core/Updates/1.5-b5.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.6-b1.php b/core/Updates/1.6-b1.php index ef54c76b4471673fbc2577d21fa1b6c26ec4f21b..992e5b01eeae82c588cb653aa612983c2f28a103 100644 --- a/core/Updates/1.6-b1.php +++ b/core/Updates/1.6-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.7-b1.php b/core/Updates/1.7-b1.php index 2b4567e9784d75c83e5e0719b0a4ba34ae1ba6f8..04fb74269cbf47fc668d1a48aa15df8d335d3522 100644 --- a/core/Updates/1.7-b1.php +++ b/core/Updates/1.7-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.7.2-rc5.php b/core/Updates/1.7.2-rc5.php index 648c2c6b04a0adfdf3176fe3c0d8fa99630f8df3..42af42e7c8b712a09a42b0634c23dd31a69f0f37 100644 --- a/core/Updates/1.7.2-rc5.php +++ b/core/Updates/1.7.2-rc5.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.7.2-rc7.php b/core/Updates/1.7.2-rc7.php index 51d1bfa8876f92510cbb71dcfdcb5a0ce90d405b..cb1d96851c02217072a6a568de8e5818a0c6d429 100755 --- a/core/Updates/1.7.2-rc7.php +++ b/core/Updates/1.7.2-rc7.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.8.3-b1.php b/core/Updates/1.8.3-b1.php index ca8c0a1c70e7947fe92d4bffadf30ba381b64d66..3f3d579e5803bdda538a7a2b0f5a4b7247e8d6df 100644 --- a/core/Updates/1.8.3-b1.php +++ b/core/Updates/1.8.3-b1.php @@ -8,7 +8,7 @@ * @category Piwik‚ * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.8.4-b1.php b/core/Updates/1.8.4-b1.php index e36349e8d14839822169bd221933e03fda747b29..f230d13da67dacc37845e7aca40151bf2681cfd7 100644 --- a/core/Updates/1.8.4-b1.php +++ b/core/Updates/1.8.4-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.9-b16.php b/core/Updates/1.9-b16.php index 096e7eadf8362c68bbe360c26cb561b2b30a90b5..380a75a808c977fdb80ca42cb3670b8d3503aaa3 100755 --- a/core/Updates/1.9-b16.php +++ b/core/Updates/1.9-b16.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.9-b19.php b/core/Updates/1.9-b19.php index de201fcb8d55492a47d40e58d3058d3582864490..bb08141de3748d0b4a9bc7edb1eb6db7bb56e690 100755 --- a/core/Updates/1.9-b19.php +++ b/core/Updates/1.9-b19.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.9-b9.php b/core/Updates/1.9-b9.php index b67304d93dfa14a1ef0bf6cdb140f3b0ce78b6db..737454231e436558b2faf53242dde3fd653dbd88 100755 --- a/core/Updates/1.9-b9.php +++ b/core/Updates/1.9-b9.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.9.1-b2.php b/core/Updates/1.9.1-b2.php index f2bcb81f42148772ddc00533bdd86fc289f98c58..81347c0844726229144260583c6d0db8f5b6576d 100644 --- a/core/Updates/1.9.1-b2.php +++ b/core/Updates/1.9.1-b2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Updates/1.9.3-b8.php b/core/Updates/1.9.3-b8.php index 3a0db0194835a1d82b61ae1102c35c845d4bf8aa..52938bd166f0f42a6e9f13b840bf7ca106dc6224 100755 --- a/core/Updates/1.9.3-b8.php +++ b/core/Updates/1.9.3-b8.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Updates diff --git a/core/Url.php b/core/Url.php index ab7b7c65e18e0a53162694c52692042290e9b69b..7ae67c1c949736acc726554cedae84131def3a03 100644 --- a/core/Url.php +++ b/core/Url.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * Class to retrieve absolute URL or URI components of the current URL, diff --git a/core/View.php b/core/View.php index c8ee8c30893fdad034adaca135c8aa3826070b2f..6d01d3632996f63210b5f0301df4b82fb6e5b8dc 100644 --- a/core/View.php +++ b/core/View.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * Transition for pre-Piwik 0.4.4 diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index e8026c916a07ea1ddf25855065cff1b52d740b39..b8195c53111a67034621d87601e1460d9be173db 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * This class is used to load (from the API) and customize the output of a given DataTable. diff --git a/core/ViewDataTable/GenerateGraphData.php b/core/ViewDataTable/GenerateGraphData.php index 91a1d889b712c45359ef7d9df243d44b95fe1ef2..af5f9ef132add55fefad8ad7881542458747ba86 100644 --- a/core/ViewDataTable/GenerateGraphData.php +++ b/core/ViewDataTable/GenerateGraphData.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Reads data from the API and prepares data to give to the renderer Piwik_Visualization_Chart. diff --git a/core/ViewDataTable/GenerateGraphData/ChartEvolution.php b/core/ViewDataTable/GenerateGraphData/ChartEvolution.php index 5a51049c8e6ff831de3216572adecdcdfb1ac355..3ce1de2d543bfde2f00f25a8ca26195827ea8175 100644 --- a/core/ViewDataTable/GenerateGraphData/ChartEvolution.php +++ b/core/ViewDataTable/GenerateGraphData/ChartEvolution.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Piwik_ViewDataTable_GenerateGraphData for the Evolution graph (eg. Last 30 days visits) using Piwik_Visualization_Chart_Evolution diff --git a/core/ViewDataTable/GenerateGraphHTML.php b/core/ViewDataTable/GenerateGraphHTML.php index 501f7fc558230c9f8b87daa165af759c14dd4891..dc7eacdc044cf79814a59b89a4d067a3de54d19f 100644 --- a/core/ViewDataTable/GenerateGraphHTML.php +++ b/core/ViewDataTable/GenerateGraphHTML.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * This class generates the HTML code to embed graphs in the page. diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php index 00c50797605f29f2e015008996132b63811e29a1..638937dc05a232a172ad20ddb2ed09e9c3945ce7 100644 --- a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php +++ b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Generates HTML embed for the Evolution graph diff --git a/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php index e1bfe37f1028584ead23a30e1d74e2764ccb873a..e7d409b8539d3ef2d43718c0e3e3fb76888ddee1 100644 --- a/core/ViewDataTable/HtmlTable.php +++ b/core/ViewDataTable/HtmlTable.php @@ -8,9 +8,9 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * Outputs an AJAX Table for a given DataTable. diff --git a/core/ViewDataTable/HtmlTable/Goals.php b/core/ViewDataTable/HtmlTable/Goals.php index 6e1ddb535dcc00667e9ca420e91573a9702fecc3..dbe8fc8338e0ed6caf3dfb54326ba4a35c74126c 100644 --- a/core/ViewDataTable/HtmlTable/Goals.php +++ b/core/ViewDataTable/HtmlTable/Goals.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik diff --git a/core/ViewDataTable/Sparkline.php b/core/ViewDataTable/Sparkline.php index f20d3bc1ec5a1cbd74b59f2482dcf75bc380d544..ae85101a7812b81016cea1c7d859ecf1e82c6e71 100644 --- a/core/ViewDataTable/Sparkline.php +++ b/core/ViewDataTable/Sparkline.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Reads the requested DataTable from the API and prepare data for the Sparkline view. diff --git a/core/Visualization/Chart.php b/core/Visualization/Chart.php index 3c6374e8525a69857b3bc7d39dd07b00782e6963..cee6b08ab7e67170fb5cfaf40238cbe234e74209 100644 --- a/core/Visualization/Chart.php +++ b/core/Visualization/Chart.php @@ -8,8 +8,8 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Generates the data in the Open Flash Chart format, from the given data. diff --git a/core/Visualization/Cloud.php b/core/Visualization/Cloud.php index 9d37bf94237c89eef8075177d3dbd5c44b0de8fc..781973340c629831679bc48d0b7a7adaaed5b288 100644 --- a/core/Visualization/Cloud.php +++ b/core/Visualization/Cloud.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Common; +use Piwik\Common; /** * Generates a tag cloud from a given data array. diff --git a/js/index.php b/js/index.php index c0a3a00d0d49aa6fd348f7730c9569117ab744d0..6c67ffdc81c3b0a462d9401c7b197925651d4a12 100644 --- a/js/index.php +++ b/js/index.php @@ -5,7 +5,7 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * Tracker proxy diff --git a/misc/cron/archive.php b/misc/cron/archive.php index 88dfb568511ed48e9c1bef4903c2f013122c039d..280574ac64fa0a3f293b138faa6e3767cbdb863c 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -1,7 +1,7 @@ <?php -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; $USAGE = " Usage: diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index 3f42dc385545e71b72507448496cf13ae0f92bba..979ff5e8f760635da1abae1f3041cd9f27810d24 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -1,7 +1,7 @@ <?php -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; ini_set("memory_limit", "512M"); error_reporting(E_ALL | E_NOTICE); diff --git a/misc/others/iframeWidget_localhost.php b/misc/others/iframeWidget_localhost.php index 4e7c4b72ad8aa8c2cd73ed3bf121022fda5f9e98..ef22366cf8e21cb9d5fba3370807c991a555a22c 100644 --- a/misc/others/iframeWidget_localhost.php +++ b/misc/others/iframeWidget_localhost.php @@ -1,5 +1,5 @@ <?php -use Piwik\Core\Common; +use Piwik\Common; exit; $date = date('Y-m-d'); diff --git a/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php b/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php index 5af16983d695745e1a45100d815ee38ebdf8223a..2af3cab4208664e11f62499e0ae0728ae109e32a 100644 --- a/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php +++ b/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php @@ -1,8 +1,8 @@ <?php // Script that creates 100 websites, then outputs a IMG that records a pageview in each website // Used initially to test how to handle cookies for this use case (see http://dev.piwik.org/trac/ticket/409) -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; exit; diff --git a/misc/others/test_generateLotsVisitsWebsites.php b/misc/others/test_generateLotsVisitsWebsites.php index a2e11deb78e3b095114cfcd568d7c877b7a1d816..abc4115ea697776a42f7b4bc7a5819482c25ca04 100644 --- a/misc/others/test_generateLotsVisitsWebsites.php +++ b/misc/others/test_generateLotsVisitsWebsites.php @@ -1,7 +1,7 @@ <?php -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../..")); define('PIWIK_ENABLE_DISPATCH', false); diff --git a/piwik.php b/piwik.php index 3a8ded12027ca8b1d804eb4e25db7b1f3518181c..65fcd550835aee299e318d85c064b1ea7f154302 100644 --- a/piwik.php +++ b/piwik.php @@ -7,7 +7,7 @@ * * @package Piwik */ -use Piwik\Core\Piwik; +use Piwik\Piwik; $GLOBALS['PIWIK_TRACKER_DEBUG'] = false; $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false; @@ -66,7 +66,7 @@ if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) { $timer = new Piwik_Timer(); set_error_handler('Piwik_ErrorHandler'); set_exception_handler('Piwik_ExceptionHandler'); - printDebug("Debug enabled - Input parameters: <br/>" . var_export($_GET, true)); + Common::printDebug("Debug enabled - Input parameters: <br/>" . var_export($_GET, true)); Piwik_Tracker_Db::enableProfiling(); Piwik::createConfigObject(); Piwik::createLogObject(); @@ -81,7 +81,7 @@ if (!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING) { } ob_end_flush(); if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) { - printDebug($_COOKIE); - printDebug($timer); + Common::printDebug($_COOKIE); + Common::printDebug($timer); } } diff --git a/plugins/API/API.php b/plugins/API/API.php index 16cba3ce4ebfcaa648c01e8fad72dd53d62f2e79..2dc0ce766db2120064f6cf1a4754ee84025d2699 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -8,8 +8,11 @@ * @category Piwik_Plugins * @package Piwik_API */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; +use Piwik\Config; + +require_once PIWIK_INCLUDE_PATH . '/core/Config.php'; /** * @package Piwik_API @@ -553,7 +556,7 @@ class Piwik_API_API } $urls = array_map('urldecode', $urls); - $urls = array_map(array('Piwik\Core\Common', 'unsanitizeInputValue'), $urls); + $urls = array_map(array('Piwik\Common', 'unsanitizeInputValue'), $urls); $result = array(); foreach ($urls as $url) { @@ -629,7 +632,7 @@ class Piwik_API_API arsort($values); $values = array_keys($values); - $values = array_map(array('Piwik\Core\Common', 'unsanitizeInputValue'), $values); + $values = array_map(array('Piwik\Common', 'unsanitizeInputValue'), $values); $values = array_slice($values, 0, $maxSuggestionsToReturn); return $values; diff --git a/plugins/API/Controller.php b/plugins/API/Controller.php index c18bfc3e850d915f67298d35f9683f2e7400ff1f..16d8f9dd1fd5a9816b421b2ab2f10bcf1972274d 100644 --- a/plugins/API/Controller.php +++ b/plugins/API/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_API */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php index 2417a558abac8f5d233c9e7dd46d1c1fd6bf5b49..70b51f91a55e250c3680d25f7537f56429bf2fd2 100644 --- a/plugins/API/ProcessedReport.php +++ b/plugins/API/ProcessedReport.php @@ -1,6 +1,6 @@ <?php -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Piwik - Open source web analytics diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php index f0eca1b1904f16c76bd37aaea22aba7d4dafa1d5..ba6a63bdb8ee0f27462334a8b13ca963d3e9a7b4 100644 --- a/plugins/API/RowEvolution.php +++ b/plugins/API/RowEvolution.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_API */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * This class generates a Row evolution dataset, from input request diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php index 0f81d9d14891a560925f2510c8a665d79850c493..695e8f5a90db6f20c2f1417dc35e75275f9d6e03 100644 --- a/plugins/Actions/API.php +++ b/plugins/Actions/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Actions */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The Actions API lets you request reports for all your Visitor Actions: Page URLs, Page titles (Piwik Events), diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 2ab5dfb2d12fb8e12e289b9e09885ab791675906..103672f37be274927b5f683e3f59ef2af29f14fb 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Actions */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Actions plugin diff --git a/plugins/Actions/Archiver.php b/plugins/Actions/Archiver.php index 0fa1f4f0e2a5006856c68b240153706c893e4763..c4a2bf24afcbaf58f7d7722eb914427da67625c6 100644 --- a/plugins/Actions/Archiver.php +++ b/plugins/Actions/Archiver.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Actions */ -use Piwik\Core\Config; +use Piwik\Config; /** * Class encapsulating logic to process Day/Period Archiving for the Actions reports diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php index 37e9e9912209f957cdfc7d5136c10db7a4d2346e..72342adff7433bac0f087772bbf6f4010f9d6adb 100644 --- a/plugins/Actions/ArchivingHelper.php +++ b/plugins/Actions/ArchivingHelper.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Actions */ -use Piwik\Core\Config; +use Piwik\Config; /** * This static class provides: diff --git a/plugins/Annotations/API.php b/plugins/Annotations/API.php index a8b0508e0be59aea4a095342b93fb39f9ee07655..92dd4f18e43620dc78191da37ca732f026ee95bc 100755 --- a/plugins/Annotations/API.php +++ b/plugins/Annotations/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Annotations */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @see plugins/Annotations/AnnotationList.php diff --git a/plugins/Annotations/AnnotationList.php b/plugins/Annotations/AnnotationList.php index 7201b180bbfdc85be900c55d2834439b1cb27d2d..0b0ca1ea44327cce13961442553d22ea8c89efd9 100755 --- a/plugins/Annotations/AnnotationList.php +++ b/plugins/Annotations/AnnotationList.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Annotations */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * This class can be used to query & modify annotations for multiple sites diff --git a/plugins/Annotations/Controller.php b/plugins/Annotations/Controller.php index 08defbc6146dfd399c98574ad86cc3eff1852a41..f632ab5ae8da49c939cb5ebfb3173f99b592133a 100755 --- a/plugins/Annotations/Controller.php +++ b/plugins/Annotations/Controller.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Annotations */ -use Piwik\Core\Common; +use Piwik\Common; /** * Controller for the Annotations plugin. diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php index 7194a055fa5f27be020684d5c45f45fd7f760c52..a835a91d8aa780f72cbe36f6e9515c2244cf07c8 100644 --- a/plugins/AnonymizeIP/AnonymizeIP.php +++ b/plugins/AnonymizeIP/AnonymizeIP.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_AnonymizeIP */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * Anonymize visitor IP addresses to comply with the privacy laws/guidelines in countries, such as Germany. diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php index 697ad3ca478b3ff1bab32ece278da185d74f2831..d192c17ca7f771ebbe1dd00ac084862a3241733b 100644 --- a/plugins/CoreAdminHome/API.php +++ b/plugins/CoreAdminHome/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_CoreAdminHome */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik_CoreAdminHome diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index 41e789861112adb378f1970569a76c48e28b7d42..1cc8afb6c4ae00c361e4e663677b3695f6e5a019 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -8,9 +8,9 @@ * @category Piwik_Plugins * @package Piwik_CoreAdminHome */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php index 41bf84048a1489bce501ebdd1edec58922145e35..110feb03b64ea29fe67fe268777b40d0e04bd848 100644 --- a/plugins/CoreAdminHome/CoreAdminHome.php +++ b/plugins/CoreAdminHome/CoreAdminHome.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_CoreAdminHome */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index 2dbe933fe5d991025830c4528999cc99bec2917a..d6afe9e354f4c7034748bbb2faf22d3a882e314a 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_CoreHome */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php index c617a77ff3840f979bbfbb8196d8733feda94661..e8625a2e07be6db4b8ac2ee7d049382bc200405f 100644 --- a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php +++ b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_CoreHome */ -use Piwik\Core\Common; +use Piwik\Common; /** * MULTI ROW EVOLUTION diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php index 7b15f9c887802cdb7b6dccfec81a68aa6496801f..4ca8bb6af3cce0c33835f0abd30598165b3ca1a0 100644 --- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php +++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_CoreHome */ -use Piwik\Core\Common; +use Piwik\Common; /** * ROW EVOLUTION diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index b5bce5532796da83a273bac2d674e29ac03df490..85f8143063593c62faabae6c7f6cb85acb096652 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_CorePluginsAdmin */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php index 5cf7824d3dcdcf2d92424b78098dfd4d54a5e3c5..c7e856b91e4389652cddb42fbf515653dafa93c4 100644 --- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php +++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_CorePluginsAdmin */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index 8744d4e65141c1237e7cd13f1b960b260279b528..98f7d968fbc4edd13a01d5ea684e1234bda49e1f 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -8,9 +8,9 @@ * @category Piwik_Plugins * @package Piwik_CoreUpdater */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php index 6f14121fbab34f44a443522ae8401711ecea7afa..efc971908afe5241f525eff594b02c115ad7d943 100644 --- a/plugins/CoreUpdater/CoreUpdater.php +++ b/plugins/CoreUpdater/CoreUpdater.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_CoreUpdater */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php index 1e2c6c74ba651b138d840583b530d8f1bf961fb6..89eaf7821a29eecb532c50218469a0cf4616e3d6 100644 --- a/plugins/CustomVariables/Archiver.php +++ b/plugins/CustomVariables/Archiver.php @@ -1,5 +1,7 @@ <?php -use Piwik\Core\Common; +use Piwik\Common; +use Piwik\Config; + /** * Piwik - Open source web analytics diff --git a/plugins/DBStats/API.php b/plugins/DBStats/API.php index 0610b4573d7bf756c53ce66dee9e19586b93c361..0c4a4d1e537910081added2249e638f1797ad25a 100644 --- a/plugins/DBStats/API.php +++ b/plugins/DBStats/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_DBStats */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @see plugins/DBStats/MySQLMetadataProvider.php diff --git a/plugins/DBStats/Controller.php b/plugins/DBStats/Controller.php index e6c93ef5e0527bfd1048fb09185d1ea53f2947d1..ebad0c031eb86793d1919e9db7ceae47484ea1d4 100644 --- a/plugins/DBStats/Controller.php +++ b/plugins/DBStats/Controller.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_DBStats */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 03e4409af4afc25311b6ea547c2d9fc0b52e19da..fd649d5b1e4ef4fcc0f84289369dd337cea2df56 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_DBStats */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/DBStats/MySQLMetadataProvider.php b/plugins/DBStats/MySQLMetadataProvider.php index 75ca12e6ac25694fd6a44856d634548846c1ee2a..9641d2d7887063fcbc014cde6c4e5308503f266b 100755 --- a/plugins/DBStats/MySQLMetadataProvider.php +++ b/plugins/DBStats/MySQLMetadataProvider.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_DBStats */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Utility class that provides general information about databases, including the size of diff --git a/plugins/Dashboard/API.php b/plugins/Dashboard/API.php index dea5f45526e9203b743a9291a6b4d848328b02ab..83a5c0b804fbfa13cade11f1d63ab6e082a2533d 100644 --- a/plugins/Dashboard/API.php +++ b/plugins/Dashboard/API.php @@ -7,7 +7,7 @@ * @category Piwik_Plugins * @package Piwik_Dashboard */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php index 309b7a73a750ae78e02c4e68d9195f4132ced020..f91718d097884624fefa0deb05dd80e2a5329ee5 100644 --- a/plugins/Dashboard/Controller.php +++ b/plugins/Dashboard/Controller.php @@ -7,8 +7,8 @@ * @category Piwik_Plugins * @package Piwik_Dashboard */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Dashboard Controller diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php index 972804a95005c942011fd918d2120304f26c4bc0..6c8a4830b1c55d45152e0ae30071351082c820bd 100644 --- a/plugins/Dashboard/Dashboard.php +++ b/plugins/Dashboard/Dashboard.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Dashboard */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik_Dashboard diff --git a/plugins/DevicesDetection/API.php b/plugins/DevicesDetection/API.php index 9548a537647f32e034ad011fac966705142dd000..789afccc964c162cf6d500ec48297b34fdfe86aa 100644 --- a/plugins/DevicesDetection/API.php +++ b/plugins/DevicesDetection/API.php @@ -9,7 +9,7 @@ * @category Piwik_Plugins * @package Piwik_DevicesDetection */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * The DevicesDetection API lets you access reports on your visitors devices, brands, models, Operating system, Browsers. diff --git a/plugins/DevicesDetection/Controller.php b/plugins/DevicesDetection/Controller.php index 6aac50450c4f325cb7ae54af2aee532082c761a9..ae94f9537501ae83bc73aea44281dd6947337c97 100644 --- a/plugins/DevicesDetection/Controller.php +++ b/plugins/DevicesDetection/Controller.php @@ -1,6 +1,6 @@ <?php -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Piwik - Open source web analytics diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php index 74ee75885489d32ad8283ece7f7548f2f828c9c9..2a734b24e452cc32ef3b541b2839fae615851b72 100644 --- a/plugins/DevicesDetection/DevicesDetection.php +++ b/plugins/DevicesDetection/DevicesDetection.php @@ -9,8 +9,8 @@ * @category Piwik_Plugins * @package Piwik_DevicesDetection */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; require_once PIWIK_INCLUDE_PATH . "/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php"; require_once PIWIK_INCLUDE_PATH . '/plugins/DevicesDetection/functions.php'; @@ -225,8 +225,8 @@ class Piwik_DevicesDetection extends Piwik_Plugin } $visitorInfo = array_merge($visitorInfo, $deviceInfo); - printDebug("Device Detection:"); - printDebug($deviceInfo); + Common::printDebug("Device Detection:"); + Common::printDebug($deviceInfo); } public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor) diff --git a/plugins/DoNotTrack/DoNotTrack.php b/plugins/DoNotTrack/DoNotTrack.php index 59c2ee95dbfb41e2f3cbf04765a23f9795a6d1be..2b8409d394a183680df4679bcf604a58093dd61d 100644 --- a/plugins/DoNotTrack/DoNotTrack.php +++ b/plugins/DoNotTrack/DoNotTrack.php @@ -36,12 +36,12 @@ class Piwik_DoNotTrack extends Piwik_Plugin $request = new Piwik_Tracker_Request($_REQUEST); $ua = $request->getUserAgent(); if (strpos($ua, 'MSIE 10') !== false) { - printDebug("INTERNET EXPLORER 10 Enables DNT by default, so Piwik ignores DNT for all IE10 browsers..."); + Common::printDebug("INTERNET EXPLORER 10 Enables DNT by default, so Piwik ignores DNT for all IE10 browsers..."); return; } $exclude = true; - printDebug("DoNotTrack found."); + Common::printDebug("DoNotTrack found."); $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie(); $trackingCookie->delete(); diff --git a/plugins/ExampleAPI/API.php b/plugins/ExampleAPI/API.php index 185aa2174d21f1c949009acaa6689a24b9932896..163d265c272022660948aea36306720289409864 100644 --- a/plugins/ExampleAPI/API.php +++ b/plugins/ExampleAPI/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_ExampleAPI */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * The ExampleAPI is useful to developers building a custom Piwik plugin. diff --git a/plugins/ExamplePlugin/Controller.php b/plugins/ExamplePlugin/Controller.php index 45857cbc0b6a9c8e862a5d5dd113960057aee20c..1bcb01479bfb0246c869bb27ad052247e5598f79 100644 --- a/plugins/ExamplePlugin/Controller.php +++ b/plugins/ExamplePlugin/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_ExamplePlugin */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php index 597dea4c0f0181e98feff3fa43c8f4528bf2963a..5ee8ffddd7051de808451b3ea2c2b58f8f7634c9 100644 --- a/plugins/ExampleUI/Controller.php +++ b/plugins/ExampleUI/Controller.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_ExampleUI */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Piwik_ExampleUI diff --git a/plugins/Feedback/Controller.php b/plugins/Feedback/Controller.php index 3ba8fa5b5a1ec9275b511637a143feb2139fa0b7..243a36bacdc8cf59a2740abfa0b4898feb5ba41f 100644 --- a/plugins/Feedback/Controller.php +++ b/plugins/Feedback/Controller.php @@ -8,9 +8,9 @@ * @category Piwik_Plugins * @package Piwik_Feedback */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php index bddaf7b98e1bbec2f55a7a7093b13713e7aaa10f..3249a3ac1ebf5a131483afaf43db4563b96ed798 100644 --- a/plugins/Goals/API.php +++ b/plugins/Goals/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Goals */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Goals API lets you Manage existing goals, via "updateGoal" and "deleteGoal", create new Goals via "addGoal", diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php index ea38907bae0ea6076144107a039ca5a5af71f575..93bdd66b897ae1fbb02bafbdd5bb252ac60036b2 100644 --- a/plugins/Goals/Controller.php +++ b/plugins/Goals/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Goals */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 9549dc2fb13a3918d79b3aef58147efbdc5a3cc5..e612295dc1c79f6378789af64963dcdd9017fe94 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Goals */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/ImageGraph/API.php b/plugins/ImageGraph/API.php index c240a04ecc9cc28f401b051a7a630941b3651a7d..4087b7a18dfc0e9050623dcd82fc8198435b38f5 100644 --- a/plugins/ImageGraph/API.php +++ b/plugins/ImageGraph/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_ImageGraph */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The ImageGraph.get API call lets you generate beautiful static PNG Graphs for any existing Piwik report. diff --git a/plugins/ImageGraph/Controller.php b/plugins/ImageGraph/Controller.php index 4cabcd9633d0979a51b73619f30b4dfc4c30fe53..cd7700ef23fbf088c433d064a3f270398ed13bf9 100644 --- a/plugins/ImageGraph/Controller.php +++ b/plugins/ImageGraph/Controller.php @@ -1,6 +1,6 @@ <?php -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Piwik - Open source web analytics diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php index dfccc799bbc31450eddc6d08edcef59f0519a63c..60ff3dc27c7dc27b60107ec5bbf2998ee173134a 100644 --- a/plugins/ImageGraph/ImageGraph.php +++ b/plugins/ImageGraph/ImageGraph.php @@ -1,5 +1,5 @@ <?php -use Piwik\Core\Common; +use Piwik\Common; /** * Piwik - Open source web analytics diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php index cf676dbd7f622d1c01d4e17b1151e1bf18cf182a..7e24ebc155e4b9381cdd7b9786d77f01945fed77 100644 --- a/plugins/Installation/Controller.php +++ b/plugins/Installation/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Installation */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Installation controller diff --git a/plugins/Installation/FormDatabaseSetup.php b/plugins/Installation/FormDatabaseSetup.php index 0136c1a20e7f82e296080788468c3ddbd36ae714..d10f3b5a4944a86d650dbb9f312f847fef83a26a 100644 --- a/plugins/Installation/FormDatabaseSetup.php +++ b/plugins/Installation/FormDatabaseSetup.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Installation */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/Installation/FormGeneralSetup.php b/plugins/Installation/FormGeneralSetup.php index 61267e390abf081c7a76e871d1a5e3858672875e..23f1dbce94b2db923777b1b473a7c364748d773e 100644 --- a/plugins/Installation/FormGeneralSetup.php +++ b/plugins/Installation/FormGeneralSetup.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Installation */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php index 20af4fb892d3c43b624e43a5a1241934115c2582..1d81de1393d8184845a9261f70537d6740800313 100644 --- a/plugins/Installation/Installation.php +++ b/plugins/Installation/Installation.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Installation */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php index 14fb3ea7f57867c43a1a4ffa74e799ea816b2b32..bda241990843f9c1ef0cd48f1f17092645d459e6 100644 --- a/plugins/LanguagesManager/API.php +++ b/plugins/LanguagesManager/API.php @@ -9,8 +9,8 @@ * @package Piwik_LanguagesManager * */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The LanguagesManager API lets you access existing Piwik translations, and change Users languages preferences. diff --git a/plugins/LanguagesManager/Controller.php b/plugins/LanguagesManager/Controller.php index 53dd6494c56eb41520bbbb247c8a718f63d712cc..6685b511e4675cc0032136737494e2e1b59c5727 100644 --- a/plugins/LanguagesManager/Controller.php +++ b/plugins/LanguagesManager/Controller.php @@ -9,8 +9,8 @@ * @package Piwik_LanguagesManager * */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik_LanguagesManager diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php index 073e7a123128ed80736f31b1aa84dd7f9e8245c2..da096266b5984e888ce35ea67d0bed6f46b54a88 100644 --- a/plugins/LanguagesManager/LanguagesManager.php +++ b/plugins/LanguagesManager/LanguagesManager.php @@ -9,9 +9,9 @@ * @package Piwik_LanguagesManager * */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 6c4e7ba0463f61c1fed553a50b2fefec45180ee2..27652141d1c9563c3560c79b9a7d540c117239a5 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -8,9 +8,9 @@ * @category Piwik_Plugins * @package Piwik_Live */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * @see plugins/Referers/functions.php diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index 13e02a5d7df6223d3ac9b01868ea6495a34d5bca..bad3a1bcbf48fe77936e912223efb6d644c42e41 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Live */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik_Live diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 800e8ec91482a2b68ebcb6216b10190ef87b6376..e10b1ea331e77686bb27b6a05666b4181484590b 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Live */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @see plugins/Referers/functions.php diff --git a/plugins/Login/Auth.php b/plugins/Login/Auth.php index 20eae5f37770677b30ae15f2e58b5d2a9e5b054c..e8de6d3c3885797fc9a8bb4754b051c59436cd1b 100644 --- a/plugins/Login/Auth.php +++ b/plugins/Login/Auth.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Login */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index 6e429788eb5e390bf8c3715e28d774859dc53fd2..013658b41986c0de7ba17b095705e0fa9d5ff822 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -8,8 +8,10 @@ * @category Piwik_Plugins * @package Piwik_Login */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; + +require_once PIWIK_INCLUDE_PATH . '/core/Config.php'; /** * Login controller diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php index 59f9d63f8fb7167dbe3ed59f8c470e60fe4c24da..a46bf6e3874527d3fdf9844f3f971fd4645348c7 100644 --- a/plugins/Login/Login.php +++ b/plugins/Login/Login.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Login */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; +use Piwik\Config; +use Piwik\Piwik; /** * diff --git a/plugins/MobileMessaging/API.php b/plugins/MobileMessaging/API.php index 52073993b0b964e1c2f42d83476c8aa307cfb227..491bb46f86087ea6541264dda91341827abe3f1f 100644 --- a/plugins/MobileMessaging/API.php +++ b/plugins/MobileMessaging/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_MobileMessaging */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The MobileMessaging API lets you manage and access all the MobileMessaging plugin features including : diff --git a/plugins/MobileMessaging/Controller.php b/plugins/MobileMessaging/Controller.php index 84893cb172cc430a4112649db075064f2dbee974..a97641ed0c9b6e9399d8cd02b0518b172142f720 100644 --- a/plugins/MobileMessaging/Controller.php +++ b/plugins/MobileMessaging/Controller.php @@ -9,8 +9,8 @@ * @package Piwik_MobileMessaging */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/functions.php'; diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php index 62debf52e6b472375ec5476fbfaafdd17a2c976f..22ae5f0d40c79f4f712245bd9bcba67ac09a5faf 100644 --- a/plugins/MobileMessaging/MobileMessaging.php +++ b/plugins/MobileMessaging/MobileMessaging.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_MobileMessaging */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/MobileMessaging/ReportRenderer/Sms.php b/plugins/MobileMessaging/ReportRenderer/Sms.php index c871e6632a40c001f03e679619b6df6d3f4a5c93..d752b50e8494195a9422ec4f6c14fced7c91ff19 100644 --- a/plugins/MobileMessaging/ReportRenderer/Sms.php +++ b/plugins/MobileMessaging/ReportRenderer/Sms.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_MobileMessaging_ReportRenderer */ -use Piwik\Core\Common; +use Piwik\Common; /** diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php index 433263ebb867e82a0666de94ec95815ea47645a9..cb83dd21125fa05f51c87076e21e7715ad60a1df 100755 --- a/plugins/MultiSites/API.php +++ b/plugins/MultiSites/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_MultiSites */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The MultiSites API lets you request the key metrics (visits, page views, revenue) for all Websites in Piwik. diff --git a/plugins/MultiSites/Controller.php b/plugins/MultiSites/Controller.php index a6634df68fb57fd9ed44128ff9a91f31b570ae4c..107f1923ce631ce8b41e364c6cfec9a7fd188f70 100644 --- a/plugins/MultiSites/Controller.php +++ b/plugins/MultiSites/Controller.php @@ -8,8 +8,9 @@ * @category Piwik_Plugins * @package Piwik_MultiSites */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; +use Piwik\Config; /** * diff --git a/plugins/Overlay/API.php b/plugins/Overlay/API.php index 812a792e1463b59f69daa7f9b0bbfc94f8f5cd45..83db709503b2e4e7d23ae3ddaf484342a0cb862c 100644 --- a/plugins/Overlay/API.php +++ b/plugins/Overlay/API.php @@ -1,6 +1,6 @@ <?php -use Piwik\Core\Config; -use Piwik\Core\Piwik; +use Piwik\Config; +use Piwik\Piwik; /** * Piwik - Open source web analytics diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php index e08218a23fd8228d9754b92912dd4b5f4633b863..d875fa97a716985506621ea69e17cfd509385910 100644 --- a/plugins/Overlay/Controller.php +++ b/plugins/Overlay/Controller.php @@ -1,6 +1,6 @@ <?php -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Piwik - Open source web analytics diff --git a/plugins/PDFReports/API.php b/plugins/PDFReports/API.php index f63225450cd00fa26ba0fb26b1bb3cf7fd51546c..f177eaf4e76718c254b2d3b6fe2cf92336cdd232 100644 --- a/plugins/PDFReports/API.php +++ b/plugins/PDFReports/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_PDFReports */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The PDFReports API lets you manage Scheduled Email reports, as well as generate, download or email any existing report. diff --git a/plugins/PDFReports/Controller.php b/plugins/PDFReports/Controller.php index 2f8a5a9d837b21084afdc42f0f98c2ee7c345d07..4e7e8c1644952973fa5bc9cff4d0791b314688fb 100644 --- a/plugins/PDFReports/Controller.php +++ b/plugins/PDFReports/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_PDFReports */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/PDFReports/PDFReports.php b/plugins/PDFReports/PDFReports.php index 93320200102eac5ec2d110848e166e39e4ca57b6..9130c2e2919124befc2a3863fd49e0edc5740aae 100644 --- a/plugins/PDFReports/PDFReports.php +++ b/plugins/PDFReports/PDFReports.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_PDFReports */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/PrivacyManager/Controller.php b/plugins/PrivacyManager/Controller.php index 049f3a1ec8382f296b40b0bdd35e42ceaa5dc133..d7191339da7524d1e2db3b4f67122e5c268db857 100644 --- a/plugins/PrivacyManager/Controller.php +++ b/plugins/PrivacyManager/Controller.php @@ -8,9 +8,9 @@ * @category Piwik_Plugins * @package Piwik_PrivacyManager */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/PrivacyManager/LogDataPurger.php b/plugins/PrivacyManager/LogDataPurger.php index 692d8435e2b973701a09c32480c7dd79838b9261..ac899a6ce4d6a8a6a6f46ded2369f586ac1a2292 100755 --- a/plugins/PrivacyManager/LogDataPurger.php +++ b/plugins/PrivacyManager/LogDataPurger.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_PrivacyManager */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Purges the log_visit, log_conversion and related tables of old visit data. diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index 9553275c8a442d2a33692fb368cc6f39c5f263d5..59836dae9a737c198032ea361a4c78efaf2a9efd 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -8,9 +8,9 @@ * @category Piwik_Plugins * @package Piwik_PrivacyManager */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * @see plugins/PrivacyManager/LogDataPurger.php diff --git a/plugins/PrivacyManager/ReportsPurger.php b/plugins/PrivacyManager/ReportsPurger.php index 49938dd33da9279dfb76dad87b6e2b091f2b3130..db4e5cafe3073c95527e6ab0362c1a83c3211e87 100755 --- a/plugins/PrivacyManager/ReportsPurger.php +++ b/plugins/PrivacyManager/ReportsPurger.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_PrivacyManager */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * Purges archived reports and metrics that are considered old. diff --git a/plugins/Provider/API.php b/plugins/Provider/API.php index 687527d5718bd91c1c435f3c1328c4459ab1f5d9..20408c70b868a7a3e4c023b4660a2321606f7c51 100644 --- a/plugins/Provider/API.php +++ b/plugins/Provider/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Provider */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @see plugins/Provider/functions.php diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php index b785229214aa2e8123b7b07302ae011d81c0be48..ca7c05ae8d0723bfa74688fe3345475e2eae4289 100644 --- a/plugins/Provider/Provider.php +++ b/plugins/Provider/Provider.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Provider */ -use Piwik\Core\Common; +use Piwik\Common; /** * @@ -111,7 +111,7 @@ class Piwik_Provider extends Piwik_Plugin // In case the IP was anonymized, we should not continue since the DNS reverse lookup will fail and this will slow down tracking if (substr($ip, -2, 2) == '.0') { - printDebug("IP Was anonymized so we skip the Provider DNS reverse lookup..."); + Common::printDebug("IP Was anonymized so we skip the Provider DNS reverse lookup..."); return; } diff --git a/plugins/Provider/functions.php b/plugins/Provider/functions.php index 36dc488a996a19a86f018c54088202d2d2d782f8..a09ec1ab366fe1f2b72978ae7eab074180896833 100644 --- a/plugins/Provider/functions.php +++ b/plugins/Provider/functions.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Provider */ -use Piwik\Core\Common; +use Piwik\Common; /** * Return hostname portion of a domain name diff --git a/plugins/Proxy/Controller.php b/plugins/Proxy/Controller.php index b97e61471c2330c756fa3f8a17378c9f46c47752..f7f71bb8a8abf717a31cbb4802663dff3bf322d8 100644 --- a/plugins/Proxy/Controller.php +++ b/plugins/Proxy/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Proxy */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Controller for proxy services diff --git a/plugins/Referers/API.php b/plugins/Referers/API.php index 39ad371b43dd3f9121d3983634e07ec8973c0068..7620cfd6684fa2746c359ab1e221fbdfa90a8000 100644 --- a/plugins/Referers/API.php +++ b/plugins/Referers/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Referers */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The Referrers API lets you access reports about Websites, Search engines, Keywords, Campaigns used to access your website. diff --git a/plugins/Referers/Archiver.php b/plugins/Referers/Archiver.php index 8dd540a478032586d309b1bd546578c0f44e247b..42af90b3201ea059523d555700f110e720b89bf6 100644 --- a/plugins/Referers/Archiver.php +++ b/plugins/Referers/Archiver.php @@ -1,5 +1,6 @@ <?php -use Piwik\Core\Common; +use Piwik\Common; +use Piwik\Config; /** * Piwik - Open source web analytics diff --git a/plugins/Referers/Controller.php b/plugins/Referers/Controller.php index df592528c1062658382a2fd21d03703b803644b1..8abcfb70628c567acf8094c7dbbfc70a120f9acd 100644 --- a/plugins/Referers/Controller.php +++ b/plugins/Referers/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Referers */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php index e4feb4d186c1c20620da78248febda03d56cccb2..c96ca7927da48f0995762a8d0543d6f12c5e32e2 100644 --- a/plugins/Referers/Referers.php +++ b/plugins/Referers/Referers.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Referers */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @see plugins/Referers/functions.php diff --git a/plugins/Referers/functions.php b/plugins/Referers/functions.php index 7ba0b6f7761ae4322ef3e4594df0df20c1ae9d69..b7038fb36006193b7ec1836313b2825b2c877558 100644 --- a/plugins/Referers/functions.php +++ b/plugins/Referers/functions.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Referers */ -use Piwik\Core\Common; +use Piwik\Common; /** * Returns path component from a URL diff --git a/plugins/SEO/API.php b/plugins/SEO/API.php index 9e1d8c171381049650e7e48fdfb3c4d79d55442f..b7826f30d564f1d42469cb1f9abf193e2a79e7ed 100644 --- a/plugins/SEO/API.php +++ b/plugins/SEO/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SEO */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @see plugins/Referers/functions.php diff --git a/plugins/SEO/Controller.php b/plugins/SEO/Controller.php index 9e9945de83ecf25ab71c5673e2f954e296af068e..c09ce235d12eddb35adbd7499ce11ba1bbc1c900 100644 --- a/plugins/SEO/Controller.php +++ b/plugins/SEO/Controller.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SEO */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Piwik_SEO diff --git a/plugins/SEO/MajesticClient.php b/plugins/SEO/MajesticClient.php index 2e0b2ee5e65e90c04ddc14b683902162504e23af..250fa0025bbf8de7d3900e1c6b956323387e15fe 100644 --- a/plugins/SEO/MajesticClient.php +++ b/plugins/SEO/MajesticClient.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SEO */ -use Piwik\Core\Common; +use Piwik\Common; /** * Client for Majestic SEO's HTTP API. diff --git a/plugins/SEO/RankChecker.php b/plugins/SEO/RankChecker.php index fabd770118ef7d6927ce0736ca29f71726f2c04a..ddc3f5117dd3f15d150be2eee3635f15709d0d4b 100644 --- a/plugins/SEO/RankChecker.php +++ b/plugins/SEO/RankChecker.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SEO */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * The functions below are derived/adapted from GetRank.org's diff --git a/plugins/SecurityInfo/Controller.php b/plugins/SecurityInfo/Controller.php index fd66acc99a0cb7ed356f612f3211a8551bee68fe..c9b307bba4455bebda576ae2197a05eb01287572 100644 --- a/plugins/SecurityInfo/Controller.php +++ b/plugins/SecurityInfo/Controller.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SecurityInfo */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @package Piwik_SecurityInfo diff --git a/plugins/SecurityInfo/SecurityInfo.php b/plugins/SecurityInfo/SecurityInfo.php index 04537325cf20bc741a901d0756449ac76e345f15..ecd8d2e5f6de75c2fd61df4c53fca9aa71c94c74 100644 --- a/plugins/SecurityInfo/SecurityInfo.php +++ b/plugins/SecurityInfo/SecurityInfo.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SecurityInfo */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php index 7d90bee3100aa59bb80be669289baf4a4290e48d..c3c04a054ebe27f3a75c1726bc059ded6b78b7da 100644 --- a/plugins/SegmentEditor/API.php +++ b/plugins/SegmentEditor/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_SegmentEditor */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The SegmentEditor API lets you add, update, delete custom Segments, and list saved segments.a diff --git a/plugins/SegmentEditor/Controller.php b/plugins/SegmentEditor/Controller.php index b48374deb1109f76440d7d6d98f0184ec89b4c5b..bafab7ac4601171cbe2d4d1db1181a71018f75f0 100644 --- a/plugins/SegmentEditor/Controller.php +++ b/plugins/SegmentEditor/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_SegmentEditor */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik_SegmentEditor diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php index 41b79dcd1d747236bf76cc50093f772c51693abb..94eefc117d9b0ddfb24f93f8ac131aace8e06714 100644 --- a/plugins/SegmentEditor/SegmentEditor.php +++ b/plugins/SegmentEditor/SegmentEditor.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SegmentEditor */ -use Piwik\Core\Common; +use Piwik\Common; /** * @package Piwik_SegmentEditor diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index 19a8db3d2e49bd265ccad0cc298e3a8bc9de39de..1400d50008d6ed3e955ae896c3012fbdd556a6d6 100644 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_SitesManager */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * The SitesManager API gives you full control on Websites in Piwik (create, update and delete), and many methods to retrieve websites based on various attributes. diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php index eca7970aca0e52e7c44e6633446b426669685f86..c6e518dbc95e10be2e9871dade06f82deb3d07a4 100644 --- a/plugins/SitesManager/Controller.php +++ b/plugins/SitesManager/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_SitesManager */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 79fa7f7701d814819ed82159db0155e1b20c7d6d..8fbad87b008dcfebdd84a1c740d39b53740e2f46 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_SitesManager */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php index 2b35a6e27105b1edf7abbe693ceb4f148d591469..739d07af7d304787b753ff5811985bb115c1a32d 100644 --- a/plugins/Transitions/API.php +++ b/plugins/Transitions/API.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_Transitions */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @package Piwik_Transitions diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php index b89b557448a77800284bca203c97677fb24d8aab..4c146e879b6ae73ee656f881fbb0d4ac871a9c07 100644 --- a/plugins/UserCountry/API.php +++ b/plugins/UserCountry/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_UserCountry */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @see plugins/UserCountry/functions.php diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php index 355f771e687ca440be0005460d46e1b811cd2b36..bda89e927bec1ffe0a38baff03cacb2b4e7487a8 100644 --- a/plugins/UserCountry/Controller.php +++ b/plugins/UserCountry/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_UserCountry */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php index febeccdee0da26ec195b1f3847e265aac11880d4..6b63142cfa5deb68bc9fcd0fe646cf779481db93 100755 --- a/plugins/UserCountry/GeoIPAutoUpdater.php +++ b/plugins/UserCountry/GeoIPAutoUpdater.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_UserCountry */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * Used to automatically update installed GeoIP databases, and manages the updater's diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php index d05fbfba7636f20bc016f4077f25af2920c19968..153247a25232b212f5eb94342c2a72ed4d96e223 100755 --- a/plugins/UserCountry/LocationProvider.php +++ b/plugins/UserCountry/LocationProvider.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_UserCountry */ -use Piwik\Core\Common; +use Piwik\Common; /** * @see plugins/UserCountry/LocationProvider/Default.php diff --git a/plugins/UserCountry/LocationProvider/Default.php b/plugins/UserCountry/LocationProvider/Default.php index 18ef73ce3ea6f452debdcb82c039d1d42978274c..a7798a5ca0f2322e58d9814c8378c12fc4e146fc 100755 --- a/plugins/UserCountry/LocationProvider/Default.php +++ b/plugins/UserCountry/LocationProvider/Default.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_UserCountry */ -use Piwik\Core\Config; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Common; /** * The default LocationProvider, this LocationProvider guesses a visitor's country diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Php.php b/plugins/UserCountry/LocationProvider/GeoIp/Php.php index 5e2e1f71e86789609f608eee6cb6d8b497243948..001b7f8c4ebd93708f062c4eb508394590ebd56b 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/Php.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/Php.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_UserCountry */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * A LocationProvider that uses the PHP implementation of GeoIP. diff --git a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php index cdafeefa6af7a29a12d47362838685b1904cc7d2..a26217bac20199265769b4700a340b3ae207f555 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php @@ -69,7 +69,7 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou && (!isset($info['disable_fallbacks']) || !$info['disable_fallbacks']) ) { - printDebug("The request is for IP address: " . $info['ip'] . " but your IP is: $myIP. GeoIP Server Module (apache/nginx) does not support this use case... "); + Common::printDebug("The request is for IP address: " . $info['ip'] . " but your IP is: $myIP. GeoIP Server Module (apache/nginx) does not support this use case... "); $fallbacks = array( Piwik_UserCountry_LocationProvider_GeoIp_Pecl::ID, Piwik_UserCountry_LocationProvider_GeoIp_Php::ID @@ -77,11 +77,11 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou foreach ($fallbacks as $fallbackProviderId) { $otherProvider = Piwik_UserCountry_LocationProvider::getProviderById($fallbackProviderId); if ($otherProvider) { - printDebug("Used $fallbackProviderId to detect this visitor IP"); + Common::printDebug("Used $fallbackProviderId to detect this visitor IP"); return $otherProvider->getLocation($info); } } - printDebug("FAILED to lookup the geo location of this IP address, as no fallback location providers is configured. We recommend to configure Geolocation PECL module to fix this error."); + Common::printDebug("FAILED to lookup the geo location of this IP address, as no fallback location providers is configured. We recommend to configure Geolocation PECL module to fix this error."); return false; } diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php index 3171a92e7cf4c45fba6c92089b63c7fe86ef1efe..d6e673e69739fba09dd51ab0277e4e92db5463d1 100644 --- a/plugins/UserCountry/UserCountry.php +++ b/plugins/UserCountry/UserCountry.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_UserCountry */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * @see plugins/UserCountry/GeoIPAutoUpdater.php @@ -69,7 +69,7 @@ class Piwik_UserCountry extends Piwik_Plugin if ($provider === false) { $id = Piwik_UserCountry_LocationProvider_Default::ID; $provider = Piwik_UserCountry_LocationProvider::getProviderById($id); - printDebug("GEO: no current location provider sent, falling back to default '$id' one."); + Common::printDebug("GEO: no current location provider sent, falling back to default '$id' one."); } $location = $provider->getLocation($visitorInfo); @@ -79,10 +79,10 @@ class Piwik_UserCountry extends Piwik_Plugin $defaultId = Piwik_UserCountry_LocationProvider_Default::ID; $provider = Piwik_UserCountry_LocationProvider::getProviderById($defaultId); $location = $provider->getLocation($visitorInfo); - printDebug("GEO: couldn't find a location with Geo Module '$id', using Default '$defaultId' provider as fallback..."); + Common::printDebug("GEO: couldn't find a location with Geo Module '$id', using Default '$defaultId' provider as fallback..."); $id = $defaultId; } - printDebug("GEO: Found IP location (provider '" . $id . "'): " . var_export($location, true)); + Common::printDebug("GEO: Found IP location (provider '" . $id . "'): " . var_export($location, true)); } function addWidgets() diff --git a/plugins/UserCountryMap/Controller.php b/plugins/UserCountryMap/Controller.php index 6eee81eed64285b919a75d3e98869b1c892592ff..08989db23791d73d453d7ff5531931ba8ac5c2bb 100644 --- a/plugins/UserCountryMap/Controller.php +++ b/plugins/UserCountryMap/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_UserCountryMap */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/UserSettings/API.php b/plugins/UserSettings/API.php index 23a538e7f140a8ad03d5e4afebb118188d297893..2a8c7584dec5b4c84479761dfcfed03ac12db35c 100644 --- a/plugins/UserSettings/API.php +++ b/plugins/UserSettings/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_UserSettings */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @see plugins/UserSettings/functions.php diff --git a/plugins/UserSettings/Archiver.php b/plugins/UserSettings/Archiver.php index 95f7f5f107acdddc375f8c7b0335b70e986d3aea..cdfd893faf85acd0ab7c936e9892b7736b4eac40 100644 --- a/plugins/UserSettings/Archiver.php +++ b/plugins/UserSettings/Archiver.php @@ -9,7 +9,7 @@ * @package Piwik_UserSettings */ -use Piwik\Core\Common; +use Piwik\Common; require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php'; diff --git a/plugins/UserSettings/functions.php b/plugins/UserSettings/functions.php index 8adc92b2450ed1be893be94ab5819e01ef890252..86164eb5a1fc8eec6d5881df101354fbb5d0e371 100644 --- a/plugins/UserSettings/functions.php +++ b/plugins/UserSettings/functions.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_UserSettings */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * @see libs/UserAgentParser/UserAgentParser.php diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php index 0ed1aaf7aae8c50bbd39fe7d024c191af16ab4a1..3a804c70f0ff3b4394ff53e7da64ad88953706a5 100644 --- a/plugins/UsersManager/API.php +++ b/plugins/UsersManager/API.php @@ -8,9 +8,9 @@ * @category Piwik_Plugins * @package Piwik_UsersManager */ -use Piwik\Core\Config; -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Common; /** * The UsersManager API lets you Manage Users and their permissions to access specific websites. diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php index ac3aaab360dcdd3a0ff4b27e2e09ee918d338277..9c8cae77ca7cdd0058d6e655e78a9029426a7ac3 100644 --- a/plugins/UsersManager/Controller.php +++ b/plugins/UsersManager/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_UsersManager */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index 82d02f36bf07194a6d6bcdc6e60faf91ae180743..58f585da67bc9eb5df388b5b2d048f620243015d 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_UsersManager */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * Manage Piwik users diff --git a/plugins/VisitFrequency/API.php b/plugins/VisitFrequency/API.php index 5b7161b7be3071e9526aa68ceb548ec1deced014..49473b51929ed05759e27fe745ada3f6371e72e5 100644 --- a/plugins/VisitFrequency/API.php +++ b/plugins/VisitFrequency/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_VisitFrequency */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * VisitFrequency API lets you access a list of metrics related to Returning Visitors. diff --git a/plugins/VisitFrequency/Controller.php b/plugins/VisitFrequency/Controller.php index 6cac26d5043369ae8e120fb9d3c3068d380beeaf..c9362959cce76a869a2516c50c4637f3e324058b 100644 --- a/plugins/VisitFrequency/Controller.php +++ b/plugins/VisitFrequency/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_VisitFrequency */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/VisitTime/API.php b/plugins/VisitTime/API.php index f473ae6ab33629afb149eecb1fd09a476904bde1..05dad866b9c5bde870fe9ff51a7f8b39312ede3a 100644 --- a/plugins/VisitTime/API.php +++ b/plugins/VisitTime/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_VisitTime */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * VisitTime API lets you access reports by Hour (Server time), and by Hour Local Time of your visitors. diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 990bf350e3783b8d466734d663e66df1f72e7733..dad9c46fec62f7cac92eefca9925f37ed4166d9f 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_VisitTime */ -use Piwik\Core\Common; +use Piwik\Common; /** * diff --git a/plugins/VisitorGenerator/Controller.php b/plugins/VisitorGenerator/Controller.php index 813984b2ed8e8dd84587e18d0909ec5d0d649281..606e8784c72bb77de8ef5c3eb5d4770d4827880e 100644 --- a/plugins/VisitorGenerator/Controller.php +++ b/plugins/VisitorGenerator/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_VisitorGenerator */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/VisitorGenerator/VisitorGenerator.php b/plugins/VisitorGenerator/VisitorGenerator.php index dc23e4f60d16daedb8a0137a230f68debcfc3286..7423f3a900fe29a0730d5865c68fcd06f3d03276 100644 --- a/plugins/VisitorGenerator/VisitorGenerator.php +++ b/plugins/VisitorGenerator/VisitorGenerator.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_VisitorGenerator */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * diff --git a/plugins/VisitorInterest/API.php b/plugins/VisitorInterest/API.php index 35e89c9896a51930e93bac594b80a9901c6c8c94..33251a72325a2b03966d9904865b40ad808a1d63 100644 --- a/plugins/VisitorInterest/API.php +++ b/plugins/VisitorInterest/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_VisitorInterest */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * VisitorInterest API lets you access two Visitor Engagement reports: number of visits per number of pages, diff --git a/plugins/VisitsSummary/API.php b/plugins/VisitsSummary/API.php index a7c0ecda714219d9dfc1dc17f195005a545a49b2..6e4399c38471bffea0a1ea069406f4d47acdd69e 100644 --- a/plugins/VisitsSummary/API.php +++ b/plugins/VisitsSummary/API.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_VisitsSummary */ -use Piwik\Core\Piwik; +use Piwik\Piwik; /** * VisitsSummary API lets you access the core web analytics metrics (visits, unique visitors, diff --git a/plugins/VisitsSummary/Controller.php b/plugins/VisitsSummary/Controller.php index 02ab257ac533c7a7736c44a2a90aff64b412e7de..8a4552f473cb40db0b360494af63d2fdb1d8d5e4 100644 --- a/plugins/VisitsSummary/Controller.php +++ b/plugins/VisitsSummary/Controller.php @@ -8,8 +8,8 @@ * @category Piwik_Plugins * @package Piwik_VisitsSummary */ -use Piwik\Core\Piwik; -use Piwik\Core\Common; +use Piwik\Piwik; +use Piwik\Common; /** * diff --git a/plugins/Widgetize/Controller.php b/plugins/Widgetize/Controller.php index be6b56a37bf0b6347d982c35db271caa090d8736..dad25069366cae934e828ea28050c2d25c89e1e0 100644 --- a/plugins/Widgetize/Controller.php +++ b/plugins/Widgetize/Controller.php @@ -8,7 +8,7 @@ * @category Piwik_Plugins * @package Piwik_Widgetize */ -use Piwik\Core\Common; +use Piwik\Common; /** *