diff options
-rw-r--r-- | core/SegmentExpression.php | 9 | ||||
-rw-r--r-- | core/Singleton.php | 3 | ||||
-rw-r--r-- | core/Tracker/Referrer.php | 75 | ||||
-rw-r--r-- | libs/upgradephp/upgrade.php | 2 | ||||
-rw-r--r-- | plugins/CoreConsole/RunTests.php | 2 | ||||
-rw-r--r-- | plugins/CoreConsole/templates/theme/Howto.md | 84 | ||||
-rw-r--r-- | plugins/CoreUpdater/Controller.php | 19 | ||||
-rw-r--r-- | plugins/Goals/API.php | 1 |
8 files changed, 52 insertions, 143 deletions
diff --git a/core/SegmentExpression.php b/core/SegmentExpression.php index 93a366778c..791be17690 100644 --- a/core/SegmentExpression.php +++ b/core/SegmentExpression.php @@ -124,15 +124,6 @@ class SegmentExpression } /** - * Returns the current sub expression - * @return array - */ - public function getSubExpressions() - { - return $this->parsedSubExpressions; - } - - /** * @param array $availableTables */ public function parseSubExpressionsIntoSqlExpressions(&$availableTables = array()) diff --git a/core/Singleton.php b/core/Singleton.php index a7abde523d..d6562a3ce9 100644 --- a/core/Singleton.php +++ b/core/Singleton.php @@ -24,9 +24,6 @@ class Singleton final private function __clone() { } - /** - * @return self - */ public static function getInstance() { $class = get_called_class(); diff --git a/core/Tracker/Referrer.php b/core/Tracker/Referrer.php index 28c7c966c1..09501943ce 100644 --- a/core/Tracker/Referrer.php +++ b/core/Tracker/Referrer.php @@ -156,52 +156,53 @@ class Referrer } } - if (!empty($campaignName)) { - $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_CAMPAIGN; - $this->nameReferrerAnalyzed = $campaignName; + if (empty($campaignName)) { + return false; + } + $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_CAMPAIGN; + $this->nameReferrerAnalyzed = $campaignName; - foreach ($this->campaignKeywords as $campaignKeywordParameter) { - $campaignKeyword = UrlHelper::getParameterFromQueryString($string, $campaignKeywordParameter); - if (!empty($campaignKeyword)) { - $this->keywordReferrerAnalyzed = trim(urldecode($campaignKeyword)); - break; - } + foreach ($this->campaignKeywords as $campaignKeywordParameter) { + $campaignKeyword = UrlHelper::getParameterFromQueryString($string, $campaignKeywordParameter); + if (!empty($campaignKeyword)) { + $this->keywordReferrerAnalyzed = trim(urldecode($campaignKeyword)); + break; } + } - // if the campaign keyword is empty, try to get a keyword from the referrer URL - if (empty($this->keywordReferrerAnalyzed)) { - // Set the Campaign keyword to the keyword found in the Referrer URL if any - $referrerUrlInfo = UrlHelper::extractSearchEngineInformationFromUrl($this->referrerUrl); - if (!empty($referrerUrlInfo['keywords'])) { - $this->keywordReferrerAnalyzed = $referrerUrlInfo['keywords']; - } + // if the campaign keyword is empty, try to get a keyword from the referrer URL + if (empty($this->keywordReferrerAnalyzed)) { + // Set the Campaign keyword to the keyword found in the Referrer URL if any + $referrerUrlInfo = UrlHelper::extractSearchEngineInformationFromUrl($this->referrerUrl); + if (!empty($referrerUrlInfo['keywords'])) { + $this->keywordReferrerAnalyzed = $referrerUrlInfo['keywords']; + } - // Set the keyword, to the hostname found, in a Adsense Referrer URL '&url=' parameter - if (empty($this->keywordReferrerAnalyzed) - && !empty($this->referrerUrlParse['query']) - && !empty($this->referrerHost) - && (strpos($this->referrerHost, 'google') !== false || strpos($this->referrerHost, 'doubleclick') !== false) - ) { - // This parameter sometimes is found & contains the page with the adsense ad bringing visitor to our site - $adsenseReferrerParameter = 'url'; - $value = trim(urldecode(UrlHelper::getParameterFromQueryString($this->referrerUrlParse['query'], $adsenseReferrerParameter))); - if (!empty($value)) { - $parsedAdsenseReferrerUrl = parse_url($value); - if (!empty($parsedAdsenseReferrerUrl['host'])) { - $this->keywordReferrerAnalyzed = self::LABEL_PREFIX_ADSENSE_KEYWORD . $parsedAdsenseReferrerUrl['host']; - } + // Set the keyword, to the hostname found, in a Adsense Referrer URL '&url=' parameter + if (empty($this->keywordReferrerAnalyzed) + && !empty($this->referrerUrlParse['query']) + && !empty($this->referrerHost) + && (strpos($this->referrerHost, 'google') !== false || strpos($this->referrerHost, 'doubleclick') !== false) + ) { + // This parameter sometimes is found & contains the page with the adsense ad bringing visitor to our site + $adsenseReferrerParameter = 'url'; + $value = trim(urldecode(UrlHelper::getParameterFromQueryString($this->referrerUrlParse['query'], $adsenseReferrerParameter))); + if (!empty($value)) { + $parsedAdsenseReferrerUrl = parse_url($value); + if (!empty($parsedAdsenseReferrerUrl['host'])) { + $this->keywordReferrerAnalyzed = self::LABEL_PREFIX_ADSENSE_KEYWORD . $parsedAdsenseReferrerUrl['host']; } } - - // or we default to the referrer hostname otherwise - if (empty($this->keywordReferrerAnalyzed)) { - $this->keywordReferrerAnalyzed = $this->referrerHost; - } } - return true; + // or we default to the referrer hostname otherwise + if (empty($this->keywordReferrerAnalyzed)) { + $this->keywordReferrerAnalyzed = $this->referrerHost; + } } - return false; + + return true; + } /** diff --git a/libs/upgradephp/upgrade.php b/libs/upgradephp/upgrade.php index d32a0fe3c2..c45ee1ca95 100644 --- a/libs/upgradephp/upgrade.php +++ b/libs/upgradephp/upgrade.php @@ -46,8 +46,6 @@ use Piwik\SettingsServer; * - some listed here might have appeared earlier or in release candidates * * @emulated - * json_encode - * json_decode * error_get_last * preg_last_error * lchown diff --git a/plugins/CoreConsole/RunTests.php b/plugins/CoreConsole/RunTests.php index 2820f30eb2..4fd5b3dc94 100644 --- a/plugins/CoreConsole/RunTests.php +++ b/plugins/CoreConsole/RunTests.php @@ -37,7 +37,7 @@ class RunTests extends ConsoleCommand $groups = explode(",", $groups); $groups = array_map('ucfirst', $groups); - $groups = array_filter('strlen', $groups); + $groups = array_filter($groups, 'strlen'); if(empty($groups)) { $groups = $this->getTestsGroups(); diff --git a/plugins/CoreConsole/templates/theme/Howto.md b/plugins/CoreConsole/templates/theme/Howto.md deleted file mode 100644 index efdfab53eb..0000000000 --- a/plugins/CoreConsole/templates/theme/Howto.md +++ /dev/null @@ -1,84 +0,0 @@ -Before you start creating your theme ------------- - -Activate your theme on the Piwik instance: Settings > Platform > Themes - - -About the plugin.json file ------------- - -You can complete your plugin.json file with the following entries: - -* "homepage" -* "author" -* "author_homepage" -* "license" -* "license_homepage" -* "version" - - -Activate the development mode -------------- -If you change your theme.less file, you will not see the difference on your Piwik instance. -The stylesheets have a cache mode to prevent from compiling them on every page call. -To disable it, you have to modify the "config/config.ini.php" file: - -```ini - [Debug] - disable_merged_assets = 1 -``` - - -Limitations ------------- -You just can not theme: - -* Installation plugin pages -* CoreUpdater plugin pages - - -How to theme -=============== - -Images ----------- -You can stock your images in the folder "plugins/YourPluginName/images". -To use images in CSS, you have to use a relative path that start at the root folder. - -Example: - -```css - background-image: url(plugins/YourPluginName/images/dropDown.jpg); -``` - -Multiple stylesheets files ----------- -You can submit only one stylesheets file for theme. -But you can import other Less files from the main theme file: - -Example: - -```css - @import "../../plugins/YourPluginName/stylesheets/_yourSubStylesheetName.less" -``` - -It's important to use this complex path to prevent compilation bugs. -It is better to prefix your sub stylesheet file name with an '_'. - - -Graphs ----------- -You can style some graph elements. -You should see "plugins/CoreHome/stylesheets/jqplotColors.less" for more informations. - - -Sparklines ----------- -You can style some sparklines elements. -You should see "plugins/CoreHome/stylesheets/sparklineColors.less" for more informations. - - -Transitions ----------- -You can style some transitions elements. -You should see "plugins/Transition/stylesheets/_transitionColors.less" for more informations.
\ No newline at end of file diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index 8359809f8f..e79bf0900f 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -131,6 +131,17 @@ class Controller extends \Piwik\Plugin\Controller } } + public static function clearPhpCaches() + { + if (function_exists('apc_clear_cache')) { + apc_clear_cache(); // clear the system (aka 'opcode') cache + } + + if (function_exists('opcache_reset')) { + opcache_reset(); // reset the opcode cache (php 5.5.0+) + } + } + private function checkNewVersionIsAvailableOrDie() { $newVersion = UpdateCheck::isNewestVersionAvailable(); @@ -247,13 +258,7 @@ class Controller extends \Piwik\Plugin\Controller Filesystem::unlinkRecursive($this->pathRootExtractedPiwik, true); - if (function_exists('apc_clear_cache')) { - apc_clear_cache(); // clear the system (aka 'opcode') cache - } - - if (function_exists('opcache_reset')) { - opcache_reset(); // reset the opcode cache (php 5.5.0+) - } + self::clearPhpCaches(); } private function oneClick_Finished() diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php index 34b3083f88..410af4d26f 100644 --- a/plugins/Goals/API.php +++ b/plugins/Goals/API.php @@ -40,6 +40,7 @@ use Piwik\Tracker\GoalManager; * See also the documentation about <a href='http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>Tracking Goals</a> in Piwik. * * @package Goals + * @method \Piwik\Plugins\Goals\API getInstance() */ class API extends \Piwik\Plugin\API { |