├── .gitignore ├── LICENSE ├── README.md ├── bitcoin.png ├── classes ├── .htaccess ├── WP_Piwik.php └── WP_Piwik │ ├── Admin.php │ ├── Admin │ ├── Network.php │ ├── Settings.php │ ├── Sitebrowser.php │ └── Statistics.php │ ├── Logger.php │ ├── Logger │ ├── Dummy.php │ ├── File.php │ └── Screen.php │ ├── Request.php │ ├── Request │ ├── Php.php │ └── Rest.php │ ├── Settings.php │ ├── Shortcode.php │ ├── Template.php │ ├── Template │ └── MetaBoxCustomVars.php │ ├── TrackingCode.php │ ├── Widget.php │ └── Widget │ ├── BrowserDetails.php │ ├── Browsers.php │ ├── Chart.php │ ├── City.php │ ├── Country.php │ ├── Ecommerce.php │ ├── Items.php │ ├── ItemsCategory.php │ ├── Keywords.php │ ├── Models.php │ ├── Noresult.php │ ├── OptOut.php │ ├── Overview.php │ ├── Pages.php │ ├── Plugins.php │ ├── Post.php │ ├── Referrers.php │ ├── Screens.php │ ├── Search.php │ ├── Seo.php │ ├── SystemDetails.php │ ├── Systems.php │ ├── Types.php │ └── Visitors.php ├── config.php ├── css ├── index.php └── wp-piwik.css ├── gpl-3.0.html ├── index.php ├── js ├── chartjs │ ├── LICENSE.md │ ├── README.md │ └── chart.min.js ├── index.php └── wp-piwik.js ├── languages ├── .htaccess ├── .tx │ └── config ├── update.sh ├── wp-piwik-az_AZ.mo ├── wp-piwik-az_AZ.po ├── wp-piwik-be_BY.mo ├── wp-piwik-be_BY.po ├── wp-piwik-cs_CZ.mo ├── wp-piwik-cs_CZ.po ├── wp-piwik-de_CH.mo ├── wp-piwik-de_CH.po ├── wp-piwik-de_DE.mo ├── wp-piwik-de_DE.po ├── wp-piwik-el.mo ├── wp-piwik-el.po ├── wp-piwik-el_GR.mo ├── wp-piwik-el_GR.po ├── wp-piwik-es_ES.mo ├── wp-piwik-es_ES.po ├── wp-piwik-fa_IR.mo ├── wp-piwik-fa_IR.po ├── wp-piwik-fr_FR.mo ├── wp-piwik-fr_FR.po ├── wp-piwik-hi.mo ├── wp-piwik-hi.po ├── wp-piwik-hu_HU.mo ├── wp-piwik-hu_HU.po ├── wp-piwik-id.mo ├── wp-piwik-id.po ├── wp-piwik-it_IT.mo ├── wp-piwik-it_IT.po ├── wp-piwik-lb.mo ├── wp-piwik-lb.po ├── wp-piwik-lt_LT.mo ├── wp-piwik-lt_LT.po ├── wp-piwik-nb_NO.mo ├── wp-piwik-nb_NO.po ├── wp-piwik-nl_NL.mo ├── wp-piwik-nl_NL.po ├── wp-piwik-pl_PL.mo ├── wp-piwik-pl_PL.po ├── wp-piwik-pt_BR.mo ├── wp-piwik-pt_BR.po ├── wp-piwik-ro_RO.mo ├── wp-piwik-ro_RO.po ├── wp-piwik-ru_RU.mo ├── wp-piwik-ru_RU.po ├── wp-piwik-sl_SI.mo ├── wp-piwik-sl_SI.po ├── wp-piwik-sq.mo ├── wp-piwik-sq.po ├── wp-piwik-sv_SE.mo ├── wp-piwik-sv_SE.po ├── wp-piwik-tr_TR.mo ├── wp-piwik-tr_TR.po ├── wp-piwik-ua_UA.mo ├── wp-piwik-ua_UA.po ├── wp-piwik-uk_UA.mo ├── wp-piwik-uk_UA.po ├── wp-piwik-zh_CN.mo ├── wp-piwik-zh_CN.po └── wp-piwik.pot ├── logs └── .htaccess ├── proxy ├── config.php ├── index.php ├── matomo.php ├── piwik.php └── proxy.php ├── readme.txt ├── screenshot-1.gif ├── screenshot-2.gif ├── screenshot-3.gif ├── screenshot-4.gif ├── screenshot-5.gif ├── uninstall.php ├── update ├── .htaccess ├── 2015051101.php ├── 2017080701.php ├── 2021070701.php ├── 2023052301.php ├── 90001.php ├── 90801.php └── 91006.php ├── wp-piwik.php └── wpml-config.xml /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .idea/ 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Connect Matomo (former WP-Matomo, WP-Piwik) 2 | 3 | This [WordPress](https://wordpress.org) plugin adds a [Matomo](http://matomo.org) stats site to your blog's dashboard. It's also able to add the Matomo tracking code to your blog. 4 | 5 | ## How to use this plugin 6 | 7 | To use this plugin you will need your own Matomo instance. If you do not already have a Matomo setup, you have two simple options: use either [self-hosted](http://matomo.org/) or [cloud-hosted](http://matomo.org/hosting/). 8 | 9 | This repository was created to develop and maintain Connect Matomo (WP-Matomo, WP-Piwik). Please see the WordPress plugin directory if you like to use this plugin: https://wordpress.org/plugins/wp-piwik/ 10 | -------------------------------------------------------------------------------- /bitcoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/bitcoin.png -------------------------------------------------------------------------------- /classes/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all 2 | -------------------------------------------------------------------------------- /classes/WP_Piwik/Admin.php: -------------------------------------------------------------------------------- 1 | getPluginURL().'css/wp-piwik.css', array(), self::$wpPiwik->getPluginVersion()); 20 | } 21 | 22 | public function onLoad() {} 23 | 24 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Admin/Network.php: -------------------------------------------------------------------------------- 1 | getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 13 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL() . 'js/chartjs/chart.min.js', "3.4.1" ); 14 | } 15 | 16 | public function onLoad() { 17 | self::$wpPiwik->onloadStatsPage(self::$pageID); 18 | } 19 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Admin/Sitebrowser.php: -------------------------------------------------------------------------------- 1 | wpPiwik = $wpPiwik; 14 | if( isset($_POST['s']) ){ 15 | $cnt = $this->prepare_items ($_POST['s']); 16 | } else { 17 | $cnt = $this->prepare_items (); 18 | } 19 | global $status, $page; 20 | $this->showSearchForm(); 21 | parent::__construct ( array ( 22 | 'singular' => __ ( 'site', 'wp-piwik' ), 23 | 'plural' => __ ( 'sites', 'wp-piwik' ), 24 | 'ajax' => false 25 | ) ); 26 | if ($cnt > 0) 27 | $this->display (); 28 | else 29 | echo '

' . __ ( 'No site configured yet.', 'wp-piwik' ) . '

'; 30 | } 31 | 32 | public function get_columns() { 33 | $columns = array ( 34 | 'id' => __ ( 'Blog ID', 'wp-piwik' ), 35 | 'name' => __ ( 'Title', 'wp-piwik' ), 36 | 'siteurl' => __ ( 'URL', 'wp-piwik' ), 37 | 'piwikid' => __ ( 'Site ID (Piwik)', 'wp-piwik' ) 38 | ); 39 | return $columns; 40 | } 41 | 42 | public function prepare_items($search = '') { 43 | $current_page = $this->get_pagenum (); 44 | $per_page = 10; 45 | global $blog_id; 46 | global $wpdb; 47 | global $pagenow; 48 | if (is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' )) { 49 | $total_items = $wpdb->get_var ( $wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->blogs . ' WHERE CONCAT(domain, path) LIKE "%%%s%%" AND spam = 0 AND deleted = 0', $search)); 50 | $blogs = \WP_Piwik\Settings::getBlogList($per_page, $current_page, $search); 51 | foreach ( $blogs as $blog ) { 52 | $blogDetails = get_blog_details ( $blog['blog_id'], true ); 53 | $this->data [] = array ( 54 | 'name' => $blogDetails->blogname, 55 | 'id' => $blogDetails->blog_id, 56 | 'siteurl' => $blogDetails->siteurl, 57 | 'piwikid' => $this->wpPiwik->getPiwikSiteId ( $blogDetails->blog_id ) 58 | ); 59 | } 60 | } else { 61 | $blogDetails = get_bloginfo (); 62 | $this->data [] = array ( 63 | 'name' => get_bloginfo ( 'name' ), 64 | 'id' => '-', 65 | 'siteurl' => get_bloginfo ( 'url' ), 66 | 'piwikid' => $this->wpPiwik->getPiwikSiteId () 67 | ); 68 | $total_items = 1; 69 | } 70 | $columns = $this->get_columns (); 71 | $hidden = array (); 72 | $sortable = array (); 73 | $this->_column_headers = array ( 74 | $columns, 75 | $hidden, 76 | $sortable 77 | ); 78 | $this->set_pagination_args ( array ( 79 | 'total_items' => $total_items, 80 | 'per_page' => $per_page 81 | ) ); 82 | foreach ( $this->data as $key => $dataset ) { 83 | if (empty ( $dataset ['piwikid'] ) || $dataset ['piwikid'] == 'n/a') 84 | $this->data [$key] ['piwikid'] = __ ( 'Site not created yet.', 'wp-piwik' ); 85 | if ($this->wpPiwik->isNetworkMode ()) 86 | $this->data [$key] ['name'] = '' . $dataset ['name'] . ''; 87 | } 88 | $this->items = $this->data; 89 | return count ( $this->items ); 90 | } 91 | 92 | public function column_default($item, $column_name) { 93 | switch ($column_name) { 94 | case 'id' : 95 | case 'name' : 96 | case 'siteurl' : 97 | case 'piwikid' : 98 | return $item [$column_name]; 99 | default : 100 | return print_r ( $item, true ); 101 | } 102 | } 103 | 104 | private function showSearchForm() { 105 | ?> 106 |
107 | 108 | search_box('Search domain and path', 'wpPiwikSiteSearch'); ?> 109 |
110 | getGlobalOption('disable_timelimit')) set_time_limit(0); 11 | echo '
'; 12 | echo '

'.(self::$settings->getGlobalOption('plugin_display_name') == 'WP-Piwik'?'Piwik '.__('Statistics', 'wp-piwik'):self::$settings->getGlobalOption('plugin_display_name')).'

'; 13 | if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin()) { 14 | 15 | if (isset($_GET['wpmu_show_stats'])) { 16 | switch_to_blog((int) $_GET['wpmu_show_stats']); 17 | } elseif ((isset($_GET['overview']) && $_GET['overview']) || (function_exists('is_network_admin') && is_network_admin())) { 18 | new \WP_Piwik\Admin\Sitebrowser(self::$wpPiwik); 19 | return; 20 | } 21 | echo '

'.__('Currently shown stats:').' '.get_bloginfo('name').'.'.' Show site overview.

'; 22 | } 23 | echo '
'; 24 | wp_nonce_field('wp-piwik_stats-general'); 25 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); 26 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); 27 | $columns = array('normal', 'side', 'column3'); 28 | for ($i = 0; $i < 3; $i++) { 29 | echo '
'; 30 | do_meta_boxes(self::$wpPiwik->statsPageId, $columns[$i], null); 31 | echo '
'; 32 | } 33 | echo '
'; 34 | echo ''."\n"; 37 | if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin()) { 38 | restore_current_blog(); 39 | } 40 | } 41 | 42 | public function printAdminScripts() { 43 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 44 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Logger.php: -------------------------------------------------------------------------------- 1 | setName($loggerName); 15 | $this->setStartMicrotime(microtime(true)); 16 | $this->log('Logging started -------------------------------'); 17 | } 18 | 19 | public function __destruct() { 20 | $this->log('Logging finished ------------------------------'); 21 | } 22 | 23 | public function log($loggerMessage) { 24 | $this->loggerOutput($this->getElapsedMicrotime(), $loggerMessage); 25 | } 26 | 27 | private function setName($loggerName) { 28 | $this->loggerName = $loggerName; 29 | } 30 | 31 | public function getName() { 32 | return $this->loggerName; 33 | } 34 | 35 | private function setStartMicrotime($startMicrotime) { 36 | $this->startMicrotime = $startMicrotime; 37 | } 38 | 39 | public function getStartMicrotime() { 40 | return $this->startMicrotime; 41 | } 42 | 43 | public function getElapsedMicrotime() { 44 | return microtime(true) - $this->getStartMicrotime(); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Logger/Dummy.php: -------------------------------------------------------------------------------- 1 | loggerFile = WP_PIWIK_PATH.'logs'.DIRECTORY_SEPARATOR. 17 | date('Ymd').'_'.$this->encodeFilename($this->getName()).'.log'; 18 | } 19 | 20 | private function getFilename() { 21 | return $this->loggerFile; 22 | } 23 | 24 | private function openFile() { 25 | if (!$this->loggerFile) 26 | $this->setFilename(); 27 | return fopen($this->getFilename(), 'a'); 28 | } 29 | 30 | private function closeFile($fileHandle) { 31 | fclose($fileHandle); 32 | } 33 | 34 | private function writeFile($fileHandle, $fileContent) { 35 | fwrite($fileHandle, $fileContent."\n"); 36 | } 37 | 38 | private function formatMicrotime($loggerTime) { 39 | return sprintf('[%6s sec]',number_format($loggerTime,3)); 40 | } 41 | 42 | public function loggerOutput($loggerTime, $loggerMessage) { 43 | if ($fileHandle = $this->openFile()) { 44 | $this->writeFile($fileHandle, $this->formatMicrotime($loggerTime).' '.$loggerMessage); 45 | $this->closeFile($fileHandle); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Logger/Screen.php: -------------------------------------------------------------------------------- 1 | logs[] = $this->formatMicrotime($loggerTime).' '.$loggerMessage; 20 | } 21 | 22 | public function echoResults() { 23 | echo '
';
24 | 			print_r($this->logs);
25 | 			echo '
'; 26 | } 27 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Request.php: -------------------------------------------------------------------------------- 1 | $method, 'parameter' => $parameter); 41 | return $id; 42 | } 43 | 44 | private static function parameterToString($parameter) { 45 | $return = ''; 46 | if (is_array($parameter)) 47 | foreach ($parameter as $key => $value) 48 | $return .= '&'.$key.'='.$value; 49 | return $return; 50 | } 51 | 52 | public function perform($id) { 53 | if ( self::$settings->getGlobalOption('cache') && false !== ( $cached = get_transient( 'wp-piwik_c_'.md5(self::$isCacheable[$id] ) ) ) ) { 54 | if (!empty ( $cached ) && !(! empty ( $cached['result'] ) && $cached['result'] == 'error') ) { 55 | self::$wpPiwik->log("Deliver cached data: ".$id); 56 | return $cached; 57 | } 58 | } 59 | self::$wpPiwik->log("Perform request: ".$id); 60 | if (!isset(self::$requests[$id])) 61 | return array('result' => 'error', 'message' => 'Request '.$id.' was not registered.'); 62 | elseif (!isset(self::$results[$id])) { 63 | $this->request($id); 64 | } 65 | if ( isset ( self::$results[$id] ) ) { 66 | if ( self::$settings->getGlobalOption('cache') && self::$isCacheable[$id] ) { 67 | set_transient( 'wp-piwik_c_'.md5(self::$isCacheable[$id]) , self::$results[$id], WEEK_IN_SECONDS ); 68 | } 69 | return self::$results[$id]; 70 | } else return false; 71 | } 72 | 73 | public function getDebug($id) { 74 | return isset( self::$debug[$id] )? self::$debug[$id] : false; 75 | } 76 | 77 | protected function buildURL($config, $urlDecode = false) { 78 | $url = 'method='.($config['method']).'&idSite='.self::$settings->getOption('site_id'); 79 | foreach ($config['parameter'] as $key => $value) 80 | $url .= '&'.$key.'='.($urlDecode?urldecode($value):$value); 81 | return $url; 82 | } 83 | 84 | protected function unserialize($str) { 85 | self::$wpPiwik->log("Result string: ".$str); 86 | return ($str == json_decode(false, true) || @json_decode($str, true) !== false)?json_decode($str, true):array(); 87 | } 88 | 89 | public static function getLastError() { 90 | return self::$lastError; 91 | } 92 | 93 | abstract protected function request($id); 94 | 95 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Request/Php.php: -------------------------------------------------------------------------------- 1 | getGlobalOption('piwik_url'); 12 | foreach (self::$requests as $requestID => $config) { 13 | if (!isset(self::$results[$requestID])) { 14 | if (self::$settings->getGlobalOption('filter_limit') != "" && self::$settings->getGlobalOption('filter_limit') == (int) self::$settings->getGlobalOption('filter_limit')) 15 | $config['parameter']['filter_limit'] = self::$settings->getGlobalOption('filter_limit'); 16 | $params = 'module=API&format=json&'.$this->buildURL($config, true); 17 | $map[$count] = $requestID; 18 | $result = $this->call($id, $url, $params); 19 | self::$results[$map[$count]] = $result; 20 | $count++; 21 | } 22 | } 23 | } 24 | 25 | private function call($id, $url, $params) { 26 | if (!defined('PIWIK_INCLUDE_PATH')) 27 | return false; 28 | if (PIWIK_INCLUDE_PATH === FALSE) 29 | return array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' "'.htmlentities(self::$settings->getGlobalOption('piwik_path')).'": '.__('realpath() returns false','wp-piwik').'.'); 30 | if (file_exists(PIWIK_INCLUDE_PATH . "/index.php")) 31 | require_once PIWIK_INCLUDE_PATH . "/index.php"; 32 | if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php")) 33 | require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php"; 34 | if (class_exists('\Piwik\Application\Environment') && !self::$piwikEnvironment) { 35 | // Piwik 2.14.* compatibility fix 36 | self::$piwikEnvironment = new \Piwik\Application\Environment(null); 37 | self::$piwikEnvironment->init(); 38 | } 39 | if (class_exists('Piwik\FrontController')) 40 | \Piwik\FrontController::getInstance()->init(); 41 | else return array('result' => 'error', 'message' => __('Class Piwik\FrontController does not exists.','wp-piwik')); 42 | if (class_exists('Piwik\API\Request')) 43 | $request = new \Piwik\API\Request($params.'&token_auth='.self::$settings->getGlobalOption('piwik_token')); 44 | else return array('result' => 'error', 'message' => __('Class Piwik\API\Request does not exists.','wp-piwik')); 45 | if (isset($request)) 46 | $result = $request->process(); 47 | else $result = null; 48 | if (!headers_sent()) 49 | header("Content-Type: text/html", true); 50 | $result = $this->unserialize($result); 51 | if ($GLOBALS ['wp-piwik_debug']) 52 | self::$debug[$id] = array ( $params.'&token_auth=...' ); 53 | return $result; 54 | } 55 | 56 | public function reset() { 57 | if (class_exists('\Piwik\Application\Environment') && !self::$piwikEnvironment) { 58 | self::$piwikEnvironment->destroy(); 59 | } 60 | if (class_exists('Piwik\FrontController')) 61 | \Piwik\FrontController::unsetInstance(); 62 | parent::reset(); 63 | } 64 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Request/Rest.php: -------------------------------------------------------------------------------- 1 | getGlobalOption('piwik_mode') == 'http') 10 | $url = self::$settings->getGlobalOption('piwik_url'); 11 | else if (self::$settings->getGlobalOption('piwik_mode') == 'cloud') 12 | $url = 'https://'.self::$settings->getGlobalOption('piwik_user').'.innocraft.cloud/'; 13 | else $url = 'https://'.self::$settings->getGlobalOption('matomo_user').'.matomo.cloud/'; 14 | $params = 'module=API&method=API.getBulkRequest&format=json'; 15 | if (self::$settings->getGlobalOption('filter_limit') != "" && self::$settings->getGlobalOption('filter_limit') == (int) self::$settings->getGlobalOption('filter_limit')) 16 | $params .= '&filter_limit='.self::$settings->getGlobalOption('filter_limit'); 17 | foreach (self::$requests as $requestID => $config) { 18 | if (!isset(self::$results[$requestID])) { 19 | $params .= '&urls['.$count.']='.urlencode($this->buildURL($config)); 20 | $map[$count] = $requestID; 21 | $count++; 22 | } 23 | } 24 | $results = ((function_exists('curl_init') && ini_get('allow_url_fopen') && self::$settings->getGlobalOption('http_connection') == 'curl') || (function_exists('curl_init') && !ini_get('allow_url_fopen')))?$this->curl($id, $url, $params):$this->fopen($id, $url, $params); 25 | if (is_array($results)) 26 | foreach ($results as $num => $result) 27 | if (isset($map[$num])) 28 | self::$results[$map[$num]] = $result; 29 | } 30 | 31 | private function curl($id, $url, $params) { 32 | if (self::$settings->getGlobalOption('http_method')=='post') { 33 | $c = curl_init($url); 34 | curl_setopt($c, CURLOPT_POST, 1); 35 | curl_setopt($c, CURLOPT_POSTFIELDS, $params.'&token_auth='.self::$settings->getGlobalOption('piwik_token')); 36 | } else $c = curl_init($url.'?'.$params.'&token_auth='.self::$settings->getGlobalOption('piwik_token')); 37 | curl_setopt($c, CURLOPT_SSL_VERIFYPEER, !self::$settings->getGlobalOption('disable_ssl_verify')); 38 | curl_setopt($c, CURLOPT_SSL_VERIFYHOST, !self::$settings->getGlobalOption('disable_ssl_verify_host')?2:0); 39 | curl_setopt($c, CURLOPT_USERAGENT, self::$settings->getGlobalOption('piwik_useragent')=='php'?ini_get('user_agent'):self::$settings->getGlobalOption('piwik_useragent_string')); 40 | curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); 41 | curl_setopt($c, CURLOPT_HEADER, $GLOBALS ['wp-piwik_debug'] ); 42 | curl_setopt($c, CURLOPT_TIMEOUT, self::$settings->getGlobalOption('connection_timeout')); 43 | $httpProxyClass = new \WP_HTTP_Proxy(); 44 | if ($httpProxyClass->is_enabled() && $httpProxyClass->send_through_proxy($url)) { 45 | curl_setopt($c, CURLOPT_PROXY, $httpProxyClass->host()); 46 | curl_setopt($c, CURLOPT_PROXYPORT, $httpProxyClass->port()); 47 | if ($httpProxyClass->use_authentication()) 48 | curl_setopt($c, CURLOPT_PROXYUSERPWD, $httpProxyClass->username().':'.$httpProxyClass->password()); 49 | } 50 | $result = curl_exec($c); 51 | self::$lastError = curl_error($c); 52 | if ($GLOBALS ['wp-piwik_debug']) { 53 | $header_size = curl_getinfo($c, CURLINFO_HEADER_SIZE); 54 | $header = substr($result, 0, $header_size); 55 | $body = substr($result, $header_size); 56 | $result = $this->unserialize($body); 57 | self::$debug[$id] = array ( $header, $url.'?'.$params.'&token_auth=...' ); 58 | } else $result = $this->unserialize($result); 59 | curl_close($c); 60 | return $result; 61 | } 62 | 63 | private function fopen($id, $url, $params) { 64 | $contextDefinition = array('http'=>array('timeout' => self::$settings->getGlobalOption('connection_timeout'), 'header' => "Content-type: application/x-www-form-urlencoded\r\n") ); 65 | $contextDefinition['ssl'] = array(); 66 | if (self::$settings->getGlobalOption('disable_ssl_verify')) 67 | $contextDefinition['ssl'] = array('allow_self_signed' => true, 'verify_peer' => false ); 68 | if (self::$settings->getGlobalOption('disable_ssl_verify_host')) 69 | $contextDefinition['ssl']['verify_peer_name'] = false; 70 | if (self::$settings->getGlobalOption('http_method')=='post') { 71 | $fullUrl = $url; 72 | $contextDefinition['http']['method'] = 'POST'; 73 | $contextDefinition['http']['content'] = $params.'&token_auth='.self::$settings->getGlobalOption('piwik_token'); 74 | } else $fullUrl = $url.'?'.$params.'&token_auth='.self::$settings->getGlobalOption('piwik_token'); 75 | $context = stream_context_create($contextDefinition); 76 | $result = $this->unserialize(@file_get_contents($fullUrl, false, $context)); 77 | if ($GLOBALS ['wp-piwik_debug']) 78 | self::$debug[$id] = array ( get_headers($fullUrl, 1), $url.'?'.$params.'&token_auth=...' ); 79 | return $result; 80 | } 81 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Settings.php: -------------------------------------------------------------------------------- 1 | 'checkPiwikUrl', 25 | 'piwik_token' => 'checkPiwikToken', 26 | 'site_id' => 'requestPiwikSiteID', 27 | 'tracking_code' => 'prepareTrackingCode', 28 | 'noscript_code' => 'prepareNocscriptCode' 29 | ); 30 | 31 | /** 32 | * 33 | * @var Register default configuration set 34 | */ 35 | private $globalSettings = array ( 36 | // Plugin settings 37 | 'revision' => 0, 38 | 'last_settings_update' => 0, 39 | // User settings: Piwik configuration 40 | 'piwik_mode' => 'http', 41 | 'piwik_url' => '', 42 | 'piwik_path' => '', 43 | 'piwik_user' => '', 44 | 'matomo_user' => '', 45 | 'piwik_token' => '', 46 | 'auto_site_config' => true, 47 | // User settings: Stats configuration 48 | 'default_date' => 'yesterday', 49 | 'stats_seo' => false, 50 | 'stats_ecommerce' => false, 51 | 'dashboard_widget' => false, 52 | 'dashboard_ecommerce' => false, 53 | 'dashboard_chart' => false, 54 | 'dashboard_seo' => false, 55 | 'toolbar' => false, 56 | 'capability_read_stats' => array ( 57 | 'administrator' => true 58 | ), 59 | 'perpost_stats' => "disabled", 60 | 'plugin_display_name' => 'Connect Matomo', 61 | 'piwik_shortcut' => false, 62 | 'shortcodes' => false, 63 | // User settings: Tracking configuration 64 | 'track_mode' => 'disabled', 65 | 'track_codeposition' => 'footer', 66 | 'track_noscript' => false, 67 | 'track_nojavascript' => false, 68 | 'proxy_url' => '', 69 | 'track_content' => 'disabled', 70 | 'track_search' => false, 71 | 'track_404' => false, 72 | 'add_post_annotations' => array(), 73 | 'add_customvars_box' => false, 74 | 'add_download_extensions' => '', 75 | 'set_download_extensions' => '', 76 | 'set_link_classes' => '', 77 | 'set_download_classes' => '', 78 | 'require_consent' => 'disabled', 79 | 'disable_cookies' => false, 80 | 'limit_cookies' => false, 81 | 'limit_cookies_visitor' => 34186669, // Piwik default 13 months 82 | 'limit_cookies_session' => 1800, // Piwik default 30 minutes 83 | 'limit_cookies_referral' => 15778463, // Piwik default 6 months 84 | 'track_admin' => false, 85 | 'capability_stealth' => array (), 86 | 'track_across' => false, 87 | 'track_across_alias' => false, 88 | 'track_crossdomain_linking' => false, 89 | 'track_feed' => false, 90 | 'track_feed_addcampaign' => false, 91 | 'track_feed_campaign' => 'feed', 92 | 'track_heartbeat' => 0, 93 | 'track_user_id' => 'disabled', 94 | // User settings: Expert configuration 95 | 'cache' => true, 96 | 'http_connection' => 'curl', 97 | 'http_method' => 'post', 98 | 'disable_timelimit' => false, 99 | 'filter_limit' => '', 100 | 'connection_timeout' => 5, 101 | 'disable_ssl_verify' => false, 102 | 'disable_ssl_verify_host' => false, 103 | 'piwik_useragent' => 'php', 104 | 'piwik_useragent_string' => 'WP-Piwik', 105 | 'dnsprefetch' => false, 106 | 'track_datacfasync' => false, 107 | 'track_cdnurl' => '', 108 | 'track_cdnurlssl' => '', 109 | 'force_protocol' => 'disabled', 110 | 'remove_type_attribute' => false, 111 | 'update_notice' => 'enabled' 112 | ), $settings = array ( 113 | 'name' => '', 114 | 'site_id' => NULL, 115 | 'noscript_code' => '', 116 | 'tracking_code' => '', 117 | 'last_tracking_code_update' => 0, 118 | 'dashboard_revision' => 0 119 | ), $settingsChanged = false; 120 | 121 | /** 122 | * Constructor class to prepare settings manager 123 | * 124 | * @param WP_Piwik $wpPiwik 125 | * active WP-Piwik instance 126 | */ 127 | public function __construct($wpPiwik) { 128 | self::$wpPiwik = $wpPiwik; 129 | self::$wpPiwik->log ( 'Store default settings' ); 130 | self::$defaultSettings = array ( 131 | 'globalSettings' => $this->globalSettings, 132 | 'settings' => $this->settings 133 | ); 134 | self::$wpPiwik->log ( 'Load settings' ); 135 | foreach ( $this->globalSettings as $key => $default ) { 136 | $this->globalSettings [$key] = ($this->checkNetworkActivation () ? get_site_option ( 'wp-piwik_global-' . $key, $default ) : get_option ( 'wp-piwik_global-' . $key, $default )); 137 | } 138 | foreach ( $this->settings as $key => $default ) 139 | $this->settings [$key] = get_option ( 'wp-piwik-' . $key, $default ); 140 | } 141 | 142 | /** 143 | * Save all settings as WordPress options 144 | */ 145 | public function save() { 146 | if (! $this->settingsChanged) { 147 | self::$wpPiwik->log ( 'No settings changed yet' ); 148 | return; 149 | } 150 | self::$wpPiwik->log ( 'Save settings' ); 151 | $this->globalSettings['plugin_display_name'] = htmlspecialchars($this->globalSettings['plugin_display_name'], ENT_QUOTES, 'utf-8'); 152 | foreach ( $this->globalSettings as $key => $value ) { 153 | if ( $this->checkNetworkActivation() ) 154 | update_site_option ( 'wp-piwik_global-' . $key, $value ); 155 | else 156 | update_option ( 'wp-piwik_global-' . $key, $value ); 157 | } 158 | foreach ( $this->settings as $key => $value ) { 159 | update_option ( 'wp-piwik-' . $key, $value ); 160 | } 161 | global $wp_roles; 162 | if (! is_object ( $wp_roles )) 163 | $wp_roles = new \WP_Roles (); 164 | if (! is_object ( $wp_roles )) 165 | die ( "STILL NO OBJECT" ); 166 | foreach ( $wp_roles->role_names as $strKey => $strName ) { 167 | $objRole = get_role ( $strKey ); 168 | foreach ( array ( 169 | 'stealth', 170 | 'read_stats' 171 | ) as $strCap ) { 172 | $aryCaps = $this->getGlobalOption ( 'capability_' . $strCap ); 173 | if (isset ( $aryCaps [$strKey] ) && $aryCaps [$strKey]) 174 | $wp_roles->add_cap ( $strKey, 'wp-piwik_' . $strCap ); 175 | else $wp_roles->remove_cap ( $strKey, 'wp-piwik_' . $strCap ); 176 | } 177 | } 178 | $this->settingsChanged = false; 179 | } 180 | 181 | /** 182 | * Get a global option's value which should not be empty 183 | * 184 | * @param string $key 185 | * option key 186 | * @return string option value 187 | */ 188 | public function getNotEmptyGlobalOption($key) { 189 | return isset ( $this->globalSettings [$key] ) && !empty($this->globalSettings [$key]) ? $this->globalSettings [$key] : self::$defaultSettings ['globalSettings'] [$key]; 190 | } 191 | 192 | /** 193 | * Get a global option's value 194 | * 195 | * @param string $key 196 | * option key 197 | * @return string option value 198 | */ 199 | public function getGlobalOption($key) { 200 | return isset ( $this->globalSettings [$key] ) ? $this->globalSettings [$key] : self::$defaultSettings ['globalSettings'] [$key]; 201 | } 202 | 203 | /** 204 | * Get an option's value related to a specific blog 205 | * 206 | * @param string $key 207 | * option key 208 | * @param int $blogID 209 | * blog ID (default: current blog) 210 | * @return \WP_Piwik\Register 211 | */ 212 | public function getOption($key, $blogID = null) { 213 | if ($this->checkNetworkActivation () && ! empty ( $blogID )) { 214 | return get_blog_option ( $blogID, 'wp-piwik-'.$key ); 215 | } 216 | return isset ( $this->settings [$key] ) ? $this->settings [$key] : self::$defaultSettings ['settings'] [$key]; 217 | } 218 | 219 | /** 220 | * Set a global option's value 221 | * 222 | * @param string $key 223 | * option key 224 | * @param string $value 225 | * new option value 226 | */ 227 | public function setGlobalOption($key, $value) { 228 | $this->settingsChanged = true; 229 | self::$wpPiwik->log ( 'Changed global option ' . $key . ': ' . (is_array ( $value ) ? serialize ( $value ) : $value) ); 230 | $this->globalSettings [$key] = $value; 231 | } 232 | 233 | /** 234 | * Set an option's value related to a specific blog 235 | * 236 | * @param string $key 237 | * option key 238 | * @param string $value 239 | * new option value 240 | * @param int $blogID 241 | * blog ID (default: current blog) 242 | */ 243 | public function setOption($key, $value, $blogID = null) { 244 | if (empty( $blogID )) { 245 | $blogID = get_current_blog_id(); 246 | } 247 | $this->settingsChanged = true; 248 | self::$wpPiwik->log ( 'Changed option ' . $key . ': ' . $value ); 249 | if ($this->checkNetworkActivation ()) { 250 | update_blog_option ( $blogID, 'wp-piwik-'.$key, $value ); 251 | } 252 | if ($blogID == get_current_blog_id()) { 253 | $this->settings [$key] = $value; 254 | } 255 | } 256 | 257 | /** 258 | * Reset settings to default 259 | */ 260 | public function resetSettings() { 261 | self::$wpPiwik->log ( 'Reset WP-Piwik settings' ); 262 | global $wpdb; 263 | if ( $this->checkNetworkActivation() ) { 264 | $aryBlogs = self::getBlogList(); 265 | if (is_array($aryBlogs)) 266 | foreach ($aryBlogs as $aryBlog) { 267 | switch_to_blog($aryBlog['blog_id']); 268 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'wp-piwik-%'"); 269 | restore_current_blog(); 270 | } 271 | $wpdb->query("DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE 'wp-piwik_global-%'"); 272 | } 273 | else $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'wp-piwik_global-%'"); 274 | } 275 | 276 | /** 277 | * Get blog list 278 | */ 279 | public static function getBlogList($limit = null, $page = null, $search = '') { 280 | if ($limit && $page) 281 | $queryLimit = ' LIMIT '.(int) (($page - 1) * $limit).','.(int) $limit; 282 | global $wpdb; 283 | return $wpdb->get_results($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs.' WHERE CONCAT(domain, path) LIKE "%%%s%%" AND spam = 0 AND deleted = 0 ORDER BY blog_id'.$queryLimit, $search), ARRAY_A); 284 | } 285 | 286 | /** 287 | * Check if plugin is network activated 288 | * 289 | * @return boolean Is network activated? 290 | */ 291 | public function checkNetworkActivation() { 292 | if (! function_exists ( "is_plugin_active_for_network" )) 293 | require_once (ABSPATH . 'wp-admin/includes/plugin.php'); 294 | return is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' ); 295 | } 296 | 297 | /** 298 | * Apply new configuration 299 | * 300 | * @param array $in 301 | * new configuration set 302 | */ 303 | public function applyChanges($in) { 304 | if (!self::$wpPiwik->isValidOptionsPost()) 305 | die("Invalid config changes."); 306 | $in = $this->checkSettings ( $in ); 307 | self::$wpPiwik->log ( 'Apply changed settings:' ); 308 | foreach ( self::$defaultSettings ['globalSettings'] as $key => $val ) 309 | $this->setGlobalOption ( $key, isset ( $in [$key] ) ? $in [$key] : $val ); 310 | foreach ( self::$defaultSettings ['settings'] as $key => $val ) 311 | $this->setOption ( $key, isset ( $in [$key] ) ? $in [$key] : $val ); 312 | $this->setGlobalOption ( 'last_settings_update', time () ); 313 | $this->save (); 314 | } 315 | 316 | /** 317 | * Apply callback function on new settings 318 | * 319 | * @param array $in 320 | * new configuration set 321 | * @return array configuration set after callback functions were applied 322 | */ 323 | private function checkSettings($in) { 324 | foreach ( $this->checkSettings as $key => $value ) 325 | if (isset ( $in [$key] )) 326 | $in [$key] = call_user_func_array ( array ( 327 | $this, 328 | $value 329 | ), array ( 330 | $in [$key], 331 | $in 332 | ) ); 333 | return $in; 334 | } 335 | 336 | /** 337 | * Add slash to Piwik URL if necessary 338 | * 339 | * @param string $value 340 | * Piwik URL 341 | * @param array $in 342 | * configuration set 343 | * @return string Piwik URL 344 | */ 345 | private function checkPiwikUrl($value, $in) { 346 | return substr ( $value, - 1, 1 ) != '/' ? $value . '/' : $value; 347 | } 348 | 349 | /** 350 | * Remove &token_auth= from auth token 351 | * 352 | * @param string $value 353 | * Piwik auth token 354 | * @param array $in 355 | * configuration set 356 | * @return string Piwik auth token 357 | */ 358 | private function checkPiwikToken($value, $in) { 359 | return str_replace ( '&token_auth=', '', $value ); 360 | } 361 | 362 | /** 363 | * Request the site ID (if not set before) 364 | * 365 | * @param string $value 366 | * tracking code 367 | * @param array $in 368 | * configuration set 369 | * @return int Piwik site ID 370 | */ 371 | private function requestPiwikSiteID($value, $in) { 372 | if ($in ['auto_site_config'] && ! $value) 373 | return self::$wpPiwik->getPiwikSiteId(); 374 | return $value; 375 | } 376 | 377 | /** 378 | * Prepare the tracking code 379 | * 380 | * @param string $value 381 | * tracking code 382 | * @param array $in 383 | * configuration set 384 | * @return string tracking code 385 | */ 386 | private function prepareTrackingCode($value, $in) { 387 | if ($in ['track_mode'] == 'manually' || $in ['track_mode'] == 'disabled') { 388 | $value = stripslashes ( $value ); 389 | if ($this->checkNetworkActivation ()) 390 | update_site_option ( 'wp-piwik-manually', $value ); 391 | return $value; 392 | } 393 | /*$result = self::$wpPiwik->updateTrackingCode (); 394 | echo '
'; print_r($result); echo '
'; 395 | $this->setOption ( 'noscript_code', $result ['noscript'] );*/ 396 | return; // $result ['script']; 397 | } 398 | 399 | /** 400 | * Prepare the nocscript code 401 | * 402 | * @param string $value 403 | * noscript code 404 | * @param array $in 405 | * configuration set 406 | * @return string noscript code 407 | */ 408 | private function prepareNocscriptCode($value, $in) { 409 | if ($in ['track_mode'] == 'manually') 410 | return stripslashes ( $value ); 411 | return $this->getOption ( 'noscript_code' ); 412 | } 413 | 414 | /** 415 | * Get debug data 416 | * 417 | * @return array WP-Piwik settings for debug output 418 | */ 419 | public function getDebugData() { 420 | $debug = array( 421 | 'global_settings' => $this->globalSettings, 422 | 'settings' => $this->settings 423 | ); 424 | $debug['global_settings']['piwik_token'] = !empty($debug['global_settings']['piwik_token'])?'set':'not set'; 425 | return $debug; 426 | } 427 | } 428 | -------------------------------------------------------------------------------- /classes/WP_Piwik/Shortcode.php: -------------------------------------------------------------------------------- 1 | 'OptOut', 9 | 'post' => 'Post', 10 | 'overview' => 'Overview' 11 | ), $content; 12 | 13 | public function __construct($attributes, $wpPiwik, $settings) { 14 | $wpPiwik->log('Check requested shortcode widget '.$attributes['module']); 15 | if (isset($attributes['module']) && isset($this->available[$attributes['module']])) { 16 | $wpPiwik->log('Add shortcode widget '.$this->available[$attributes['module']]); 17 | $class = '\\WP_Piwik\\Widget\\'.$this->available[$attributes['module']]; 18 | $widget = new $class($wpPiwik, $settings, null, null, null, $attributes, true); 19 | $widget->show(); 20 | $this->content = $widget->get(); 21 | } 22 | } 23 | 24 | public function get() { 25 | return $this->content; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Template.php: -------------------------------------------------------------------------------- 1 | '.$name.''.$value.''; 23 | } 24 | 25 | public function getRangeLast30() { 26 | $diff = (self::$settings->getGlobalOption('default_date') == 'yesterday') ? -86400 : 0; 27 | $end = time() + $diff; 28 | $start = time() - 2592000 + $diff; 29 | return date('Y-m-d', $start).','.date('Y-m-d', $end); 30 | } 31 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Template/MetaBoxCustomVars.php: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |

. (.)

31 | post_type); 40 | // Check if the current user has permission to edit the post. 41 | if (!current_user_can($objPostType->cap->edit_post, $intID)) 42 | return $intID; 43 | $aryNames = array('cat', 'val'); 44 | for ($i = 1; $i <= 5; $i++) 45 | for ($j = 0; $j <= 1; $j++) { 46 | // Get data 47 | $strMetaVal = (isset($_POST['wp-piwik_custom_'.$aryNames[$j].$i])?htmlentities($_POST['wp-piwik_custom_'.$aryNames[$j].$i]):''); 48 | // Create key 49 | $strMetaKey = 'wp-piwik_custom_'.$aryNames[$j].$i; 50 | // Get the meta value of the custom field key 51 | $strCurVal = get_post_meta($intID, $strMetaKey, true); 52 | // Add meta val: 53 | if ($strMetaVal && '' == $strCurVal) 54 | add_post_meta($intID, $strMetaKey, $strMetaVal, true); 55 | // Update meta val: 56 | elseif ($strMetaVal && $strMetaVal != $strCurVal) 57 | update_post_meta($intID, $strMetaKey, $strMetaVal); 58 | // Delete meta val: 59 | elseif (''==$strMetaVal && $strCurVal) 60 | delete_post_meta($intID, $strMetaKey, $strCurVal); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/TrackingCode.php: -------------------------------------------------------------------------------- 1 | isCurrentTrackingCode () || ! self::$wpPiwik->getOption ( 'tracking_code' ) || strpos( self::$wpPiwik->getOption ( 'tracking_code' ), '{"result":"error",' ) !== false ) 16 | self::$wpPiwik->updateTrackingCode (); 17 | $this->trackingCode = (self::$wpPiwik->isNetworkMode () && self::$wpPiwik->getGlobalOption ( 'track_mode' ) == 'manually') ? get_site_option ( 'wp-piwik-manually' ) : self::$wpPiwik->getOption ( 'tracking_code' ); 18 | } 19 | 20 | public function getTrackingCode() { 21 | if ($this->isUsertracking) 22 | $this->applyUserTracking (); 23 | if ($this->is404) 24 | $this->apply404Changes (); 25 | if ($this->isSearch) 26 | $this->applySearchChanges (); 27 | if (is_single () || is_page()) 28 | $this->addCustomValues (); 29 | $this->trackingCode = apply_filters('wp-piwik_tracking_code', $this->trackingCode); 30 | return $this->trackingCode; 31 | } 32 | 33 | public static function prepareTrackingCode($code, $settings, $logger) { 34 | global $current_user; 35 | $logger->log ( 'Apply tracking code changes:' ); 36 | $settings->setOption ( 'last_tracking_code_update', time () ); 37 | if (preg_match ( '/var u="([^"]*)";/', $code, $hits )) { 38 | $fetchedProxyUrl = $hits [1]; 39 | } else $fetchedProxyUrl = ''; 40 | if ($settings->getGlobalOption ( 'remove_type_attribute')) { 41 | $code = str_replace ( 42 | array( ' type="text/javascript"', " type='text/javascript'" ), 43 | '', 44 | $code 45 | ); 46 | } 47 | if ($settings->getGlobalOption ( 'track_mode' ) == 'js') 48 | $code = str_replace ( array ( 49 | 'piwik.js', 50 | 'piwik.php', 51 | 'matomo.js', 52 | 'matomo.php' 53 | ), 'js/index.php', $code ); 54 | elseif ($settings->getGlobalOption ( 'track_mode' ) == 'proxy') { 55 | $code = str_replace ( 'piwik.js', 'matomo.php', $code ); 56 | $code = str_replace ( 'matomo.js', 'matomo.php', $code ); 57 | $code = str_replace ( 'piwik.php', 'matomo.php', $code ); 58 | $proxy = str_replace ( array ( 59 | 'https://', 60 | 'http://' 61 | ), '//', plugins_url ( 'wp-piwik' ) . '/proxy' ) . '/'; 62 | $code = preg_replace ( '/var u="([^"]*)";/', 'var u="' . $proxy . '"', $code ); 63 | $code = preg_replace ( '/img src="([^"]*)piwik.php/', 'img src="' . $proxy . 'matomo.php', $code ); 64 | $code = preg_replace ( '/img src="([^"]*)matomo.php/', 'img src="' . $proxy . 'matomo.php', $code ); 65 | } 66 | if ($settings->getGlobalOption ( 'track_cdnurl' ) || $settings->getGlobalOption ( 'track_cdnurlssl' )) 67 | $code = str_replace ( array ( 68 | "var d=doc", 69 | "g.src=u+" 70 | ), array ( 71 | "var ucdn=(('https:' == document.location.protocol) ? 'https://" . ($settings->getGlobalOption ( 'track_cdnurlssl' ) ? $settings->getGlobalOption ( 'track_cdnurlssl' ) : $settings->getGlobalOption ( 'track_cdnurl' )) . "/' : 'http://" . ($settings->getGlobalOption ( 'track_cdnurl' ) ? $settings->getGlobalOption ( 'track_cdnurl' ) : $settings->getGlobalOption ( 'track_cdnurlssl' )) . "/');\nvar d=doc", 72 | "g.src=ucdn+" 73 | ), $code ); 74 | 75 | if ($settings->getGlobalOption ( 'track_datacfasync' )) 76 | $code = str_replace ( ' 419 | getTimeSettings(); 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => $timeSettings['period'], 16 | 'date' => $timeSettings['date'] 17 | ); 18 | $this->title = $prefix.__('Browser Details', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 19 | $this->method = 'DevicesDetection.getBrowserVersions'; 20 | $this->context = 'normal'; 21 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 22 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 23 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 24 | } 25 | 26 | public function show() { 27 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 28 | $tableBody = array(); 29 | if (!empty($response['result']) && $response['result'] ='error') 30 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 31 | else { 32 | $tableHead = array(__('Browser', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 33 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 34 | else $unique = 'sum_daily_nb_uniq_visitors'; 35 | $count = 0; 36 | $sum = 0; 37 | $js = array(); 38 | $class = array(); 39 | if (is_array($response)) 40 | foreach ($response as $row) { 41 | $count++; 42 | $sum += isset($row[$unique])?$row[$unique]:0; 43 | if ($count < $this->limit) 44 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 45 | elseif (!isset($tableBody['Others'])) { 46 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 47 | $class['Others'] = 'wp-piwik-hideDetails'; 48 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 49 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 50 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 51 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 52 | } else { 53 | $tableBody['Others'][1] += $row[$unique]; 54 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 55 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 56 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 57 | } 58 | } 59 | if ($count > $this->limit) 60 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 61 | 62 | foreach ($tableBody as $key => $row) 63 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 64 | 65 | if (!empty($tableBody)) $this->pieChart($tableBody); 66 | $this->table($tableHead, $tableBody, null, false, $js, $class); 67 | } 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Browsers.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => $timeSettings['period'], 16 | 'date' => $timeSettings['date'] 17 | ); 18 | $this->title = $prefix.__('Browsers', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 19 | $this->method = 'DevicesDetection.getBrowsers'; 20 | $this->context = 'normal'; 21 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 22 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 23 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 24 | } 25 | 26 | public function show() { 27 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 28 | $tableBody = array(); 29 | if (!empty($response['result']) && $response['result'] ='error') 30 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 31 | else { 32 | $tableHead = array(__('Browser', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 33 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 34 | else $unique = 'sum_daily_nb_uniq_visitors'; 35 | $count = 0; 36 | $sum = 0; 37 | $js = array(); 38 | $class = array(); 39 | if (is_array($response)) 40 | foreach ($response as $row) { 41 | $count++; 42 | $sum += isset($row[$unique])?$row[$unique]:0; 43 | if ($count < $this->limit) 44 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 45 | elseif (!isset($tableBody['Others'])) { 46 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 47 | $class['Others'] = 'wp-piwik-hideDetails'; 48 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 49 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 50 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 51 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 52 | } else { 53 | $tableBody['Others'][1] += $row[$unique]; 54 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 55 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 56 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 57 | } 58 | } 59 | if ($count > $this->limit) 60 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 61 | elseif ($count == $this->limit) { 62 | $class['Others'] = $js['Others'] = ''; 63 | } 64 | 65 | foreach ($tableBody as $key => $row) 66 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 67 | 68 | if (!empty($tableBody)) $this->pieChart($tableBody); 69 | $this->table($tableHead, $tableBody, null, false, $js, $class); 70 | } 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Chart.php: -------------------------------------------------------------------------------- 1 | requestData(); 15 | $response = $result["response"]; 16 | if (!$result["success"]) { 17 | echo '' . __('Piwik error', 'wp-piwik') . ': ' . htmlentities($response[$method]['message'], ENT_QUOTES, 'utf-8'); 18 | } else { 19 | $values = $labels = $bounced = $unique = ''; 20 | $count = $uniqueSum = 0; 21 | if (is_array($response['VisitsSummary.getVisits'])) 22 | foreach ($response['VisitsSummary.getVisits'] as $date => $value) { 23 | $count++; 24 | $values .= $value . ','; 25 | $unique .= $response['VisitsSummary.getUniqueVisitors'][$date] . ','; 26 | $bounced .= $response['VisitsSummary.getBounceCount'][$date] . ','; 27 | if ($this->parameter['period'] == 'week') { 28 | preg_match("/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/", $date, $dateList); 29 | $textKey = $this->dateFormat($dateList[0], 'short_week'); 30 | } else $textKey = substr($date, -2); 31 | $labels .= '["' . $textKey . '"],'; 32 | $uniqueSum += $response['VisitsSummary.getActions'][$date]; 33 | } 34 | else { 35 | $values = '0,'; 36 | $labels = '[0,"-"],'; 37 | $unique = '0,'; 38 | $bounced = '0,'; 39 | } 40 | $average = round($uniqueSum / 30, 0); 41 | $values = substr($values, 0, -1); 42 | $unique = substr($unique, 0, -1); 43 | $labels = substr($labels, 0, -1); 44 | $bounced = substr($bounced, 0, -1); 45 | ?> 46 |
47 | 48 |
49 | 84 | getTimeSettings(); 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => $timeSettings['period'], 16 | 'date' => $timeSettings['date'] 17 | ); 18 | $this->title = $prefix.__('Cities', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 19 | $this->method = 'UserCountry.getCity'; 20 | $this->context = 'normal'; 21 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 22 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 23 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 24 | } 25 | 26 | public function show() { 27 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 28 | $tableBody = array(); 29 | if (!empty($response['result']) && $response['result'] ='error') 30 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 31 | else { 32 | $tableHead = array(__('City', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 33 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 34 | else $unique = 'sum_daily_nb_uniq_visitors'; 35 | $count = 0; 36 | $sum = 0; 37 | $js = array(); 38 | $class = array(); 39 | if (is_array($response)) 40 | foreach ($response as $row) { 41 | $count++; 42 | $sum += isset($row[$unique])?$row[$unique]:0; 43 | if ($count < $this->limit) 44 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 45 | elseif (!isset($tableBody['Others'])) { 46 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 47 | $class['Others'] = 'wp-piwik-hideDetails'; 48 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 49 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 50 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 51 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 52 | } else { 53 | $tableBody['Others'][1] += $row[$unique]; 54 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 55 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 56 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 57 | } 58 | } 59 | if ($count > $this->limit) 60 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 61 | elseif ($count == $this->limit) { 62 | $class['Others'] = $js['Others'] = ''; 63 | } 64 | 65 | foreach ($tableBody as $key => $row) 66 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 67 | 68 | if (!empty($tableBody)) $this->pieChart($tableBody); 69 | $this->table($tableHead, $tableBody, null, false, $js, $class); 70 | } 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Country.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => $timeSettings['period'], 16 | 'date' => $timeSettings['date'] 17 | ); 18 | $this->title = $prefix.__('Countries', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 19 | $this->method = 'UserCountry.getCountry '; 20 | $this->context = 'normal'; 21 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 22 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 23 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 24 | } 25 | 26 | public function show() { 27 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 28 | $tableBody = array(); 29 | if (!empty($response['result']) && $response['result'] ='error') 30 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 31 | else { 32 | $tableHead = array(__('Country', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 33 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 34 | else $unique = 'sum_daily_nb_uniq_visitors'; 35 | $count = 0; 36 | $sum = 0; 37 | $js = array(); 38 | $class = array(); 39 | if (is_array($response)) 40 | foreach ($response as $row) { 41 | $count++; 42 | $sum += isset($row[$unique])?$row[$unique]:0; 43 | if ($count < $this->limit) 44 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 45 | elseif (!isset($tableBody['Others'])) { 46 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 47 | $class['Others'] = 'wp-piwik-hideDetails'; 48 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 49 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 50 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 51 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 52 | } else { 53 | $tableBody['Others'][1] += $row[$unique]; 54 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 55 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 56 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 57 | } 58 | } 59 | if ($count > $this->limit) 60 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 61 | elseif ($count == $this->limit) { 62 | $class['Others'] = $js['Others'] = ''; 63 | } 64 | 65 | foreach ($tableBody as $key => $row) 66 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 67 | 68 | if (!empty($tableBody)) $this->pieChart($tableBody); 69 | $this->table($tableHead, $tableBody, null, false, $js, $class); 70 | } 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Ecommerce.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 13 | $this->title = $prefix . __('E-Commerce', 'wp-piwik'); 14 | $this->method = 'Goals.get'; 15 | $this->parameter = array( 16 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 17 | 'period' => $timeSettings['period'], 18 | 'date' => $timeSettings['date'] 19 | ); 20 | } 21 | 22 | public function show() 23 | { 24 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 25 | if (!empty($response['result']) && $response['result'] = 'error') 26 | echo '' . __('Piwik error', 'wp-piwik') . ': ' . htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 27 | else { 28 | $tableHead = null; 29 | $revenue = is_float($this->value($response, 'revenue')) ? number_format($this->value($response, 'revenue'), 2) : ""; 30 | $revenue_new = is_float($this->value($response, 'revenue_new_visit')) ? number_format($this->value($response, 'revenue_new_visit'), 2) : ""; 31 | $revenue_return = is_float($this->value($response, 'revenue_returning_visit')) ? number_format($this->value($response, 'revenue_returning_visit'), 2) : ""; 32 | $tableBody = array( 33 | array(__('Conversions', 'wp-piwik') . ':', $this->value($response, 'nb_conversions')), 34 | array(__('Visits converted', 'wp-piwik') . ':', $this->value($response, 'nb_visits_converted')), 35 | array(__('Revenue', 'wp-piwik') . ':', $revenue), 36 | array(__('Conversion rate', 'wp-piwik') . ':', $this->value($response, 'conversion_rate')), 37 | array(__('Conversions (new visitor)', 'wp-piwik') . ':', $this->value($response, 'nb_conversions_new_visit')), 38 | array(__('Visits converted (new visitor)', 'wp-piwik') . ':', $this->value($response, 'nb_visits_converted_new_visit')), 39 | array(__('Revenue (new visitor)', 'wp-piwik') . ':', $revenue_new), 40 | array(__('Conversion rate (new visitor)', 'wp-piwik') . ':', $this->value($response, 'conversion_rate_new_visit')), 41 | array(__('Conversions (returning visitor)', 'wp-piwik') . ':', $this->value($response, 'nb_conversions_returning_visit')), 42 | array(__('Visits converted (returning visitor)', 'wp-piwik') . ':', $this->value($response, 'nb_visits_converted_returning_visit')), 43 | array(__('Revenue (returning visitor)', 'wp-piwik') . ':', $revenue_return), 44 | array(__('Conversion rate (returning visitor)', 'wp-piwik') . ':', $this->value($response, 'conversion_rate_returning_visit')), 45 | ); 46 | $tableFoot = (self::$settings->getGlobalOption('piwik_shortcut') ? array(__('Shortcut', 'wp-piwik') . ':', 'Piwik' . (isset($aryConf['inline']) && $aryConf['inline'] ? ' - WP-Piwik' : '')) : null); 47 | $this->table($tableHead, $tableBody, $tableFoot); 48 | } 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Items.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->title = $prefix.__('E-Commerce Items', 'wp-piwik'); 12 | $this->method = 'Goals.getItemsName'; 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => $timeSettings['period'], 16 | 'date' => $timeSettings['date'] 17 | ); 18 | } 19 | 20 | public function show() { 21 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 22 | if (!empty($response['result']) && $response['result'] ='error') 23 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 24 | else { 25 | $tableHead = array( 26 | __('Label', 'wp-piwik'), 27 | __('Revenue', 'wp-piwik'), 28 | __('Quantity', 'wp-piwik'), 29 | __('Orders', 'wp-piwik'), 30 | __('Avg. price', 'wp-piwik'), 31 | __('Avg. quantity', 'wp-piwik'), 32 | __('Conversion rate', 'wp-piwik'), 33 | ); 34 | $tableBody = array(); 35 | if (is_array($response)) 36 | foreach ($response as $data) { 37 | array_push($tableBody, array( 38 | $data['label'], 39 | number_format($data['revenue'],2), 40 | $data['quantity'], 41 | $data['orders'], 42 | number_format($data['avg_price'],2), 43 | $data['avg_quantity'], 44 | $data['conversion_rate'] 45 | )); 46 | } 47 | $tableFoot = array(); 48 | $this->table($tableHead, $tableBody, $tableFoot); 49 | } 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/ItemsCategory.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->title = $prefix.__('E-Commerce Item Categories', 'wp-piwik'); 12 | $this->method = 'Goals.getItemsCategory'; 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => $timeSettings['period'], 16 | 'date' => $timeSettings['date'] 17 | ); 18 | } 19 | 20 | public function show() { 21 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 22 | if (!empty($response['result']) && $response['result'] ='error') 23 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 24 | else { 25 | $tableHead = array( 26 | __('Label', 'wp-piwik'), 27 | __('Revenue', 'wp-piwik'), 28 | __('Quantity', 'wp-piwik'), 29 | __('Orders', 'wp-piwik'), 30 | __('Avg. price', 'wp-piwik'), 31 | __('Avg. quantity', 'wp-piwik'), 32 | __('Conversion rate', 'wp-piwik'), 33 | ); 34 | $tableBody = array(); 35 | if (is_array($response)) 36 | foreach ($response as $data) { 37 | array_push($tableBody, array( 38 | $data['label'], 39 | isset($data['revenue'])?number_format($data['revenue'],2):"-.--", 40 | isset($data['quantity'])?$data['quantity']:'-', 41 | isset($data['orders'])?$data['orders']:'-', 42 | number_format($data['avg_price'],2), 43 | $data['avg_quantity'], 44 | $data['conversion_rate'] 45 | )); 46 | } 47 | $tableFoot = array(); 48 | $this->table($tableHead, $tableBody, $tableFoot); 49 | } 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Keywords.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->parameter = array( 12 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 13 | 'period' => $timeSettings['period'], 14 | 'date' => $timeSettings['date'] 15 | ); 16 | $this->title = $prefix.__('Keywords', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 17 | $this->method = 'Referrers.getKeywords'; 18 | $this->name = 'Keyword'; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Models.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => $timeSettings['period'], 16 | 'date' => $timeSettings['date'] 17 | ); 18 | $this->title = $prefix.__('Models', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 19 | $this->method = 'DevicesDetection.getModel'; 20 | $this->context = 'normal'; 21 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 22 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 23 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 24 | } 25 | 26 | public function show() { 27 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 28 | $tableBody = array(); 29 | if (!empty($response['result']) && $response['result'] ='error') 30 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 31 | else { 32 | $tableHead = array(__('Model', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 33 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 34 | else $unique = 'sum_daily_nb_uniq_visitors'; 35 | $count = 0; 36 | $sum = 0; 37 | $js = array(); 38 | $class = array(); 39 | if (is_array($response)) 40 | foreach ($response as $row) { 41 | $count++; 42 | $sum += isset($row[$unique])?$row[$unique]:0; 43 | if ($count < $this->limit) 44 | $tableBody[$row['label']] = array(htmlentities($row['label']), $row[$unique], 0); 45 | elseif (!isset($tableBody['Others'])) { 46 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 47 | $class['Others'] = 'wp-piwik-hideDetails'; 48 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 49 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 50 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 51 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 52 | } else { 53 | $tableBody['Others'][1] += $row[$unique]; 54 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 55 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 56 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 57 | } 58 | } 59 | if ($count > $this->limit) 60 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 61 | elseif ($count == $this->limit) { 62 | $class['Others'] = $js['Others'] = ''; 63 | } 64 | 65 | foreach ($tableBody as $key => $row) 66 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 67 | 68 | if (!empty($tableBody)) $this->pieChart($tableBody); 69 | $this->table($tableHead, $tableBody, null, false, $js, $class); 70 | } 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Noresult.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->parameter = array( 12 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 13 | 'period' => $timeSettings['period'], 14 | 'date' => $timeSettings['date'] 15 | ); 16 | $this->title = $prefix.__('Site Search', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 17 | $this->method = 'Actions.getSiteSearchNoResultKeywords'; 18 | } 19 | 20 | public function show() { 21 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 22 | if (!empty($response['result']) && $response['result'] ='error') 23 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 24 | else { 25 | $tableHead = array(__('Keyword', 'wp-piwik'), __('Requests', 'wp-piwik'), __('Bounced', 'wp-piwik')); 26 | $tableBody = array(); 27 | $count = 0; 28 | if (is_array($response)) 29 | foreach ($response as $row) { 30 | $count++; 31 | $tableBody[] = array($row['label'], $row['nb_visits'], $row['bounce_rate']); 32 | if ($count == 10) break; 33 | } 34 | $this->table($tableHead, $tableBody, null); 35 | } 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/OptOut.php: -------------------------------------------------------------------------------- 1 | parameter = $params; 13 | } 14 | 15 | public function show() 16 | { 17 | $protocol = (isset ($_SERVER ['HTTPS']) && $_SERVER ['HTTPS'] != 'off') ? 'https' : 'http'; 18 | switch (self::$settings->getGlobalOption('piwik_mode')) { 19 | case 'php' : 20 | $PIWIK_URL = $protocol . ':' . self::$settings->getGlobalOption('proxy_url'); 21 | break; 22 | case 'cloud' : 23 | $PIWIK_URL = 'https://' . self::$settings->getGlobalOption('piwik_user') . '.innocraft.cloud/'; 24 | break; 25 | case 'cloud-matomo': 26 | $PIWIK_URL = 'https://' . self::$settings->getGlobalOption('matomo_user') . '.matomo.cloud/'; 27 | break; 28 | default : 29 | $PIWIK_URL = self::$settings->getGlobalOption('piwik_url'); 30 | } 31 | $width = (isset($this->parameter['width']) ? esc_attr($this->parameter['width']) : ''); 32 | $height = (isset($this->parameter['height']) ? esc_attr($this->parameter['height']) : ''); 33 | $idSite = (isset($this->parameter['idsite']) ? 'idsite=' . (int)$this->parameter['idsite'] . '&' : ''); 34 | $language = (isset($this->parameter['language']) ? esc_attr($this->parameter['language']) : 'en'); 35 | $this->out(''); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Overview.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 13 | $this->parameter = array( 14 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 15 | 'period' => isset($params['period']) ? $params['period'] : $timeSettings['period'], 16 | 'date' => isset($params['date']) ? $params['date'] : $timeSettings['date'], 17 | 'description' => $timeSettings['description'] 18 | ); 19 | $this->title = !$this->isShortcode ? $prefix . __('Overview', 'wp-piwik') . ' (' . __($this->pageId == 'dashboard' ? $this->rangeName() : $timeSettings['description'], 'wp-piwik') . ')' : ($params['title'] ? $params['title'] : ''); 20 | $this->method = 'VisitsSummary.get'; 21 | } 22 | 23 | public function show() 24 | { 25 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 26 | if (!empty($response['result']) && $response['result'] = 'error') 27 | echo '' . __('Piwik error', 'wp-piwik') . ': ' . htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 28 | else { 29 | if (in_array($this->parameter['date'], array('last30', 'last60', 'last90'))) { 30 | $result = array(); 31 | if (is_array($response)) { 32 | foreach ($response as $data) 33 | foreach ($data as $key => $value) 34 | if (isset($result[$key]) && is_numeric($value)) 35 | $result[$key] += $value; 36 | elseif (is_numeric($value)) 37 | $result[$key] = $value; 38 | else 39 | $result[$key] = 0; 40 | if (isset($result['nb_visits']) && $result['nb_visits'] > 0) { 41 | $result['nb_actions_per_visit'] = round($result['nb_actions'] / $result['nb_visits'], 1); 42 | $result['bounce_rate'] = round($result['bounce_count'] / $result['nb_visits'] * 100, 1) . '%'; 43 | $result['avg_time_on_site'] = round($result['sum_visit_length'] / $result['nb_visits'], 0); 44 | } else $result['nb_actions_per_visit'] = $result['bounce_rate'] = $result['avg_time_on_site'] = 0; 45 | } 46 | $response = $result; 47 | } 48 | $time = isset($response['sum_visit_length']) ? $this->timeFormat($response['sum_visit_length']) : '-'; 49 | $avgTime = isset($response['avg_time_on_site']) ? $this->timeFormat($response['avg_time_on_site']) : '-'; 50 | $tableHead = null; 51 | $tableBody = array(array(__('Visitors', 'wp-piwik') . ':', $this->value($response, 'nb_visits'))); 52 | if ($this->value($response, 'nb_uniq_visitors') != '-') 53 | array_push($tableBody, array(__('Unique visitors', 'wp-piwik') . ':', $this->value($response, 'nb_uniq_visitors'))); 54 | array_push($tableBody, 55 | array(__('Page views', 'wp-piwik') . ':', $this->value($response, 'nb_actions') . ' (Ø ' . $this->value($response, 'nb_actions_per_visit') . ')'), 56 | array(__('Total time spent', 'wp-piwik') . ':', $time . ' (Ø ' . $avgTime . ')'), 57 | array(__('Bounce count', 'wp-piwik') . ':', $this->value($response, 'bounce_count') . ' (' . $this->value($response, 'bounce_rate') . ')') 58 | ); 59 | if (!in_array($this->parameter['date'], array('last30', 'last60', 'last90'))) 60 | array_push($tableBody, array(__('Time/visit', 'wp-piwik') . ':', $avgTime), array(__('Max. page views in one visit', 'wp-piwik') . ':', $this->value($response, 'max_actions'))); 61 | $tableFoot = (self::$settings->getGlobalOption('piwik_shortcut') ? array(__('Shortcut', 'wp-piwik') . ':', 'Matomo' . (isset($aryConf['inline']) && $aryConf['inline'] ? ' - WP-Piwik' : '')) : null); 62 | $this->table($tableHead, $tableBody, $tableFoot); 63 | } 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Pages.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->parameter = array( 12 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 13 | 'period' => $timeSettings['period'], 14 | 'date' => $timeSettings['date'] 15 | ); 16 | $this->title = $prefix.__('Pages', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 17 | $this->method = 'Actions.getPageTitles'; 18 | $this->name = __('Page', 'wp-piwik' ); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Plugins.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->parameter = array( 12 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 13 | 'period' => $timeSettings['period'], 14 | 'date' => $timeSettings['date'] 15 | ); 16 | $this->title = $prefix.__('Plugins', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 17 | $this->method = 'DevicePlugins.getPlugin'; 18 | } 19 | 20 | public function show() { 21 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 22 | if (!empty($response['result']) && $response['result'] ='error') 23 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 24 | else { 25 | $tableHead = array(__('Plugin', 'wp-piwik'), __('Visits', 'wp-piwik'), __('Percent', 'wp-piwik')); 26 | $tableBody = array(); 27 | $count = 0; 28 | if (is_array($response)) 29 | foreach ($response as $row) { 30 | $count++; 31 | $tableBody[] = array($row['label'], $row['nb_visits'], $row['nb_visits_percentage']); 32 | if ($count == 10) break; 33 | } 34 | $this->table($tableHead, $tableBody, null); 35 | } 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Post.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 12 | $this->parameter = array( 13 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 14 | 'period' => isset($params['period']) ? $params['period'] : $timeSettings['period'], 15 | 'date' => isset($params['date']) ? $params['date'] : $timeSettings['date'], 16 | 'key' => isset($params['key'])?$params['key']:null, 17 | 'pageUrl' => isset($params['url'])?$params['url']:urlencode(get_permalink($post->ID)), 18 | 'description' => $timeSettings['description'] 19 | ); 20 | $this->title = $prefix.__('Overview', 'wp-piwik').' ('.__($this->parameter['date'],'wp-piwik').')'; 21 | $this->method = 'Actions.getPageUrl'; 22 | } 23 | 24 | public function show() { 25 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 26 | if (!empty($response['result']) && $response['result'] = 'error') 27 | echo '' . __('Piwik error', 'wp-piwik') . ': ' . htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 28 | else { 29 | if (in_array($this->parameter['date'], array('last30', 'last60', 'last90'))) { 30 | $result = array(); 31 | if (is_array($response)) { 32 | foreach ($response as $data) { 33 | if (isset($data[0])) { 34 | foreach ($data[0] as $key => $value) 35 | if (isset($result[$key]) && is_numeric($value)) 36 | $result[$key] += $value; 37 | elseif (is_numeric($value)) 38 | $result[$key] = $value; 39 | else 40 | $result[$key] = 0; 41 | } 42 | } 43 | if (isset($result['nb_visits']) && $result['nb_visits'] > 0) { 44 | $result['nb_actions_per_visit'] = round((isset( $result['nb_actions'] ) ? $result['nb_actions'] : 0) / $result['nb_visits'], 1); 45 | $result['bounce_rate'] = round((isset($result['bounce_count']) ? $result['bounce_count'] : 0) / $result['nb_visits'] * 100, 1) . '%'; 46 | $result['avg_time_on_site'] = round((isset($result['sum_visit_length']) ? $result['sum_visit_length'] : 0) / $result['nb_visits'], 0); 47 | } else $result['nb_actions_per_visit'] = $result['bounce_rate'] = $result['avg_time_on_site'] = 0; 48 | } 49 | $response = $result; 50 | } else { 51 | if (isset($response[0])) 52 | $response = $response[0]; 53 | if ($this->parameter['key']) { 54 | $this->out(isset($response[$this->parameter['key']])?$response[$this->parameter['key']]:'not defined'); 55 | return; 56 | } 57 | } 58 | $time = isset($response['sum_visit_length']) ? $this->timeFormat($response['sum_visit_length']) : '-'; 59 | $avgTime = isset($response['avg_time_on_site']) ? $this->timeFormat($response['avg_time_on_site']) : '-'; 60 | $tableHead = null; 61 | $tableBody = array(array(__('Visitors', 'wp-piwik') . ':', $this->value($response, 'nb_visits'))); 62 | if ($this->value($response, 'nb_uniq_visitors') != '-') 63 | array_push($tableBody, array(__('Unique visitors', 'wp-piwik') . ':', $this->value($response, 'nb_uniq_visitors'))); 64 | elseif ($this->value($response, 'sum_daily_nb_uniq_visitors') != '-') { 65 | array_push($tableBody, __('Unique visitors', 'wp-piwik') . ':', $this->value($response, 'sum_daily_nb_uniq_visitors')); 66 | } 67 | array_push($tableBody, 68 | array(__('Page views', 'wp-piwik').':', $this->value($response, 'nb_hits').' (Ø '.$this->value($response, 'entry_nb_actions').')'), 69 | array(__('Total time spent', 'wp-piwik').':', $time), 70 | array(__('Bounce count', 'wp-piwik').':', $this->value($response, 'entry_bounce_count').' ('.$this->value($response, 'bounce_rate').')'), 71 | array(__('Time/visit', 'wp-piwik').':', $avgTime), 72 | array(__('Min. generation time', 'wp-piwik').':', $this->value($response, 'min_time_generation')), 73 | array(__('Max. generation time', 'wp-piwik').':', $this->value($response, 'max_time_generation')) 74 | ); 75 | if (!in_array($this->parameter['date'], array('last30', 'last60', 'last90'))) 76 | array_push($tableBody, array(__('Time/visit', 'wp-piwik') . ':', $avgTime), array(__('Max. page views in one visit', 'wp-piwik') . ':', $this->value($response, 'max_actions'))); 77 | $tableFoot = (self::$settings->getGlobalOption('piwik_shortcut') ? array(__('Shortcut', 'wp-piwik') . ':', 'Piwik' . (isset($aryConf['inline']) && $aryConf['inline'] ? ' - WP-Piwik' : '')) : null); 78 | $this->table($tableHead, $tableBody, $tableFoot); 79 | } 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Referrers.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->parameter = array( 12 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 13 | 'period' => $timeSettings['period'], 14 | 'date' => $timeSettings['date'] 15 | ); 16 | $this->title = $prefix.__('Referrers', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 17 | $this->method = 'Referrers.getWebsites'; 18 | $this->name = 'Referrer'; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Screens.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->parameter = array( 12 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 13 | 'period' => $timeSettings['period'], 14 | 'date' => $timeSettings['date'] 15 | ); 16 | $this->title = $prefix.__('Resolutions', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 17 | $this->method = 'Resolution.getResolution'; 18 | $this->context = 'normal'; 19 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 20 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 21 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 22 | } 23 | 24 | public function show() { 25 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 26 | $tableBody = array(); 27 | if (!empty($response['result']) && $response['result'] ='error') 28 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 29 | else { 30 | $tableHead = array(__('Resolution', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 31 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 32 | else $unique = 'sum_daily_nb_uniq_visitors'; 33 | $count = 0; 34 | $sum = 0; 35 | $js = array(); 36 | $class = array(); 37 | if (is_array($response)) 38 | foreach ($response as $row) { 39 | $count++; 40 | $sum += isset($row[$unique])?$row[$unique]:0; 41 | if ($count < $this->limit) 42 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 43 | elseif (!isset($tableBody['Others'])) { 44 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 45 | $class['Others'] = 'wp-piwik-hideDetails'; 46 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 47 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 48 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 49 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 50 | } else { 51 | $tableBody['Others'][1] += $row[$unique]; 52 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 53 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 54 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 55 | } 56 | } 57 | if ($count > $this->limit) 58 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 59 | 60 | foreach ($tableBody as $key => $row) 61 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 62 | 63 | if (!empty($tableBody)) $this->pieChart($tableBody); 64 | $this->table($tableHead, $tableBody, null, false, $js, $class); 65 | } 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Search.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 11 | $this->parameter = array( 12 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 13 | 'period' => $timeSettings['period'], 14 | 'date' => $timeSettings['date'] 15 | ); 16 | $this->title = $prefix.__('Site Search', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 17 | $this->method = 'Actions.getSiteSearchKeywords'; 18 | } 19 | 20 | public function show() { 21 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 22 | if (!empty($response['result']) && $response['result'] ='error') 23 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 24 | else { 25 | $tableHead = array(__('Keyword', 'wp-piwik'), __('Requests', 'wp-piwik'), __('Bounced', 'wp-piwik')); 26 | $tableBody = array(); 27 | $count = 0; 28 | if (is_array($response)) 29 | foreach ($response as $row) { 30 | $count++; 31 | $tableBody[] = array(htmlentities($row['label']), $row['nb_visits'], $row['bounce_rate']); 32 | if ($count == 10) break; 33 | } 34 | $this->table($tableHead, $tableBody, null); 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Seo.php: -------------------------------------------------------------------------------- 1 | parameter = array( 11 | 'url' => get_bloginfo('url') 12 | ); 13 | $this->title = $prefix.__('SEO', 'wp-piwik'); 14 | $this->method = 'SEO.getRank'; 15 | } 16 | 17 | public function show() { 18 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 19 | if (!empty($response['result']) && $response['result'] ='error') 20 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 21 | else { 22 | echo '
'; 23 | if (is_array($response)) 24 | foreach ($response as $val) 25 | echo ''; 26 | else echo ''; 27 | echo '
'.(isset($val['logo_link']) && !empty($val['logo_link'])?''.$val['label'].'':$val['label']).''.$val['rank'].'
SEO module currently not available.
'; 28 | } 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/SystemDetails.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 9 | $this->parameter = array( 10 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 11 | 'period' => $timeSettings['period'], 12 | 'date' => $timeSettings['date'] 13 | ); 14 | $this->title = $prefix.__('Operation System Details', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 15 | $this->method = 'DevicesDetection.getOsVersions'; 16 | $this->context = 'normal'; 17 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 18 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 19 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 20 | } 21 | 22 | public function show() { 23 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 24 | $tableBody = array(); 25 | if (!empty($response['result']) && $response['result'] ='error') 26 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 27 | else { 28 | $tableHead = array(__('Operation System', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 29 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 30 | else $unique = 'sum_daily_nb_uniq_visitors'; 31 | $count = 0; 32 | $sum = 0; 33 | $js = array(); 34 | $class = array(); 35 | if (is_array($response)) 36 | foreach ($response as $row) { 37 | $count++; 38 | $sum += isset($row[$unique])?$row[$unique]:0; 39 | if ($count < $this->limit) 40 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 41 | elseif (!isset($tableBody['Others'])) { 42 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 43 | $class['Others'] = 'wp-piwik-hideDetails'; 44 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 45 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 46 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 47 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 48 | } else { 49 | $tableBody['Others'][1] += $row[$unique]; 50 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 51 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 52 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 53 | } 54 | } 55 | if ($count > $this->limit) 56 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 57 | 58 | foreach ($tableBody as $key => $row) 59 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 60 | 61 | if (!empty($tableBody)) $this->pieChart($tableBody); 62 | $this->table($tableHead, $tableBody, null, false, $js, $class); 63 | } 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Systems.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 9 | $this->parameter = array( 10 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 11 | 'period' => $timeSettings['period'], 12 | 'date' => $timeSettings['date'] 13 | ); 14 | $this->title = $prefix.__('Operation Systems', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')'; 15 | $this->method = 'DevicesDetection.getOsFamilies'; 16 | $this->context = 'normal'; 17 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 18 | wp_enqueue_script ( 'wp-piwik-chartjs', self::$wpPiwik->getPluginURL () . 'js/chartjs/chart.min.js', "3.4.1" ); 19 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion()); 20 | } 21 | 22 | public function show() { 23 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 24 | $tableBody = array(); 25 | if (!empty($response['result']) && $response['result'] ='error') 26 | echo ''.__('Piwik error', 'wp-piwik').': '.htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 27 | else { 28 | $tableHead = array(__('Operation System', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 29 | if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors'; 30 | else $unique = 'sum_daily_nb_uniq_visitors'; 31 | $count = 0; 32 | $sum = 0; 33 | $js = array(); 34 | $class = array(); 35 | if (is_array($response)) 36 | foreach ($response as $row) { 37 | $count++; 38 | $sum += isset($row[$unique])?$row[$unique]:0; 39 | if ($count < $this->limit) 40 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 41 | elseif (!isset($tableBody['Others'])) { 42 | $tableBody['Others'] = array($row['label'], $row[$unique], 0); 43 | $class['Others'] = 'wp-piwik-hideDetails'; 44 | $js['Others'] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 45 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 46 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 47 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 48 | } else { 49 | $tableBody['Others'][1] += $row[$unique]; 50 | $tableBody[$row['label']] = array($row['label'], $row[$unique], 0); 51 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 52 | $js[$row['label']] = '$j'."( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 53 | } 54 | } 55 | if ($count > $this->limit) 56 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 57 | 58 | foreach ($tableBody as $key => $row) 59 | $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%'; 60 | 61 | if (!empty($tableBody)) $this->pieChart($tableBody); 62 | $this->table($tableHead, $tableBody, null, false, $js, $class); 63 | } 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Types.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 15 | $this->parameter = array( 16 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 17 | 'period' => $timeSettings['period'], 18 | 'date' => $timeSettings['date'] 19 | ); 20 | $this->title = $prefix . __('Types', 'wp-piwik') . ' (' . __($timeSettings['description'], 'wp-piwik') . ')'; 21 | $this->method = 'DevicesDetection.getType'; 22 | $this->context = 'normal'; 23 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL() . 'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 24 | wp_enqueue_script('wp-piwik-chartjs', self::$wpPiwik->getPluginURL() . 'js/chartjs/chart.min.js', "3.4.1"); 25 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL() . 'css/wp-piwik.css', array(), self::$wpPiwik->getPluginVersion()); 26 | } 27 | 28 | public function show() 29 | { 30 | $response = self::$wpPiwik->request($this->apiID[$this->method]); 31 | $tableBody = array(); 32 | if (!empty($response['result']) && $response['result'] = 'error') 33 | echo '' . __('Piwik error', 'wp-piwik') . ': ' . htmlentities($response['message'], ENT_QUOTES, 'utf-8'); 34 | else { 35 | $tableHead = array(__('Type', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik')); 36 | if (isset($response[0]['nb_uniq_visitors'])) { 37 | $unique = 'nb_uniq_visitors'; 38 | } else { 39 | $unique = 'sum_daily_nb_uniq_visitors'; 40 | } 41 | $count = 0; 42 | $sum = 0; 43 | $js = array(); 44 | $class = array(); 45 | if (is_array($response)) 46 | foreach ($response as $row) { 47 | $key = isset($row[$unique]) ? $unique : "nb_visits"; 48 | $count++; 49 | $sum += isset($row[$key]) ? $row[$key] : 0; 50 | if ($count < $this->limit) 51 | $tableBody[$row['label']] = array($row['label'], $row[$key], 0); 52 | elseif (!isset($tableBody['Others'])) { 53 | $tableBody['Others'] = array($row['label'], $row[$key], 0); 54 | $class['Others'] = 'wp-piwik-hideDetails'; 55 | $js['Others'] = '$j' . "( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 56 | $tableBody[$row['label']] = array($row['label'], $row[$key], 0); 57 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 58 | $js[$row['label']] = '$j' . "( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 59 | } else { 60 | $tableBody['Others'][1] += $row[$key]; 61 | $tableBody[$row['label']] = array($row['label'], $row[$key], 0); 62 | $class[$row['label']] = 'wp-piwik-hideDetails hidden'; 63 | $js[$row['label']] = '$j' . "( '.wp-piwik-hideDetails' ).toggle( 'hidden' );"; 64 | } 65 | } 66 | if ($count > $this->limit) { 67 | $tableBody['Others'][0] = __('Others', 'wp-piwik'); 68 | } elseif ($count == $this->limit) { 69 | $class['Others'] = $js['Others'] = ''; 70 | } 71 | 72 | foreach ($tableBody as $key => $row) 73 | $tableBody[$key][2] = number_format($row[1] / $sum * 100, 2) . '%'; 74 | 75 | if (!empty($tableBody)) $this->pieChart($tableBody); 76 | $this->table($tableHead, $tableBody, null, false, $js, $class); 77 | } 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /classes/WP_Piwik/Widget/Visitors.php: -------------------------------------------------------------------------------- 1 | getTimeSettings(); 15 | $this->parameter = array( 16 | 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId), 17 | 'period' => isset($params['period']) ? $params['period'] : $timeSettings['period'], 18 | 'date' => 'last' . ($timeSettings['period'] == 'day' ? '30' : '12'), 19 | 'limit' => null 20 | ); 21 | $this->title = $prefix . __('Visitors', 'wp-piwik') . ' (' . __($this->rangeName(), 'wp-piwik') . ')'; 22 | $this->method = array('VisitsSummary.getVisits', 'VisitsSummary.getUniqueVisitors', 'VisitsSummary.getBounceCount', 'VisitsSummary.getActions'); 23 | $this->context = 'normal'; 24 | wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL() . 'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true); 25 | wp_enqueue_script('wp-piwik-chartjs', self::$wpPiwik->getPluginURL() . 'js/chartjs/chart.min.js', "3.4.1"); 26 | wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL() . 'css/wp-piwik.css', array(), self::$wpPiwik->getPluginVersion()); 27 | } 28 | 29 | public function requestData() 30 | { 31 | $response = array(); 32 | $success = true; 33 | foreach ($this->method as $method) { 34 | $response[$method] = self::$wpPiwik->request($this->apiID[$method]); 35 | if (!empty($response[$method]['result']) && $response[$method]['result'] = 'error') 36 | $success = false; 37 | } 38 | return array("response" => $response, "success" => $success); 39 | } 40 | 41 | public function show() 42 | { 43 | $result = $this->requestData(); 44 | $response = $result["response"]; 45 | if (!$result["success"]) { 46 | echo '' . __('Piwik error', 'wp-piwik') . ': ' . htmlentities($response[$method]['message'], ENT_QUOTES, 'utf-8'); 47 | } else { 48 | $data = array(); 49 | if (is_array($response) && is_array($response['VisitsSummary.getVisits'])) 50 | foreach ($response['VisitsSummary.getVisits'] as $key => $value) { 51 | if ($this->parameter['period'] == 'week') { 52 | preg_match("/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/", $key, $dateList); 53 | $jsKey = $dateList[0]; 54 | $textKey = $this->dateFormat($jsKey, 'week'); 55 | } elseif ($this->parameter['period'] == 'month') { 56 | $jsKey = $key . '-01'; 57 | $textKey = $key; 58 | } else $jsKey = $textKey = $key; 59 | $data[] = array( 60 | $textKey, 61 | $value, 62 | $response['VisitsSummary.getUniqueVisitors'][$key] ? $response['VisitsSummary.getUniqueVisitors'][$key] : '-', 63 | $response['VisitsSummary.getBounceCount'][$key] ? $response['VisitsSummary.getBounceCount'][$key] : '-', 64 | $response['VisitsSummary.getActions'][$key] ? $response['VisitsSummary.getActions'][$key] : '-' 65 | ); 66 | $javaScript[] = 'javascript:wp_piwik_datelink(\'' . urlencode('wp-piwik_stats') . '\',\'' . str_replace('-', '', $jsKey) . '\',\'' . (isset($_GET['wpmu_show_stats']) ? (int)$_GET['wpmu_show_stats'] : '') . '\');'; 67 | } 68 | $this->table( 69 | array(__('Date', 'wp-piwik'), __('Visits', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Bounced', 'wp-piwik'), __('Page Views', 'wp-piwik')), 70 | array_reverse($data), 71 | array(), 72 | 'clickable', 73 | array_reverse(isset($javaScript) ? $javaScript : []) 74 | ); 75 | } 76 | 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /config.php: -------------------------------------------------------------------------------- 1 | 2 |
3 | Simple yet flexible JavaScript charting for designers & developers 4 |

5 | 6 |

7 | Downloads 8 | GitHub Workflow Status 9 | Coverage 10 | Awesome 11 | Slack 12 |

13 | 14 | ## Documentation 15 | 16 | All the links point to the new version 3 of the lib. 17 | 18 | * [Introduction](https://www.chartjs.org/docs/latest/) 19 | * [Getting Started](https://www.chartjs.org/docs/latest/getting-started/index) 20 | * [General](https://www.chartjs.org/docs/latest/general/data-structures) 21 | * [Configuration](https://www.chartjs.org/docs/latest/configuration/index) 22 | * [Charts](https://www.chartjs.org/docs/latest/charts/line) 23 | * [Axes](https://www.chartjs.org/docs/latest/axes/index) 24 | * [Developers](https://www.chartjs.org/docs/latest/developers/index) 25 | * [Popular Extensions](https://github.com/chartjs/awesome) 26 | * [Samples](https://www.chartjs.org/samples/) 27 | 28 | In case you are looking for the docs of version 2, you will have to specify the specific version in the url like this: [https://www.chartjs.org/docs/2.9.4/](https://www.chartjs.org/docs/2.9.4/) 29 | 30 | ## Contributing 31 | 32 | Instructions on building and testing Chart.js can be found in [the documentation](https://www.chartjs.org/docs/master/developers/contributing.html#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://www.chartjs.org/docs/master/developers/contributing) first. For support, please post questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/chartjs) with the `chartjs` tag. 33 | 34 | ## License 35 | 36 | Chart.js is available under the [MIT license](https://opensource.org/licenses/MIT). 37 | -------------------------------------------------------------------------------- /js/index.php: -------------------------------------------------------------------------------- 1 | .po 6 | source_file = wp-piwik.pot 7 | source_lang = en 8 | type = PO 9 | 10 | -------------------------------------------------------------------------------- /languages/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "== Fetch updated language files ====" 3 | tx pull -a 4 | echo "== Convert po to po ================" 5 | for file in `find . -name "*.po"` ; do echo $file; msgfmt -v -o ${file/.po/.mo} $file ; done 6 | -------------------------------------------------------------------------------- /languages/wp-piwik-az_AZ.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-az_AZ.mo -------------------------------------------------------------------------------- /languages/wp-piwik-be_BY.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-be_BY.mo -------------------------------------------------------------------------------- /languages/wp-piwik-cs_CZ.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-cs_CZ.mo -------------------------------------------------------------------------------- /languages/wp-piwik-de_CH.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-de_CH.mo -------------------------------------------------------------------------------- /languages/wp-piwik-de_DE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-de_DE.mo -------------------------------------------------------------------------------- /languages/wp-piwik-el.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-el.mo -------------------------------------------------------------------------------- /languages/wp-piwik-el_GR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-el_GR.mo -------------------------------------------------------------------------------- /languages/wp-piwik-el_GR.po: -------------------------------------------------------------------------------- 1 | # Translation of the WordPress plugin WP-Piwik 0.8.0 by André Bräkling. 2 | # Copyright (C) 2010 André Bräkling 3 | # This file is distributed under the same license as the WP-Piwik package. 4 | # André Bräkling , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: WP-Piwik 0.8.6\n" 9 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-piwik\n" 10 | "POT-Creation-Date: 2010-07-19 18:06+0000\n" 11 | "PO-Revision-Date: 2011-04-29 20:30+0200\n" 12 | "Last-Translator: Harry \n" 13 | "Language-Team: AggelioPolis.gr\n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=utf-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | "X-Poedit-Language: Greek\n" 18 | "X-Poedit-Country: GREECE\n" 19 | 20 | #: dashboard/browsers.php:12 21 | #: dashboard/browsers.php:33 22 | msgid "Browser" 23 | msgstr "Browser" 24 | 25 | #: dashboard/browsers.php:22 26 | #: dashboard/pages.php:43 27 | #: dashboard/screens.php:22 28 | #: dashboard/systems.php:22 29 | msgid "Others" 30 | msgstr "Άλλοι" 31 | 32 | #: dashboard/browsers.php:34 33 | #: dashboard/keywords.php:17 34 | #: dashboard/pages.php:22 35 | #: dashboard/screens.php:33 36 | #: dashboard/systems.php:35 37 | #: dashboard/visitors.php:53 38 | #: dashboard/websites.php:19 39 | #: wp-piwik.php:305 40 | msgid "Unique" 41 | msgstr "Μοναδικοί" 42 | 43 | #: dashboard/browsers.php:35 44 | #: dashboard/plugins.php:33 45 | #: dashboard/screens.php:34 46 | #: dashboard/systems.php:36 47 | msgid "Percent" 48 | msgstr "Τοις εκατό" 49 | 50 | #: dashboard/keywords.php:12 51 | msgid "Keywords" 52 | msgstr "Λέξεις κλειδιά" 53 | 54 | #: dashboard/keywords.php:17 55 | msgid "Keyword" 56 | msgstr "Λέξη κλειδί" 57 | 58 | #: dashboard/overview.php:12 59 | msgid "Overview" 60 | msgstr "Επισκόπηση" 61 | 62 | #: dashboard/overview.php:42 63 | #: dashboard/visitors.php:24 64 | msgid "Visitors" 65 | msgstr "Επισκέπτες" 66 | 67 | #: dashboard/overview.php:43 68 | msgid "Unique visitors" 69 | msgstr "Μοναδικοί επισκέπτες" 70 | 71 | #: dashboard/overview.php:44 72 | msgid "Page views" 73 | msgstr "Προβολές σελίδων" 74 | 75 | #: dashboard/overview.php:45 76 | msgid "Max. page views in one visit" 77 | msgstr "Ανώτατο όριο προβολών σελίδων σε μια επίσκεψη" 78 | 79 | #: dashboard/overview.php:46 80 | msgid "Total time spent" 81 | msgstr "Συνολικός χρόνος" 82 | 83 | msgid "Time/visit" 84 | msgstr "Χρόνος/Επίσκεψη" 85 | 86 | #: dashboard/overview.php:47 87 | msgid "Bounce count" 88 | msgstr "Αριθμός που εγκατέλειψαν" 89 | 90 | #: dashboard/overview.php:49 91 | #: wp-piwik.php:563 92 | msgid "Shortcut" 93 | msgstr "Συντόμευση" 94 | 95 | #: dashboard/pages.php:13 96 | msgid "Pages" 97 | msgstr "Σελίδες" 98 | 99 | #: dashboard/pages.php:21 100 | msgid "Page" 101 | msgstr "Σελίδα" 102 | 103 | #: dashboard/pages.php:23 104 | #: dashboard/plugins.php:32 105 | #: dashboard/visitors.php:52 106 | msgid "Visits" 107 | msgstr "Επισκέψεις" 108 | 109 | #: dashboard/plugins.php:12 110 | #: dashboard/plugins.php:31 111 | msgid "Plugins" 112 | msgstr "Plugins" 113 | 114 | #: dashboard/screens.php:12 115 | #: dashboard/screens.php:32 116 | msgid "Resolution" 117 | msgstr "Ανάλυση" 118 | 119 | #: dashboard/systems.php:12 120 | #: dashboard/systems.php:34 121 | msgid "Operating System" 122 | msgstr "Λειτουργικό Σύστημα" 123 | 124 | #: dashboard/visitors.php:51 125 | msgid "Date" 126 | msgstr "Ημερομηνία" 127 | 128 | #: dashboard/visitors.php:54 129 | msgid "Bounced" 130 | msgstr "Εγκατέλειψαν" 131 | 132 | #: dashboard/visitors.php:67 133 | msgid "Unique TOTAL" 134 | msgstr "Unique ΆΘΡΟΙΣΜΑ" 135 | 136 | #: dashboard/visitors.php:67 137 | msgid "Sum" 138 | msgstr "Άθροισμα" 139 | 140 | #: dashboard/visitors.php:67 141 | msgid "Avg" 142 | msgstr "Μέσος Όρος" 143 | 144 | #: dashboard/websites.php:12 145 | msgid "Websites" 146 | msgstr "Ιστοσελίδες" 147 | 148 | #: dashboard/websites.php:18 149 | msgid "Website" 150 | msgstr "Ιστοσελίδα" 151 | 152 | #: wp-piwik.php:110 153 | #: wp-piwik.php:365 154 | msgid "Piwik Statistics" 155 | msgstr "Piwik Στατιστικά" 156 | 157 | #. #-#-#-#-# plugin.pot (WP-Piwik 0.8.0) #-#-#-#-# 158 | #. Plugin Name of the plugin/theme 159 | #: wp-piwik.php:111 160 | #: wp-piwik.php:122 161 | #: wp-piwik.php:123 162 | #: wp-piwik.php:146 163 | msgid "WP-Piwik" 164 | msgstr "WP-Piwik" 165 | 166 | #: wp-piwik.php:130 167 | #: wp-piwik.php:131 168 | msgid "WPMU-Piwik" 169 | msgstr "WPMU-Piwik" 170 | 171 | #: wp-piwik.php:142 172 | #: wp-piwik.php:557 173 | msgid "yesterday" 174 | msgstr "χθες" 175 | 176 | #: wp-piwik.php:143 177 | #: wp-piwik.php:558 178 | msgid "today" 179 | msgstr "σήμερα" 180 | 181 | #: wp-piwik.php:144 182 | #: wp-piwik.php:559 183 | msgid "last 30 days" 184 | msgstr "τελευταίες 30 ημέρες" 185 | 186 | #: wp-piwik.php:179 187 | msgid "Settings" 188 | msgstr "Ρυθμίσεις" 189 | 190 | #: wp-piwik.php:381 191 | msgid "Change" 192 | msgstr "Αλλαγή" 193 | 194 | #: wp-piwik.php:382 195 | msgid "Currently shown stats:" 196 | msgstr "Τρέχουσα προβολή στατιστικών:" 197 | 198 | #: wp-piwik.php:383 199 | msgid "Current shown stats: Overall" 200 | msgstr "Τρέχουσα προβολή στατιστικών: Συνολικά" 201 | 202 | #: wp-piwik.php:448 203 | msgid "WP-Piwik Settings" 204 | msgstr "WP-Piwik Ρυθμίσεις" 205 | 206 | #: wp-piwik.php:455 207 | #: wp-piwik.php:617 208 | msgid "Account settings" 209 | msgstr "Ρυθμίσεις Λογαριασμού" 210 | 211 | #: wp-piwik.php:457 212 | #: wp-piwik.php:619 213 | msgid "Piwik URL" 214 | msgstr "Piwik URL" 215 | 216 | #: wp-piwik.php:461 217 | #: wp-piwik.php:623 218 | msgid "Auth token" 219 | msgstr "Σύμβολο γνησιότητας" 220 | 221 | #: wp-piwik.php:467 222 | #: wp-piwik.php:628 223 | msgid "To enable Piwik statistics, please enter your Piwik base URL (like http://mydomain.com/piwik) and your personal authentification token. You can get the token on the API page inside your Piwik interface. It looks like "1234a5cd6789e0a12345b678cd9012ef"." 224 | msgstr "Για να ενεργοποιήσετε τα Piwik στατιστικά, παρακαλώ εισάγετε τη βασική Piwik URL σας (π.χ. http://mydomain.com/piwik) και τo προσωπικό σύμβολο (token) γνησιότητας. Μπορείτε να το βρείτε στη σελίδα API μέσα στη διεπαφή του Piwik. Μοιάζει με: "1234a5cd6789e0a12345b678cd9012ef"." 225 | 226 | #: wp-piwik.php:477 227 | msgid "Important note: If you do not host this blog on your own, your site admin is able to get your auth token from the database. So he is able to access your statistics. You should never use an auth token with more than simple view access!" 228 | msgstr "Σημαντική Σημείωση: Εάν δεν φιλοξενείται το ιστολόγιο από εσάς, τότε ο διαχειριστής θα μπορεί να έχει πρόσβαση στο σύμβολο γνησιότητας (auth token) σας από τη βάση δεδομένων. Έτσι θα έχει πρόσβαση στα στατιστικά σας. Γι'αυτό το λόγο το σύμβολο γνησιότητας (auth token) δεν θα πρέπει να έχει περισσότερα δικαιώματα, παρά μόνο δικαίωμα προβολής." 229 | 230 | #: wp-piwik.php:485 231 | #: wp-piwik.php:489 232 | msgid "An error occured" 233 | msgstr "Παρουσιάστηκε σφάλμα" 234 | 235 | #: wp-piwik.php:486 236 | msgid "Please check URL and auth token. You need at least view access to one site." 237 | msgstr "Παρακαλώ ελέγξτε URL και σύμβολο γνησιότητας (auth token). Απαιτείται τουλάχιστον να έχετε δικαίωμα προβολής ενός site ." 238 | 239 | #: wp-piwik.php:492 240 | msgid "Choose site" 241 | msgstr "Επιλέξτε site" 242 | 243 | #: wp-piwik.php:511 244 | #: wp-piwik.php:547 245 | #: wp-piwik.php:584 246 | #: wp-piwik.php:658 247 | msgid "Save settings" 248 | msgstr "Αποθήκευση ρυθμίσεων" 249 | 250 | #: wp-piwik.php:515 251 | #: wp-piwik.php:643 252 | msgid "Tracking settings" 253 | msgstr "Ρυθμίσεις παρακολούθησης" 254 | 255 | #: wp-piwik.php:521 256 | msgid "Add script" 257 | msgstr "Προσθήκη script" 258 | 259 | #: wp-piwik.php:525 260 | msgid "If your template uses wp_footer(), WP-Piwik can automatically add the Piwik javascript code to your blog." 261 | msgstr "Αν το πρότυπό σας χρησιμοποιεί wp_footer (), το WP-Piwik μπορεί αυτόματα να προσθέσει τον Piwik javascript κώδικα στο ιστολόγιο σας." 262 | 263 | #: wp-piwik.php:528 264 | msgid "Track 404" 265 | msgstr "Παρακολούθηση 404" 266 | 267 | #: wp-piwik.php:532 268 | msgid "If you add the Piwik javascript code by wp_footer(), WP-Piwik can automatically add a 404-category to track 404-page-visits." 269 | msgstr "Αν προσθέσατε το Piwik javascript κώδικα μέσω wp_footer (), το WP-Piwik μπορεί αυτόματα να προσθέσει μια κατηγορία 404 για την παρακολούθηση 404 επισκέψεων." 270 | 271 | #: wp-piwik.php:536 272 | #: wp-piwik.php:644 273 | msgid "Tracking filter" 274 | msgstr "Φίλτρο Παρακολούθησης" 275 | 276 | msgid "Choose users by user role you do not want to track." 277 | msgstr "Επιλέξτε το ρόλο χρήστη, τον οποίο δε θέλετε να παρακολουθήσετε." 278 | 279 | msgid "Choose users by user role you do not want to track. Requires enabled "Add script"-functionality." 280 | msgstr "Επιλέξτε τους ρόλους χρηστών, τους οποίους δε θέλετε να παρακολουθήσετε. Γι'αυτό θα πρέπει να είναι ενεργοποιημένη η λειτουργία "Προσθήκη script"." 281 | 282 | #: wp-piwik.php:551 283 | msgid "Statistic view settings" 284 | msgstr "Ρυθμίσεις Στατιστικών" 285 | 286 | #: wp-piwik.php:554 287 | msgid "Dashboard" 288 | msgstr "Dashboard" 289 | 290 | #: wp-piwik.php:556 291 | msgid "No" 292 | msgstr "Όχι" 293 | 294 | #: wp-piwik.php:557 295 | #: wp-piwik.php:558 296 | #: wp-piwik.php:559 297 | msgid "Yes" 298 | msgstr "Ναι" 299 | 300 | #: wp-piwik.php:562 301 | msgid "Display a dashboard widget to your WordPress dashboard." 302 | msgstr "Εμφάνιση ενός widget στο WordPress dashboard." 303 | 304 | #: wp-piwik.php:567 305 | msgid "Display a shortcut to Piwik itself." 306 | msgstr "Εμφάνιση μιας συντόμευσης προς Piwik." 307 | 308 | #: wp-piwik.php:568 309 | msgid "Display to" 310 | msgstr "Εμφάνιση για " 311 | 312 | #: wp-piwik.php:579 313 | msgid "Choose user roles allowed to see the statistics page." 314 | msgstr "Επιλέξτε τους ρόλους χρηστών, οι οποίοι επιτρέπεται να βλέπουν τα στατιστικά." 315 | 316 | #: wp-piwik.php:612 317 | msgid "WPMU-Piwik Settings" 318 | msgstr "WPMU-Piwik Ρυθμίσεις" 319 | 320 | #: wp-piwik.php:636 321 | msgid "Important note: You have to choose a token which provides administration access. WPMU-Piwik will create new Piwik sites for each blog if it is shown the first time and it is not added yet. All users can access their own statistics only, while site admins can access all statistics. To avoid conflicts, you should use a clean Piwik installation without other sites added. The provided themes should use wp_footer, because it adds the Piwik javascript code to each page." 322 | msgstr "Σημαντική Σημείωση: Θα πρέπει να επιλέξετε ένα σύμβολο γνησιότητας (auth token), το οποίο θα έχει διαχειριστική πρόσβαση. Το WPMU-Piwik θα δημιουργήσει νέα Piwik sites για κάθε ιστολόγιο, εάν προβληθεί για πρώτη φορά και δεν έχει προστεθεί ακόμη. Όλοι οι χρήστες μπορούν να έχουν πρόσβαση στα δικά τους στατιστικά, ενώ οι διαχειριστές της ιστοσελίδας μπορούν να έχουν πρόσβαση σε όλες τις στατιστικές. Για την αποφυγή συγκρούσεων, θα πρέπει να χρησιμοποιήσετε μια καθαρή εγκατάσταση Piwik, χωρίς να έχετε πρoσθέσει άλλα sites. Τα παρεχόμενα πρότυπα θα πρέπει να χρησιμοποιούν wp_footer, διότι προσθέτει τον Piwik javascript κώδικα σε κάθε σελίδα." 323 | 324 | #: wp-piwik.php:671 325 | msgid "If you like WP-Piwik, you can support its development by a donation:" 326 | msgstr "Αν σας αρέσει το WP-Piwik, μπορείτε να στηρίξετε την ανάπτυξή του με μια δωρεά:" 327 | 328 | #: wp-piwik.php:687 329 | msgid "My Amazon.de wishlist (German)" 330 | msgstr "Η λίστα επιθυμιών μου στο Amazon.de (Γερμανικά)" 331 | 332 | #. Plugin URI of the plugin/theme 333 | msgid "http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress/" 334 | msgstr "http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress/" 335 | 336 | #. Description of the plugin/theme 337 | msgid "Adds Piwik stats to your dashboard menu and Piwik code to your wordpress footer." 338 | msgstr "Προσθέτει τα στατιστικά Piwik στο dashboard μενού και τον κώδικα Piwik στο wordpress footer." 339 | 340 | #. Author of the plugin/theme 341 | msgid "André Bräkling" 342 | msgstr "André Bräkling" 343 | 344 | #. Author URI of the plugin/theme 345 | msgid "http://www.braekling.de" 346 | msgstr "http://www.braekling.de" 347 | 348 | msgid "Credits" 349 | msgstr "Συντελεστές" 350 | 351 | msgid "Thank you very much for your donation" 352 | msgstr "Ευχαριστώ για τις δωρεές" 353 | 354 | msgid "and all people flattering this" 355 | msgstr "και σε όλους τους χρήστες που μιλούν με κολακευτικά λόγια" 356 | 357 | msgid "Graphs powered by jqPlot, an open source project by Chris Leonello. Give it a try! (License: GPL 2.0 and MIT)" 358 | msgstr "Τα γραφήματα δημιουργούνται με τη βοήθεια του jqPlot, ενός προγράμματος ανοιχτού κώδικα του Chris Leonello. Δοκίμασέ το! (Άδεια χρήσης: GPL 2.0 και MIT)" 359 | 360 | msgid "Thank you very much" 361 | msgstr "Ευχαριστώ πολύ" 362 | 363 | msgid ", and" 364 | msgstr " και" 365 | 366 | msgid "for your translation work" 367 | msgstr "για τη μετάφραση" 368 | 369 | msgid "Thank you very much, all users who send me mails containing criticism, commendation, feature requests and bug reports! You help me to make WP-Piwik much better." 370 | msgstr "Σας ευχαριστώ πολύ, όλους τους χρήστες που μου στείλατε μηνύματα που περιέχουν κριτική, επιδοκιμασία, αιτήματα για νέες λειτουργίες και αναφορές σφαλμάτων! Βοηθάτε να γίνει το WP-piwik πολύ καλύτερο." 371 | 372 | msgid "Thank you for using my plugin. It is the best commendation if my piece of code is really used!" 373 | msgstr "Σας ευχαριστώ για τη χρήση του plugin μου. Είναι ο καλύτερος έπαινος, αν ο κώδικάς μου χρησιμοποιείται πραγματικά!" 374 | 375 | msgid "Changes saved" 376 | msgstr "Αλλαγές αποθηκεύτηκαν" 377 | 378 | msgid "installed" 379 | msgstr "εγκαταστάθηκε" 380 | 381 | msgid "Next you should connect to Piwik" 382 | msgstr "Στη συνέχεια συνδεθείτε με Piwik" 383 | 384 | msgid "Please validate your configuration" 385 | msgstr "Παρακαλώ επαληθεύστε τη διαμόρφωση" 386 | 387 | msgid "Default date" 388 | msgstr "Προεπιλεγμένη ημερομηνία" 389 | 390 | msgid "Default date shown on statistics page." 391 | msgstr "Προεπιλεγμένη ημερομηνία που αναγράφεται στη σελίδα των στατιστικών." 392 | 393 | msgid "Dashboard data" 394 | msgstr "Δεδομένα Dashboard" 395 | 396 | msgid "Display an overview widget to your WordPress dashboard." 397 | msgstr "Προβολή ενός widget προεπισκόπησης στο WordPress dashboard." 398 | 399 | msgid "Boad chart" 400 | msgstr "Board γράφημα" 401 | 402 | msgid "Display a visitor graph widget to your WordPress dashboard." 403 | msgstr "Προβολή ενός widget με γράφημα επισκεπτών στο WordPress dashboard." 404 | 405 | msgid "No data available." 406 | msgstr "Δεν υπάρχουν διαθέσιμα στοιχεία." 407 | 408 | -------------------------------------------------------------------------------- /languages/wp-piwik-es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-es_ES.mo -------------------------------------------------------------------------------- /languages/wp-piwik-fa_IR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-fa_IR.mo -------------------------------------------------------------------------------- /languages/wp-piwik-fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-fr_FR.mo -------------------------------------------------------------------------------- /languages/wp-piwik-hi.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-hi.mo -------------------------------------------------------------------------------- /languages/wp-piwik-hu_HU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-hu_HU.mo -------------------------------------------------------------------------------- /languages/wp-piwik-id.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-id.mo -------------------------------------------------------------------------------- /languages/wp-piwik-it_IT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-it_IT.mo -------------------------------------------------------------------------------- /languages/wp-piwik-lb.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-lb.mo -------------------------------------------------------------------------------- /languages/wp-piwik-lt_LT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-lt_LT.mo -------------------------------------------------------------------------------- /languages/wp-piwik-nb_NO.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-nb_NO.mo -------------------------------------------------------------------------------- /languages/wp-piwik-nl_NL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-nl_NL.mo -------------------------------------------------------------------------------- /languages/wp-piwik-pl_PL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-pl_PL.mo -------------------------------------------------------------------------------- /languages/wp-piwik-pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-pt_BR.mo -------------------------------------------------------------------------------- /languages/wp-piwik-ro_RO.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-ro_RO.mo -------------------------------------------------------------------------------- /languages/wp-piwik-ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-ru_RU.mo -------------------------------------------------------------------------------- /languages/wp-piwik-sl_SI.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-sl_SI.mo -------------------------------------------------------------------------------- /languages/wp-piwik-sq.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-sq.mo -------------------------------------------------------------------------------- /languages/wp-piwik-sv_SE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-sv_SE.mo -------------------------------------------------------------------------------- /languages/wp-piwik-tr_TR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-tr_TR.mo -------------------------------------------------------------------------------- /languages/wp-piwik-ua_UA.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-ua_UA.mo -------------------------------------------------------------------------------- /languages/wp-piwik-ua_UA.po: -------------------------------------------------------------------------------- 1 | # WP-Piwik 0.3.0 - Belorussian language file 2 | # Copyright (C) 2009 Andre Braekling 3 | # This file is distributed under the same license as the WP-Piwik package. 4 | # Andre Braekling , 2009. 5 | # FatCow http://www.fatcow.com, 2009. 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: 0.3.0\n" 9 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-piwik\n" 10 | "POT-Creation-Date: 2009-06-09 19:05+0000\n" 11 | "PO-Revision-Date: 2011-07-07 22:43+0200\n" 12 | "Last-Translator: Alexandr \n" 13 | "Language-Team: Alyona Lompar \n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=UTF-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | "X-Poedit-Language: Ukrainian\n" 18 | "X-Poedit-Country: UKRAINE\n" 19 | "X-Poedit-SourceCharset: utf-8\n" 20 | 21 | #: dashboard/browsers.php:8 22 | #: dashboard/browsers.php:37 23 | msgid "Browser" 24 | msgstr "Браузер" 25 | 26 | msgid "Resolution" 27 | msgstr "Розширення" 28 | 29 | msgid "Operating System" 30 | msgstr "Операційна система" 31 | 32 | #: dashboard/browsers.php:37 33 | #: dashboard/keywords.php:13 34 | #: dashboard/visitors.php:56 35 | #: dashboard/websites.php:13 36 | msgid "Unique" 37 | msgstr "Унікальність" 38 | 39 | #: dashboard/browsers.php:37 40 | msgid "Percent" 41 | msgstr "Відсотків" 42 | 43 | #: dashboard/keywords.php:8 44 | msgid "Keywords" 45 | msgstr "Ключові слова" 46 | 47 | #: dashboard/keywords.php:13 48 | msgid "Keyword" 49 | msgstr "Ключове слово" 50 | 51 | #: dashboard/overview.php:8 52 | msgid "Overview" 53 | msgstr "Опис" 54 | 55 | #: dashboard/overview.php:16 56 | #: dashboard/visitors.php:21 57 | msgid "Visitors" 58 | msgstr "Відвідувачів" 59 | 60 | #: dashboard/overview.php:17 61 | msgid "Unique visitors" 62 | msgstr "Унікальних відвідувачів" 63 | 64 | #: dashboard/overview.php:18 65 | msgid "Page views" 66 | msgstr "Переглядів сторінки" 67 | 68 | #: dashboard/overview.php:19 69 | msgid "Max. page views in one visit" 70 | msgstr "Макс. Сторінок переглянуто за один візит" 71 | 72 | #: dashboard/overview.php:20 73 | msgid "Total time spent by visitors" 74 | msgstr "Всього часу, проведеного відвідувачем" 75 | 76 | #: dashboard/overview.php:21 77 | msgid "Bounce count" 78 | msgstr "Кількість відмов" 79 | 80 | #: dashboard/visitors.php:56 81 | msgid "Date" 82 | msgstr "Дата" 83 | 84 | #: dashboard/visitors.php:56 85 | msgid "Visits" 86 | msgstr "Візитів" 87 | 88 | #: dashboard/visitors.php:56 89 | msgid "Bounced" 90 | msgstr "Відмов" 91 | 92 | #: dashboard/websites.php:8 93 | msgid "Websites" 94 | msgstr "Сайтів" 95 | 96 | #: dashboard/websites.php:13 97 | msgid "Website" 98 | msgstr "Вебсайт" 99 | 100 | #: wp-piwik.php:49 101 | #: wp-piwik.php:147 102 | msgid "Piwik Statistics" 103 | msgstr "Piwik статистика" 104 | 105 | #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-# 106 | #. Plugin Name of an extension 107 | #: wp-piwik.php:49 108 | msgid "WP-Piwik" 109 | msgstr "WP-Piwik" 110 | 111 | #: wp-piwik.php:53 112 | #: wp-piwik.php:185 113 | msgid "WP-Piwik Settings" 114 | msgstr "WP-Piwik налаштування" 115 | 116 | #: wp-piwik.php:59 117 | msgid "Settings" 118 | msgstr "Настройки" 119 | 120 | #: wp-piwik.php:112 121 | msgid "Remote access to Piwik not possible. Enable allow_url_fopen or CURL." 122 | msgstr "Віддалений доступ до Piwik неможливий. Увімкніть allow_url_fopen або CURL." 123 | 124 | #: wp-piwik.php:190 125 | msgid "Account settings" 126 | msgstr "Параметри облікового запису" 127 | 128 | #: wp-piwik.php:192 129 | msgid "Piwik URL" 130 | msgstr "Piwik URL" 131 | 132 | #: wp-piwik.php:196 133 | msgid "Auth token" 134 | msgstr "Авто token" 135 | 136 | #: wp-piwik.php:200 137 | msgid "To enable Piwik statistics, please enter your Piwik base URL (like http://mydomain.com/piwik) and your personal authentification token. You can get the token on the API page inside your Piwik interface. It looks like "1234a5cd6789e0a12345b678cd9012ef"." 138 | msgstr "Для того щоб увімкнути Piwik статистику, будь ласка, введіть Ваш Piwik Базовий URL (наприклад, http://mydomain.com/piwik), і ваш особистий знак автентичності. Ви можете отримати знак на сторінці API всередині інтерфейсу Piwik. Він має вигляд як цей "1234a5cd6789e0a12345b678cd9012ef"." 139 | 140 | #: wp-piwik.php:205 141 | #: wp-piwik.php:207 142 | msgid "An error occured" 143 | msgstr "Сталася помилка" 144 | 145 | #: wp-piwik.php:205 146 | msgid "Please check URL and auth token. You need at least view access to one site." 147 | msgstr "Будь ласка, перевірте URL та AUTH маркер. Вам потрібно мінімум відкрити доступ до одного сайту." 148 | 149 | #: wp-piwik:php:215 150 | msgid "Choose site" 151 | msgstr "Вибрати сайт" 152 | 153 | #: wp-piwik.php:221 154 | msgid "If your template uses wp_footer(), WP-Piwik can automatically add the Piwik javascript code to your blog." 155 | msgstr "Якщо в шаблоні використовуються wp_footer (), WP-Piwik може автоматично додати Piwik JavaScript код до вашого блогу." 156 | 157 | #: wp-piwik.php:226 158 | msgid "Add script to wp_footer()" 159 | msgstr "Додати скрипт в wp_footer ()" 160 | 161 | msgid "Tracking filter" 162 | msgstr "Слідкуючий фільтр" 163 | 164 | msgid "Choose users by user role you do not want to track. Requires enabled "Add script to wp_footer()"-functionality." 165 | msgstr "Виберіть користувачів з користувачів, які не потрібно відстежувати. Повинен бути ввімкнений функціонал "Add script to wp_footer()"." 166 | 167 | #: wp-piwik.php:229 168 | msgid "Save settings" 169 | msgstr "Зберегти налаштування" 170 | 171 | #. Plugin URI of an extension 172 | msgid "http://dev.braekling.de/wordpress-plugins/dev/wp-piwik/index.html" 173 | msgstr "http://dev.braekling.de/wordpress-plugins/dev/wp-piwik/index.html" 174 | 175 | #. Description of an extension 176 | msgid "Adds Piwik stats to your dashboard menu and Piwik code to your wordpress footer." 177 | msgstr "Додає Piwik статистику до меню панелі інструментів і Piwik код до WordPress колонтитула." 178 | 179 | #. Author of an extension 180 | msgid "André Bräkling" 181 | msgstr "André Bräkling" 182 | 183 | #. Author URI of an extension 184 | msgid "http://www.braekling.de" 185 | msgstr "http://www.braekling.de" 186 | 187 | -------------------------------------------------------------------------------- /languages/wp-piwik-uk_UA.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-uk_UA.mo -------------------------------------------------------------------------------- /languages/wp-piwik-zh_CN.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/languages/wp-piwik-zh_CN.mo -------------------------------------------------------------------------------- /logs/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /proxy/config.php: -------------------------------------------------------------------------------- 1 | getGlobalOption ( 'piwik_mode' )) { 15 | case 'php' : 16 | $PIWIK_URL = $settings->getGlobalOption ( 'proxy_url' ); 17 | break; 18 | case 'cloud' : 19 | $PIWIK_URL = 'https://' . $settings->getGlobalOption ( 'piwik_user' ) . '.innocraft.cloud/'; 20 | break; 21 | case 'cloud-matomo' : 22 | $PIWIK_URL = 'https://' . $settings->getGlobalOption ( 'matomo_user' ) . '.matomo.cloud/'; 23 | break; 24 | default : 25 | $PIWIK_URL = $settings->getGlobalOption ( 'piwik_url' ); 26 | } 27 | 28 | if (substr ( $PIWIK_URL, 0, 2 ) == '//') 29 | $PIWIK_URL = $protocol . ':' . $PIWIK_URL; 30 | 31 | $TOKEN_AUTH = $settings->getGlobalOption ( 'piwik_token' ); 32 | $timeout = $settings->getGlobalOption ( 'connection_timeout' ); 33 | $useCurl = ( 34 | (function_exists('curl_init') && ini_get('allow_url_fopen') && $settings->getGlobalOption('http_connection') == 'curl') || (function_exists('curl_init') && !ini_get('allow_url_fopen')) 35 | ); 36 | 37 | $settings->getGlobalOption ( 'http_connection' ); 38 | 39 | ini_set ( 'display_errors', 0 ); -------------------------------------------------------------------------------- /proxy/index.php: -------------------------------------------------------------------------------- 1 | $lastModified) { 92 | sendHeader(sprintf("%s 304 Not Modified", $_SERVER['SERVER_PROTOCOL'])); 93 | } else { 94 | sendHeader('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 95 | sendHeader('Content-Type: application/javascript; charset=UTF-8'); 96 | 97 | // Silent fail: hide Warning in 'matomo.js' response 98 | if (empty($_GET) && empty($_POST)) { 99 | if ($path !== 'matomo.php') { 100 | $jsPath = 'piwik.js'; // for BC eg in case user uses an older version of Matomo 101 | } else { 102 | $jsPath = 'matomo.js'; 103 | } 104 | list($content, $httpStatus) = getHttpContentAndStatus($MATOMO_URL . $jsPath, $timeout, $user_agent); 105 | } else { 106 | list($content, $httpStatus) = getHttpContentAndStatus($MATOMO_URL . $filerequest, $timeout, $user_agent); 107 | } 108 | if ($matomoJs = $content) { 109 | echo $matomoJs; 110 | } else { 111 | echo '/* there was an error loading matomo.js */'; 112 | } 113 | } 114 | exit; 115 | } 116 | @ini_set('magic_quotes_runtime', 0); 117 | 118 | // 2) MATOMO.PHP PROXY: GET parameters found, this is a tracking request, we redirect it to Piwik 119 | if (strpos($path, '?') === false) { 120 | $path = $path . '?'; 121 | } 122 | 123 | $extraQueryParams = array(); 124 | if (strpos($path, 'piwik.php') === 0 || strpos($path, 'matomo.php') === 0) { 125 | $extraQueryParams = array( 126 | 'cip' => getVisitIp(), 127 | 'token_auth' => $TOKEN_AUTH, 128 | ); 129 | } 130 | 131 | $url = $MATOMO_URL . $path; 132 | $url .= http_build_query(array_merge($extraQueryParams, $_GET)); 133 | 134 | if (version_compare(PHP_VERSION, '5.3.0', '<')) { 135 | 136 | // PHP 5.2 breaks with the new 204 status code so we force returning the image every time 137 | list($content, $httpStatus) = getHttpContentAndStatus($url . '&send_image=1', $timeout, $user_agent); 138 | $content = sanitizeContent($content); 139 | 140 | forwardHeaders($content); 141 | 142 | echo $content; 143 | 144 | } else { 145 | // PHP 5.3 and above 146 | list($content, $httpStatus) = getHttpContentAndStatus($url, $timeout, $user_agent); 147 | $content = sanitizeContent($content); 148 | 149 | forwardHeaders($content); 150 | 151 | // Forward the HTTP response code 152 | if (!headers_sent() && !empty($httpStatus)) { 153 | header($httpStatus); 154 | } 155 | 156 | echo $content; 157 | } 158 | 159 | function sanitizeContent($content) 160 | { 161 | global $TOKEN_AUTH; 162 | global $MATOMO_URL; 163 | global $PROXY_URL; 164 | global $VALID_FILES; 165 | 166 | $matomoHost = parse_url($MATOMO_URL, PHP_URL_HOST); 167 | $proxyHost = parse_url($PROXY_URL, PHP_URL_HOST); 168 | 169 | $content = str_replace($TOKEN_AUTH, '', $content); 170 | $content = str_replace($MATOMO_URL, $PROXY_URL, $content); 171 | $content = str_replace($matomoHost, $proxyHost, $content); 172 | 173 | if(isset($VALID_FILES)) { 174 | foreach($VALID_FILES as $filepath) { 175 | // replace file paths to match the proxy and discard cb 176 | $content = preg_replace('^' . $filepath . '(\?cb\=[a-z0-9]*)?^', $PROXY_URL . 'matomo-proxy.php?file=' . $filepath, $content); 177 | } 178 | } 179 | 180 | return $content; 181 | } 182 | 183 | function forwardHeaders($content) 184 | { 185 | global $httpResponseHeaders; 186 | 187 | $headersToForward = array( 188 | 'content-type', 189 | 'access-control-allow-origin', 190 | 'access-control-allow-methods', 191 | 'set-cookie', 192 | ); 193 | 194 | foreach ($httpResponseHeaders as $header) { 195 | $parts = explode(':', $header); 196 | if (empty($parts[0])) { 197 | continue; 198 | } 199 | 200 | $name = trim(strtolower($parts[0])); 201 | if (in_array($name, $headersToForward)) { 202 | sendHeader($header); 203 | } 204 | } 205 | 206 | sendHeader('content-length: ' . strlen($content)); 207 | } 208 | 209 | function getVisitIp() 210 | { 211 | $ipKeys = array( 212 | 'HTTP_X_FORWARDED_FOR', 213 | 'HTTP_CLIENT_IP', 214 | 'HTTP_CF_CONNECTING_IP', 215 | ); 216 | foreach($ipKeys as $ipKey) { 217 | if (isset($_SERVER[$ipKey]) 218 | && filter_var($_SERVER[$ipKey], FILTER_VALIDATE_IP) !== false 219 | ) { 220 | return $_SERVER[$ipKey]; 221 | } 222 | } 223 | return arrayValue($_SERVER, 'REMOTE_ADDR'); 224 | } 225 | 226 | function transformHeaderLine($headerLine) 227 | { 228 | // if we're not on an https protocol, make sure cookies do not have 'secure;' 229 | if (empty($_SERVER['HTTPS']) && preg_match('/^set-cookie:/i', $headerLine)) { 230 | $headerLine = str_replace('secure;', '', $headerLine); 231 | } 232 | return $headerLine; 233 | } 234 | 235 | // captures a header line when using a curl request. would be better to use an anonymous function, but that would break 236 | // PHP 5.2 support. 237 | function handleHeaderLine($curl, $headerLine) 238 | { 239 | global $httpResponseHeaders; 240 | 241 | $originalByteCount = strlen($headerLine); 242 | 243 | $headerLine = transformHeaderLine($headerLine); 244 | $httpResponseHeaders[] = trim($headerLine); 245 | 246 | return $originalByteCount; 247 | } 248 | 249 | function getHttpContentAndStatus($url, $timeout, $user_agent) 250 | { 251 | global $httpResponseHeaders; 252 | global $DEBUG_PROXY; 253 | global $NO_VERIFY_SSL; 254 | global $http_ip_forward_header; 255 | 256 | $useFopen = @ini_get('allow_url_fopen') == '1'; 257 | 258 | $header = array(); 259 | $header[] = sprintf("Accept-Language: %s", str_replace(array("\n", "\t", "\r"), "", arrayValue($_SERVER, 'HTTP_ACCEPT_LANGUAGE', ''))); 260 | 261 | // NOTE: any changes made to Piwik\Plugins\PrivacyManager\DoNotTrackHeaderChecker must be made here as well 262 | if((isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1')) { 263 | $header[] = "X-Do-Not-Track: 1"; 264 | } 265 | 266 | if((isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1')) { 267 | $header[] = "DNT: 1"; 268 | } 269 | 270 | if (isset($_SERVER['HTTP_COOKIE'])) { 271 | $header[] = "Cookie: " . $_SERVER['HTTP_COOKIE']; 272 | } 273 | 274 | $stream_options = array( 275 | 'http' => array( 276 | 'user_agent' => $user_agent, 277 | 'header' => $header, 278 | 'timeout' => $timeout, 279 | ), 280 | ); 281 | 282 | if ($DEBUG_PROXY) { 283 | $stream_options['http']['ignore_errors'] = true; 284 | } 285 | 286 | if ($NO_VERIFY_SSL) { 287 | $stream_options['ssl'] = array( 288 | 'verify_peer' => false, 289 | 'verify_peer_name' => false, 290 | ); 291 | } 292 | 293 | // if there's POST data, send our proxy request as a POST 294 | if (!empty($_POST)) { 295 | $postBody = file_get_contents("php://input"); 296 | 297 | $stream_options['http']['method'] = 'POST'; 298 | $stream_options['http']['header'][] = "Content-type: application/x-www-form-urlencoded"; 299 | $stream_options['http']['header'][] = "Content-Length: " . strlen($postBody); 300 | $stream_options['http']['content'] = $postBody; 301 | 302 | if(!empty($http_ip_forward_header)) { 303 | $visitIp = getVisitIp(); 304 | $stream_options['http']['header'][] = "$http_ip_forward_header: $visitIp"; 305 | } 306 | } 307 | 308 | if($useFopen) { 309 | $ctx = stream_context_create($stream_options); 310 | 311 | if ($DEBUG_PROXY) { 312 | $content = file_get_contents($url, 0, $ctx); 313 | } else { 314 | $content = @file_get_contents($url, 0, $ctx); 315 | } 316 | 317 | $httpStatus = ''; 318 | if (isset($http_response_header[0])) { 319 | $httpStatus = $http_response_header[0]; 320 | $httpResponseHeaders = array_slice($http_response_header, 1); 321 | $httpResponseHeaders = array_map('transformHeaderLine', $httpResponseHeaders); 322 | } 323 | } else { 324 | if(!function_exists('curl_init')) { 325 | throw new Exception("You must either set allow_url_fopen=1 in your PHP configuration, or enable the PHP Curl extension."); 326 | } 327 | 328 | $ch = curl_init(); 329 | curl_setopt($ch, CURLOPT_HEADER, 0); 330 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 331 | curl_setopt($ch, CURLOPT_USERAGENT, $stream_options['http']['user_agent']); 332 | curl_setopt($ch, CURLOPT_HTTPHEADER, $stream_options['http']['header']); 333 | curl_setopt($ch, CURLOPT_TIMEOUT, $stream_options['http']['timeout']); 334 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $stream_options['http']['timeout']); 335 | curl_setopt($ch, CURLOPT_URL, $url); 336 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'handleHeaderLine'); 337 | 338 | if (!empty($stream_options['http']['method']) 339 | && $stream_options['http']['method'] == 'POST' 340 | ) { 341 | curl_setopt($ch, CURLOPT_POST, 1); 342 | curl_setopt($ch, CURLOPT_POSTFIELDS, $stream_options['http']['content']); 343 | } 344 | 345 | if (isset($stream_options['ssl']['verify_peer']) && $stream_options['ssl']['verify_peer'] == false) { 346 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 347 | } 348 | 349 | if (isset($stream_options['ssl']['verify_peer_name']) && $stream_options['ssl']['verify_peer'] == false) { 350 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 351 | } 352 | 353 | $content = curl_exec($ch); 354 | $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); 355 | if(!empty($httpStatus)) { 356 | $httpStatus = 'HTTP/1.1 ' . $httpStatus; 357 | } 358 | curl_close($ch); 359 | } 360 | 361 | return array( 362 | $content, 363 | $httpStatus, 364 | ); 365 | 366 | } 367 | 368 | function sendHeader($header, $replace = true) 369 | { 370 | headers_sent() || header($header, $replace); 371 | } 372 | 373 | function arrayValue($array, $key, $value = null) 374 | { 375 | if (!empty($array[$key])) { 376 | $value = $array[$key]; 377 | } 378 | return $value; 379 | } 380 | -------------------------------------------------------------------------------- /screenshot-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/screenshot-1.gif -------------------------------------------------------------------------------- /screenshot-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/screenshot-2.gif -------------------------------------------------------------------------------- /screenshot-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/screenshot-3.gif -------------------------------------------------------------------------------- /screenshot-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/screenshot-4.gif -------------------------------------------------------------------------------- /screenshot-5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braekling/WP-Matomo/9b0ba10d8c02fa21acb84c55dca3ffdce6b8b356/screenshot-5.gif -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 | get_results('SELECT blog_id FROM '.$wpdb->blogs.' '.$queryLimit.'ORDER BY blog_id', ARRAY_A); 80 | if (is_array($aryBlogs)) 81 | foreach ($aryBlogs as $aryBlog) { 82 | foreach ($settings as $key) { 83 | delete_blog_option($aryBlog['blog_id'], 'wp-piwik-'.$key); 84 | } 85 | switch_to_blog($aryBlog['blog_id']); 86 | $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key LIKE 'wp-piwik_%'"); 87 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_wp-piwik_%'"); 88 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_wp-piwik_%'"); 89 | restore_current_blog(); 90 | } 91 | foreach ($globalSettings as $key) 92 | delete_site_option('wp-piwik_global-'.$key); 93 | delete_site_option('wp-piwik-manually'); 94 | delete_site_option('wp-piwik-notices'); 95 | } 96 | 97 | foreach ($settings as $key) 98 | delete_option('wp-piwik-'.$key); 99 | 100 | foreach ($globalSettings as $key) 101 | delete_option('wp-piwik_global-'.$key); 102 | 103 | delete_option('wp-piwik-manually'); 104 | delete_option('wp-piwik-notices'); 105 | 106 | $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key LIKE 'wp-piwik-%'"); 107 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_wp-piwik_%'"); 108 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_wp-piwik_%'"); -------------------------------------------------------------------------------- /update/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all 2 | -------------------------------------------------------------------------------- /update/2015051101.php: -------------------------------------------------------------------------------- 1 | checkNetworkActivation ()) { 5 | $oldGlobalOptions = get_site_option ( 'wp-piwik_global-settings', array () ); 6 | delete_site_option('wp-piwik_global-settings'); 7 | } else { 8 | $oldGlobalOptions = get_option ( 'wp-piwik_global-settings', array () ); 9 | delete_option('wp-piwik_global-settings'); 10 | } 11 | 12 | $oldOptions = get_option ( 'wp-piwik_settings', array () ); 13 | delete_option('wp-piwik_settings'); 14 | 15 | if (self::$settings->checkNetworkActivation ()) { 16 | global $wpdb; 17 | $aryBlogs = \WP_Piwik\Settings::getBlogList(); 18 | if (is_array($aryBlogs)) 19 | foreach ($aryBlogs as $aryBlog) { 20 | $oldOptions = get_blog_option ( $aryBlog['blog_id'], 'wp-piwik_settings', array () ); 21 | if (!$this->isConfigured()) 22 | foreach ( $oldOptions as $key => $value ) 23 | self::$settings->setOption ( $key, $value, $aryBlog['blog_id'] ); 24 | delete_blog_option($aryBlog['blog_id'], 'wp-piwik_settings'); 25 | } 26 | } 27 | 28 | if (!$this->isConfigured()) { 29 | if (!$oldGlobalOptions['add_tracking_code']) $oldGlobalOptions['track_mode'] = 'disabled'; 30 | elseif (!$oldGlobalOptions['track_mode']) $oldGlobalOptions['track_mode'] = 'default'; 31 | elseif ($oldGlobalOptions['track_mode'] == 1) $oldGlobalOptions['track_mode'] = 'js'; 32 | elseif ($oldGlobalOptions['track_mode'] == 2) $oldGlobalOptions['track_mode'] = 'proxy'; 33 | 34 | // Store old values in new settings 35 | foreach ( $oldGlobalOptions as $key => $value ) 36 | self::$settings->setGlobalOption ( $key, $value ); 37 | foreach ( $oldOptions as $key => $value ) 38 | self::$settings->setOption ( $key, $value ); 39 | } 40 | 41 | self::$settings->save (); -------------------------------------------------------------------------------- /update/2017080701.php: -------------------------------------------------------------------------------- 1 | isConfigured() && self::$settings->getGlobalOption ( 'piwik_mode' ) == 'pro') { 5 | self::$settings->setGlobalOption ( 'piwik_url', 'https://' . self::$settings->getGlobalOption ( 'piwik_user' ) . '.piwik.pro/'); 6 | self::$settings->setGlobalOption ( 'piwik_mode', 'http' ); 7 | } 8 | 9 | // If post annotations are already enabled, choose all existing post types 10 | if (self::$settings->getGlobalOption('add_post_annotations')) 11 | self::$settings->setGlobalOption('add_post_annotations', get_post_types()); 12 | 13 | self::$settings->save (); -------------------------------------------------------------------------------- /update/2021070701.php: -------------------------------------------------------------------------------- 1 | getGlobalOption('perpost_stats')) { 5 | self::$settings->setGlobalOption('perpost_stats', "last30"); 6 | } else { 7 | self::$settings->setGlobalOption('perpost_stats', "disabled"); 8 | } 9 | 10 | self::$settings->save (); -------------------------------------------------------------------------------- /update/2023052301.php: -------------------------------------------------------------------------------- 1 | setGlobalOption('plugin_display_name', "Connect Matomo"); 4 | self::$settings->save (); -------------------------------------------------------------------------------- /update/90001.php: -------------------------------------------------------------------------------- 1 | checkNetworkActivation () && $aryWPMUConfig) { 4 | foreach ( $aryWPMUConfig as $key => $value ) 5 | self::$settings->setGlobalOption ( $key, $value ); 6 | delete_site_option ( 'wpmu-piwik_global-settings' ); 7 | self::$settings->setGlobalOption ( 'auto_site_config', true ); 8 | } else 9 | self::$settings->setGlobalOption ( 'auto_site_config', false ); -------------------------------------------------------------------------------- /update/90801.php: -------------------------------------------------------------------------------- 1 | getGlobalOption ( 'track_compress' )) 3 | self::$settings->setGlobalOption ( 'track_mode', 1 ); 4 | else 5 | self::$settings->setGlobalOption ( 'track_mode', 0 ); -------------------------------------------------------------------------------- /update/91006.php: -------------------------------------------------------------------------------- 1 | . 31 | *******************************************************************************************/ 32 | 33 | if (! function_exists ( 'add_action' )) { 34 | header ( 'Status: 403 Forbidden' ); 35 | header ( 'HTTP/1.1 403 Forbidden' ); 36 | exit (); 37 | } 38 | 39 | if (! defined ( 'NAMESPACE_SEPARATOR' )) 40 | define ( 'NAMESPACE_SEPARATOR', '\\' ); 41 | 42 | /** 43 | * Define WP-Piwik autoloader 44 | * 45 | * @param string $class 46 | * class name 47 | */ 48 | function wp_piwik_autoloader($class) { 49 | if (substr ( $class, 0, 9 ) == 'WP_Piwik' . NAMESPACE_SEPARATOR) { 50 | $class = str_replace ( '.', '', str_replace ( NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, substr ( $class, 9 ) ) ); 51 | require_once ('classes' . DIRECTORY_SEPARATOR . 'WP_Piwik' . DIRECTORY_SEPARATOR . $class . '.php'); 52 | } 53 | } 54 | 55 | /** 56 | * Show notice about outdated PHP version 57 | */ 58 | function wp_piwik_phperror() { 59 | echo '

'; 60 | printf ( __ ( 'WP-Matomo requires at least PHP 5.3. You are using the deprecated version %s. Please update PHP to use WP-Matomo.', 'wp-piwik' ), PHP_VERSION ); 61 | echo '

'; 62 | } 63 | 64 | function wp_piwik_load_textdomain() { 65 | load_plugin_textdomain( 'wp-piwik', false, plugin_basename( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR ); 66 | } 67 | add_action( 'plugins_loaded', 'wp_piwik_load_textdomain' ); 68 | 69 | if (version_compare ( PHP_VERSION, '5.3.0', '<' )) 70 | add_action ( 'admin_notices', 'wp_piwik_phperror' ); 71 | else { 72 | define ( 'WP_PIWIK_PATH', dirname ( __FILE__ ) . DIRECTORY_SEPARATOR ); 73 | require_once (WP_PIWIK_PATH . 'config.php'); 74 | require_once (WP_PIWIK_PATH . 'classes' . DIRECTORY_SEPARATOR . 'WP_Piwik.php'); 75 | spl_autoload_register ( 'wp_piwik_autoloader' ); 76 | $GLOBALS ['wp-piwik_debug'] = false; 77 | if (class_exists ( 'WP_Piwik' )) 78 | add_action( 'init', 'wp_piwik_loader' ); 79 | } 80 | 81 | function wp_piwik_loader() { 82 | $GLOBALS ['wp-piwik'] = new WP_Piwik (); 83 | } 84 | -------------------------------------------------------------------------------- /wpml-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | --------------------------------------------------------------------------------