From eb016eee0a6f60a1049f72e237de9e769da15118 Mon Sep 17 00:00:00 2001 From: lechuck <l3chuck@autistici.org> Date: Mon, 17 Mar 2014 13:14:17 +0000 Subject: [PATCH] Upgraded wp-piwik to 0.9.9.9 --- wp-content/plugins/wp-piwik/cache/.htaccess | 1 + wp-content/plugins/wp-piwik/cache/index.php | 2 + wp-content/plugins/wp-piwik/classes/.htaccess | 1 + .../wp-piwik/classes/WP_Piwik_Logger.php | 45 + .../classes/WP_Piwik_Logger_Dummy.php | 9 + .../wp-piwik/classes/WP_Piwik_Logger_File.php | 48 + .../WP_Piwik_MetaBox_PerPost_Stats.php | 37 + .../wp-piwik/classes/WP_Piwik_Settings.php | 147 +++ .../wp-piwik/classes/WP_Piwik_Template.php | 32 + wp-content/plugins/wp-piwik/classes/index.php | 2 + wp-content/plugins/wp-piwik/config.php | 9 + .../plugins/wp-piwik/dashboard/browsers.php | 1 + .../plugins/wp-piwik/dashboard/index.php | 2 + .../plugins/wp-piwik/dashboard/overview.php | 4 +- .../plugins/wp-piwik/debug/testscript.php | 10 +- .../wp-piwik/js/sparkline/jquery.sparkline.js | 146 ++- .../js/sparkline/jquery.sparkline.min.js | 6 +- .../plugins/wp-piwik/languages/index.php | 2 + .../wp-piwik/languages/wp-piwik-de_DE.mo | Bin 19994 -> 21532 bytes .../wp-piwik/languages/wp-piwik-de_DE.po | 41 +- .../wp-piwik/languages/wp-piwik-zh_CN.mo | Bin 0 -> 16660 bytes .../wp-piwik/languages/wp-piwik-zh_CN.po | 861 ++++++++++++++++++ wp-content/plugins/wp-piwik/logs/.htaccess | 1 + wp-content/plugins/wp-piwik/logs/index.php | 2 + wp-content/plugins/wp-piwik/piwik.php | 11 +- wp-content/plugins/wp-piwik/readme.txt | 48 +- .../plugins/wp-piwik/settings/credits.php | 4 +- .../plugins/wp-piwik/settings/homepage.php | 6 +- .../plugins/wp-piwik/settings/index.php | 2 + .../plugins/wp-piwik/settings/piwik.php | 52 +- .../plugins/wp-piwik/settings/sitebrowser.php | 3 +- .../plugins/wp-piwik/settings/support.php | 9 +- .../plugins/wp-piwik/settings/tracking.php | 56 +- .../plugins/wp-piwik/settings/views.php | 37 +- .../plugins/wp-piwik/shortcodes/index.php | 2 + .../plugins/wp-piwik/shortcodes/overview.php | 2 +- wp-content/plugins/wp-piwik/update/80403.php | 8 +- wp-content/plugins/wp-piwik/update/80502.php | 2 +- wp-content/plugins/wp-piwik/update/80602.php | 2 +- wp-content/plugins/wp-piwik/update/80800.php | 2 +- wp-content/plugins/wp-piwik/update/90001.php | 17 +- wp-content/plugins/wp-piwik/update/90206.php | 2 +- wp-content/plugins/wp-piwik/update/90405.php | 8 +- wp-content/plugins/wp-piwik/update/90601.php | 4 +- wp-content/plugins/wp-piwik/update/90700.php | 2 +- wp-content/plugins/wp-piwik/update/90801.php | 13 +- wp-content/plugins/wp-piwik/update/90821.php | 2 +- wp-content/plugins/wp-piwik/update/90910.php | 4 +- wp-content/plugins/wp-piwik/update/90920.php | 2 + wp-content/plugins/wp-piwik/update/90940.php | 2 + wp-content/plugins/wp-piwik/update/90961.php | 2 + wp-content/plugins/wp-piwik/update/90971.php | 3 + wp-content/plugins/wp-piwik/update/90980.php | 6 + wp-content/plugins/wp-piwik/update/index.php | 2 + wp-content/plugins/wp-piwik/wp-piwik.php | 761 ++++++++-------- 55 files changed, 1908 insertions(+), 577 deletions(-) create mode 100644 wp-content/plugins/wp-piwik/cache/.htaccess create mode 100644 wp-content/plugins/wp-piwik/cache/index.php create mode 100644 wp-content/plugins/wp-piwik/classes/.htaccess create mode 100644 wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger.php create mode 100644 wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_Dummy.php create mode 100644 wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_File.php create mode 100644 wp-content/plugins/wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php create mode 100644 wp-content/plugins/wp-piwik/classes/WP_Piwik_Settings.php create mode 100644 wp-content/plugins/wp-piwik/classes/WP_Piwik_Template.php create mode 100644 wp-content/plugins/wp-piwik/classes/index.php create mode 100644 wp-content/plugins/wp-piwik/config.php create mode 100644 wp-content/plugins/wp-piwik/dashboard/index.php create mode 100644 wp-content/plugins/wp-piwik/languages/index.php create mode 100644 wp-content/plugins/wp-piwik/languages/wp-piwik-zh_CN.mo create mode 100644 wp-content/plugins/wp-piwik/languages/wp-piwik-zh_CN.po create mode 100644 wp-content/plugins/wp-piwik/logs/.htaccess create mode 100644 wp-content/plugins/wp-piwik/logs/index.php create mode 100644 wp-content/plugins/wp-piwik/settings/index.php create mode 100644 wp-content/plugins/wp-piwik/shortcodes/index.php create mode 100644 wp-content/plugins/wp-piwik/update/90920.php create mode 100644 wp-content/plugins/wp-piwik/update/90940.php create mode 100644 wp-content/plugins/wp-piwik/update/90961.php create mode 100644 wp-content/plugins/wp-piwik/update/90971.php create mode 100644 wp-content/plugins/wp-piwik/update/90980.php create mode 100644 wp-content/plugins/wp-piwik/update/index.php diff --git a/wp-content/plugins/wp-piwik/cache/.htaccess b/wp-content/plugins/wp-piwik/cache/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/wp-content/plugins/wp-piwik/cache/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/wp-content/plugins/wp-piwik/cache/index.php b/wp-content/plugins/wp-piwik/cache/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/cache/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/classes/.htaccess b/wp-content/plugins/wp-piwik/classes/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger.php new file mode 100644 index 000000000..9a0928815 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger.php @@ -0,0 +1,45 @@ +<?php + + abstract class WP_Piwik_Logger { + + private $loggerName = 'unnamed'; + private $loggerContent = array(); + private $startMicrotime = null; + + abstract function loggerOutput($loggerTime, $loggerMessage); + + public function __construct($loggerName) { + $this->setName($loggerName); + $this->setStartMicrotime(microtime(true)); + $this->log('Logging started -------------------------------'); + } + + public function __destruct() { + $this->log('Logging finished ------------------------------'); + } + + public function log($loggerMessage) { + $this->loggerOutput($this->getElapsedMicrotime(), $loggerMessage); + } + + private function setName($loggerName) { + $this->loggerName = $loggerName; + } + + public function getName() { + return $this->loggerName; + } + + private function setStartMicrotime($startMicrotime) { + $this->startMicrotime = $startMicrotime; + } + + public function getStartMicrotime() { + return $this->startMicrotime; + } + + public function getElapsedMicrotime() { + return microtime(true) - $this->getStartMicrotime(); + } + + } \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_Dummy.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_Dummy.php new file mode 100644 index 000000000..f962105f3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_Dummy.php @@ -0,0 +1,9 @@ +<?php + + require_once('WP_Piwik_Logger.php'); + + class WP_Piwik_Logger_Dummy extends WP_Piwik_Logger { + + public function loggerOutput($loggerTime, $loggerMessage) {} + + } \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_File.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_File.php new file mode 100644 index 000000000..0c9c93e46 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Logger_File.php @@ -0,0 +1,48 @@ +<?php + + require_once('WP_Piwik_Logger.php'); + + class WP_Piwik_Logger_File extends WP_Piwik_Logger { + + private $loggerFile = null; + + private function encodeFilename($fileName) { + $fileName = str_replace (' ', '_', $fileName); + preg_replace('/[^0-9^a-z^_^.]/', '', $fileName); + return $fileName; + } + + private function setFilename() { + $this->loggerFile = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'logs'.DIRECTORY_SEPARATOR. + date('Ymd').'_'.$this->encodeFilename($this->getName()).'.log'; + } + + private function getFilename() { + return $this->loggerFile; + } + + private function openFile() { + if (!$this->loggerFile) + $this->setFilename(); + return fopen($this->getFilename(), 'a'); + } + + private function closeFile($fileHandle) { + fclose($fileHandle); + } + + private function writeFile($fileHandle, $fileContent) { + fwrite($fileHandle, $fileContent."\n"); + } + + private function formatMicrotime($loggerTime) { + return sprintf('[%6s sec]',number_format($loggerTime,3)); + } + + public function loggerOutput($loggerTime, $loggerMessage) { + if ($fileHandle = $this->openFile()) { + $this->writeFile($fileHandle, $this->formatMicrotime($loggerTime).' '.$loggerMessage); + $this->closeFile($fileHandle); + } + } + } \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php new file mode 100644 index 000000000..5a72c25b7 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php @@ -0,0 +1,37 @@ +<?php + + require_once('WP_Piwik_Template.php'); + + class WP_Piwik_MetaBox_PerPost_Stats extends WP_Piwik_Template { + + function addMetabox() { + add_meta_box( + 'wp-piwik_post_perpoststats', + __('Piwik Statistics (last 30 days)', 'wp-piwik'), + array(&$this, 'showStats'), + 'post', + 'side', + 'default' + ); + } + + function showStats() { + global $post; + $postURL = get_permalink($post->ID); + $range = $this->getRangeLast30(); + self::$logger->log('Load per post statistics: '.$postURL); + $data = self::$wpPiwik->callPiwikAPI('Actions.getPageUrl', 'range', $range, null, false, false, 'PHP', $postURL, false); + if (!isset($data[0])) return; + echo '<table>'; + $this->tabRow(__('Visitors', 'wp-piwik').':',$data[0]['nb_visits']); + $this->tabRow(__('Unique visitors', 'wp-piwik').':', $data[0]['sum_daily_nb_uniq_visitors']); + $this->tabRow(__('Page views', 'wp-piwik').':', $data[0]['nb_hits']); + $this->tabRow(__('Time/visit', 'wp-piwik').':', $data[0]['avg_time_on_page']); + $this->tabRow(__('Bounce count', 'wp-piwik').':', $this->output($data[0], 'entry_bounce_count', 0).' ('.$data[0]['bounce_rate'].')'); + $this->tabRow(__('Exit count', 'wp-piwik').':', $this->output($data[0], 'exit_nb_visits', 0).' ('.$data[0]['exit_rate'].')'); + if (isset($data[0]['avg_time_generation'])) + $this->tabRow(__('Avg. generation time', 'wp-piwik').':', $data[0]['avg_time_generation']); + echo '</table>'; + } + + } \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik_Settings.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Settings.php new file mode 100644 index 000000000..96eb40d38 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Settings.php @@ -0,0 +1,147 @@ +<?php + + class WP_Piwik_Settings { + + private static $logger, $defaultSettings; + + private $globalSettings = array( + 'revision' => 90921, + 'plugin_display_name' => 'WP-Piwik', + 'add_tracking_code' => false, + 'last_settings_update' => 0, + 'piwik_token' => '', + 'piwik_url' => '', + 'piwik_path' => '', + 'piwik_mode' => 'http', + 'piwik_useragent' => 'php', + 'piwik_useragent_string' => 'WP-Piwik', + 'connection_timeout' => 5, + 'dashboard_widget' => false, + 'dashboard_chart' => false, + 'dashboard_seo' => false, + 'stats_seo' => false, + 'capability_stealth' => array(), + 'capability_read_stats' => array('administrator' => true), + 'piwik_shortcut' => false, + 'default_date' => 'yesterday', + 'auto_site_config' => true, + 'track_404' => false, + 'track_search' => false, + 'track_mode' => 0, + 'track_post' => false, + 'track_proxy' => false, + 'track_admin' => false, + 'track_feed' => false, + 'track_feed_goal' => '', + 'track_feed_revenue' => '', + 'track_feed_campaign' => 'feed', + 'track_feed_addcampaign' => 'false', + 'track_cdnurlssl' => '', + 'track_noscript' => false, + 'track_nojavascript' => false, + 'disable_timelimit' => false, + 'disable_ssl_verify' => false, + 'disable_cookies' => false, + 'toolbar' => false, + 'shortcodes' => false, + 'cache' => true, + 'perpost_stats' => false + ), + $settings = array( + 'name' => '', + 'tracking_code' => '', + 'site_id' => NULL, + 'last_tracking_code_update' => 0, + 'dashboard_revision' => 0, + 'noscript_code' => '' + ), + $settingsChanged = false; + + public function __construct($objLogger) { + self::$logger = $objLogger; + self::$logger->log('Store default settings'); + self::$defaultSettings = array('globalSettings' => $this->globalSettings, 'settings' => $this->settings); + self::$logger->log('Load settings'); + $this->globalSettings = (is_plugin_active_for_network('wp-piwik/wp-piwik.php')? + get_site_option('wp-piwik_global-settings', $this->globalSettings): + get_option('wp-piwik_global-settings', $this->globalSettings) + ); + $this->settings = get_option('wp-piwik_settings',$this->settings); + } + + public function save() { + if (!$this->settingsChanged) { + self::$logger->log('No settings changed yet'); + return; + } + self::$logger->log('Save settings'); + if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) + update_site_option('wp-piwik_global-settings', $this->globalSettings); + else + update_option('wp-piwik_global-settings', $this->globalSettings); + update_option('wp-piwik_settings', $this->settings); + global $wp_roles; + if (!is_object($wp_roles)) + $wp_roles = new WP_Roles(); + if (!is_object($wp_roles)) die("STILL NO OBJECT"); + foreach($wp_roles->role_names as $strKey => $strName) { + $objRole = get_role($strKey); + foreach (array('stealth', 'read_stats') as $strCap) { + $aryCaps = $this->getGlobalOption('capability_'.$strCap); + if (isset($aryCaps[$strKey]) && $aryCaps[$strKey]) + $objRole->add_cap('wp-piwik_'.$strCap); + else $objRole->remove_cap('wp-piwik_'.$strCap); + } + } + $this->settingsChanges = false; + } + + public function getGlobalOption($key) { + return isset($this->globalSettings[$key])?$this->globalSettings[$key]:null; + } + + public function getOption($key) { + return isset($this->settings[$key])?$this->settings[$key]:null; + } + + public function setGlobalOption($key, $value) { + $this->settingsChanged = true; + self::$logger->log('Changed global option '.$key.': '.(is_array($value)?serialize($value):$value)); + $this->globalSettings[$key] = $value; + } + + public function setOption($key, $value) { + $this->settingsChanged = true; + self::$logger->log('Changed option '.$key.': '.$value); + $this->settings[$key] = $value; + } + + public function resetSettings($bolFull = false) { + self::$logger->log('Reset WP-Piwik settings'); + global $wpdb; + $keepSettings = array( + 'piwik_token' => $this->getGlobalOption('piwik_token'), + 'piwik_url' => $this->getGlobalOption('piwik_url'), + 'piwik_path' => $this->getGlobalOption('piwik_path'), + 'piwik_mode' => $this->getGlobalOption('piwik_mode') + ); + if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { + delete_site_option('wp-piwik_global-settings'); + $aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id'); + foreach ($aryBlogs as $aryBlog) + delete_blog_option($aryBlog->blog_id, 'wp-piwik_settings'); + if (!$bolFull) update_site_option('wp-piwik_global-settings', $keepSettings); + } else { + delete_option('wp-piwik_global-settings'); + delete_option('wp-piwik_settings'); + } + $this->globalSettings = self::$defaultSettings['globalSettings']; + $this->settings = self::$defaultSettings['settings']; + if (!$bolFull) { + self::$logger->log('Restore connection settings'); + foreach ($keepSettings as $key => $value) + $this->setGlobalOption($key, $value); + } + $this->save(); + } + } \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik_Template.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Template.php new file mode 100644 index 000000000..69ddbcb31 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik_Template.php @@ -0,0 +1,32 @@ +<?php + + class WP_Piwik_Template { + + public static $logger, $settings, $wpPiwik; + + public function __construct($config) { + self::$logger = $config['logger']; + self::$settings = $config['settings']; + self::$wpPiwik = $config['wp_piwik']; + } + + public function output($array, $key, $default = '') { + if (isset($array[$key])) + return $array[$key]; + else + return $default; + } + + public function tabRow($name, $value) { + echo '<tr><td>'.$name.'</td><td>'.$value.'</td></tr>'; + } + + public function getRangeLast30() { + $diff = (self::$settings->getGlobalOption('default_date') == 'yesterday') ? -86400 : 0; + $end = time() + $diff; + $start = time() - 2592000 + $diff; + return date('Y-m-d', $start).','.date('Y-m-d', $end); + + } + + } \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/classes/index.php b/wp-content/plugins/wp-piwik/classes/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/classes/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/config.php b/wp-content/plugins/wp-piwik/config.php new file mode 100644 index 000000000..833aabea2 --- /dev/null +++ b/wp-content/plugins/wp-piwik/config.php @@ -0,0 +1,9 @@ +<?php + + /* + Configure WP-Piwik Logger + 0: Logger disabled + 1: Log to screen (available soon) + 2: Log to file (logs/YYYYMMDD_wp-piwik.log) + */ + define('WP_PIWIK_ACTIVATE_LOGGER', 0); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/dashboard/browsers.php b/wp-content/plugins/wp-piwik/dashboard/browsers.php index 7003c9f26..7affa594f 100644 --- a/wp-content/plugins/wp-piwik/dashboard/browsers.php +++ b/wp-content/plugins/wp-piwik/dashboard/browsers.php @@ -9,6 +9,7 @@ $aryConf['params']['date'], $aryConf['params']['limit'] ); + $aryConf['title'] = __('Browser', 'wp-piwik'); $strValues = ''; $intCount = 0; $intMore = 0; $intSum = 0; diff --git a/wp-content/plugins/wp-piwik/dashboard/index.php b/wp-content/plugins/wp-piwik/dashboard/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/dashboard/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/dashboard/overview.php b/wp-content/plugins/wp-piwik/dashboard/overview.php index 553d211a5..e9c8cb331 100644 --- a/wp-content/plugins/wp-piwik/dashboard/overview.php +++ b/wp-content/plugins/wp-piwik/dashboard/overview.php @@ -60,8 +60,8 @@ echo '<tr><td>'.__('Total time spent', 'wp-piwik').':</td><td>'.$strTime.'</td></tr>'; echo '<tr><td>'.__('Time/visit', 'wp-piwik').':</td><td>'.$strAvgTime.'</td></tr>'; echo '<tr><td>'.__('Bounce count', 'wp-piwik').':</td><td>'.$aryConf['data']['bounce_count'].' ('.$aryConf['data']['bounce_rate'].')</td></tr>'; - if (self::$aryGlobalSettings['piwik_shortcut']) - echo '<tr><td>'.__('Shortcut', 'wp-piwik').':</td><td><a href="'.self::$aryGlobalSettings['piwik_url'].'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik_stats">WP-Piwik</a>':'').'</td></tr>'; + if (self::$settings->getGlobalOption('piwik_shortcut')) + echo '<tr><td>'.__('Shortcut', 'wp-piwik').':</td><td><a href="'.self::$settings->getGlobalOption('piwik_url').'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik_stats">WP-Piwik</a>':'').'</td></tr>'; /***************************************************************************/ ?> </tbody> </table> diff --git a/wp-content/plugins/wp-piwik/debug/testscript.php b/wp-content/plugins/wp-piwik/debug/testscript.php index 4dcc41beb..d40693d32 100644 --- a/wp-content/plugins/wp-piwik/debug/testscript.php +++ b/wp-content/plugins/wp-piwik/debug/testscript.php @@ -9,13 +9,13 @@ *****************/ // PIWIK URL, e.g. http://www.website.example/piwik -$strPiwikURL = self::$aryGlobalSettings['piwik_url']; +$strPiwikURL = self::$settings->getGlobalOption('piwik_url'); // PIWIK AUTH TOKEN, e.g. 1234a5cd6789e0a12345b678cd9012ef -$strPiwikAuthToken = self::$aryGlobalSettings['piwik_token']; +$strPiwikAuthToken = self::$settings->getGlobalOption('piwik_token'); // YOUR BLOG'S URL, e.g. http://www.website.example $strPiwikYourBlogURL = get_bloginfo('url'); // User agent -$strUA = self::$aryGlobalSettings['piwik_useragent']=='php'?ini_get('user_agent'):self::$aryGlobalSettings['piwik_useragent_string']; +$strUA = self::$settings->getGlobalOption('piwik_useragent')=='php'?ini_get('user_agent'):self::$settings->getGlobalOption('piwik_useragent_string'); /* That's all, stop editing! */ @@ -72,11 +72,11 @@ foreach ($aryURLs as $strMethod => $strURL) { $intTest++; echo '*** Test '.$intTest.'/'.count($aryURLs).': '.$strMethod.' ***'."\n"; echo 'Using: '.(function_exists('curl_init')?'cURL':'fopen')."\n"; - echo 'SSL peer verification: '.(function_exists('curl_init') && !self::$aryGlobalSettings['disable_ssl_verify']?'enabled':'disabled')."\n"; + echo 'SSL peer verification: '.(function_exists('curl_init') && !self::$settings->getGlobalOption('disable_ssl_verify')?'enabled':'disabled')."\n"; echo 'User Agent: '.$strUA."\n"; echo 'Call: '.$strURL.'&token_auth= + TOKEN'."\n"; $x = microtime(true); - $strResult = getRemoteFile($strURL,$strToken,!self::$aryGlobalSettings['disable_ssl_verify'],$strUA); + $strResult = getRemoteFile($strURL,$strToken,!self::$settings->getGlobalOption('disable_ssl_verify'),$strUA); $x = microtime(true) - $x; echo 'Result:'."\n"; echo htmlentities($strResult)."\n"; diff --git a/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.js b/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.js index 3ffb05159..4b969379a 100644 --- a/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.js +++ b/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.js @@ -2,7 +2,7 @@ * * jquery.sparkline.js * -* v2.0 +* v2.1.1 * (c) Splunk, Inc * Contact: Gareth Watts (gareth@splunk.com) * http://omnipotent.net/jquery.sparkline/ @@ -179,7 +179,7 @@ * When set to false you can supply any number of values and the box plot will * be computed for you. Default is false. * showOutliers - Set to true (default) to display outliers as circles -* outlierIRQ - Interquartile range used to determine outliers. Default 1.5 +* outlierIQR - Interquartile range used to determine outliers. Default 1.5 * boxLineColor - Outline color of the box * boxFillColor - Fill color for the box * whiskerColor - Line color used for whiskers @@ -202,7 +202,15 @@ /*jslint regexp: true, browser: true, jquery: true, white: true, nomen: false, plusplus: false, maxerr: 500, indent: 4 */ -(function ($) { +(function(factory) { + if(typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } + else { + factory(jQuery); + } +} +(function($) { 'use strict'; var UNSET_OPTION = {}, @@ -210,7 +218,7 @@ remove, isNumber, all, sum, addCSS, ensureArray, formatNumber, RangeMap, MouseHandler, Tooltip, barHighlightMixin, line, bar, tristate, discrete, bullet, pie, box, defaultStyles, initStyles, - VShape, VCanvas_base, VCanvas_canvas, VCanvas_vml, pending, shapeCount = 0; + VShape, VCanvas_base, VCanvas_canvas, VCanvas_vml, pending, shapeCount = 0; /** * Default configuration settings @@ -359,6 +367,7 @@ 'white-space: nowrap;' + 'padding: 5px;' + 'border: 1px solid white;' + + 'z-index: 10000;' + '}' + '.jqsfield { ' + 'color: white;' + @@ -366,12 +375,6 @@ 'text-align: left;' + '}'; - initStyles = function() { - addCSS(defaultStyles); - }; - - $(initStyles); - /** * Utilities */ @@ -476,10 +479,16 @@ var vl; if (q === 2) { vl = Math.floor(values.length / 2); - return values.length % 2 ? values[vl] : (values[vl] + values[vl + 1]) / 2; + return values.length % 2 ? values[vl] : (values[vl-1] + values[vl]) / 2; } else { - vl = Math.floor(values.length / 4); - return values.length % 2 ? (values[vl * q] + values[vl * q + 1]) / 2 : values[vl * q]; + if (values.length % 2 ) { // odd + vl = (values.length * q + q) / 4; + return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl-1]; + } else { //even + vl = (values.length * q + 2) / 4; + return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl-1]; + + } } }; @@ -547,7 +556,8 @@ all = function (val, arr, ignoreNull) { var i; for (i = arr.length; i--; ) { - if (arr[i] !== val || (!ignoreNull && val === null)) { + if (ignoreNull && arr[i] === null) continue; + if (arr[i] !== val) { return false; } } @@ -593,9 +603,9 @@ if (height === undefined) { height = $(this).innerHeight(); } - if ($.browser.hasCanvas) { + if ($.fn.sparkline.hasCanvas) { target = new VCanvas_canvas(width, height, this, interact); - } else if ($.browser.msie) { + } else if ($.fn.sparkline.hasVML) { target = new VCanvas_vml(width, height, this); } else { return false; @@ -900,6 +910,12 @@ } }); + initStyles = function() { + addCSS(defaultStyles); + }; + + $(initStyles); + pending = []; $.fn.sparkline = function (userValues, userOptions) { return this.each(function () { @@ -1484,7 +1500,7 @@ canvasTop, canvasLeft, vertex, path, paths, x, y, xnext, xpos, xposnext, last, next, yvalcount, lineShapes, fillShapes, plen, - valueSpots, color, xvalues, yvalues, i; + valueSpots, hlSpotsEnabled, color, xvalues, yvalues, i; if (!line._super.render.call(this)) { return; @@ -1512,18 +1528,20 @@ } if (spotRadius) { // adjust the canvas size as required so that spots will fit - if (options.get('minSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.miny)) { + hlSpotsEnabled = options.get('highlightSpotColor') && !options.get('disableInteraction'); + if (hlSpotsEnabled || options.get('minSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.miny)) { canvasHeight -= Math.ceil(spotRadius); } - if (options.get('maxSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.maxy)) { + if (hlSpotsEnabled || options.get('maxSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.maxy)) { canvasHeight -= Math.ceil(spotRadius); canvasTop += Math.ceil(spotRadius); } - if ((options.get('minSpotColor') || options.get('maxSpotColor')) && (yvalues[0] === this.miny || yvalues[0] === this.maxy)) { + if (hlSpotsEnabled || + ((options.get('minSpotColor') || options.get('maxSpotColor')) && (yvalues[0] === this.miny || yvalues[0] === this.maxy))) { canvasLeft += Math.ceil(spotRadius); canvasWidth -= Math.ceil(spotRadius); } - if (options.get('spotColor') || + if (hlSpotsEnabled || options.get('spotColor') || (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[yvallast] === this.miny || yvalues[yvallast] === this.maxy))) { canvasWidth -= Math.ceil(spotRadius); @@ -1533,7 +1551,7 @@ canvasHeight--; - if (options.get('normalRangeMin') && !options.get('drawNormalOnTop')) { + if (options.get('normalRangeMin') !== undefined && !options.get('drawNormalOnTop')) { this.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey); } @@ -1555,8 +1573,8 @@ if (yvalues[i - 1] !== null) { path = []; paths.push(path); - vertices.push(null); } + vertices.push(null); } } else { if (y < this.miny) { @@ -1603,7 +1621,7 @@ options.get('fillColor'), options.get('fillColor')).append(); } - if (options.get('normalRangeMin') && options.get('drawNormalOnTop')) { + if (options.get('normalRangeMin') !== undefined && options.get('drawNormalOnTop')) { this.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey); } @@ -1629,7 +1647,7 @@ } } - if (spotRadius && options.get('spotColor')) { + if (spotRadius && options.get('spotColor') && yvalues[yvallast] !== null) { target.drawCircle(canvasLeft + Math.round((xvalues[xvalues.length - 1] - this.minx) * (canvasWidth / rangex)), canvasTop + Math.round(canvasHeight - (canvasHeight * ((yvalues[yvallast] - this.miny) / rangey))), spotRadius, undefined, @@ -2085,11 +2103,15 @@ type: 'bullet', init: function (el, values, options, width, height) { - var min, max; + var min, max, vals; bullet._super.init.call(this, el, values, options, width, height); // values: target, performance, range1, range2, range3 - values = $.map(values, Number); + this.values = values = normalizeValues(values); + // target or performance could be null + vals = values.slice(); + vals[0] = vals[0] === null ? vals[2] : vals[0]; + vals[1] = values[1] === null ? vals[2] : vals[1]; min = Math.min.apply(Math, values); max = Math.max.apply(Math, values); if (options.get('base') === undefined) { @@ -2191,12 +2213,16 @@ this.shapes[shape.id] = 'r' + i; this.valueShapes['r' + i] = shape.id; } - shape = this.renderPerformance().append(); - this.shapes[shape.id] = 'p1'; - this.valueShapes.p1 = shape.id; - shape = this.renderTarget().append(); - this.shapes[shape.id] = 't0'; - this.valueShapes.t0 = shape.id; + if (this.values[1] !== null) { + shape = this.renderPerformance().append(); + this.shapes[shape.id] = 'p1'; + this.valueShapes.p1 = shape.id; + } + if (this.values[0] !== null) { + shape = this.renderTarget().append(); + this.shapes[shape.id] = 't0'; + this.valueShapes.t0 = shape.id; + } target.render(); } }); @@ -2303,9 +2329,11 @@ options.get('borderColor'), undefined, borderWidth).append(); } for (i = values.length; i--;) { - shape = this.renderSlice(i).append(); - this.valueShapes[i] = shape.id; // store just the shapeid - this.shapes[shape.id] = i; + if (values[i]) { // don't render zero values + shape = this.renderSlice(i).append(); + this.valueShapes[i] = shape.id; // store just the shapeid + this.shapes[shape.id] = i; + } } target.render(); } @@ -2338,10 +2366,14 @@ var result = [ { field: 'lq', value: this.quartiles[0] }, { field: 'med', value: this.quartiles[1] }, - { field: 'uq', value: this.quartiles[2] }, - { field: 'lo', value: this.loutlier }, - { field: 'ro', value: this.routlier } + { field: 'uq', value: this.quartiles[2] } ]; + if (this.loutlier !== undefined) { + result.push({ field: 'lo', value: this.loutlier}); + } + if (this.routlier !== undefined) { + result.push({ field: 'ro', value: this.routlier}); + } if (this.lwhisker !== undefined) { result.push({ field: 'lw', value: this.lwhisker}); } @@ -2496,13 +2528,19 @@ // Setup a very simple "virtual canvas" to make drawing the few shapes we need easier // This is accessible as $(foo).simpledraw() - if ($.browser.msie && !document.namespaces.v) { - document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML'); - } + // Detect browser renderer support + (function() { + if (document.namespaces && !document.namespaces.v) { + $.fn.sparkline.hasVML = true; + document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML'); + } else { + $.fn.sparkline.hasVML = false; + } + + var el = document.createElement('canvas'); + $.fn.sparkline.hasCanvas = !!(el.getContext && el.getContext('2d')); - if ($.browser.hasCanvas === undefined) { - $.browser.hasCanvas = document.createElement('canvas').getContext !== undefined; - } + })() VShape = createClass({ init: function (target, id, type, args) { @@ -2902,7 +2940,7 @@ _drawPieSlice: function (shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) { var vpath, startx, starty, endx, endy, stroke, fill, vel; if (startAngle === endAngle) { - return; // VML seems to have problem when start angle equals end angle. + return ''; // VML seems to have problem when start angle equals end angle. } if ((endAngle - startAngle) === (2 * Math.PI)) { startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0 @@ -2914,9 +2952,18 @@ endx = x + Math.round(Math.cos(endAngle) * radius); endy = y + Math.round(Math.sin(endAngle) * radius); - // Prevent very small slices from being mistaken as a whole pie + if (startx === endx && starty === endy) { + if ((endAngle - startAngle) < Math.PI) { + // Prevent very small slices from being mistaken as a whole pie + return ''; + } + // essentially going to be the entire circle, so ignore startAngle + startx = endx = x + radius; + starty = endy = y; + } + if (startx === endx && starty === endy && (endAngle - startAngle) < Math.PI) { - return; + return ''; } vpath = [x - radius, y - radius, x + radius, y + radius, startx, starty, endx, endy]; @@ -2997,5 +3044,4 @@ } }); - -})(jQuery); +})); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.min.js b/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.min.js index ea174b6d6..74187063f 100644 --- a/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.min.js +++ b/wp-content/plugins/wp-piwik/js/sparkline/jquery.sparkline.min.js @@ -1,5 +1,5 @@ -/* jquery.sparkline 2.0 - http://omnipotent.net/jquery.sparkline/ +/* jquery.sparkline 2.1.1 - http://omnipotent.net/jquery.sparkline/ ** Licensed under the New BSD License - see above site for details */ -(function(a){"use strict";var b={},c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=0;c=function(){return{common:{type:"line",lineColor:"#00f",fillColor:"#cdf",defaultPixelsPerValue:3,width:"auto",height:"auto",composite:!1,tagValuesAttribute:"values",tagOptionsPrefix:"spark",enableTagOptions:!1,enableHighlight:!0,highlightLighten:1.4,tooltipSkipNull:!0,tooltipPrefix:"",tooltipSuffix:"",disableHiddenCheck:!1,numberFormatter:!1,numberDigitGroupCount:3,numberDigitGroupSep:",",numberDecimalMark:".",disableTooltips:!1,disableInteraction:!1},line:{spotColor:"#f80",highlightSpotColor:"#5f5",highlightLineColor:"#f22",spotRadius:1.5,minSpotColor:"#f80",maxSpotColor:"#f80",lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:"#ccc",drawNormalOnTop:!1,chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined,tooltipFormat:new e('<span style="color: {{color}}">●</span> {{prefix}}{{y}}{{suffix}}')},bar:{barColor:"#3366cc",negBarColor:"#f44",stackedBarColor:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],zeroColor:undefined,nullColor:undefined,zeroAxis:!0,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,colorMap:undefined,tooltipFormat:new e('<span style="color: {{color}}">●</span> {{prefix}}{{value}}{{suffix}}')},tristate:{barWidth:4,barSpacing:1,posBarColor:"#6f6",negBarColor:"#f44",zeroBarColor:"#999",colorMap:{},tooltipFormat:new e('<span style="color: {{color}}">●</span> {{value:map}}'),tooltipValueLookups:{map:{"-1":"Loss",0:"Draw",1:"Win"}}},discrete:{lineHeight:"auto",thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,tooltipFormat:new e("{{prefix}}{{value}}{{suffix}}")},bullet:{targetColor:"#f33",targetWidth:3,performanceColor:"#33f",rangeColors:["#d3dafe","#a8b6ff","#7f94ff"],base:undefined,tooltipFormat:new e("{{fieldkey:fields}} - {{value}}"),tooltipValueLookups:{fields:{r:"Range",p:"Performance",t:"Target"}}},pie:{offset:0,sliceColors:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],borderWidth:0,borderColor:"#000",tooltipFormat:new e('<span style="color: {{color}}">●</span> {{value}} ({{percent.1}}%)')},box:{raw:!1,boxLineColor:"#000",boxFillColor:"#cdf",whiskerColor:"#000",outlierLineColor:"#333",outlierFillColor:"#fff",medianColor:"#f00",showOutliers:!0,outlierIQR:1.5,spotRadius:1.5,target:undefined,targetColor:"#4a2",chartRangeMax:undefined,chartRangeMin:undefined,tooltipFormat:new e("{{field:fields}}: {{value}}"),tooltipFormatFieldlistKey:"field",tooltipValueLookups:{fields:{lq:"Lower Quartile",med:"Median",uq:"Upper Quartile",lo:"Left Outlier",ro:"Right Outlier",lw:"Left Whisker",rw:"Right Whisker"}}}}},B='.jqstooltip { position: absolute;left: 0px;top: 0px;visibility: hidden;background: rgb(0, 0, 0) transparent;background-color: rgba(0,0,0,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";color: white;font: 10px arial, san serif;text-align: left;white-space: nowrap;padding: 5px;border: 1px solid white;}.jqsfield { color: white;font: 10px arial, san serif;text-align: left;}',C=function(){n(B)},a(C),d=function(){var b,c;return b=function(){this.init.apply(this,arguments)},arguments.length>1?(arguments[0]?(b.prototype=a.extend(new arguments[0],arguments[arguments.length-1]),b._super=arguments[0].prototype):b.prototype=arguments[arguments.length-1],arguments.length>2&&(c=Array.prototype.slice.call(arguments,1,-1),c.unshift(b.prototype),a.extend.apply(a,c))):b.prototype=arguments[0],b.prototype.cls=b,b},a.SPFormatClass=e=d({fre:/\{\{([\w.]+?)(:(.+?))?\}\}/g,precre:/(\w+)\.(\d+)/,init:function(a,b){this.format=a,this.fclass=b},render:function(a,b,c){var d=this,e=a,f,g,h,i,j;return this.format.replace(this.fre,function(){var a;return g=arguments[1],h=arguments[3],f=d.precre.exec(g),f?(j=f[2],g=f[1]):j=!1,i=e[g],i===undefined?"":h&&b&&b[h]?(a=b[h],a.get?b[h].get(i)||i:b[h][i]||i):(k(i)&&(c.get("numberFormatter")?i=c.get("numberFormatter")(i):i=p(i,j,c.get("numberDigitGroupCount"),c.get("numberDigitGroupSep"),c.get("numberDecimalMark"))),i)})}}),a.spformat=function(a,b){return new e(a,b)},f=function(a,b,c){return a<b?b:a>c?c:a},g=function(a,b){var c;return b===2?(c=Math.floor(a.length/2),a.length%2?a[c]:(a[c]+a[c+1])/2):(c=Math.floor(a.length/4),a.length%2?(a[c*b]+a[c*b+1])/2:a[c*b])},h=function(a){var b;switch(a){case"undefined":a=undefined;break;case"null":a=null;break;case"true":a=!0;break;case"false":a=!1;break;default:b=parseFloat(a),a==b&&(a=b)}return a},i=function(a){var b,c=[];for(b=a.length;b--;)c[b]=h(a[b]);return c},j=function(a,b){var c,d,e=[];for(c=0,d=a.length;c<d;c++)a[c]!==b&&e.push(a[c]);return e},k=function(a){return!isNaN(parseFloat(a))&&isFinite(a)},p=function(b,c,d,e,f){var g,h;b=(c===!1?parseFloat(b).toString():b.toFixed(c)).split(""),g=(g=a.inArray(".",b))<0?b.length:g,g<b.length&&(b[g]=f);for(h=g-d;h>0;h-=d)b.splice(h,0,e);return b.join("")},l=function(a,b,c){var d;for(d=b.length;d--;)if(b[d]!==a||!c&&a===null)return!1;return!0},m=function(a){var b=0,c;for(c=a.length;c--;)b+=typeof a[c]=="number"?a[c]:0;return b},o=function(b){return a.isArray(b)?b:[b]},n=function(a){var b;document.createStyleSheet?document.createStyleSheet().cssText=a:(b=document.createElement("style"),b.type="text/css",document.getElementsByTagName("head")[0].appendChild(b),b[typeof document.body.style.WebkitAppearance=="string"?"innerText":"innerHTML"]=a)},a.fn.simpledraw=function(b,c,d,e){var f,g;if(d&&(f=this.data("_jqs_vcanvas")))return f;b===undefined&&(b=a(this).innerWidth()),c===undefined&&(c=a(this).innerHeight());if(a.browser.hasCanvas)f=new F(b,c,this,e);else{if(!a.browser.msie)return!1;f=new G(b,c,this)}return g=a(this).data("_jqs_mhandler"),g&&g.registerCanvas(f),f},a.fn.cleardraw=function(){var a=this.data("_jqs_vcanvas");a&&a.reset()},a.RangeMapClass=q=d({init:function(a){var b,c,d=[];for(b in a)a.hasOwnProperty(b)&&typeof b=="string"&&b.indexOf(":")>-1&&(c=b.split(":"),c[0]=c[0].length===0?-Infinity:parseFloat(c[0]),c[1]=c[1].length===0?Infinity:parseFloat(c[1]),c[2]=a[b],d.push(c));this.map=a,this.rangelist=d||!1},get:function(a){var b=this.rangelist,c,d,e;if((e=this.map[a])!==undefined)return e;if(b)for(c=b.length;c--;){d=b[c];if(d[0]<=a&&d[1]>=a)return d[2]}return undefined}}),a.range_map=function(a){return new q(a)},r=d({init:function(b,c){var d=a(b);this.$el=d,this.options=c,this.currentPageX=0,this.currentPageY=0,this.el=b,this.splist=[],this.tooltip=null,this.over=!1,this.displayTooltips=!c.get("disableTooltips"),this.highlightEnabled=!c.get("disableHighlight")},registerSparkline:function(a){this.splist.push(a),this.over&&this.updateDisplay()},registerCanvas:function(b){var c=a(b.canvas);this.canvas=b,this.$canvas=c,c.mouseenter(a.proxy(this.mouseenter,this)),c.mouseleave(a.proxy(this.mouseleave,this)),c.click(a.proxy(this.mouseclick,this))},reset:function(a){this.splist=[],this.tooltip&&a&&(this.tooltip.remove(),this.tooltip=undefined)},mouseclick:function(b){var c=a.Event("sparklineClick");c.originalEvent=b,c.sparklines=this.splist,this.$el.trigger(c)},mouseenter:function(b){a(document.body).unbind("mousemove.jqs"),a(document.body).bind("mousemove.jqs",a.proxy(this.mousemove,this)),this.over=!0,this.currentPageX=b.pageX,this.currentPageY=b.pageY,this.currentEl=b.target,!this.tooltip&&this.displayTooltips&&(this.tooltip=new s(this.options),this.tooltip.updatePosition(b.pageX,b.pageY)),this.updateDisplay()},mouseleave:function(){a(document.body).unbind("mousemove.jqs");var b=this.splist,c=b.length,d=!1,e,f;this.over=!1,this.currentEl=null,this.tooltip&&(this.tooltip.remove(),this.tooltip=null);for(f=0;f<c;f++)e=b[f],e.clearRegionHighlight()&&(d=!0);d&&this.canvas.render()},mousemove:function(a){this.currentPageX=a.pageX,this.currentPageY=a.pageY,this.currentEl=a.target,this.tooltip&&this.tooltip.updatePosition(a.pageX,a.pageY),this.updateDisplay()},updateDisplay:function(){var b=this.splist,c=b.length,d=!1,e=this.$canvas.offset(),f=this.currentPageX-e.left,g=this.currentPageY-e.top,h,i,j,k,l;if(!this.over)return;for(j=0;j<c;j++)i=b[j],k=i.setRegionHighlight(this.currentEl,f,g),k&&(d=!0);if(d){l=a.Event("sparklineRegionChange"),l.sparklines=this.splist,this.$el.trigger(l);if(this.tooltip){h="";for(j=0;j<c;j++)i=b[j],h+=i.getCurrentRegionTooltip();this.tooltip.setContent(h)}this.disableHighlight||this.canvas.render()}k===null&&this.mouseleave()}}),s=d({sizeStyle:"position: static !important;display: block !important;visibility: hidden !important;float: left !important;",init:function(b){var c=b.get("tooltipClassname","jqstooltip"),d=this.sizeStyle,e;this.container=b.get("tooltipContainer")||document.body,this.tooltipOffsetX=b.get("tooltipOffsetX",10),this.tooltipOffsetY=b.get("tooltipOffsetY",12),a("#jqssizetip").remove(),a("#jqstooltip").remove(),this.sizetip=a("<div/>",{id:"jqssizetip",style:d,"class":c}),this.tooltip=a("<div/>",{id:"jqstooltip","class":c}).appendTo(this.container),e=this.tooltip.offset(),this.offsetLeft=e.left,this.offsetTop=e.top,this.hidden=!0,a(window).unbind("resize.jqs scroll.jqs"),a(window).bind("resize.jqs scroll.jqs",a.proxy(this.updateWindowDims,this)),this.updateWindowDims()},updateWindowDims:function(){this.scrollTop=a(window).scrollTop(),this.scrollLeft=a(window).scrollLeft(),this.scrollRight=this.scrollLeft+a(window).width(),this.updatePosition()},getSize:function(a){this.sizetip.html(a).appendTo(this.container),this.width=this.sizetip.width()+1,this.height=this.sizetip.height(),this.sizetip.remove()},setContent:function(a){if(!a){this.tooltip.css("visibility","hidden"),this.hidden=!0;return}this.getSize(a),this.tooltip.html(a).css({width:this.width,height:this.height,visibility:"visible"}),this.hidden&&(this.hidden=!1,this.updatePosition())},updatePosition:function(a,b){if(a===undefined){if(this.mousex===undefined)return;a=this.mousex-this.offsetLeft,b=this.mousey-this.offsetTop}else this.mousex=a-=this.offsetLeft,this.mousey=b-=this.offsetTop;if(!this.height||!this.width||this.hidden)return;b-=this.height+this.tooltipOffsetY,a+=this.tooltipOffsetX,b<this.scrollTop&&(b=this.scrollTop),a<this.scrollLeft?a=this.scrollLeft:a+this.width>this.scrollRight&&(a=this.scrollRight-this.width),this.tooltip.css({left:a,top:b})},remove:function(){this.tooltip.remove(),this.sizetip.remove(),this.sizetip=this.tooltip=undefined,a(window).unbind("resize.jqs scroll.jqs")}}),H=[],a.fn.sparkline=function(b,c){return this.each(function(){var d=new a.fn.sparkline.options(this,c),e=a(this),f,g;f=function(){var c,f,g,h,i,j,k;if(b==="html"||b===undefined){k=this.getAttribute(d.get("tagValuesAttribute"));if(k===undefined||k===null)k=e.html();c=k.replace(/(^\s*<!--)|(-->\s*$)|\s+/g,"").split(",")}else c=b;f=d.get("width")==="auto"?c.length*d.get("defaultPixelsPerValue"):d.get("width");if(d.get("height")==="auto"){if(!d.get("composite")||!a.data(this,"_jqs_vcanvas"))h=document.createElement("span"),h.innerHTML="a",e.html(h),g=a(h).innerHeight()||a(h).height(),a(h).remove(),h=null}else g=d.get("height");d.get("disableInteraction")?i=!1:(i=a.data(this,"_jqs_mhandler"),i?d.get("composite")||i.reset():(i=new r(this,d),a.data(this,"_jqs_mhandler",i)));if(d.get("composite")&&!a.data(this,"_jqs_vcanvas")){a.data(this,"_jqs_errnotify")||(alert("Attempted to attach a composite sparkline to an element with no existing sparkline"),a.data(this,"_jqs_errnotify",!0));return}j=new(a.fn.sparkline[d.get("type")])(this,c,d,f,g),j.render(),i&&i.registerSparkline(j)};if(a(this).html()&&!d.get("disableHiddenCheck")&&a(this).is(":hidden")||a.fn.jquery<"1.3.0"&&a(this).parents().is(":hidden")||!a(this).parents("body").length){if(!d.get("composite")&&a.data(this,"_jqs_pending"))for(g=H.length;g;g--)H[g-1][0]==this&&H.splice(g-1,1);H.push([this,f]),a.data(this,"_jqs_pending",!0)}else f.call(this)})},a.fn.sparkline.defaults=c(),a.sparkline_display_visible=function(){var b,c,d,e=[];for(c=0,d=H.length;c<d;c++)b=H[c][0],a(b).is(":visible")&&!a(b).parents().is(":hidden")?(H[c][1].call(b),a.data(H[c][0],"_jqs_pending",!1),e.push(c)):!a(b).closest("html").length&&!a.data(b,"_jqs_pending")&&(a.data(H[c][0],"_jqs_pending",!1),e.push(c));for(c=e.length;c;c--)H.splice(e[c-1],1)},a.fn.sparkline.options=d({init:function(c,d){var e,f,g,h;this.userOptions=d=d||{},this.tag=c,this.tagValCache={},f=a.fn.sparkline.defaults,g=f.common,this.tagOptionsPrefix=d.enableTagOptions&&(d.tagOptionsPrefix||g.tagOptionsPrefix),h=this.getTagSetting("type"),h===b?e=f[d.type||g.type]:e=f[h],this.mergedOptions=a.extend({},g,e,d)},getTagSetting:function(a){var c=this.tagOptionsPrefix,d,e,f,g;if(c===!1||c===undefined)return b;if(this.tagValCache.hasOwnProperty(a))d=this.tagValCache.key;else{d=this.tag.getAttribute(c+a);if(d===undefined||d===null)d=b;else if(d.substr(0,1)==="["){d=d.substr(1,d.length-2).split(",");for(e=d.length;e--;)d[e]=h(d[e].replace(/(^\s*)|(\s*$)/g,""))}else if(d.substr(0,1)==="{"){f=d.substr(1,d.length-2).split(","),d={};for(e=f.length;e--;)g=f[e].split(":",2),d[g[0].replace(/(^\s*)|(\s*$)/g,"")]=h(g[1].replace(/(^\s*)|(\s*$)/g,""))}else d=h(d);this.tagValCache.key=d}return d},get:function(a,c){var d=this.getTagSetting(a),e;return d!==b?d:(e=this.mergedOptions[a])===undefined?c:e}}),a.fn.sparkline._base=d({disabled:!1,init:function(b,c,d,e,f){this.el=b,this.$el=a(b),this.values=c,this.options=d,this.width=e,this.height=f,this.currentRegion=undefined},initTarget:function(){var a=!this.options.get("disableInteraction");(this.target=this.$el.simpledraw(this.width,this.height,this.options.get("composite"),a))?(this.canvasWidth=this.target.pixelWidth,this.canvasHeight=this.target.pixelHeight):this.disabled=!0},render:function(){return this.disabled?(this.el.innerHTML="",!1):!0},getRegion:function(a,b){},setRegionHighlight:function(a,b,c){var d=this.currentRegion,e=!this.options.get("disableHighlight"),f;return b>this.canvasWidth||c>this.canvasHeight||b<0||c<0?null:(f=this.getRegion(a,b,c),d!==f?(d!==undefined&&e&&this.removeHighlight(),this.currentRegion=f,f!==undefined&&e&&this.renderHighlight(),!0):!1)},clearRegionHighlight:function(){return this.currentRegion!==undefined?(this.removeHighlight(),this.currentRegion=undefined,!0):!1},renderHighlight:function(){this.changeHighlight(!0)},removeHighlight:function(){this.changeHighlight(!1)},changeHighlight:function(a){},getCurrentRegionTooltip:function(){var b=this.options,c="",d=[],f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(this.currentRegion===undefined)return"";f=this.getCurrentRegionFields(),p=b.get("tooltipFormatter");if(p)return p(this,b,f);b.get("tooltipChartTitle")&&(c+='<div class="jqs jqstitle">'+b.get("tooltipChartTitle")+"</div>\n"),g=this.options.get("tooltipFormat");if(!g)return"";a.isArray(g)||(g=[g]),a.isArray(f)||(f=[f]),l=this.options.get("tooltipFormatFieldlist"),m=this.options.get("tooltipFormatFieldlistKey");if(l&&m){n=[];for(k=f.length;k--;)o=f[k][m],(s=a.inArray(o,l))!=-1&&(n[s]=f[k]);f=n}h=g.length,r=f.length;for(k=0;k<h;k++){q=g[k],typeof q=="string"&&(q=new e(q)),i=q.fclass||"jqsfield";for(s=0;s<r;s++)if(!f[s].isNull||!b.get("tooltipSkipNull"))a.extend(f[s],{prefix:b.get("tooltipPrefix"),suffix:b.get("tooltipSuffix")}),j=q.render(f[s],b.get("tooltipValueLookups"),b),d.push('<div class="'+i+'">'+j+"</div>")}return d.length?c+d.join("\n"):""},getCurrentRegionFields:function(){},calcHighlightColor:function(a,b){var c=b.get("highlightColor"),d=b.get("highlightLighten"),e,g,h,i;if(c)return c;if(d){e=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a)||/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(a);if(e){h=[],g=a.length===4?16:1;for(i=0;i<3;i++)h[i]=f(Math.round(parseInt(e[i+1],16)*g*d),0,255);return"rgb("+h.join(",")+")"}}return a}}),t={changeHighlight:function(b){var c=this.currentRegion,d=this.target,e=this.regionShapes[c],f;e&&(f=this.renderRegion(c,b),a.isArray(f)||a.isArray(e)?(d.replaceWithShapes(e,f),this.regionShapes[c]=a.map(f,function(a){return a.id})):(d.replaceWithShape(e,f),this.regionShapes[c]=f.id))},render:function(){var b=this.values,c=this.target,d=this.regionShapes,e,f,g,h;if(!this.cls._super.render.call(this))return;for(g=b.length;g--;){e=this.renderRegion(g);if(e)if(a.isArray(e)){f=[];for(h=e.length;h--;)e[h].append(),f.push(e[h].id);d[g]=f}else e.append(),d[g]=e.id;else d[g]=null}c.render()}},a.fn.sparkline.line=u=d(a.fn.sparkline._base,{type:"line",init:function(a,b,c,d,e){u._super.init.call(this,a,b,c,d,e),this.vertices=[],this.regionMap=[],this.xvalues=[],this.yvalues=[],this.yminmax=[],this.hightlightSpotId=null,this.lastShapeId=null,this.initTarget()},getRegion:function(a,b,c){var d,e=this.regionMap;for(d=e.length;d--;)if(e[d]!==null&&b>=e[d][0]&&b<=e[d][1])return e[d][2];return undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.yvalues[a]===null,x:this.xvalues[a],y:this.yvalues[a],color:this.options.get("lineColor"),fillColor:this.options.get("fillColor"),offset:a}},renderHighlight:function(){var a=this.currentRegion,b=this.target,c=this.vertices[a],d=this.options,e=d.get("spotRadius"),f=d.get("highlightSpotColor"),g=d.get("highlightLineColor"),h,i;if(!c)return;e&&f&&(h=b.drawCircle(c[0],c[1],e,undefined,f),this.highlightSpotId=h.id,b.insertAfterShape(this.lastShapeId,h)),g&&(i=b.drawLine(c[0],this.canvasTop,c[0],this.canvasTop+this.canvasHeight,g),this.highlightLineId=i.id,b.insertAfterShape(this.lastShapeId,i))},removeHighlight:function(){var a=this.target;this.highlightSpotId&&(a.removeShapeId(this.highlightSpotId),this.highlightSpotId=null),this.highlightLineId&&(a.removeShapeId(this.highlightLineId),this.highlightLineId=null)},scanValues:function(){var a=this.values,b=a.length,c=this.xvalues,d=this.yvalues,e=this.yminmax,f,g,h,i,j;for(f=0;f<b;f++)g=a[f],h=typeof a[f]=="string",i=typeof a[f]=="object"&&a[f]instanceof Array,j=h&&a[f].split(":"),h&&j.length===2?(c.push(Number(j[0])),d.push(Number(j[1])),e.push(Number(j[1]))):i?(c.push(g[0]),d.push(g[1]),e.push(g[1])):(c.push(f),a[f]===null||a[f]==="null"?d.push(null):(d.push(Number(g)),e.push(Number(g))));this.options.get("xvalues")&&(c=this.options.get("xvalues")),this.maxy=this.maxyorg=Math.max.apply(Math,e),this.miny=this.minyorg=Math.min.apply(Math,e),this.maxx=Math.max.apply(Math,c),this.minx=Math.min.apply(Math,c),this.xvalues=c,this.yvalues=d,this.yminmax=e},processRangeOptions:function(){var a=this.options,b=a.get("normalRangeMin"),c=a.get("normalRangeMax");b!==undefined&&(b<this.miny&&(this.miny=b),c>this.maxy&&(this.maxy=c)),a.get("chartRangeMin")!==undefined&&(a.get("chartRangeClip")||a.get("chartRangeMin")<this.miny)&&(this.miny=a.get("chartRangeMin")),a.get("chartRangeMax")!==undefined&&(a.get("chartRangeClip")||a.get("chartRangeMax")>this.maxy)&&(this.maxy=a.get("chartRangeMax")),a.get("chartRangeMinX")!==undefined&&(a.get("chartRangeClipX")||a.get("chartRangeMinX")<this.minx)&&(this.minx=a.get("chartRangeMinX")),a.get("chartRangeMaxX")!==undefined&&(a.get("chartRangeClipX")||a.get("chartRangeMaxX")>this.maxx)&&(this.maxx=a.get("chartRangeMaxX"))},drawNormalRange:function(a,b,c,d,e){var f=this.options.get("normalRangeMin"),g=this.options.get("normalRangeMax"),h=b+Math.round(c-c*((g-this.miny)/e)),i=Math.round(c*(g-f)/e);this.target.drawRect(a,h,d,i,undefined,this.options.get("normalRangeColor")).append()},render:function(){var b=this.options,c=this.target,d=this.canvasWidth,e=this.canvasHeight,f=this.vertices,g=b.get("spotRadius"),h=this.regionMap,i,j,k,l,m,n,o,p,r,s,t,v,w,x,y,z,A,B,C,D,E,F,G,H;if(!u._super.render.call(this))return;this.scanValues(),this.processRangeOptions(),F=this.xvalues,G=this.yvalues;if(!this.yminmax.length||this.yvalues.length<2)return;l=m=0,i=this.maxx-this.minx===0?1:this.maxx-this.minx,j=this.maxy-this.miny===0?1:this.maxy-this.miny,k=this.yvalues.length-1,g&&(d<g*4||e<g*4)&&(g=0);if(g){if(b.get("minSpotColor")||b.get("spotColor")&&G[k]===this.miny)e-=Math.ceil(g);if(b.get("maxSpotColor")||b.get("spotColor")&&G[k]===this.maxy)e-=Math.ceil(g),l+=Math.ceil(g);(b.get("minSpotColor")||b.get("maxSpotColor"))&&(G[0]===this.miny||G[0]===this.maxy)&&(m+=Math.ceil(g),d-=Math.ceil(g));if(b.get("spotColor")||b.get("minSpotColor")||b.get("maxSpotColor")&&(G[k]===this.miny||G[k]===this.maxy))d-=Math.ceil(g)}e--,b.get("normalRangeMin")&&!b.get("drawNormalOnTop")&&this.drawNormalRange(m,l,e,d,j),o=[],p=[o],x=y=null,z=G.length;for(H=0;H<z;H++)r=F[H],t=F[H+1],s=G[H],v=m+Math.round((r-this.minx)*(d/i)),w=H<z-1?m+Math.round((t-this.minx)*(d/i)):d,y=v+(w-v)/2,h[H]=[x||0,y,H],x=y,s===null?H&&G[H-1]!==null&&(o=[],p.push(o),f.push(null)):(s<this.miny&&(s=this.miny),s>this.maxy&&(s=this.maxy),o.length||o.push([v,l+e]),n=[v,l+Math.round(e-e*((s-this.miny)/j))],o.push(n),f.push(n));A=[],B=[],C=p.length;for(H=0;H<C;H++)o=p[H],o.length&&(b.get("fillColor")&&(o.push([o[o.length-1][0],l+e]),B.push(o.slice(0)),o.pop()),o.length>2&&(o[0]=[o[0][0],o[1][1]]),A.push(o));C=B.length;for(H=0;H<C;H++)c.drawShape(B[H],b.get("fillColor"),b.get("fillColor")).append();b.get("normalRangeMin")&&b.get("drawNormalOnTop")&&this.drawNormalRange(m,l,e,d,j),C=A.length;for(H=0;H<C;H++)c.drawShape(A[H],b.get("lineColor"),undefined,b.get("lineWidth")).append();if(g&&b.get("valueSpots")){D=b.get("valueSpots"),D.get===undefined&&(D=new q(D));for(H=0;H<z;H++)E=D.get(G[H]),E&&c.drawCircle(m+Math.round((F[H]-this.minx)*(d/i)),l+Math.round(e-e*((G[H]-this.miny)/j)),g,undefined,E).append()}g&&b.get("spotColor")&&c.drawCircle(m+Math.round((F[F.length-1]-this.minx)*(d/i)),l+Math.round(e-e*((G[k]-this.miny)/j)),g,undefined,b.get("spotColor")).append(),this.maxy!==this.minyorg&&(g&&b.get("minSpotColor")&&(r=F[a.inArray(this.minyorg,G)],c.drawCircle(m+Math.round((r-this.minx)*(d/i)),l+Math.round(e-e*((this.minyorg-this.miny)/j)),g,undefined,b.get("minSpotColor")).append()),g&&b.get("maxSpotColor")&&(r=F[a.inArray(this.maxyorg,G)],c.drawCircle(m+Math.round((r-this.minx)*(d/i)),l+Math.round(e-e*((this.maxyorg-this.miny)/j)),g,undefined,b.get("maxSpotColor")).append())),this.lastShapeId=c.getLastShapeId(),this.canvasTop=l,c.render()}}),a.fn.sparkline.bar=v=d(a.fn.sparkline._base,t,{type:"bar",init:function(b,c,d,e,g){var k=parseInt(d.get("barWidth"),10),l=parseInt(d.get("barSpacing"),10),m=d.get("chartRangeMin"),n=d.get("chartRangeMax"),o=d.get("chartRangeClip"),p=Infinity,r=-Infinity,s,t,u,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;v._super.init.call(this,b,c,d,e,g);for(y=0,z=c.length;y<z;y++){M=c[y],s=typeof M=="string"&&M.indexOf(":")>-1;if(s||a.isArray(M))H=!0,s&&(M=c[y]=i(M.split(":"))),M=j(M,null),t=Math.min.apply(Math,M),u=Math.max.apply(Math,M),t<p&&(p=t),u>r&&(r=u)}this.stacked=H,this.regionShapes={},this.barWidth=k,this.barSpacing=l,this.totalBarWidth=k+l,this.width=e=c.length*k+(c.length-1)*l,this.initTarget(),o&&(F=m===undefined?-Infinity:m,G=n===undefined?Infinity:n),x=[],w=H?[]:x;var Q=[],R=[];for(y=0,z=c.length;y<z;y++)if(H){I=c[y],c[y]=L=[],Q[y]=0,w[y]=R[y]=0;for(J=0,K=I.length;J<K;J++)M=L[J]=o?f(I[J],F,G):I[J],M!==null&&(M>0&&(Q[y]+=M),p<0&&r>0?M<0?R[y]+=Math.abs(M):w[y]+=M:w[y]+=Math.abs(M-(M<0?r:p)),x.push(M))}else M=o?f(c[y],F,G):c[y],M=c[y]=h(M),M!==null&&x.push(M);this.max=E=Math.max.apply(Math,x),this.min=D=Math.min.apply(Math,x),this.stackMax=r=H?Math.max.apply(Math,Q):E,this.stackMin=p=H?Math.min.apply(Math,x):D,d.get("chartRangeMin")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMin")<D)&&(D=d.get("chartRangeMin")),d.get("chartRangeMax")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMax")>E)&&(E=d.get("chartRangeMax")),this.zeroAxis=B=d.get("zeroAxis",!0),D<=0&&E>=0&&B?C=0:B==0?C=D:D>0?C=D:C=E,this.xaxisOffset=C,A=H?Math.max.apply(Math,w)+Math.max.apply(Math,R):E-D,this.canvasHeightEf=B&&D<0?this.canvasHeight-2:this.canvasHeight-1,D<C?(O=H&&E>=0?r:E,N=(O-C)/A*this.canvasHeight,N!==Math.ceil(N)&&(this.canvasHeightEf-=2,N=Math.ceil(N))):N=this.canvasHeight,this.yoffset=N,a.isArray(d.get("colorMap"))?(this.colorMapByIndex=d.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=d.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===undefined&&(this.colorMapByValue=new q(this.colorMapByValue))),this.range=A},getRegion:function(a,b,c){var d=Math.floor(b/this.totalBarWidth);return d<0||d>=this.values.length?undefined:d},getCurrentRegionFields:function(){var a=this.currentRegion,b=o(this.values[a]),c=[],d,e;for(e=b.length;e--;)d=b[e],c.push({isNull:d===null,value:d,color:this.calcColor(e,d,a),offset:a});return c},calcColor:function(b,c,d){var e=this.colorMapByIndex,f=this.colorMapByValue,g=this.options,h,i;return this.stacked?h=g.get("stackedBarColor"):h=c<0?g.get("negBarColor"):g.get("barColor"),c===0&&g.get("zeroColor")!==undefined&&(h=g.get("zeroColor")),f&&(i=f.get(c))?h=i:e&&e.length>d&&(h=e[d]),a.isArray(h)?h[b%h.length]:h},renderRegion:function(b,c){var d=this.values[b],e=this.options,f=this.xaxisOffset,g=[],h=this.range,i=this.stacked,j=this.target,k=b*this.totalBarWidth,m=this.canvasHeightEf,n=this.yoffset,o,p,q,r,s,t,u,v,w,x;d=a.isArray(d)?d:[d],u=d.length,v=d[0],r=l(null,d),x=l(f,d,!0);if(r)return e.get("nullColor")?(q=c?e.get("nullColor"):this.calcHighlightColor(e.get("nullColor"),e),o=n>0?n-1:n,j.drawRect(k,o,this.barWidth-1,0,q,q)):undefined;s=n;for(t=0;t<u;t++){v=d[t];if(i&&v===f){if(!x||w)continue;w=!0}h>0?p=Math.floor(m*(Math.abs(v-f)/h))+1:p=1,v<f||v===f&&n===0?(o=s,s+=p):(o=n-p,n-=p),q=this.calcColor(t,v,b),c&&(q=this.calcHighlightColor(q,e)),g.push(j.drawRect(k,o,this.barWidth-1,p-1,q,q))}return g.length===1?g[0]:g}}),a.fn.sparkline.tristate=w=d(a.fn.sparkline._base,t,{type:"tristate",init:function(b,c,d,e,f){var g=parseInt(d.get("barWidth"),10),h=parseInt(d.get("barSpacing"),10);w._super.init.call(this,b,c,d,e,f),this.regionShapes={},this.barWidth=g,this.barSpacing=h,this.totalBarWidth=g+h,this.values=a.map(c,Number),this.width=e=c.length*g+(c.length-1)*h,a.isArray(d.get("colorMap"))?(this.colorMapByIndex=d.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=d.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===undefined&&(this.colorMapByValue=new q(this.colorMapByValue))),this.initTarget()},getRegion:function(a,b,c){return Math.floor(b/this.totalBarWidth)},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],color:this.calcColor(this.values[a],a),offset:a}},calcColor:function(a,b){var c=this.values,d=this.options,e=this.colorMapByIndex,f=this.colorMapByValue,g,h;return f&&(h=f.get(a))?g=h:e&&e.length>b?g=e[b]:c[b]<0?g=d.get("negBarColor"):c[b]>0?g=d.get("posBarColor"):g=d.get("zeroBarColor"),g},renderRegion:function(a,b){var c=this.values,d=this.options,e=this.target,f,g,h,i,j,k;f=e.pixelHeight,h=Math.round(f/2),i=a*this.totalBarWidth,c[a]<0?(j=h,g=h-1):c[a]>0?(j=0,g=h-1):(j=h-1,g=2),k=this.calcColor(c[a],a);if(k===null)return;return b&&(k=this.calcHighlightColor(k,d)),e.drawRect(i,j,this.barWidth-1,g-1,k,k)}}),a.fn.sparkline.discrete=x=d(a.fn.sparkline._base,t,{type:"discrete",init:function(b,c,d,e,f){x._super.init.call(this,b,c,d,e,f),this.regionShapes={},this.values=c=a.map(c,Number),this.min=Math.min.apply(Math,c),this.max=Math.max.apply(Math,c),this.range=this.max-this.min,this.width=e=d.get("width")==="auto"?c.length*2:this.width,this.interval=Math.floor(e/c.length),this.itemWidth=e/c.length,d.get("chartRangeMin")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMin")<this.min)&&(this.min=d.get("chartRangeMin")),d.get("chartRangeMax")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMax")>this.max)&&(this.max=d.get("chartRangeMax")),this.initTarget(),this.target&&(this.lineHeight=d.get("lineHeight")==="auto"?Math.round(this.canvasHeight*.3):d.get("lineHeight"))},getRegion:function(a,b,c){return Math.floor(b/this.itemWidth)},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],offset:a}},renderRegion:function(a,b){var c=this.values,d=this.options,e=this.min,g=this.max,h=this.range,i=this.interval,j=this.target,k=this.canvasHeight,l=this.lineHeight,m=k-l,n,o,p,q;return o=f(c[a],e,g),q=a*i,n=Math.round(m-m*((o-e)/h)),p=d.get("thresholdColor")&&o<d.get("thresholdValue")?d.get("thresholdColor"):d.get("lineColor"),b&&(p=this.calcHighlightColor(p,d)),j.drawLine(q,n,q,n+l,p)}}),a.fn.sparkline.bullet=y=d(a.fn.sparkline._base,{type:"bullet",init:function(b,c,d,e,f){var g,h;y._super.init.call(this,b,c,d,e,f),c=a.map(c,Number),g=Math.min.apply(Math,c),h=Math.max.apply(Math,c),d.get("base")===undefined?g=g<0?g:0:g=d.get("base"),this.min=g,this.max=h,this.range=h-g,this.shapes={},this.valueShapes={},this.regiondata={},this.width=e=d.get("width")==="auto"?"4.0em":e,this.target=this.$el.simpledraw(e,f,d.get("composite")),c.length||(this.disabled=!0),this.initTarget()},getRegion:function(a,b,c){var d=this.target.getShapeAt(a,b,c);return d!==undefined&&this.shapes[d]!==undefined?this.shapes[d]:undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{fieldkey:a.substr(0,1),value:this.values[a.substr(1)],region:a}},changeHighlight:function(a){var b=this.currentRegion,c=this.valueShapes[b],d;delete this.shapes[c];switch(b.substr(0,1)){case"r":d=this.renderRange(b.substr(1),a);break;case"p":d=this.renderPerformance(a);break;case"t":d=this.renderTarget(a)}this.valueShapes[b]=d.id,this.shapes[d.id]=b,this.target.replaceWithShape(c,d)},renderRange:function(a,b){var c=this.values[a],d=Math.round(this.canvasWidth*((c-this.min)/this.range)),e=this.options.get("rangeColors")[a-2];return b&&(e=this.calcHighlightColor(e,this.options)),this.target.drawRect(0,0,d-1,this.canvasHeight-1,e,e)},renderPerformance:function(a){var b=this.values[1],c=Math.round(this.canvasWidth*((b-this.min)/this.range)),d=this.options.get("performanceColor");return a&&(d=this.calcHighlightColor(d,this.options)),this.target.drawRect(0,Math.round(this.canvasHeight*.3),c-1,Math.round(this.canvasHeight*.4)-1,d,d)},renderTarget:function(a){var b=this.values[0],c=Math.round(this.canvasWidth*((b-this.min)/this.range)-this.options.get("targetWidth")/2),d=Math.round(this.canvasHeight*.1),e=this.canvasHeight-d*2,f=this.options.get("targetColor");return a&&(f=this.calcHighlightColor(f,this.options)),this.target.drawRect(c,d,this.options.get("targetWidth")-1,e-1,f,f)},render:function(){var a=this.values.length,b=this.target,c,d;if(!y._super.render.call(this))return;for(c=2;c<a;c++)d=this.renderRange(c).append(),this.shapes[d.id]="r"+c,this.valueShapes["r"+c]=d.id;d=this.renderPerformance().append(),this.shapes[d.id]="p1",this.valueShapes.p1=d.id,d=this.renderTarget().append(),this.shapes[d.id]="t0",this.valueShapes.t0=d.id,b.render()}}),a.fn.sparkline.pie=z=d(a.fn.sparkline._base,{type:"pie",init:function(b,c,d,e,f){var g=0,h;z._super.init.call(this,b,c,d,e,f),this.shapes={},this.valueShapes={},this.values=c=a.map(c,Number),d.get("width")==="auto"&&(this.width=this.height);if(c.length>0)for(h=c.length;h--;)g+=c[h];this.total=g,this.initTarget(),this.radius=Math.floor(Math.min(this.canvasWidth,this.canvasHeight)/2)},getRegion:function(a,b,c){var d=this.target.getShapeAt(a,b,c);return d!==undefined&&this.shapes[d]!==undefined?this.shapes[d]:undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],percent:this.values[a]/this.total*100,color:this.options.get("sliceColors")[a%this.options.get("sliceColors").length],offset:a}},changeHighlight:function(a){var b=this.currentRegion,c=this.renderSlice(b,a),d=this.valueShapes[b];delete this.shapes[d],this.target.replaceWithShape(d,c),this.valueShapes[b]=c.id,this.shapes[c.id]=b},renderSlice:function(a,b){var c=this.target,d=this.options,e=this.radius,f=d.get("borderWidth"),g=d.get("offset"),h=2*Math.PI,i=this.values,j=this.total,k=g?2*Math.PI*(g/360):0,l,m,n,o,p;o=i.length;for(n=0;n<o;n++){l=k,m=k,j>0&&(m=k+h*(i[n]/j));if(a===n)return p=d.get("sliceColors")[n%d.get("sliceColors").length],b&&(p=this.calcHighlightColor(p,d)),c.drawPieSlice(e,e,e-f,l,m,undefined,p);k=m}},render:function(){var a=this.target,b=this.values,c=this.options,d=this.radius,e=c.get("borderWidth"),f,g;if(!z._super.render.call(this))return;e&&a.drawCircle(d,d,Math.floor(d-e/2),c.get("borderColor"),undefined,e).append();for(g=b.length;g--;)f=this.renderSlice(g).append(),this.valueShapes[g]=f.id,this.shapes[f.id]=g;a.render()}}),a.fn.sparkline.box=A=d(a.fn.sparkline._base,{type:"box",init:function(b,c,d,e,f){A._super.init.call(this,b,c,d,e,f),this.values=a.map(c,Number),this.width=d.get("width")==="auto"?"4.0em":e,this.initTarget(),this.values.length||(this -.disabled=1)},getRegion:function(){return 1},getCurrentRegionFields:function(){var a=[{field:"lq",value:this.quartiles[0]},{field:"med",value:this.quartiles[1]},{field:"uq",value:this.quartiles[2]},{field:"lo",value:this.loutlier},{field:"ro",value:this.routlier}];return this.lwhisker!==undefined&&a.push({field:"lw",value:this.lwhisker}),this.rwhisker!==undefined&&a.push({field:"rw",value:this.rwhisker}),a},render:function(){var a=this.target,b=this.values,c=b.length,d=this.options,e=this.canvasWidth,f=this.canvasHeight,h=d.get("chartRangeMin")===undefined?Math.min.apply(Math,b):d.get("chartRangeMin"),i=d.get("chartRangeMax")===undefined?Math.max.apply(Math,b):d.get("chartRangeMax"),j=0,k,l,m,n,o,p,q,r,s,t,u;if(!A._super.render.call(this))return;if(d.get("raw"))d.get("showOutliers")&&b.length>5?(l=b[0],k=b[1],n=b[2],o=b[3],p=b[4],q=b[5],r=b[6]):(k=b[0],n=b[1],o=b[2],p=b[3],q=b[4]);else{b.sort(function(a,b){return a-b}),n=g(b,1),o=g(b,2),p=g(b,3),m=p-n;if(d.get("showOutliers")){k=q=undefined;for(s=0;s<c;s++)k===undefined&&b[s]>n-m*d.get("outlierIQR")&&(k=b[s]),b[s]<p+m*d.get("outlierIQR")&&(q=b[s]);l=b[0],r=b[c-1]}else k=b[0],q=b[c-1]}this.quartiles=[n,o,p],this.lwhisker=k,this.rwhisker=q,this.loutlier=l,this.routlier=r,u=e/(i-h+1),d.get("showOutliers")&&(j=Math.ceil(d.get("spotRadius")),e-=2*Math.ceil(d.get("spotRadius")),u=e/(i-h+1),l<k&&a.drawCircle((l-h)*u+j,f/2,d.get("spotRadius"),d.get("outlierLineColor"),d.get("outlierFillColor")).append(),r>q&&a.drawCircle((r-h)*u+j,f/2,d.get("spotRadius"),d.get("outlierLineColor"),d.get("outlierFillColor")).append()),a.drawRect(Math.round((n-h)*u+j),Math.round(f*.1),Math.round((p-n)*u),Math.round(f*.8),d.get("boxLineColor"),d.get("boxFillColor")).append(),a.drawLine(Math.round((k-h)*u+j),Math.round(f/2),Math.round((n-h)*u+j),Math.round(f/2),d.get("lineColor")).append(),a.drawLine(Math.round((k-h)*u+j),Math.round(f/4),Math.round((k-h)*u+j),Math.round(f-f/4),d.get("whiskerColor")).append(),a.drawLine(Math.round((q-h)*u+j),Math.round(f/2),Math.round((p-h)*u+j),Math.round(f/2),d.get("lineColor")).append(),a.drawLine(Math.round((q-h)*u+j),Math.round(f/4),Math.round((q-h)*u+j),Math.round(f-f/4),d.get("whiskerColor")).append(),a.drawLine(Math.round((o-h)*u+j),Math.round(f*.1),Math.round((o-h)*u+j),Math.round(f*.9),d.get("medianColor")).append(),d.get("target")&&(t=Math.ceil(d.get("spotRadius")),a.drawLine(Math.round((d.get("target")-h)*u+j),Math.round(f/2-t),Math.round((d.get("target")-h)*u+j),Math.round(f/2+t),d.get("targetColor")).append(),a.drawLine(Math.round((d.get("target")-h)*u+j-t),Math.round(f/2),Math.round((d.get("target")-h)*u+j+t),Math.round(f/2),d.get("targetColor")).append()),a.render()}}),a.browser.msie&&!document.namespaces.v&&document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"),a.browser.hasCanvas===undefined&&(a.browser.hasCanvas=document.createElement("canvas").getContext!==undefined),D=d({init:function(a,b,c,d){this.target=a,this.id=b,this.type=c,this.args=d},append:function(){return this.target.appendShape(this),this}}),E=d({_pxregex:/(\d+)(px)?\s*$/i,init:function(b,c,d){if(!b)return;this.width=b,this.height=c,this.target=d,this.lastShapeId=null,d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this)},drawLine:function(a,b,c,d,e,f){return this.drawShape([[a,b],[c,d]],e,f)},drawShape:function(a,b,c,d){return this._genShape("Shape",[a,b,c,d])},drawCircle:function(a,b,c,d,e,f){return this._genShape("Circle",[a,b,c,d,e,f])},drawPieSlice:function(a,b,c,d,e,f,g){return this._genShape("PieSlice",[a,b,c,d,e,f,g])},drawRect:function(a,b,c,d,e,f){return this._genShape("Rect",[a,b,c,d,e,f])},getElement:function(){return this.canvas},getLastShapeId:function(){return this.lastShapeId},reset:function(){alert("reset not implemented")},_insert:function(b,c){a(c).html(b)},_calculatePixelDims:function(b,c,d){var e;e=this._pxregex.exec(c),e?this.pixelHeight=e[1]:this.pixelHeight=a(d).height(),e=this._pxregex.exec(b),e?this.pixelWidth=e[1]:this.pixelWidth=a(d).width()},_genShape:function(a,b){var c=I++;return b.unshift(c),new D(this,c,a,b)},appendShape:function(a){alert("appendShape not implemented")},replaceWithShape:function(a,b){alert("replaceWithShape not implemented")},insertAfterShape:function(a,b){alert("insertAfterShape not implemented")},removeShapeId:function(a){alert("removeShapeId not implemented")},getShapeAt:function(a,b,c){alert("getShapeAt not implemented")},render:function(){alert("render not implemented")}}),F=d(E,{init:function(b,c,d,e){F._super.init.call(this,b,c,d),this.canvas=document.createElement("canvas"),d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this),a(this.canvas).css({display:"inline-block",width:b,height:c,verticalAlign:"top"}),this._insert(this.canvas,d),this._calculatePixelDims(b,c,this.canvas),this.canvas.width=this.pixelWidth,this.canvas.height=this.pixelHeight,this.interact=e,this.shapes={},this.shapeseq=[],this.currentTargetShapeId=undefined,a(this.canvas).css({width:this.pixelWidth,height:this.pixelHeight})},_getContext:function(a,b,c){var d=this.canvas.getContext("2d");return a!==undefined&&(d.strokeStyle=a),d.lineWidth=c===undefined?1:c,b!==undefined&&(d.fillStyle=b),d},reset:function(){var a=this._getContext();a.clearRect(0,0,this.pixelWidth,this.pixelHeight),this.shapes={},this.shapeseq=[],this.currentTargetShapeId=undefined},_drawShape:function(a,b,c,d,e){var f=this._getContext(c,d,e),g,h;f.beginPath(),f.moveTo(b[0][0]+.5,b[0][1]+.5);for(g=1,h=b.length;g<h;g++)f.lineTo(b[g][0]+.5,b[g][1]+.5);c!==undefined&&f.stroke(),d!==undefined&&f.fill(),this.targetX!==undefined&&this.targetY!==undefined&&f.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=a)},_drawCircle:function(a,b,c,d,e,f,g){var h=this._getContext(e,f,g);h.beginPath(),h.arc(b,c,d,0,2*Math.PI,!1),this.targetX!==undefined&&this.targetY!==undefined&&h.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=a),e!==undefined&&h.stroke(),f!==undefined&&h.fill()},_drawPieSlice:function(a,b,c,d,e,f,g,h){var i=this._getContext(g,h);i.beginPath(),i.moveTo(b,c),i.arc(b,c,d,e,f,!1),i.lineTo(b,c),i.closePath(),g!==undefined&&i.stroke(),h&&i.fill(),this.targetX!==undefined&&this.targetY!==undefined&&i.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=a)},_drawRect:function(a,b,c,d,e,f,g){return this._drawShape(a,[[b,c],[b+d,c],[b+d,c+e],[b,c+e],[b,c]],f,g)},appendShape:function(a){return this.shapes[a.id]=a,this.shapeseq.push(a.id),this.lastShapeId=a.id,a.id},replaceWithShape:function(a,b){var c=this.shapeseq,d;this.shapes[b.id]=b;for(d=c.length;d--;)c[d]==a&&(c[d]=b.id);delete this.shapes[a]},replaceWithShapes:function(a,b){var c=this.shapeseq,d={},e,f,g;for(f=a.length;f--;)d[a[f]]=!0;for(f=c.length;f--;)e=c[f],d[e]&&(c.splice(f,1),delete this.shapes[e],g=f);for(f=b.length;f--;)c.splice(g,0,b[f].id),this.shapes[b[f].id]=b[f]},insertAfterShape:function(a,b){var c=this.shapeseq,d;for(d=c.length;d--;)if(c[d]===a){c.splice(d+1,0,b.id),this.shapes[b.id]=b;return}},removeShapeId:function(a){var b=this.shapeseq,c;for(c=b.length;c--;)if(b[c]===a){b.splice(c,1);break}delete this.shapes[a]},getShapeAt:function(a,b,c){return this.targetX=b,this.targetY=c,this.render(),this.currentTargetShapeId},render:function(){var a=this.shapeseq,b=this.shapes,c=a.length,d=this._getContext(),e,f,g;d.clearRect(0,0,this.pixelWidth,this.pixelHeight);for(g=0;g<c;g++)e=a[g],f=b[e],this["_draw"+f.type].apply(this,f.args);this.interact||(this.shapes={},this.shapeseq=[])}}),G=d(E,{init:function(b,c,d){var e;G._super.init.call(this,b,c,d),d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this),this.canvas=document.createElement("span"),a(this.canvas).css({display:"inline-block",position:"relative",overflow:"hidden",width:b,height:c,margin:"0px",padding:"0px",verticalAlign:"top"}),this._insert(this.canvas,d),this._calculatePixelDims(b,c,this.canvas),this.canvas.width=this.pixelWidth,this.canvas.height=this.pixelHeight,e='<v:group coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'"'+' style="position:absolute;top:0;left:0;width:'+this.pixelWidth+"px;height="+this.pixelHeight+'px;"></v:group>',this.canvas.insertAdjacentHTML("beforeEnd",e),this.group=a(this.canvas).children()[0],this.rendered=!1,this.prerender=""},_drawShape:function(a,b,c,d,e){var f=[],g,h,i,j,k,l,m;for(m=0,l=b.length;m<l;m++)f[m]=""+b[m][0]+","+b[m][1];return g=f.splice(0,1),e=e===undefined?1:e,h=c===undefined?' stroked="false" ':' strokeWeight="'+e+'px" strokeColor="'+c+'" ',i=d===undefined?' filled="false"':' fillColor="'+d+'" filled="true" ',j=f[0]===f[f.length-1]?"x ":"",k='<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" '+' id="jqsshape'+a+'" '+h+i+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;" '+' path="m '+g+" l "+f.join(", ")+" "+j+'e">'+" </v:shape>",k},_drawCircle:function(a,b,c,d,e,f,g){var h,i,j;return b-=d,c-=d,h=e===undefined?' stroked="false" ':' strokeWeight="'+g+'px" strokeColor="'+e+'" ',i=f===undefined?' filled="false"':' fillColor="'+f+'" filled="true" ',j='<v:oval id="jqsshape'+a+'" '+h+i+' style="position:absolute;top:'+c+"px; left:"+b+"px; width:"+d*2+"px; height:"+d*2+'px"></v:oval>',j},_drawPieSlice:function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n,o,p;if(e===f)return;f-e===2*Math.PI&&(e=0,f=2*Math.PI),j=b+Math.round(Math.cos(e)*d),k=c+Math.round(Math.sin(e)*d),l=b+Math.round(Math.cos(f)*d),m=c+Math.round(Math.sin(f)*d);if(j===l&&k===m&&f-e<Math.PI)return;return i=[b-d,c-d,b+d,c+d,j,k,l,m],n=g===undefined?' stroked="false" ':' strokeWeight="1px" strokeColor="'+g+'" ',o=h===undefined?' filled="false"':' fillColor="'+h+'" filled="true" ',p='<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" '+' id="jqsshape'+a+'" '+n+o+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;" '+' path="m '+b+","+c+" wa "+i.join(", ")+' x e">'+" </v:shape>",p},_drawRect:function(a,b,c,d,e,f,g){return this._drawShape(a,[[b,c],[b,c+e],[b+d,c+e],[b+d,c],[b,c]],f,g)},reset:function(){this.group.innerHTML=""},appendShape:function(a){var b=this["_draw"+a.type].apply(this,a.args);return this.rendered?this.group.insertAdjacentHTML("beforeEnd",b):this.prerender+=b,this.lastShapeId=a.id,a.id},replaceWithShape:function(b,c){var d=a("#jqsshape"+b),e=this["_draw"+c.type].apply(this,c.args);d[0].outerHTML=e},replaceWithShapes:function(b,c){var d=a("#jqsshape"+b[0]),e="",f=c.length,g;for(g=0;g<f;g++)e+=this["_draw"+c[g].type].apply(this,c[g].args);d[0].outerHTML=e;for(g=1;g<b.length;g++)a("#jqsshape"+b[g]).remove()},insertAfterShape:function(b,c){var d=a("#jqsshape"+b),e=this["_draw"+c.type].apply(this,c.args);d[0].insertAdjacentHTML("afterEnd",e)},removeShapeId:function(b){var c=a("#jqsshape"+b);this.group.removeChild(c[0])},getShapeAt:function(a,b,c){var d=a.id.substr(8);return d},render:function(){this.rendered||(this.group.innerHTML=this.prerender,this.rendered=!0)}})})(jQuery); \ No newline at end of file +(function(a){typeof define=="function"&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){"use strict";var b={},c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=0;c=function(){return{common:{type:"line",lineColor:"#00f",fillColor:"#cdf",defaultPixelsPerValue:3,width:"auto",height:"auto",composite:!1,tagValuesAttribute:"values",tagOptionsPrefix:"spark",enableTagOptions:!1,enableHighlight:!0,highlightLighten:1.4,tooltipSkipNull:!0,tooltipPrefix:"",tooltipSuffix:"",disableHiddenCheck:!1,numberFormatter:!1,numberDigitGroupCount:3,numberDigitGroupSep:",",numberDecimalMark:".",disableTooltips:!1,disableInteraction:!1},line:{spotColor:"#f80",highlightSpotColor:"#5f5",highlightLineColor:"#f22",spotRadius:1.5,minSpotColor:"#f80",maxSpotColor:"#f80",lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:"#ccc",drawNormalOnTop:!1,chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined,tooltipFormat:new e('<span style="color: {{color}}">●</span> {{prefix}}{{y}}{{suffix}}')},bar:{barColor:"#3366cc",negBarColor:"#f44",stackedBarColor:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],zeroColor:undefined,nullColor:undefined,zeroAxis:!0,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,colorMap:undefined,tooltipFormat:new e('<span style="color: {{color}}">●</span> {{prefix}}{{value}}{{suffix}}')},tristate:{barWidth:4,barSpacing:1,posBarColor:"#6f6",negBarColor:"#f44",zeroBarColor:"#999",colorMap:{},tooltipFormat:new e('<span style="color: {{color}}">●</span> {{value:map}}'),tooltipValueLookups:{map:{"-1":"Loss",0:"Draw",1:"Win"}}},discrete:{lineHeight:"auto",thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,tooltipFormat:new e("{{prefix}}{{value}}{{suffix}}")},bullet:{targetColor:"#f33",targetWidth:3,performanceColor:"#33f",rangeColors:["#d3dafe","#a8b6ff","#7f94ff"],base:undefined,tooltipFormat:new e("{{fieldkey:fields}} - {{value}}"),tooltipValueLookups:{fields:{r:"Range",p:"Performance",t:"Target"}}},pie:{offset:0,sliceColors:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],borderWidth:0,borderColor:"#000",tooltipFormat:new e('<span style="color: {{color}}">●</span> {{value}} ({{percent.1}}%)')},box:{raw:!1,boxLineColor:"#000",boxFillColor:"#cdf",whiskerColor:"#000",outlierLineColor:"#333",outlierFillColor:"#fff",medianColor:"#f00",showOutliers:!0,outlierIQR:1.5,spotRadius:1.5,target:undefined,targetColor:"#4a2",chartRangeMax:undefined,chartRangeMin:undefined,tooltipFormat:new e("{{field:fields}}: {{value}}"),tooltipFormatFieldlistKey:"field",tooltipValueLookups:{fields:{lq:"Lower Quartile",med:"Median",uq:"Upper Quartile",lo:"Left Outlier",ro:"Right Outlier",lw:"Left Whisker",rw:"Right Whisker"}}}}},B='.jqstooltip { position: absolute;left: 0px;top: 0px;visibility: hidden;background: rgb(0, 0, 0) transparent;background-color: rgba(0,0,0,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";color: white;font: 10px arial, san serif;text-align: left;white-space: nowrap;padding: 5px;border: 1px solid white;z-index: 10000;}.jqsfield { color: white;font: 10px arial, san serif;text-align: left;}',d=function(){var b,c;return b=function(){this.init.apply(this,arguments)},arguments.length>1?(arguments[0]?(b.prototype=a.extend(new arguments[0],arguments[arguments.length-1]),b._super=arguments[0].prototype):b.prototype=arguments[arguments.length-1],arguments.length>2&&(c=Array.prototype.slice.call(arguments,1,-1),c.unshift(b.prototype),a.extend.apply(a,c))):b.prototype=arguments[0],b.prototype.cls=b,b},a.SPFormatClass=e=d({fre:/\{\{([\w.]+?)(:(.+?))?\}\}/g,precre:/(\w+)\.(\d+)/,init:function(a,b){this.format=a,this.fclass=b},render:function(a,b,c){var d=this,e=a,f,g,h,i,j;return this.format.replace(this.fre,function(){var a;return g=arguments[1],h=arguments[3],f=d.precre.exec(g),f?(j=f[2],g=f[1]):j=!1,i=e[g],i===undefined?"":h&&b&&b[h]?(a=b[h],a.get?b[h].get(i)||i:b[h][i]||i):(k(i)&&(c.get("numberFormatter")?i=c.get("numberFormatter")(i):i=p(i,j,c.get("numberDigitGroupCount"),c.get("numberDigitGroupSep"),c.get("numberDecimalMark"))),i)})}}),a.spformat=function(a,b){return new e(a,b)},f=function(a,b,c){return a<b?b:a>c?c:a},g=function(a,b){var c;return b===2?(c=Math.floor(a.length/2),a.length%2?a[c]:(a[c-1]+a[c])/2):a.length%2?(c=(a.length*b+b)/4,c%1?(a[Math.floor(c)]+a[Math.floor(c)-1])/2:a[c-1]):(c=(a.length*b+2)/4,c%1?(a[Math.floor(c)]+a[Math.floor(c)-1])/2:a[c-1])},h=function(a){var b;switch(a){case"undefined":a=undefined;break;case"null":a=null;break;case"true":a=!0;break;case"false":a=!1;break;default:b=parseFloat(a),a==b&&(a=b)}return a},i=function(a){var b,c=[];for(b=a.length;b--;)c[b]=h(a[b]);return c},j=function(a,b){var c,d,e=[];for(c=0,d=a.length;c<d;c++)a[c]!==b&&e.push(a[c]);return e},k=function(a){return!isNaN(parseFloat(a))&&isFinite(a)},p=function(b,c,d,e,f){var g,h;b=(c===!1?parseFloat(b).toString():b.toFixed(c)).split(""),g=(g=a.inArray(".",b))<0?b.length:g,g<b.length&&(b[g]=f);for(h=g-d;h>0;h-=d)b.splice(h,0,e);return b.join("")},l=function(a,b,c){var d;for(d=b.length;d--;){if(c&&b[d]===null)continue;if(b[d]!==a)return!1}return!0},m=function(a){var b=0,c;for(c=a.length;c--;)b+=typeof a[c]=="number"?a[c]:0;return b},o=function(b){return a.isArray(b)?b:[b]},n=function(a){var b;document.createStyleSheet?document.createStyleSheet().cssText=a:(b=document.createElement("style"),b.type="text/css",document.getElementsByTagName("head")[0].appendChild(b),b[typeof document.body.style.WebkitAppearance=="string"?"innerText":"innerHTML"]=a)},a.fn.simpledraw=function(b,c,d,e){var f,g;if(d&&(f=this.data("_jqs_vcanvas")))return f;b===undefined&&(b=a(this).innerWidth()),c===undefined&&(c=a(this).innerHeight());if(a.fn.sparkline.hasCanvas)f=new F(b,c,this,e);else{if(!a.fn.sparkline.hasVML)return!1;f=new G(b,c,this)}return g=a(this).data("_jqs_mhandler"),g&&g.registerCanvas(f),f},a.fn.cleardraw=function(){var a=this.data("_jqs_vcanvas");a&&a.reset()},a.RangeMapClass=q=d({init:function(a){var b,c,d=[];for(b in a)a.hasOwnProperty(b)&&typeof b=="string"&&b.indexOf(":")>-1&&(c=b.split(":"),c[0]=c[0].length===0?-Infinity:parseFloat(c[0]),c[1]=c[1].length===0?Infinity:parseFloat(c[1]),c[2]=a[b],d.push(c));this.map=a,this.rangelist=d||!1},get:function(a){var b=this.rangelist,c,d,e;if((e=this.map[a])!==undefined)return e;if(b)for(c=b.length;c--;){d=b[c];if(d[0]<=a&&d[1]>=a)return d[2]}return undefined}}),a.range_map=function(a){return new q(a)},r=d({init:function(b,c){var d=a(b);this.$el=d,this.options=c,this.currentPageX=0,this.currentPageY=0,this.el=b,this.splist=[],this.tooltip=null,this.over=!1,this.displayTooltips=!c.get("disableTooltips"),this.highlightEnabled=!c.get("disableHighlight")},registerSparkline:function(a){this.splist.push(a),this.over&&this.updateDisplay()},registerCanvas:function(b){var c=a(b.canvas);this.canvas=b,this.$canvas=c,c.mouseenter(a.proxy(this.mouseenter,this)),c.mouseleave(a.proxy(this.mouseleave,this)),c.click(a.proxy(this.mouseclick,this))},reset:function(a){this.splist=[],this.tooltip&&a&&(this.tooltip.remove(),this.tooltip=undefined)},mouseclick:function(b){var c=a.Event("sparklineClick");c.originalEvent=b,c.sparklines=this.splist,this.$el.trigger(c)},mouseenter:function(b){a(document.body).unbind("mousemove.jqs"),a(document.body).bind("mousemove.jqs",a.proxy(this.mousemove,this)),this.over=!0,this.currentPageX=b.pageX,this.currentPageY=b.pageY,this.currentEl=b.target,!this.tooltip&&this.displayTooltips&&(this.tooltip=new s(this.options),this.tooltip.updatePosition(b.pageX,b.pageY)),this.updateDisplay()},mouseleave:function(){a(document.body).unbind("mousemove.jqs");var b=this.splist,c=b.length,d=!1,e,f;this.over=!1,this.currentEl=null,this.tooltip&&(this.tooltip.remove(),this.tooltip=null);for(f=0;f<c;f++)e=b[f],e.clearRegionHighlight()&&(d=!0);d&&this.canvas.render()},mousemove:function(a){this.currentPageX=a.pageX,this.currentPageY=a.pageY,this.currentEl=a.target,this.tooltip&&this.tooltip.updatePosition(a.pageX,a.pageY),this.updateDisplay()},updateDisplay:function(){var b=this.splist,c=b.length,d=!1,e=this.$canvas.offset(),f=this.currentPageX-e.left,g=this.currentPageY-e.top,h,i,j,k,l;if(!this.over)return;for(j=0;j<c;j++)i=b[j],k=i.setRegionHighlight(this.currentEl,f,g),k&&(d=!0);if(d){l=a.Event("sparklineRegionChange"),l.sparklines=this.splist,this.$el.trigger(l);if(this.tooltip){h="";for(j=0;j<c;j++)i=b[j],h+=i.getCurrentRegionTooltip();this.tooltip.setContent(h)}this.disableHighlight||this.canvas.render()}k===null&&this.mouseleave()}}),s=d({sizeStyle:"position: static !important;display: block !important;visibility: hidden !important;float: left !important;",init:function(b){var c=b.get("tooltipClassname","jqstooltip"),d=this.sizeStyle,e;this.container=b.get("tooltipContainer")||document.body,this.tooltipOffsetX=b.get("tooltipOffsetX",10),this.tooltipOffsetY=b.get("tooltipOffsetY",12),a("#jqssizetip").remove(),a("#jqstooltip").remove(),this.sizetip=a("<div/>",{id:"jqssizetip",style:d,"class":c}),this.tooltip=a("<div/>",{id:"jqstooltip","class":c}).appendTo(this.container),e=this.tooltip.offset(),this.offsetLeft=e.left,this.offsetTop=e.top,this.hidden=!0,a(window).unbind("resize.jqs scroll.jqs"),a(window).bind("resize.jqs scroll.jqs",a.proxy(this.updateWindowDims,this)),this.updateWindowDims()},updateWindowDims:function(){this.scrollTop=a(window).scrollTop(),this.scrollLeft=a(window).scrollLeft(),this.scrollRight=this.scrollLeft+a(window).width(),this.updatePosition()},getSize:function(a){this.sizetip.html(a).appendTo(this.container),this.width=this.sizetip.width()+1,this.height=this.sizetip.height(),this.sizetip.remove()},setContent:function(a){if(!a){this.tooltip.css("visibility","hidden"),this.hidden=!0;return}this.getSize(a),this.tooltip.html(a).css({width:this.width,height:this.height,visibility:"visible"}),this.hidden&&(this.hidden=!1,this.updatePosition())},updatePosition:function(a,b){if(a===undefined){if(this.mousex===undefined)return;a=this.mousex-this.offsetLeft,b=this.mousey-this.offsetTop}else this.mousex=a-=this.offsetLeft,this.mousey=b-=this.offsetTop;if(!this.height||!this.width||this.hidden)return;b-=this.height+this.tooltipOffsetY,a+=this.tooltipOffsetX,b<this.scrollTop&&(b=this.scrollTop),a<this.scrollLeft?a=this.scrollLeft:a+this.width>this.scrollRight&&(a=this.scrollRight-this.width),this.tooltip.css({left:a,top:b})},remove:function(){this.tooltip.remove(),this.sizetip.remove(),this.sizetip=this.tooltip=undefined,a(window).unbind("resize.jqs scroll.jqs")}}),C=function(){n(B)},a(C),H=[],a.fn.sparkline=function(b,c){return this.each(function(){var d=new a.fn.sparkline.options(this,c),e=a(this),f,g;f=function(){var c,f,g,h,i,j,k;if(b==="html"||b===undefined){k=this.getAttribute(d.get("tagValuesAttribute"));if(k===undefined||k===null)k=e.html();c=k.replace(/(^\s*<!--)|(-->\s*$)|\s+/g,"").split(",")}else c=b;f=d.get("width")==="auto"?c.length*d.get("defaultPixelsPerValue"):d.get("width");if(d.get("height")==="auto"){if(!d.get("composite")||!a.data(this,"_jqs_vcanvas"))h=document.createElement("span"),h.innerHTML="a",e.html(h),g=a(h).innerHeight()||a(h).height(),a(h).remove(),h=null}else g=d.get("height");d.get("disableInteraction")?i=!1:(i=a.data(this,"_jqs_mhandler"),i?d.get("composite")||i.reset():(i=new r(this,d),a.data(this,"_jqs_mhandler",i)));if(d.get("composite")&&!a.data(this,"_jqs_vcanvas")){a.data(this,"_jqs_errnotify")||(alert("Attempted to attach a composite sparkline to an element with no existing sparkline"),a.data(this,"_jqs_errnotify",!0));return}j=new(a.fn.sparkline[d.get("type")])(this,c,d,f,g),j.render(),i&&i.registerSparkline(j)};if(a(this).html()&&!d.get("disableHiddenCheck")&&a(this).is(":hidden")||a.fn.jquery<"1.3.0"&&a(this).parents().is(":hidden")||!a(this).parents("body").length){if(!d.get("composite")&&a.data(this,"_jqs_pending"))for(g=H.length;g;g--)H[g-1][0]==this&&H.splice(g-1,1);H.push([this,f]),a.data(this,"_jqs_pending",!0)}else f.call(this)})},a.fn.sparkline.defaults=c(),a.sparkline_display_visible=function(){var b,c,d,e=[];for(c=0,d=H.length;c<d;c++)b=H[c][0],a(b).is(":visible")&&!a(b).parents().is(":hidden")?(H[c][1].call(b),a.data(H[c][0],"_jqs_pending",!1),e.push(c)):!a(b).closest("html").length&&!a.data(b,"_jqs_pending")&&(a.data(H[c][0],"_jqs_pending",!1),e.push(c));for(c=e.length;c;c--)H.splice(e[c-1],1)},a.fn.sparkline.options=d({init:function(c,d){var e,f,g,h;this.userOptions=d=d||{},this.tag=c,this.tagValCache={},f=a.fn.sparkline.defaults,g=f.common,this.tagOptionsPrefix=d.enableTagOptions&&(d.tagOptionsPrefix||g.tagOptionsPrefix),h=this.getTagSetting("type"),h===b?e=f[d.type||g.type]:e=f[h],this.mergedOptions=a.extend({},g,e,d)},getTagSetting:function(a){var c=this.tagOptionsPrefix,d,e,f,g;if(c===!1||c===undefined)return b;if(this.tagValCache.hasOwnProperty(a))d=this.tagValCache.key;else{d=this.tag.getAttribute(c+a);if(d===undefined||d===null)d=b;else if(d.substr(0,1)==="["){d=d.substr(1,d.length-2).split(",");for(e=d.length;e--;)d[e]=h(d[e].replace(/(^\s*)|(\s*$)/g,""))}else if(d.substr(0,1)==="{"){f=d.substr(1,d.length-2).split(","),d={};for(e=f.length;e--;)g=f[e].split(":",2),d[g[0].replace(/(^\s*)|(\s*$)/g,"")]=h(g[1].replace(/(^\s*)|(\s*$)/g,""))}else d=h(d);this.tagValCache.key=d}return d},get:function(a,c){var d=this.getTagSetting(a),e;return d!==b?d:(e=this.mergedOptions[a])===undefined?c:e}}),a.fn.sparkline._base=d({disabled:!1,init:function(b,c,d,e,f){this.el=b,this.$el=a(b),this.values=c,this.options=d,this.width=e,this.height=f,this.currentRegion=undefined},initTarget:function(){var a=!this.options.get("disableInteraction");(this.target=this.$el.simpledraw(this.width,this.height,this.options.get("composite"),a))?(this.canvasWidth=this.target.pixelWidth,this.canvasHeight=this.target.pixelHeight):this.disabled=!0},render:function(){return this.disabled?(this.el.innerHTML="",!1):!0},getRegion:function(a,b){},setRegionHighlight:function(a,b,c){var d=this.currentRegion,e=!this.options.get("disableHighlight"),f;return b>this.canvasWidth||c>this.canvasHeight||b<0||c<0?null:(f=this.getRegion(a,b,c),d!==f?(d!==undefined&&e&&this.removeHighlight(),this.currentRegion=f,f!==undefined&&e&&this.renderHighlight(),!0):!1)},clearRegionHighlight:function(){return this.currentRegion!==undefined?(this.removeHighlight(),this.currentRegion=undefined,!0):!1},renderHighlight:function(){this.changeHighlight(!0)},removeHighlight:function(){this.changeHighlight(!1)},changeHighlight:function(a){},getCurrentRegionTooltip:function(){var b=this.options,c="",d=[],f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(this.currentRegion===undefined)return"";f=this.getCurrentRegionFields(),p=b.get("tooltipFormatter");if(p)return p(this,b,f);b.get("tooltipChartTitle")&&(c+='<div class="jqs jqstitle">'+b.get("tooltipChartTitle")+"</div>\n"),g=this.options.get("tooltipFormat");if(!g)return"";a.isArray(g)||(g=[g]),a.isArray(f)||(f=[f]),l=this.options.get("tooltipFormatFieldlist"),m=this.options.get("tooltipFormatFieldlistKey");if(l&&m){n=[];for(k=f.length;k--;)o=f[k][m],(s=a.inArray(o,l))!=-1&&(n[s]=f[k]);f=n}h=g.length,r=f.length;for(k=0;k<h;k++){q=g[k],typeof q=="string"&&(q=new e(q)),i=q.fclass||"jqsfield";for(s=0;s<r;s++)if(!f[s].isNull||!b.get("tooltipSkipNull"))a.extend(f[s],{prefix:b.get("tooltipPrefix"),suffix:b.get("tooltipSuffix")}),j=q.render(f[s],b.get("tooltipValueLookups"),b),d.push('<div class="'+i+'">'+j+"</div>")}return d.length?c+d.join("\n"):""},getCurrentRegionFields:function(){},calcHighlightColor:function(a,b){var c=b.get("highlightColor"),d=b.get("highlightLighten"),e,g,h,i;if(c)return c;if(d){e=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a)||/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(a);if(e){h=[],g=a.length===4?16:1;for(i=0;i<3;i++)h[i]=f(Math.round(parseInt(e[i+1],16)*g*d),0,255);return"rgb("+h.join(",")+")"}}return a}}),t={changeHighlight:function(b){var c=this.currentRegion,d=this.target,e=this.regionShapes[c],f;e&&(f=this.renderRegion(c,b),a.isArray(f)||a.isArray(e)?(d.replaceWithShapes(e,f),this.regionShapes[c]=a.map(f,function(a){return a.id})):(d.replaceWithShape(e,f),this.regionShapes[c]=f.id))},render:function(){var b=this.values,c=this.target,d=this.regionShapes,e,f,g,h;if(!this.cls._super.render.call(this))return;for(g=b.length;g--;){e=this.renderRegion(g);if(e)if(a.isArray(e)){f=[];for(h=e.length;h--;)e[h].append(),f.push(e[h].id);d[g]=f}else e.append(),d[g]=e.id;else d[g]=null}c.render()}},a.fn.sparkline.line=u=d(a.fn.sparkline._base,{type:"line",init:function(a,b,c,d,e){u._super.init.call(this,a,b,c,d,e),this.vertices=[],this.regionMap=[],this.xvalues=[],this.yvalues=[],this.yminmax=[],this.hightlightSpotId=null,this.lastShapeId=null,this.initTarget()},getRegion:function(a,b,c){var d,e=this.regionMap;for(d=e.length;d--;)if(e[d]!==null&&b>=e[d][0]&&b<=e[d][1])return e[d][2];return undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.yvalues[a]===null,x:this.xvalues[a],y:this.yvalues[a],color:this.options.get("lineColor"),fillColor:this.options.get("fillColor"),offset:a}},renderHighlight:function(){var a=this.currentRegion,b=this.target,c=this.vertices[a],d=this.options,e=d.get("spotRadius"),f=d.get("highlightSpotColor"),g=d.get("highlightLineColor"),h,i;if(!c)return;e&&f&&(h=b.drawCircle(c[0],c[1],e,undefined,f),this.highlightSpotId=h.id,b.insertAfterShape(this.lastShapeId,h)),g&&(i=b.drawLine(c[0],this.canvasTop,c[0],this.canvasTop+this.canvasHeight,g),this.highlightLineId=i.id,b.insertAfterShape(this.lastShapeId,i))},removeHighlight:function(){var a=this.target;this.highlightSpotId&&(a.removeShapeId(this.highlightSpotId),this.highlightSpotId=null),this.highlightLineId&&(a.removeShapeId(this.highlightLineId),this.highlightLineId=null)},scanValues:function(){var a=this.values,b=a.length,c=this.xvalues,d=this.yvalues,e=this.yminmax,f,g,h,i,j;for(f=0;f<b;f++)g=a[f],h=typeof a[f]=="string",i=typeof a[f]=="object"&&a[f]instanceof Array,j=h&&a[f].split(":"),h&&j.length===2?(c.push(Number(j[0])),d.push(Number(j[1])),e.push(Number(j[1]))):i?(c.push(g[0]),d.push(g[1]),e.push(g[1])):(c.push(f),a[f]===null||a[f]==="null"?d.push(null):(d.push(Number(g)),e.push(Number(g))));this.options.get("xvalues")&&(c=this.options.get("xvalues")),this.maxy=this.maxyorg=Math.max.apply(Math,e),this.miny=this.minyorg=Math.min.apply(Math,e),this.maxx=Math.max.apply(Math,c),this.minx=Math.min.apply(Math,c),this.xvalues=c,this.yvalues=d,this.yminmax=e},processRangeOptions:function(){var a=this.options,b=a.get("normalRangeMin"),c=a.get("normalRangeMax");b!==undefined&&(b<this.miny&&(this.miny=b),c>this.maxy&&(this.maxy=c)),a.get("chartRangeMin")!==undefined&&(a.get("chartRangeClip")||a.get("chartRangeMin")<this.miny)&&(this.miny=a.get("chartRangeMin")),a.get("chartRangeMax")!==undefined&&(a.get("chartRangeClip")||a.get("chartRangeMax")>this.maxy)&&(this.maxy=a.get("chartRangeMax")),a.get("chartRangeMinX")!==undefined&&(a.get("chartRangeClipX")||a.get("chartRangeMinX")<this.minx)&&(this.minx=a.get("chartRangeMinX")),a.get("chartRangeMaxX")!==undefined&&(a.get("chartRangeClipX")||a.get("chartRangeMaxX")>this.maxx)&&(this.maxx=a.get("chartRangeMaxX"))},drawNormalRange:function(a,b,c,d,e){var f=this.options.get("normalRangeMin"),g=this.options.get("normalRangeMax"),h=b+Math.round(c-c*((g-this.miny)/e)),i=Math.round(c*(g-f)/e);this.target.drawRect(a,h,d,i,undefined,this.options.get("normalRangeColor")).append()},render:function(){var b=this.options,c=this.target,d=this.canvasWidth,e=this.canvasHeight,f=this.vertices,g=b.get("spotRadius"),h=this.regionMap,i,j,k,l,m,n,o,p,r,s,t,v,w,x,y,z,A,B,C,D,E,F,G,H,I;if(!u._super.render.call(this))return;this.scanValues(),this.processRangeOptions(),G=this.xvalues,H=this.yvalues;if(!this.yminmax.length||this.yvalues.length<2)return;l=m=0,i=this.maxx-this.minx===0?1:this.maxx-this.minx,j=this.maxy-this.miny===0?1:this.maxy-this.miny,k=this.yvalues.length-1,g&&(d<g*4||e<g*4)&&(g=0);if(g){E=b.get("highlightSpotColor")&&!b.get("disableInteraction");if(E||b.get("minSpotColor")||b.get("spotColor")&&H[k]===this.miny)e-=Math.ceil(g);if(E||b.get("maxSpotColor")||b.get("spotColor")&&H[k]===this.maxy)e-=Math.ceil(g),l+=Math.ceil(g);if(E||(b.get("minSpotColor")||b.get("maxSpotColor"))&&(H[0]===this.miny||H[0]===this.maxy))m+=Math.ceil(g),d-=Math.ceil(g);if(E||b.get("spotColor")||b.get("minSpotColor")||b.get("maxSpotColor")&&(H[k]===this.miny||H[k]===this.maxy))d-=Math.ceil(g)}e--,b.get("normalRangeMin")!==undefined&&!b.get("drawNormalOnTop")&&this.drawNormalRange(m,l,e,d,j),o=[],p=[o],x=y=null,z=H.length;for(I=0;I<z;I++)r=G[I],t=G[I+1],s=H[I],v=m+Math.round((r-this.minx)*(d/i)),w=I<z-1?m+Math.round((t-this.minx)*(d/i)):d,y=v+(w-v)/2,h[I]=[x||0,y,I],x=y,s===null?I&&(H[I-1]!==null&&(o=[],p.push(o)),f.push(null)):(s<this.miny&&(s=this.miny),s>this.maxy&&(s=this.maxy),o.length||o.push([v,l+e]),n=[v,l+Math.round(e-e*((s-this.miny)/j))],o.push(n),f.push(n));A=[],B=[],C=p.length;for(I=0;I<C;I++)o=p[I],o.length&&(b.get("fillColor")&&(o.push([o[o.length-1][0],l+e]),B.push(o.slice(0)),o.pop()),o.length>2&&(o[0]=[o[0][0],o[1][1]]),A.push(o));C=B.length;for(I=0;I<C;I++)c.drawShape(B[I],b.get("fillColor"),b.get("fillColor")).append();b.get("normalRangeMin")!==undefined&&b.get("drawNormalOnTop")&&this.drawNormalRange(m,l,e,d,j),C=A.length;for(I=0;I<C;I++)c.drawShape(A[I],b.get("lineColor"),undefined,b.get("lineWidth")).append();if(g&&b.get("valueSpots")){D=b.get("valueSpots"),D.get===undefined&&(D=new q(D));for(I=0;I<z;I++)F=D.get(H[I]),F&&c.drawCircle(m+Math.round((G[I]-this.minx)*(d/i)),l+Math.round(e-e*((H[I]-this.miny)/j)),g,undefined,F).append()}g&&b.get("spotColor")&&H[k]!==null&&c.drawCircle(m+Math.round((G[G.length-1]-this.minx)*(d/i)),l+Math.round(e-e*((H[k]-this.miny)/j)),g,undefined,b.get("spotColor")).append(),this.maxy!==this.minyorg&&(g&&b.get("minSpotColor")&&(r=G[a.inArray(this.minyorg,H)],c.drawCircle(m+Math.round((r-this.minx)*(d/i)),l+Math.round(e-e*((this.minyorg-this.miny)/j)),g,undefined,b.get("minSpotColor")).append()),g&&b.get("maxSpotColor")&&(r=G[a.inArray(this.maxyorg,H)],c.drawCircle(m+Math.round((r-this.minx)*(d/i)),l+Math.round(e-e*((this.maxyorg-this.miny)/j)),g,undefined,b.get("maxSpotColor")).append())),this.lastShapeId=c.getLastShapeId(),this.canvasTop=l,c.render()}}),a.fn.sparkline.bar=v=d(a.fn.sparkline._base,t,{type:"bar",init:function(b,c,d,e,g){var k=parseInt(d.get("barWidth"),10),l=parseInt(d.get("barSpacing"),10),m=d.get("chartRangeMin"),n=d.get("chartRangeMax"),o=d.get("chartRangeClip"),p=Infinity,r=-Infinity,s,t,u,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;v._super.init.call(this,b,c,d,e,g);for(y=0,z=c.length;y<z;y++){M=c[y],s=typeof M=="string"&&M.indexOf(":")>-1;if(s||a.isArray(M))H=!0,s&&(M=c[y]=i(M.split(":"))),M=j(M,null),t=Math.min.apply(Math,M),u=Math.max.apply(Math,M),t<p&&(p=t),u>r&&(r=u)}this.stacked=H,this.regionShapes={},this.barWidth=k,this.barSpacing=l,this.totalBarWidth=k+l,this.width=e=c.length*k+(c.length-1)*l,this.initTarget(),o&&(F=m===undefined?-Infinity:m,G=n===undefined?Infinity:n),x=[],w=H?[]:x;var Q=[],R=[];for(y=0,z=c.length;y<z;y++)if(H){I=c[y],c[y]=L=[],Q[y]=0,w[y]=R[y]=0;for(J=0,K=I.length;J<K;J++)M=L[J]=o?f(I[J],F,G):I[J],M!==null&&(M>0&&(Q[y]+=M),p<0&&r>0?M<0?R[y]+=Math.abs(M):w[y]+=M:w[y]+=Math.abs(M-(M<0?r:p)),x.push(M))}else M=o?f(c[y],F,G):c[y],M=c[y]=h(M),M!==null&&x.push(M);this.max=E=Math.max.apply(Math,x),this.min=D=Math.min.apply(Math,x),this.stackMax=r=H?Math.max.apply(Math,Q):E,this.stackMin=p=H?Math.min.apply(Math,x):D,d.get("chartRangeMin")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMin")<D)&&(D=d.get("chartRangeMin")),d.get("chartRangeMax")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMax")>E)&&(E=d.get("chartRangeMax")),this.zeroAxis=B=d.get("zeroAxis",!0),D<=0&&E>=0&&B?C=0:B==0?C=D:D>0?C=D:C=E,this.xaxisOffset=C,A=H?Math.max.apply(Math,w)+Math.max.apply(Math,R):E-D,this.canvasHeightEf=B&&D<0?this.canvasHeight-2:this.canvasHeight-1,D<C?(O=H&&E>=0?r:E,N=(O-C)/A*this.canvasHeight,N!==Math.ceil(N)&&(this.canvasHeightEf-=2,N=Math.ceil(N))):N=this.canvasHeight,this.yoffset=N,a.isArray(d.get("colorMap"))?(this.colorMapByIndex=d.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=d.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===undefined&&(this.colorMapByValue=new q(this.colorMapByValue))),this.range=A},getRegion:function(a,b,c){var d=Math.floor(b/this.totalBarWidth);return d<0||d>=this.values.length?undefined:d},getCurrentRegionFields:function(){var a=this.currentRegion,b=o(this.values[a]),c=[],d,e;for(e=b.length;e--;)d=b[e],c.push({isNull:d===null,value:d,color:this.calcColor(e,d,a),offset:a});return c},calcColor:function(b,c,d){var e=this.colorMapByIndex,f=this.colorMapByValue,g=this.options,h,i;return this.stacked?h=g.get("stackedBarColor"):h=c<0?g.get("negBarColor"):g.get("barColor"),c===0&&g.get("zeroColor")!==undefined&&(h=g.get("zeroColor")),f&&(i=f.get(c))?h=i:e&&e.length>d&&(h=e[d]),a.isArray(h)?h[b%h.length]:h},renderRegion:function(b,c){var d=this.values[b],e=this.options,f=this.xaxisOffset,g=[],h=this.range,i=this.stacked,j=this.target,k=b*this.totalBarWidth,m=this.canvasHeightEf,n=this.yoffset,o,p,q,r,s,t,u,v,w,x;d=a.isArray(d)?d:[d],u=d.length,v=d[0],r=l(null,d),x=l(f,d,!0);if(r)return e.get("nullColor")?(q=c?e.get("nullColor"):this.calcHighlightColor(e.get("nullColor"),e),o=n>0?n-1:n,j.drawRect(k,o,this.barWidth-1,0,q,q)):undefined;s=n;for(t=0;t<u;t++){v=d[t];if(i&&v===f){if(!x||w)continue;w=!0}h>0?p=Math.floor(m*(Math.abs(v-f)/h))+1:p=1,v<f||v===f&&n===0?(o=s,s+=p):(o=n-p,n-=p),q=this.calcColor(t,v,b),c&&(q=this.calcHighlightColor(q,e)),g.push(j.drawRect(k,o,this.barWidth-1,p-1,q,q))}return g.length===1?g[0]:g}}),a.fn.sparkline.tristate=w=d(a.fn.sparkline._base,t,{type:"tristate",init:function(b,c,d,e,f){var g=parseInt(d.get("barWidth"),10),h=parseInt(d.get("barSpacing"),10);w._super.init.call(this,b,c,d,e,f),this.regionShapes={},this.barWidth=g,this.barSpacing=h,this.totalBarWidth=g+h,this.values=a.map(c,Number),this.width=e=c.length*g+(c.length-1)*h,a.isArray(d.get("colorMap"))?(this.colorMapByIndex=d.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=d.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===undefined&&(this.colorMapByValue=new q(this.colorMapByValue))),this.initTarget()},getRegion:function(a,b,c){return Math.floor(b/this.totalBarWidth)},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],color:this.calcColor(this.values[a],a),offset:a}},calcColor:function(a,b){var c=this.values,d=this.options,e=this.colorMapByIndex,f=this.colorMapByValue,g,h;return f&&(h=f.get(a))?g=h:e&&e.length>b?g=e[b]:c[b]<0?g=d.get("negBarColor"):c[b]>0?g=d.get("posBarColor"):g=d.get("zeroBarColor"),g},renderRegion:function(a,b){var c=this.values,d=this.options,e=this.target,f,g,h,i,j,k;f=e.pixelHeight,h=Math.round(f/2),i=a*this.totalBarWidth,c[a]<0?(j=h,g=h-1):c[a]>0?(j=0,g=h-1):(j=h-1,g=2),k=this.calcColor(c[a],a);if(k===null)return;return b&&(k=this.calcHighlightColor(k,d)),e.drawRect(i,j,this.barWidth-1,g-1,k,k)}}),a.fn.sparkline.discrete=x=d(a.fn.sparkline._base,t,{type:"discrete",init:function(b,c,d,e,f){x._super.init.call(this,b,c,d,e,f),this.regionShapes={},this.values=c=a.map(c,Number),this.min=Math.min.apply(Math,c),this.max=Math.max.apply(Math,c),this.range=this.max-this.min,this.width=e=d.get("width")==="auto"?c.length*2:this.width,this.interval=Math.floor(e/c.length),this.itemWidth=e/c.length,d.get("chartRangeMin")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMin")<this.min)&&(this.min=d.get("chartRangeMin")),d.get("chartRangeMax")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMax")>this.max)&&(this.max=d.get("chartRangeMax")),this.initTarget(),this.target&&(this.lineHeight=d.get("lineHeight")==="auto"?Math.round(this.canvasHeight*.3):d.get("lineHeight"))},getRegion:function(a,b,c){return Math.floor(b/this.itemWidth)},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],offset:a}},renderRegion:function(a,b){var c=this.values,d=this.options,e=this.min,g=this.max,h=this.range,i=this.interval,j=this.target,k=this.canvasHeight,l=this.lineHeight,m=k-l,n,o,p,q;return o=f(c[a],e,g),q=a*i,n=Math.round(m-m*((o-e)/h)),p=d.get("thresholdColor")&&o<d.get("thresholdValue")?d.get("thresholdColor"):d.get("lineColor"),b&&(p=this.calcHighlightColor(p,d)),j.drawLine(q,n,q,n+l,p)}}),a.fn.sparkline.bullet=y=d(a.fn.sparkline._base,{type:"bullet",init:function(a,b,c,d,e){var f,g,h;y._super.init.call(this,a,b,c,d,e),this.values=b=i(b),h=b.slice(),h[0]=h[0]===null?h[2]:h[0],h[1]=b[1]===null?h[2]:h[1],f=Math.min.apply(Math,b),g=Math.max.apply(Math,b),c.get("base")===undefined?f=f<0?f:0:f=c.get("base"),this.min=f,this.max=g,this.range=g-f,this.shapes={},this.valueShapes={},this.regiondata={},this.width=d=c.get("width")==="auto"?"4.0em":d,this.target=this.$el.simpledraw(d,e,c.get("composite")),b.length||(this.disabled=!0),this.initTarget()},getRegion:function(a,b,c){var d=this.target.getShapeAt(a,b,c);return d!==undefined&&this.shapes[d]!==undefined?this.shapes[d]:undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{fieldkey:a.substr(0,1),value:this.values[a.substr(1)],region:a}},changeHighlight:function(a){var b=this.currentRegion,c=this.valueShapes[b],d;delete this.shapes[c];switch(b.substr(0,1)){case"r":d=this.renderRange(b.substr(1),a);break;case"p":d=this.renderPerformance(a);break;case"t":d=this.renderTarget(a)}this.valueShapes[b]=d.id,this.shapes[d.id]=b,this.target.replaceWithShape(c,d)},renderRange:function(a,b){var c=this.values[a],d=Math.round(this.canvasWidth*((c-this.min)/this.range)),e=this.options.get("rangeColors")[a-2];return b&&(e=this.calcHighlightColor(e,this.options)),this.target.drawRect(0,0,d-1,this.canvasHeight-1,e,e)},renderPerformance:function(a){var b=this.values[1],c=Math.round(this.canvasWidth*((b-this.min)/this.range)),d=this.options.get("performanceColor");return a&&(d=this.calcHighlightColor(d,this.options)),this.target.drawRect(0,Math.round(this.canvasHeight*.3),c-1,Math.round(this.canvasHeight*.4)-1,d,d)},renderTarget:function(a){var b=this.values[0],c=Math.round(this.canvasWidth*((b-this.min)/this.range)-this.options.get("targetWidth")/2),d=Math.round(this.canvasHeight*.1),e=this.canvasHeight-d*2,f=this.options.get("targetColor");return a&&(f=this.calcHighlightColor(f,this.options)),this.target.drawRect(c,d,this.options.get("targetWidth")-1,e-1,f,f)},render:function(){var a=this.values.length,b=this.target,c,d;if(!y._super.render.call(this))return;for(c=2;c<a;c++)d=this.renderRange(c).append(),this.shapes[d.id]="r"+c,this.valueShapes["r"+c]=d.id;this.values[1]!==null&&(d=this.renderPerformance().append(),this.shapes[d.id]="p1",this.valueShapes.p1=d.id),this.values[0]!==null&&(d=this.renderTarget().append(),this.shapes[d.id]="t0",this.valueShapes.t0=d.id),b.render()}}),a.fn.sparkline.pie=z=d(a.fn.sparkline._base,{type:"pie",init:function(b,c,d,e,f){var g=0,h;z._super.init.call(this,b,c,d,e,f),this.shapes={},this.valueShapes={},this.values=c=a.map(c,Number),d.get("width")==="auto"&&(this.width=this.height);if(c.length>0)for(h=c.length;h--;)g+=c[h];this.total=g,this.initTarget(),this.radius=Math.floor(Math.min(this.canvasWidth,this.canvasHeight)/2)},getRegion:function(a,b,c){var d=this.target.getShapeAt(a,b,c);return d!==undefined&&this.shapes[d]!==undefined?this.shapes[d]:undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],percent:this.values[a]/this.total*100,color:this.options.get("sliceColors")[a%this.options.get("sliceColors").length],offset:a}},changeHighlight:function(a){var b=this.currentRegion,c=this.renderSlice(b,a),d=this.valueShapes[b];delete this.shapes[d],this.target.replaceWithShape(d,c),this.valueShapes[b]=c.id,this.shapes[c.id]=b},renderSlice:function(a,b){var c=this.target,d=this.options,e=this.radius,f=d.get("borderWidth"),g=d.get("offset"),h=2*Math.PI,i=this.values,j=this.total,k=g?2*Math.PI*(g/360):0,l,m,n,o,p;o=i.length;for(n=0;n<o;n++){l=k,m=k,j>0&&(m=k+h*(i[n]/j));if(a===n)return p=d.get("sliceColors")[n%d.get("sliceColors").length],b&&(p=this.calcHighlightColor(p,d)),c.drawPieSlice(e,e,e-f,l,m,undefined,p);k=m}},render:function(){var a=this.target,b=this.values,c=this.options,d=this.radius,e=c.get("borderWidth"),f,g;if(!z._super. +render.call(this))return;e&&a.drawCircle(d,d,Math.floor(d-e/2),c.get("borderColor"),undefined,e).append();for(g=b.length;g--;)b[g]&&(f=this.renderSlice(g).append(),this.valueShapes[g]=f.id,this.shapes[f.id]=g);a.render()}}),a.fn.sparkline.box=A=d(a.fn.sparkline._base,{type:"box",init:function(b,c,d,e,f){A._super.init.call(this,b,c,d,e,f),this.values=a.map(c,Number),this.width=d.get("width")==="auto"?"4.0em":e,this.initTarget(),this.values.length||(this.disabled=1)},getRegion:function(){return 1},getCurrentRegionFields:function(){var a=[{field:"lq",value:this.quartiles[0]},{field:"med",value:this.quartiles[1]},{field:"uq",value:this.quartiles[2]}];return this.loutlier!==undefined&&a.push({field:"lo",value:this.loutlier}),this.routlier!==undefined&&a.push({field:"ro",value:this.routlier}),this.lwhisker!==undefined&&a.push({field:"lw",value:this.lwhisker}),this.rwhisker!==undefined&&a.push({field:"rw",value:this.rwhisker}),a},render:function(){var a=this.target,b=this.values,c=b.length,d=this.options,e=this.canvasWidth,f=this.canvasHeight,h=d.get("chartRangeMin")===undefined?Math.min.apply(Math,b):d.get("chartRangeMin"),i=d.get("chartRangeMax")===undefined?Math.max.apply(Math,b):d.get("chartRangeMax"),j=0,k,l,m,n,o,p,q,r,s,t,u;if(!A._super.render.call(this))return;if(d.get("raw"))d.get("showOutliers")&&b.length>5?(l=b[0],k=b[1],n=b[2],o=b[3],p=b[4],q=b[5],r=b[6]):(k=b[0],n=b[1],o=b[2],p=b[3],q=b[4]);else{b.sort(function(a,b){return a-b}),n=g(b,1),o=g(b,2),p=g(b,3),m=p-n;if(d.get("showOutliers")){k=q=undefined;for(s=0;s<c;s++)k===undefined&&b[s]>n-m*d.get("outlierIQR")&&(k=b[s]),b[s]<p+m*d.get("outlierIQR")&&(q=b[s]);l=b[0],r=b[c-1]}else k=b[0],q=b[c-1]}this.quartiles=[n,o,p],this.lwhisker=k,this.rwhisker=q,this.loutlier=l,this.routlier=r,u=e/(i-h+1),d.get("showOutliers")&&(j=Math.ceil(d.get("spotRadius")),e-=2*Math.ceil(d.get("spotRadius")),u=e/(i-h+1),l<k&&a.drawCircle((l-h)*u+j,f/2,d.get("spotRadius"),d.get("outlierLineColor"),d.get("outlierFillColor")).append(),r>q&&a.drawCircle((r-h)*u+j,f/2,d.get("spotRadius"),d.get("outlierLineColor"),d.get("outlierFillColor")).append()),a.drawRect(Math.round((n-h)*u+j),Math.round(f*.1),Math.round((p-n)*u),Math.round(f*.8),d.get("boxLineColor"),d.get("boxFillColor")).append(),a.drawLine(Math.round((k-h)*u+j),Math.round(f/2),Math.round((n-h)*u+j),Math.round(f/2),d.get("lineColor")).append(),a.drawLine(Math.round((k-h)*u+j),Math.round(f/4),Math.round((k-h)*u+j),Math.round(f-f/4),d.get("whiskerColor")).append(),a.drawLine(Math.round((q-h)*u+j),Math.round(f/2),Math.round((p-h)*u+j),Math.round(f/2),d.get("lineColor")).append(),a.drawLine(Math.round((q-h)*u+j),Math.round(f/4),Math.round((q-h)*u+j),Math.round(f-f/4),d.get("whiskerColor")).append(),a.drawLine(Math.round((o-h)*u+j),Math.round(f*.1),Math.round((o-h)*u+j),Math.round(f*.9),d.get("medianColor")).append(),d.get("target")&&(t=Math.ceil(d.get("spotRadius")),a.drawLine(Math.round((d.get("target")-h)*u+j),Math.round(f/2-t),Math.round((d.get("target")-h)*u+j),Math.round(f/2+t),d.get("targetColor")).append(),a.drawLine(Math.round((d.get("target")-h)*u+j-t),Math.round(f/2),Math.round((d.get("target")-h)*u+j+t),Math.round(f/2),d.get("targetColor")).append()),a.render()}}),function(){document.namespaces&&!document.namespaces.v?(a.fn.sparkline.hasVML=!0,document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML")):a.fn.sparkline.hasVML=!1;var b=document.createElement("canvas");a.fn.sparkline.hasCanvas=!!b.getContext&&!!b.getContext("2d")}(),D=d({init:function(a,b,c,d){this.target=a,this.id=b,this.type=c,this.args=d},append:function(){return this.target.appendShape(this),this}}),E=d({_pxregex:/(\d+)(px)?\s*$/i,init:function(b,c,d){if(!b)return;this.width=b,this.height=c,this.target=d,this.lastShapeId=null,d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this)},drawLine:function(a,b,c,d,e,f){return this.drawShape([[a,b],[c,d]],e,f)},drawShape:function(a,b,c,d){return this._genShape("Shape",[a,b,c,d])},drawCircle:function(a,b,c,d,e,f){return this._genShape("Circle",[a,b,c,d,e,f])},drawPieSlice:function(a,b,c,d,e,f,g){return this._genShape("PieSlice",[a,b,c,d,e,f,g])},drawRect:function(a,b,c,d,e,f){return this._genShape("Rect",[a,b,c,d,e,f])},getElement:function(){return this.canvas},getLastShapeId:function(){return this.lastShapeId},reset:function(){alert("reset not implemented")},_insert:function(b,c){a(c).html(b)},_calculatePixelDims:function(b,c,d){var e;e=this._pxregex.exec(c),e?this.pixelHeight=e[1]:this.pixelHeight=a(d).height(),e=this._pxregex.exec(b),e?this.pixelWidth=e[1]:this.pixelWidth=a(d).width()},_genShape:function(a,b){var c=I++;return b.unshift(c),new D(this,c,a,b)},appendShape:function(a){alert("appendShape not implemented")},replaceWithShape:function(a,b){alert("replaceWithShape not implemented")},insertAfterShape:function(a,b){alert("insertAfterShape not implemented")},removeShapeId:function(a){alert("removeShapeId not implemented")},getShapeAt:function(a,b,c){alert("getShapeAt not implemented")},render:function(){alert("render not implemented")}}),F=d(E,{init:function(b,c,d,e){F._super.init.call(this,b,c,d),this.canvas=document.createElement("canvas"),d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this),a(this.canvas).css({display:"inline-block",width:b,height:c,verticalAlign:"top"}),this._insert(this.canvas,d),this._calculatePixelDims(b,c,this.canvas),this.canvas.width=this.pixelWidth,this.canvas.height=this.pixelHeight,this.interact=e,this.shapes={},this.shapeseq=[],this.currentTargetShapeId=undefined,a(this.canvas).css({width:this.pixelWidth,height:this.pixelHeight})},_getContext:function(a,b,c){var d=this.canvas.getContext("2d");return a!==undefined&&(d.strokeStyle=a),d.lineWidth=c===undefined?1:c,b!==undefined&&(d.fillStyle=b),d},reset:function(){var a=this._getContext();a.clearRect(0,0,this.pixelWidth,this.pixelHeight),this.shapes={},this.shapeseq=[],this.currentTargetShapeId=undefined},_drawShape:function(a,b,c,d,e){var f=this._getContext(c,d,e),g,h;f.beginPath(),f.moveTo(b[0][0]+.5,b[0][1]+.5);for(g=1,h=b.length;g<h;g++)f.lineTo(b[g][0]+.5,b[g][1]+.5);c!==undefined&&f.stroke(),d!==undefined&&f.fill(),this.targetX!==undefined&&this.targetY!==undefined&&f.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=a)},_drawCircle:function(a,b,c,d,e,f,g){var h=this._getContext(e,f,g);h.beginPath(),h.arc(b,c,d,0,2*Math.PI,!1),this.targetX!==undefined&&this.targetY!==undefined&&h.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=a),e!==undefined&&h.stroke(),f!==undefined&&h.fill()},_drawPieSlice:function(a,b,c,d,e,f,g,h){var i=this._getContext(g,h);i.beginPath(),i.moveTo(b,c),i.arc(b,c,d,e,f,!1),i.lineTo(b,c),i.closePath(),g!==undefined&&i.stroke(),h&&i.fill(),this.targetX!==undefined&&this.targetY!==undefined&&i.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=a)},_drawRect:function(a,b,c,d,e,f,g){return this._drawShape(a,[[b,c],[b+d,c],[b+d,c+e],[b,c+e],[b,c]],f,g)},appendShape:function(a){return this.shapes[a.id]=a,this.shapeseq.push(a.id),this.lastShapeId=a.id,a.id},replaceWithShape:function(a,b){var c=this.shapeseq,d;this.shapes[b.id]=b;for(d=c.length;d--;)c[d]==a&&(c[d]=b.id);delete this.shapes[a]},replaceWithShapes:function(a,b){var c=this.shapeseq,d={},e,f,g;for(f=a.length;f--;)d[a[f]]=!0;for(f=c.length;f--;)e=c[f],d[e]&&(c.splice(f,1),delete this.shapes[e],g=f);for(f=b.length;f--;)c.splice(g,0,b[f].id),this.shapes[b[f].id]=b[f]},insertAfterShape:function(a,b){var c=this.shapeseq,d;for(d=c.length;d--;)if(c[d]===a){c.splice(d+1,0,b.id),this.shapes[b.id]=b;return}},removeShapeId:function(a){var b=this.shapeseq,c;for(c=b.length;c--;)if(b[c]===a){b.splice(c,1);break}delete this.shapes[a]},getShapeAt:function(a,b,c){return this.targetX=b,this.targetY=c,this.render(),this.currentTargetShapeId},render:function(){var a=this.shapeseq,b=this.shapes,c=a.length,d=this._getContext(),e,f,g;d.clearRect(0,0,this.pixelWidth,this.pixelHeight);for(g=0;g<c;g++)e=a[g],f=b[e],this["_draw"+f.type].apply(this,f.args);this.interact||(this.shapes={},this.shapeseq=[])}}),G=d(E,{init:function(b,c,d){var e;G._super.init.call(this,b,c,d),d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this),this.canvas=document.createElement("span"),a(this.canvas).css({display:"inline-block",position:"relative",overflow:"hidden",width:b,height:c,margin:"0px",padding:"0px",verticalAlign:"top"}),this._insert(this.canvas,d),this._calculatePixelDims(b,c,this.canvas),this.canvas.width=this.pixelWidth,this.canvas.height=this.pixelHeight,e='<v:group coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'"'+' style="position:absolute;top:0;left:0;width:'+this.pixelWidth+"px;height="+this.pixelHeight+'px;"></v:group>',this.canvas.insertAdjacentHTML("beforeEnd",e),this.group=a(this.canvas).children()[0],this.rendered=!1,this.prerender=""},_drawShape:function(a,b,c,d,e){var f=[],g,h,i,j,k,l,m;for(m=0,l=b.length;m<l;m++)f[m]=""+b[m][0]+","+b[m][1];return g=f.splice(0,1),e=e===undefined?1:e,h=c===undefined?' stroked="false" ':' strokeWeight="'+e+'px" strokeColor="'+c+'" ',i=d===undefined?' filled="false"':' fillColor="'+d+'" filled="true" ',j=f[0]===f[f.length-1]?"x ":"",k='<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" '+' id="jqsshape'+a+'" '+h+i+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;" '+' path="m '+g+" l "+f.join(", ")+" "+j+'e">'+" </v:shape>",k},_drawCircle:function(a,b,c,d,e,f,g){var h,i,j;return b-=d,c-=d,h=e===undefined?' stroked="false" ':' strokeWeight="'+g+'px" strokeColor="'+e+'" ',i=f===undefined?' filled="false"':' fillColor="'+f+'" filled="true" ',j='<v:oval id="jqsshape'+a+'" '+h+i+' style="position:absolute;top:'+c+"px; left:"+b+"px; width:"+d*2+"px; height:"+d*2+'px"></v:oval>',j},_drawPieSlice:function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n,o,p;if(e===f)return"";f-e===2*Math.PI&&(e=0,f=2*Math.PI),j=b+Math.round(Math.cos(e)*d),k=c+Math.round(Math.sin(e)*d),l=b+Math.round(Math.cos(f)*d),m=c+Math.round(Math.sin(f)*d);if(j===l&&k===m){if(f-e<Math.PI)return"";j=l=b+d,k=m=c}return j===l&&k===m&&f-e<Math.PI?"":(i=[b-d,c-d,b+d,c+d,j,k,l,m],n=g===undefined?' stroked="false" ':' strokeWeight="1px" strokeColor="'+g+'" ',o=h===undefined?' filled="false"':' fillColor="'+h+'" filled="true" ',p='<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" '+' id="jqsshape'+a+'" '+n+o+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;" '+' path="m '+b+","+c+" wa "+i.join(", ")+' x e">'+" </v:shape>",p)},_drawRect:function(a,b,c,d,e,f,g){return this._drawShape(a,[[b,c],[b,c+e],[b+d,c+e],[b+d,c],[b,c]],f,g)},reset:function(){this.group.innerHTML=""},appendShape:function(a){var b=this["_draw"+a.type].apply(this,a.args);return this.rendered?this.group.insertAdjacentHTML("beforeEnd",b):this.prerender+=b,this.lastShapeId=a.id,a.id},replaceWithShape:function(b,c){var d=a("#jqsshape"+b),e=this["_draw"+c.type].apply(this,c.args);d[0].outerHTML=e},replaceWithShapes:function(b,c){var d=a("#jqsshape"+b[0]),e="",f=c.length,g;for(g=0;g<f;g++)e+=this["_draw"+c[g].type].apply(this,c[g].args);d[0].outerHTML=e;for(g=1;g<b.length;g++)a("#jqsshape"+b[g]).remove()},insertAfterShape:function(b,c){var d=a("#jqsshape"+b),e=this["_draw"+c.type].apply(this,c.args);d[0].insertAdjacentHTML("afterEnd",e)},removeShapeId:function(b){var c=a("#jqsshape"+b);this.group.removeChild(c[0])},getShapeAt:function(a,b,c){var d=a.id.substr(8);return d},render:function(){this.rendered||(this.group.innerHTML=this.prerender,this.rendered=!0)}})}); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/languages/index.php b/wp-content/plugins/wp-piwik/languages/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/languages/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/languages/wp-piwik-de_DE.mo b/wp-content/plugins/wp-piwik/languages/wp-piwik-de_DE.mo index 9a47efb36620cb5be87e82a14e49553812f5393e..25ce6c01488fa4fcff1f154800613e948f5357af 100755 GIT binary patch delta 5661 zcmbO=hjGpd#`=3gEK?a67#NN-Ffhn4FffF$F);8lGBEV;fJ7M>4hS$Xure?(928(+ zPyneDU|{HBU|@J5z`*dEfq|h^kb&VTBLhRB5Cek%0|P_22m^x%0|P^b2m^x>0|P^? z2m=Eb0|UbX5e5c91_p-JA`A=x3=9l=MHm?L7#Qjq_(UNZZABRvq!<_&{6rxdGDR5} zxEUB2N}%Emq6`eo3=9mjMHv``7#JAlL*+M#GBAMLx=)mWft`VY;WU)KEXu%O%fP^J zTa<x;gMooTQjCFtje&tdNsNJkmw|ynQ;dOO0z*9mgSi;Qq7z~a45kbW3|GV$7+e?_ z7`Vh47^)c<82rT<7(74*i$g3Hk$_mFF2TT{%fP^(FTubd#=yW3E5X3P339Lm0|Ore z14Eqz0|N^K14FL_#DS9}7#P$*4wry<_?QF(1AjdO1H*L*1_oIM28QPn3=G-~3=FK2 z3=I4X3=D>n5DOh885qPtQ6mZQQH~@7gE<2O!zxJz24w~YhDVYN4Au+`3~W*maVIGT z1{($jhAJsYNN$&c`23I*1A`v}1H(xvh=U}g85rt8aiS{Cz@Wvzz+f)Tz+l9{z>p-( zz!1;Cz%W&sfx(S|f#It(14AwY1A~nW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wkHFm z-UjhOWpp9~q(CZSU|=X<fYcAY(2god4XCrR48&l7WIGVE0@QP2U|?uufHY?6K!OaA z5);Y<bv!{mKZey{l7WGtgMope3MxAvR5>s}3LsG9A%%f~p$*hwWME(bb(KNYa4e`} z2~`iGKy3q1xv&jX$AkKMpqh{YQpkYhK|SJh5Ce)q-7-+e#ubz}CNnTFWHT@@YzB2g z86edqNL?xe1A`=}cf`QJFr5KX<buSPGB7YKW?*2@XJBAxW?*3G*}PX^J@e)zA{LCB zmBs$BOxBS$-)t-MhIzBCLKO4nXUYOhn@!bLF>cb3<k_5MGMjO8oEbOU<Owz+llyHf fH=nj$#IkvcQ##A$IQJx`%>rJ=Oq;WPHnIZ%2zsZQ diff --git a/wp-content/plugins/wp-piwik/languages/wp-piwik-de_DE.po b/wp-content/plugins/wp-piwik/languages/wp-piwik-de_DE.po index 6cc24d65d..1991cb0c8 100755 --- a/wp-content/plugins/wp-piwik/languages/wp-piwik-de_DE.po +++ b/wp-content/plugins/wp-piwik/languages/wp-piwik-de_DE.po @@ -671,4 +671,43 @@ msgid "Adds the <noscript> code to your footer." msgstr "Fügt den <noscript>-Code im Footer ein." msgid "Use Piwik's advanced Site Search Analytics feature. See" -msgstr "Benutze Piwiks erweiterte Site Search Analyse. Siehe" \ No newline at end of file +msgstr "Benutze Piwiks erweiterte Site Search Analyse. Siehe" + +msgid "Enable tracking for visitors without JavaScript (not recommended). See" +msgstr "Aktiviere das Tracking von Besuchern ohne JavaScript (nicht empfohlen). Siehe" + +msgid "Add rec parameter to noscript code" +msgstr "Füge rec-Parameter zum noscript Code hinzu" + +msgid "Add <noscript>" +msgstr "Füge <noscript> hinzu" + +msgid "Cache API calls, which not contain today's values, for a week" +msgstr "Cache alle API-Aufrufe, die keine heutigen Daten enthalten, für eine Woche" + +msgid "Enable cache" +msgstr "Cache einschalten" + +msgid "This will add Piwik campaign parameters to the RSS feed links." +msgstr "Dadurch werden Piwik Kampagnen-Parameter an die Links des RSS-Feeds angehangen." + +msgid "Campaign" +msgstr "Kampagne" + +msgid "Keyword: post name." +msgstr "Schlüsselwort: Name des Beitrags." + +msgid "Enable to track posts in feeds via tracking pixel." +msgstr "Aktivieren, um Beiräge im Feed via Tracking-Pixel zu zählen." + +msgid "Enable to track users on admin pages (remember to configure the tracking filter appropriately)." +msgstr "Aktivieren, um Nutzer auf Admin-Seiten zu zählen (bitte den Tracking Filter entsprechend konfigurieren)." + +msgid "Track RSS feed links as campaign" +msgstr "Links in RSS-Feeds als Kampagne tracken" + +msgid "Show stats about single posts at the post edit admin page." +msgstr "Zeige Statistiken zu einzelnen Beiträgen auf der Bearbeiten-Seite." + +msgid "Show per post stats" +msgstr "Zeige Beitrags-Statistiken" \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/languages/wp-piwik-zh_CN.mo b/wp-content/plugins/wp-piwik/languages/wp-piwik-zh_CN.mo new file mode 100644 index 0000000000000000000000000000000000000000..bf7678d53ea6d4074fb29f52113f34419d037098 GIT binary patch literal 16660 zcmca7#4?qEfq`K+0|SE$0|UbsRtARO3=9lsxIv-}3_JK47-Sh37<TeAFt9Q(FkI(n zU{GLSV7SZAz|h0M!0?ZsfkA|UfuUP~fkBCZfnk9F1A`y~1H)kf1_nI_28OEw3=9Gc z3=AxS3=CWh3=E=z3=ANn6$BX=q!<_&bOad~m>C!t+yxmJgcukYyagE;co-NM;shBO z*cliYvY~XbAOizG0|P@fl;17Lz+lV3z%W^mfq|ESf#ISc#C`Xn<~$W-V3@$b!0-cV zU#AcQgDC?8!&D{VefhSNd}3?2*&3<AOsdn1J*?#>a0*jp#ez#zuJz|bblz`(-5 zz%W;sfq|2Ofnkv_#C>ao85q<+;UWz2-veQY`#uUo!i!OafkB&rfk9pbBJM2$u_s!D zfkB*sfgw)>;{G-f1_osY28JUd3=B353=A(sAmOAc%D}+Jz`$T2%D~{qz`$TG3bD6M z6ynawq6`dL3=9lQMHv{}7#J8Xh(i1?F2=x+%fP@OD+aN*Ta1Arn}LC0wiv|y?BbA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pl0BOk}w`^frktaT&Vjw3@XoHqtkXjoOK9J-A$+J(}cRlah0O?#p!VT&cj2R_R z#K6)ts2BErPe-UDsCaqWu!jMXvOv_!>FW>^B3QfSps-f}h3DR>pn?L@2{bV<QGmDz z(%ryr45$s-u?-U3Anz?`e6o9~0%&#!(#Qb~Q9SLR__Co9(i}huDMaH7JWv5Dg1c5g zeTy7?pqg-Z-;0Kxr~T8O>|U$@9?b^L9f7hqgj0}FfZb?F9R;bH5WxV=0PA|5bxc5r zLW<I-t!ti6?0PnLKSBcPCPZog_t%kqjZh2fBSJceaF>Axv|tgB;!H?_Vt`Vp?LE-2 z;N01uwi7&@p3U9=bnbMtnIveA-Mr#yTMsC~bZ>mIel5eZ8S6ou_1hs{g%$9Sem=a6 zhnHoDN*Si|CAe~itHe@EXMz{5fKuU;y$c}Y8OQ;}@MP}-h}$5Idz>b`-_!HFW!uvU zea||3A#HGoF_1zC(v^efGmN>T=Y1PMO_ryVdKjMegZk|Z;NC4%7&3+d?S_L~^knxM zP_4Ru_lxxtpX{CUbaEr8T89>b&|!?V3{SUjdb+Oj#o|^5lz{}$V9(1r4bM=+`st*e zr~9^p0{zL3UItKG6x<0%o+o;-f6CL@^Ptm2kYx09_M(?F=0k=y7@q9zdb(sK!?PJH zKoq3$1}(H9Y2)eqUC$RbfLcYMGJoUlCwulh+0~~2n&7e0N1gNmC%gB1I-kLs{h%ZS zvGduS-lts)pUzwXX@8;^Ma%>esBnQe?#Yf-Pj>BsIuSW$A2&3CI)&g24H_Q;Hz48a z_C4Rb?)lUn$dH}_Xc7rh#DF>)kWuILOChaaP}gr=^Yb~~FSc%fHg_qgZ44gseh&7# Q0%Vp5G<igLE(w%E0oX<DLI3~& literal 0 HcmV?d00001 diff --git a/wp-content/plugins/wp-piwik/languages/wp-piwik-zh_CN.po b/wp-content/plugins/wp-piwik/languages/wp-piwik-zh_CN.po new file mode 100644 index 000000000..52b3ab6c9 --- /dev/null +++ b/wp-content/plugins/wp-piwik/languages/wp-piwik-zh_CN.po @@ -0,0 +1,861 @@ +msgid "" +msgstr "" +"Project-Id-Version: WP-Piwik\n" +"POT-Creation-Date: 2013-06-14 17:12+0800\n" +"PO-Revision-Date: 2013-06-14 22:37+0800\n" +"Last-Translator: mogita <chrisprc@gmail.com>\n" +"Language-Team: mogita <chrisprc@gmail.com>\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.5\n" +"X-Poedit-KeywordsList: _;gettext;gettext_noop;_e;__\n" +"X-Poedit-Basepath: .\n" +"X-Poedit-SearchPath-0: ..\n" +"X-Poedit-SearchPath-1: ../cache\n" +"X-Poedit-SearchPath-2: ../classes\n" +"X-Poedit-SearchPath-3: ../dashboard\n" +"X-Poedit-SearchPath-4: ../debug\n" +"X-Poedit-SearchPath-5: ../logs\n" +"X-Poedit-SearchPath-6: ../settings\n" +"X-Poedit-SearchPath-7: ../shortcodes\n" +"X-Poedit-SearchPath-8: ../update\n" + +#: ../wp-piwik.php:197 +msgid "installed" +msgstr "已安装" + +#: ../wp-piwik.php:198 +msgid "Next you should connect to Piwik" +msgstr "接下来,请连接到 Piwik" + +#: ../wp-piwik.php:198 +msgid "Please validate your configuration" +msgstr "请验证你的配置" + +#: ../wp-piwik.php:199 ../wp-piwik.php:597 ../wp-piwik.php:1227 +msgid "Settings" +msgstr "设置" + +#: ../wp-piwik.php:200 +msgid "Important" +msgstr "重要" + +#: ../wp-piwik.php:328 +msgid "Piwik Custom Variables" +msgstr "Piwik 自定义变量" + +#: ../wp-piwik.php:342 +msgid "Name" +msgstr "名称" + +#: ../wp-piwik.php:342 +msgid "Value" +msgstr "值" + +#: ../wp-piwik.php:351 +msgid "Set custom variables for a page view" +msgstr "为页面浏览量(PV)设置自定义变量" + +#: ../wp-piwik.php:351 +msgid "More information" +msgstr "更多信息" + +#: ../wp-piwik.php:396 ../wp-piwik.php:437 +msgid "Piwik Statistics" +msgstr "Piwik 统计" + +#: ../wp-piwik.php:555 ../wp-piwik.php:974 ../dashboard/overview.php:56 +#: ../shortcodes/overview.php:38 +msgid "Visitors" +msgstr "访客" + +#: ../wp-piwik.php:575 ../wp-piwik.php:965 ../dashboard/seo.php:20 +msgid "SEO" +msgstr "SEO" + +#: ../wp-piwik.php:723 +msgid "Could not resolve" +msgstr "无法解析" + +#: ../wp-piwik.php:723 +msgid "realpath() returns false" +msgstr "realpath() 返回 false" + +#: ../wp-piwik.php:964 ../dashboard/overview.php:23 +#: ../shortcodes/overview.php:11 +msgid "Overview" +msgstr "概览" + +#: ../wp-piwik.php:966 ../dashboard/pages.php:13 +msgid "Pages" +msgstr "页面" + +#: ../wp-piwik.php:967 ../dashboard/keywords.php:12 +msgid "Keywords" +msgstr "关键词" + +#: ../wp-piwik.php:968 ../dashboard/websites.php:12 +msgid "Websites" +msgstr "站点" + +#: ../wp-piwik.php:969 ../dashboard/plugins.php:12 ../dashboard/plugins.php:33 +msgid "Plugins" +msgstr "插件" + +#: ../wp-piwik.php:970 ../dashboard/search.php:12 +msgid "Site Search Keywords" +msgstr "站内搜索关键词" + +#: ../wp-piwik.php:971 ../dashboard/noresult.php:12 +msgid "Site Search without Results" +msgstr "未查找到结果的站内搜索" + +#: ../wp-piwik.php:975 ../dashboard/browserdetails.php:39 +#: ../dashboard/browsers.php:13 ../dashboard/browsers.php:40 +msgid "Browser" +msgstr "浏览器" + +#: ../wp-piwik.php:976 ../dashboard/browserdetails.php:12 +msgid "Browser Details" +msgstr "浏览器细节" + +#: ../wp-piwik.php:977 ../dashboard/screens.php:12 ../dashboard/screens.php:39 +msgid "Resolution" +msgstr "分辨率" + +#: ../wp-piwik.php:978 ../dashboard/systems.php:12 ../dashboard/systems.php:40 +msgid "Operating System" +msgstr "操作系统" + +#: ../wp-piwik.php:1050 ../wp-piwik.php:1124 +msgid "Statistics" +msgstr "统计数据" + +#: ../wp-piwik.php:1060 +msgid "Currently shown stats:" +msgstr "目前展示的统计:" + +#: ../wp-piwik.php:1107 +msgid "Cheatin’ uh?" +msgstr "呃,打开的方式不对吧?" + +#: ../wp-piwik.php:1121 +msgid "Home" +msgstr "首页" + +#: ../wp-piwik.php:1122 ../wp-piwik.php:1128 +msgid "Piwik Settings" +msgstr "Piwik 设置" + +#: ../wp-piwik.php:1123 +msgid "Tracking" +msgstr "跟踪" + +#: ../wp-piwik.php:1125 ../wp-piwik.php:1129 ../wp-piwik.php:1286 +msgid "Support" +msgstr "支持" + +#: ../wp-piwik.php:1126 ../wp-piwik.php:1130 +msgid "Credits" +msgstr "荣誉榜" + +#: ../wp-piwik.php:1225 +msgid "Changes saved" +msgstr "变更已保存" + +#: ../wp-piwik.php:1233 +msgid "Donate" +msgstr "捐赠" + +#: ../wp-piwik.php:1234 +msgid "If you like WP-Piwik, you can support its development by a donation:" +msgstr "如果你喜欢 WP-Piwik,可以考虑捐赠来支持它的开发:" + +#: ../wp-piwik.php:1250 +msgid "My Amazon.de wishlist" +msgstr "我的 Amazon.de 愿望单" + +#: ../wp-piwik.php:1253 ../settings/support.php:8 +msgid "Please don't forget to vote the compatibility at the" +msgstr "请记得提交兼容性投票,地址在" + +#: ../wp-piwik.php:1268 +msgid "Save settings" +msgstr "保存设置" + +#: ../wp-piwik.php:1286 +msgid "An error occured" +msgstr "出错了" + +#: ../dashboard/browserdetails.php:16 ../dashboard/browsers.php:17 +#: ../dashboard/keywords.php:14 ../dashboard/noresult.php:14 +#: ../dashboard/overview.php:26 ../dashboard/pages.php:16 +#: ../dashboard/plugins.php:26 ../dashboard/screens.php:16 +#: ../dashboard/search.php:14 ../dashboard/seo.php:17 +#: ../dashboard/systems.php:16 ../dashboard/visitors.php:26 +#: ../dashboard/websites.php:15 +msgid "Piwik error" +msgstr "Piwik 错误" + +#: ../dashboard/browserdetails.php:25 ../dashboard/browsers.php:26 +#: ../dashboard/pages.php:45 ../dashboard/screens.php:25 +#: ../dashboard/systems.php:25 +msgid "Others" +msgstr "其他" + +#: ../dashboard/browserdetails.php:40 ../dashboard/browsers.php:41 +#: ../dashboard/keywords.php:19 ../dashboard/pages.php:24 +#: ../dashboard/screens.php:40 ../dashboard/systems.php:41 +#: ../dashboard/visitors.php:58 ../dashboard/websites.php:22 +msgid "Unique" +msgstr "独立访客" + +#: ../dashboard/browserdetails.php:41 ../dashboard/browsers.php:42 +#: ../dashboard/plugins.php:35 ../dashboard/screens.php:41 +#: ../dashboard/systems.php:42 +msgid "Percent" +msgstr "百分比" + +#: ../dashboard/browserdetails.php:55 ../dashboard/browsers.php:56 +#: ../dashboard/keywords.php:25 ../dashboard/noresult.php:25 +#: ../dashboard/pages.php:43 ../dashboard/plugins.php:51 +#: ../dashboard/screens.php:55 ../dashboard/search.php:25 +#: ../dashboard/systems.php:56 ../dashboard/websites.php:29 +msgid "No data available." +msgstr "目前无数据" + +#: ../dashboard/keywords.php:19 ../dashboard/noresult.php:19 +#: ../dashboard/search.php:19 +msgid "Keyword" +msgstr "关键词" + +#: ../dashboard/noresult.php:19 ../dashboard/search.php:19 +msgid "Requests" +msgstr "请求" + +#: ../dashboard/noresult.php:19 ../dashboard/search.php:19 +#: ../dashboard/visitors.php:59 +msgid "Bounced" +msgstr "弹出次数" + +#: ../dashboard/overview.php:57 ../shortcodes/overview.php:39 +msgid "Unique visitors" +msgstr "独立访客" + +#: ../dashboard/overview.php:58 ../shortcodes/overview.php:40 +msgid "Page views" +msgstr "页面浏览量(PV)" + +#: ../dashboard/overview.php:59 ../shortcodes/overview.php:41 +msgid "Max. page views in one visit" +msgstr "单次访问中最大页面浏览量" + +#: ../dashboard/overview.php:60 ../shortcodes/overview.php:42 +msgid "Total time spent" +msgstr "总停留时长" + +#: ../dashboard/overview.php:61 ../shortcodes/overview.php:43 +msgid "Time/visit" +msgstr "平均每次访问的停留时长" + +#: ../dashboard/overview.php:62 ../shortcodes/overview.php:44 +msgid "Bounce count" +msgstr "弹出次数" + +#: ../dashboard/overview.php:64 ../settings/views.php:40 +msgid "Shortcut" +msgstr "便捷链接" + +#: ../dashboard/pages.php:23 +msgid "Page" +msgstr "页面" + +#: ../dashboard/pages.php:25 ../dashboard/plugins.php:34 +#: ../dashboard/visitors.php:57 +msgid "Visits" +msgstr "访问" + +#: ../dashboard/visitors.php:48 +msgid "" +"The graph contains the values shown in the table below (visitors / unique / " +"bounces). The red line show a linear trendline (unique)." +msgstr "" +"图表中反映的是下边表格里的数据(访客、独立访客、弹出次数)。红色线条表示线性" +"趋势走向(独立访客)。" + +#: ../dashboard/visitors.php:56 +msgid "Date" +msgstr "日期" + +#: ../dashboard/visitors.php:74 +msgid "Unique TOTAL" +msgstr "独立访客总数" + +#: ../dashboard/visitors.php:74 +msgid "Sum" +msgstr "统计" + +#: ../dashboard/visitors.php:74 +msgid "Avg" +msgstr "平均" + +#: ../dashboard/websites.php:21 +msgid "Website" +msgstr "站点" + +#: ../settings/credits.php:3 +msgid "Thank you very much for your donation" +msgstr "十分感谢您的捐赠" + +#: ../settings/credits.php:3 +msgid "the Piwik team itself" +msgstr "Piwik 团队本身" + +#: ../settings/credits.php:3 +msgid ", and all people flattering this" +msgstr ",所有谈论到它的人们" + +#: ../settings/credits.php:8 +msgid "" +"Graphs powered by <a href=\"http://www.jqplot.com/\">jqPlot</a> (License: " +"GPL 2.0 and MIT) and <a href=\"http://omnipotent.net/jquery.sparkline/" +"\">jQuery Sparklines</a> (License: New BSD License)." +msgstr "" +"图表由 <a href=\"http://www.jqplot.com/\">jqPlot</a>(许可:GPL 2.0 and MIT)" +"以及 <a href=\"http://omnipotent.net/jquery.sparkline/\">jQuery Sparklines</" +"a>(许可:New BSD License)强力驱动。" + +#: ../settings/credits.php:13 +msgid "Metabox support inspired by" +msgstr "Metabox 支持灵感来源于" + +#: ../settings/credits.php:14 +msgid "Tabbed settings page suggested by the" +msgstr "标签式设置页面的建议来自" + +#: ../settings/credits.php:19 +msgid "Thank you very much" +msgstr "非常感谢" + +#: ../settings/credits.php:19 +msgid ", and" +msgstr "," + +#: ../settings/credits.php:19 +msgid "for your translation work" +msgstr "你们的翻译作品" + +#: ../settings/credits.php:24 +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." +msgstr "" +"非常感谢,所有给我发邮件提出批评、建议、功能请求和 bug 报告的用户们!是你们帮" +"助我把 WP-Piwik 做得更好。" + +#: ../settings/credits.php:29 +msgid "" +"Thank <strong>you</strong> for using my plugin. It is the best commendation " +"if my piece of code is really used!" +msgstr "" +"感谢<strong>你</strong>使用我的插件。我的代码能帮到你,就是对我最大的嘉奖了!" + +#: ../settings/homepage.php:4 +msgid "Thanks for using WP-Piwik!" +msgstr "感谢使用 WP-Piwik!" + +#: ../settings/homepage.php:8 +msgid "You are using Piwik" +msgstr "你正在使用 Piwik" + +#: ../settings/homepage.php:8 +msgid "and" +msgstr "和" + +#: ../settings/homepage.php:8 +msgid "in network mode" +msgstr "在网络模式中" + +#: ../settings/homepage.php:10 +msgid "Auto site configuration is" +msgstr "自动站点配置目前为" + +#: ../settings/homepage.php:10 ../settings/homepage.php:11 +#: ../settings/support.php:23 +msgid "enabled" +msgstr "启用" + +#: ../settings/homepage.php:10 ../settings/homepage.php:11 +msgid "disabled" +msgstr "禁用" + +#: ../settings/homepage.php:11 +msgid "Tracking code insertion is" +msgstr "跟踪代码插入状态目前为" + +#: ../settings/piwik.php:7 ../settings/sitebrowser.php:7 +#: ../settings/tracking.php:7 ../settings/views.php:7 +msgid "" +"Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik " +"won't be able to connect to Piwik." +msgstr "错误:cURL 未启用,fopen 无法打开 URL。WP-Piwik 无法连接到 Piwik。" + +#: ../settings/piwik.php:11 +msgid "To enable Piwik statistics, please enter" +msgstr "要启用 Piwik 统计,请输入" + +#: ../settings/piwik.php:13 +msgid "" +"your Piwik base URL (like http://mydomain.com/piwik) or your Piwik server " +"path (like /var/www/mydomain.com/httpdocs/piwik/)" +msgstr "" +"你的 Piwik 站点基础 URL(类似于 http://mydomain.com/piwik)或者你的 Piwik 服" +"务器路径(类似于 var/www/mydomain.com/httpdocs/piwik/)" + +#: ../settings/piwik.php:14 +msgid "" +"your personal Piwik authentification token. You can get the token on the API " +"page inside your Piwik interface. It looks like " +""1234a5cd6789e0a12345b678cd9012ef"." +msgstr "" +"你的个人 Piwik 认证令牌。你可以在你的 Piwik 设置界面的 API 页面中找到该令牌。" +"它看起来和这个类似 "1234a5cd6789e0a12345b678cd9012ef"。" + +#: ../settings/piwik.php:16 +msgid "No idea what I'm talking about?" +msgstr "完全不懂我在说什么?" + +#: ../settings/piwik.php:16 +msgid "Get help." +msgstr "查看帮助。" + +#: ../settings/piwik.php:18 +msgid "" +"<strong>Important note:</strong> If you do not host this blog on your own, " +"your site admin is able to get your auth token from the database." +msgstr "" +"<strong>重要:</strong>如果这个博客不是由你自己架设的,你的站点管理员可以帮你" +"从数据库里查找到认证令牌。" + +#: ../settings/piwik.php:22 +msgid "Piwik URL" +msgstr "Piwik URL" + +#: ../settings/piwik.php:29 +msgid "Piwik path" +msgstr "Piwik 路径" + +#: ../settings/piwik.php:33 +msgid "" +"If you like to use the PHP API and also to enable tracking by WP-Piwik, " +"please enter your Piwik URL, too. Otherwise your tracking code may be " +"erroneous." +msgstr "" +"如果你喜欢用 PHP API 并且想要启用 WP-Piwik 跟踪功能,请同样输入你的 Piwik " +"URL。否则你的跟踪代码可能会出问题。" + +#: ../settings/piwik.php:36 +msgid "Invalid path. Please enter the file path to Piwik." +msgstr "路径不正确。请输入到 Piwik 的文件路径。" + +#: ../settings/piwik.php:40 +msgid "Auth token" +msgstr "认证令牌(Auth Token)" + +#: ../settings/piwik.php:46 +msgid "Auto config" +msgstr "自动配置" + +#: ../settings/piwik.php:49 +msgid "" +"Check this to automatically choose your blog from your Piwik sites by URL. " +"If your blog is not added to Piwik yet, WP-Piwik will add a new site." +msgstr "" +"选中此项,可以根据 URL 来自动从 Piwki 站点中选择你的博客。如果你的博客尚未添" +"加到 Piwik,那么 WP-Piwik 会自动添加一个新条目。" + +#: ../settings/piwik.php:57 +msgid "" +"Please check URL and auth token. You need at least view access to one site." +msgstr "请检查 URL 和认证令牌,你至少要拥有一个站点的查看权限。" + +#: ../settings/piwik.php:65 +msgid "Choose site" +msgstr "选择站点" + +#: ../settings/piwik.php:79 +msgid "Determined site" +msgstr "判断站点" + +#: ../settings/piwik.php:92 +msgid "Expert Settings" +msgstr "高级设置" + +#: ../settings/piwik.php:94 +msgid "Connection timeout" +msgstr "连接超时" + +#: ../settings/piwik.php:101 +msgid "Disable SSL peer verification" +msgstr "禁用 SSL 端点认证" + +#: ../settings/piwik.php:103 +msgid "not recommended" +msgstr "不推荐" + +#: ../settings/piwik.php:106 +msgid "User agent" +msgstr "用户代理(UA)" + +#: ../settings/piwik.php:118 +msgid "" +"Further expert settings require cURL. See <a href=\"http://www.php.net/" +"manual/curl.setup.php\">PHP manual</a>" +msgstr "" +"高级设置要求启用 cURL。请查看 <a href=\"http://www.php.net/manual/curl.setup." +"php\">PHP 手册</a>" + +#: ../settings/sitebrowser.php:26 +msgid "ID" +msgstr "ID" + +#: ../settings/sitebrowser.php:27 +msgid "Title" +msgstr "标题" + +#: ../settings/sitebrowser.php:28 +msgid "URL" +msgstr "URL" + +#: ../settings/sitebrowser.php:29 +msgid "Site ID (Piwik)" +msgstr "站点 ID(Piwik)" + +#: ../settings/support.php:2 +msgid "WP-Piwik support board" +msgstr "WP-Piwik 支持公告板" + +#: ../settings/support.php:2 +msgid "no registration required, English & German" +msgstr "无需注册,英语和德语" + +#: ../settings/support.php:5 +msgid "WordPress.org forum about WP-Piwik" +msgstr "WordPress.org 论坛的 WP-Piwik 板块" + +#: ../settings/support.php:5 +msgid "WordPress.org registration required, English" +msgstr "WordPress.org 需要注册,英语" + +#: ../settings/support.php:12 +msgid "Debugging" +msgstr "正在除错" + +#: ../settings/support.php:13 +msgid "" +"Either allow_url_fopen has to be enabled <em>or</em> cURL has to be " +"available:" +msgstr "要么必须启用 allow_url_fopen,要么使用 cURL:" + +#: ../settings/support.php:16 +msgid "cURL is" +msgstr "cURL 现在" + +#: ../settings/support.php:17 ../settings/support.php:22 +msgid "not" +msgstr "不" + +#: ../settings/support.php:18 +msgid "available" +msgstr "可用" + +#: ../settings/support.php:21 +msgid "allow_url_fopen is" +msgstr "allow_url_fopen 现在" + +#: ../settings/support.php:31 +msgid "Test script result" +msgstr "测试脚本结果" + +#: ../settings/support.php:35 +msgid "Please confirm your reset request" +msgstr "请确认你的重置请求" + +#: ../settings/support.php:35 +msgid "" +"YES, please reset <strong>all</strong> WP-Piwik settings <strong>except</" +"strong> auth token and Piwi URL." +msgstr "" +"是,请重置<strong>所有</strong> WP-Piwik 设置,<strong>除了</strong>认证令牌" +"和 Piwik URL。" + +#: ../settings/support.php:41 +msgid "WP-Piwik reset done" +msgstr "WP-Piwik 重置完成" + +#: ../settings/support.php:46 +msgid "Get more debug information" +msgstr "获取更多除错信息" + +#: ../settings/support.php:48 +msgid "Run test script" +msgstr "运行测试脚本" + +#: ../settings/support.php:49 +msgid "Get site configuration details" +msgstr "获取站点配置细节" + +#: ../settings/support.php:50 +msgid "Reset WP-Piwik settings except auth token and Piwik URL" +msgstr "重置 WP-Piwki 设置,除了认证令牌和 Piwki URL" + +#: ../settings/support.php:50 +msgid "" +"This will not affect Piwik itself. Resetting large networks may take some " +"minutes." +msgstr "这样不会影响 Piwik 本身。重置大型网络时可能需要更多时间。" + +#: ../settings/support.php:52 +msgid "" +"You have to enter your auth token and the Piwik URL before you can access " +"more debug functions." +msgstr "你需要输入认证令牌和 Piwik URL,然后才可以使用更多除错功能。" + +#: ../settings/support.php:55 +msgid "Latest support threads on WordPress.org" +msgstr "WordPress.org 上的最新支持讨论" + +#: ../settings/tracking.php:10 +msgid "Add tracking code" +msgstr "添加跟踪代码" + +#: ../settings/tracking.php:14 +msgid "" +"If your template uses wp_footer(), WP-Piwik can automatically add the Piwik " +"javascript code to your blog." +msgstr "" +"如果你的模板使用了 wp_footer() 函数,WP-Piwik 则可以自动把 Piwik 脚本代码插入" +"到你的博客中。" + +#: ../settings/tracking.php:31 +msgid "Tracking code preview" +msgstr "跟踪代码预览" + +#: ../settings/tracking.php:37 +msgid "<noscript> code preview" +msgstr "<noscript> 代码预览" + +#: ../settings/tracking.php:43 +msgid "Default tracking" +msgstr "默认跟踪" + +#: ../settings/tracking.php:45 +msgid "WP-Piwik uses the Piwik default tracking code." +msgstr "WP-Piwik 使用 Piwik 的默认跟踪代码" + +#: ../settings/tracking.php:48 +msgid "Use js/index.php" +msgstr "使用 js/index.php" + +#: ../settings/tracking.php:50 +msgid "" +"WP-Piwik can automatically use js/index.php instead of piwik.js and piwik." +"php. See" +msgstr "" +"WP-Piwik 可以自动使用 js/index.php,从而取代 piwik.js 和 piwik.php。请查看" + +#: ../settings/tracking.php:53 +msgid "Use proxy script" +msgstr "使用代理脚本" + +#: ../settings/tracking.php:55 +msgid "WP-Piwik will use the piwik.php proxy script. See" +msgstr "WP-Piwik 要使用 piwik.php 代理脚本。请查看" + +#: ../settings/tracking.php:59 +msgid "Add <noscript>" +msgstr "添加 <noscript>" + +#: ../settings/tracking.php:61 +msgid "Adds the <noscript> code to your footer." +msgstr "添加 <noscript> 代码到你的 footer 部分。" + +#: ../settings/tracking.php:61 ../settings/tracking.php:66 +#: ../settings/tracking.php:86 +msgid "Disabled in proxy mode." +msgstr "在代理模式下不可用" + +#: ../settings/tracking.php:64 +msgid "Add rec parameter to noscript code" +msgstr "在 noscript 代码中添加 rec 参数" + +#: ../settings/tracking.php:66 +msgid "Enable tracking for visitors without JavaScript (not recommended). See" +msgstr "对未启用 JavaScript 的访客启用跟踪(不推荐)。请查看" + +#: ../settings/tracking.php:69 +msgid "Disable cookies" +msgstr "禁用 Cookie" + +#: ../settings/tracking.php:71 +msgid "Disable all tracking cookies for a visitor." +msgstr "对某访问者禁用所有跟踪 Cookie" + +#: ../settings/tracking.php:74 +msgid "Track search" +msgstr "跟踪搜索" + +#: ../settings/tracking.php:76 +msgid "Use Piwik's advanced Site Search Analytics feature. See" +msgstr "使用 Piwik 的高级站点搜索分析功能。请查看" + +#: ../settings/tracking.php:79 +msgid "Track 404" +msgstr "跟踪 404" + +#: ../settings/tracking.php:81 +msgid "WP-Piwik can automatically add a 404-category to track 404-page-visits." +msgstr "WP-Piwik 会自动添加一个 404 目录来跟踪 404 页面的访问" + +#: ../settings/tracking.php:84 +msgid "Avoid mod_security" +msgstr "避免 mod_security" + +#: ../settings/tracking.php:86 +msgid "" +"WP-Piwik can automatically force the Tracking Code to sent data in POST. See" +msgstr "WP-Piwik 会自动强制跟踪代码以 POST 的方式发送信息。请查看" + +#: ../settings/tracking.php:89 +msgid "Enable cache" +msgstr "启用缓存" + +#: ../settings/tracking.php:91 +msgid "Cache API calls, which not contain today's values, for a week" +msgstr "缓存 API,其不包含当天的数值,为期一周" + +#: ../settings/tracking.php:94 +msgid "CDN URL" +msgstr "CDN URL" + +#: ../settings/tracking.php:96 +msgid "" +"Leave blank if you do not want to define a CDN URL or you do not know what " +"this is." +msgstr "如果不需要定义 CDN URL,或者你不清楚这是什么,请留空。" + +#: ../settings/tracking.php:99 +msgid "Tracking filter" +msgstr "跟踪过滤器" + +#: ../settings/tracking.php:106 +msgid "Choose users by user role you do <strong>not</strong> want to track." +msgstr "选择你<strong>不</strong>需要跟踪的用户组" + +#: ../settings/views.php:10 +msgid "WP-Piwik display name" +msgstr "WP-Piwik 显示名称" + +#: ../settings/views.php:12 +msgid "Plugin name shown in WordPress." +msgstr "在 WordPress 中显示的插件名称。" + +#: ../settings/views.php:14 +msgid "Default date" +msgstr "默认日期" + +#: ../settings/views.php:16 ../settings/views.php:24 +msgid "yesterday" +msgstr "昨天" + +#: ../settings/views.php:17 ../settings/views.php:25 +msgid "today" +msgstr "今天" + +#: ../settings/views.php:19 +msgid "Default date shown on statistics page." +msgstr "在统计数据页面显示的默认日期。" + +#: ../settings/views.php:21 +msgid "Home Dashboard" +msgstr "仪表盘首页" + +#: ../settings/views.php:23 +msgid "Hide overview" +msgstr "隐藏概览" + +#: ../settings/views.php:24 ../settings/views.php:25 ../settings/views.php:26 +msgid "Show overview" +msgstr "显示概览" + +#: ../settings/views.php:26 +msgid "last 30 days" +msgstr "最近 30 天" + +#: ../settings/views.php:28 +msgid "Chart" +msgstr "图表" + +#: ../settings/views.php:29 +msgid "SEO <em>(slow!)</em>" +msgstr "SEO(很慢!)" + +#: ../settings/views.php:30 +msgid "" +"Configure WP-Piwik widgets to be shown on your WordPress Home Dashboard." +msgstr "配置 WP-Piwik 挂件,以显示在你的 WordPress 仪表盘首页上。" + +#: ../settings/views.php:32 +msgid "Show graph on WordPress Toolbar" +msgstr "在 WordPress 工具条上显示图表" + +#: ../settings/views.php:34 +msgid "Display the last 30 days visitor stats on WordPress Toolbar." +msgstr "在 WordPress 工具条上显示最近 30 天里的访客统计" + +#: ../settings/views.php:36 +msgid "SEO data" +msgstr "SEO 数据" + +#: ../settings/views.php:38 +msgid "Display SEO ranking data on statistics page. <em>(Slow!)</em>" +msgstr "在统计数据页面显示 SEO 排名数据(很慢!)" + +#: ../settings/views.php:42 +msgid "Display a shortcut to Piwik itself." +msgstr "显示到 Piwik 本身的链接。" + +#: ../settings/views.php:44 +msgid "Display to" +msgstr "显示在" + +#: ../settings/views.php:51 +msgid "Choose user roles allowed to see the statistics page." +msgstr "选择能够查看统计页面的用户组" + +#: ../settings/views.php:53 +msgid "Disable time limit" +msgstr "禁用时间限制" + +#: ../settings/views.php:55 +msgid "Use set_time_limit(0) if stats page causes a time out." +msgstr "如果统计数据页面出现超时,请使用 set_time_limit(0)。" + +#: ../settings/views.php:57 +msgid "Enable shortcodes" +msgstr "启用短代码" + +#: ../settings/views.php:59 +msgid "Enable shortcodes in post or page content." +msgstr "启用短代码,可以插入到文章或页面内容中。" + +#: ../shortcodes/overview.php:26 +msgid "Error" +msgstr "错误" + +#: ../shortcodes/overview.php:46 +msgid "No data available" +msgstr "暂无数据" diff --git a/wp-content/plugins/wp-piwik/logs/.htaccess b/wp-content/plugins/wp-piwik/logs/.htaccess new file mode 100644 index 000000000..14249c50b --- /dev/null +++ b/wp-content/plugins/wp-piwik/logs/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/logs/index.php b/wp-content/plugins/wp-piwik/logs/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/logs/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/piwik.php b/wp-content/plugins/wp-piwik/piwik.php index 8f72dae71..8c0341f26 100644 --- a/wp-content/plugins/wp-piwik/piwik.php +++ b/wp-content/plugins/wp-piwik/piwik.php @@ -1,8 +1,11 @@ <?php - require( '../../../wp-load.php' ); + require('../../../wp-load.php'); + require_once('classes/WP_Piwik_Settings.php'); + require_once('classes/WP_Piwik_Logger_Dummy.php'); - $arySettings = wp_piwik::loadSettings(); + $logger = new WP_Piwik_Logger_Dummy(__CLASS__); + $settings = new WP_Piwik_Settings($logger); /* PIWIK PROXY SCRIPT */ @@ -58,11 +61,11 @@ // Edit the line below, and replace http://piwik-server.com/piwik/ // with your Piwik URL ending with a slash. // This URL will never be revealed to visitors or search engines. -$PIWIK_URL = $arySettings['global']['piwik_url']; +$PIWIK_URL = $settings->getGlobalOption('piwik_url'); // Edit the line below, and replace xyz by the token_auth for the user "UserTrackingAPI" // which you created when you followed instructions above. -$TOKEN_AUTH = $arySettings['global']['piwik_token']; +$TOKEN_AUTH = $settings->getGlobalOption('piwik_token'); // Maximum time, in seconds, to wait for the Piwik server to return the 1*1 GIF $timeout = 5; diff --git a/wp-content/plugins/wp-piwik/readme.txt b/wp-content/plugins/wp-piwik/readme.txt index 1f623f8cd..61f546a48 100644 --- a/wp-content/plugins/wp-piwik/readme.txt +++ b/wp-content/plugins/wp-piwik/readme.txt @@ -1,9 +1,9 @@ === WP-Piwik === Contributors: Braekling -Requires at least: 3.5 -Tested up to: 3.5.1 -Stable tag: 0.9.9.1 +Requires at least: 3.8 +Tested up to: 3.8 +Stable tag: 0.9.9.8 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779 Tags: statistics, stats, analytics, piwik, wpmu @@ -13,13 +13,13 @@ This plugin adds a Piwik stats site to your WordPress or WordPress multisite das This plugin adds a Piwik stats site to your WordPress dashboard. It's also able to add the Piwik tracking code to your blog using wp_footer. -**You need a running Piwik (at least 1.11) installation** and at least view access to your stats. Also PHP 5 or higher is strictly required. +**You need a running Piwik (at least 2.0.2) installation** and at least view access to your stats. Also PHP 5 or higher is strictly required. Look at the [Piwik website](http://piwik.org/) to get further information about Piwik. *This plugin is not created or provided by the Piwik project team.* -Languages: English, German, Albanian, Azerbaijani, Belorussian, Dutch, French, Greek, Lithuanian, Norwegian, Persian, Romanian, Russian, Spanish, Swedish, Ukrainian +Languages: English, German, Albanian, Azerbaijani, Belorussian, Chinese (simplified), Dutch, French, Greek, Italian, Lithuanian, Norwegian, Persian, Romanian, Russian, Spanish, Swedish, Ukrainian *Note: If you vote "It's broken", please tell me about your problem. It's hard to fix a bug I don't know about! ;-)* @@ -46,7 +46,7 @@ See section "Installation". * Graphs powered by [jqPlot](http://www.jqplot.com/) (GPL 2.0 and MIT) and and [jQuery Sparklines](http://omnipotent.net/jquery.sparkline/) (New BSD License). * Metabox support inspired by [Heiko Rabe's metabox demo plugin](http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own-plugins). * Translation credits see plugin settings -* Donations: Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S, Thomas M., John C., Andreas G., Ben M., the Piwik team itself, and all people flattering this. +* Donations: Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S, Thomas M., John C., Andreas G., Ben M., Myra R. I., Carlos U. R.-S., the Piwik team itself, and all people flattering this. * All users who send me mails containing criticism, commendation, feature requests and bug reports - you help me to make WP-Piwik much better! Thank you all! @@ -71,6 +71,9 @@ Try to enable the "avoid mod_security" option (WP-Piwik settings, Tracking tab) See [this support thread](http://wordpress.org/support/topic/plugin-wp-piwik-https-ssl-support?replies=3). += Overview shortcode shows no unique visitors using a yearly range. = +See [Piwik FAQ](http://piwik.org/faq/how-to/#faq_113). + == Installation == = Install WP-Piwik on a simple WordPress blog = @@ -114,6 +117,39 @@ Please update Piwik if not done yet (Piwik 1.11 or higher is recommended)! == Changelog == += 0.9.9.8 = +* Feature: Per post stats (shown at the edit post page) +* Feature: Track RSS views using a measurement pixel + += 0.9.9.7 = +* Bugfix: Error messages won't by cached anymore +* Bugfix: Custom vars will now be added properly +* Bugfix: Missing slash in proxy mode added +* Feature: Track users on admin pages + += 0.9.9.6 = +* Bugfix: Proxy script will work again +* Option: Enable/disable one week caching +* Load config file using full path to avoid side effects + += 0.9.9.5 = +* Fatal error on statistics settings page fixed + += 0.9.9.4 = +* Use Transients API (one week caching) +* Option: Track visitors without JavaScript, see http://piwik.org/faq/how-to/#faq_176 + += 0.9.9.3 = +* Sparkline script update (IE 10 compatbility) +* Syntax error fixes + += 0.9.9.2 = +* Bugfix regarding tracking code changes in proxy mode, see http://wordpress.org/support/topic/problem-with-https-in-proxy-mode +* Feature: Change text "WP-Piwik" in menu items and dashboard widgets +* Code cleanup ("new" first step) +* Debugging: Logger added +* Avoid double slash (//) in tracking code + = 0.9.9.1 = * CDN support: http and https separated, see http://wordpress.org/support/topic/request-cdn-support-1 * Made <noscript> code optional. Move <noscript> code to site footer. diff --git a/wp-content/plugins/wp-piwik/settings/credits.php b/wp-content/plugins/wp-piwik/settings/credits.php index bf772c952..73bc4d859 100644 --- a/wp-content/plugins/wp-piwik/settings/credits.php +++ b/wp-content/plugins/wp-piwik/settings/credits.php @@ -1,6 +1,6 @@ <tr> <td> - <strong><?php _e('Thank you very much for your donation', 'wp-piwik'); ?>:</strong> Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S., Thomas M., John C., Andreas G., Ben M., <?php _e('the Piwik team itself','wp-piwik');?><?php _e(', and all people flattering this','wp-piwik'); ?>! + <strong><?php _e('Thank you very much for your donation', 'wp-piwik'); ?>:</strong> Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S., Thomas M., John C., Andreas G., Ben M., Myra R. I., Carlos U. R.-S., Oleg I., M. N., <?php _e('the Piwik team itself','wp-piwik');?><?php _e(', and all people flattering this','wp-piwik'); ?>! </td> </tr> <tr> @@ -16,7 +16,7 @@ </tr> <tr> <td> - <?php _e('Thank you very much','wp-piwik'); ?>, <a href="http://blogu.programeshqip.org/">Besnik Bleta</a>, <a href="http://www.fatcow.com/">FatCow</a>, <a href="http://www.pamukkaleturkey.com/">Rene</a>, Fab, <a href="http://ezbizniz.com/">EzBizNiz</a>, Gormer, Natalya, <a href="www.aggeliopolis.gr">AggelioPolis</a><?php _e(', and', 'wp-piwik'); ?> <a href="http://wwww.webhostinggeeks.com">Web Hosting Geeks</a>, <a href="http://www.webhostingrating.com">Web Hosting Rating</a>, <a href="http://www.webhostinghub.com">Nata Strazda (Web Hosting Hub)</a>, <a href="http://www.libreoffice.ir">Hossein, LibreOffice localization team</a> & <a href="http://www.vogliaditerra.com">Ste</a> <?php _e('for your translation work','wp-piwik'); ?>! + <?php _e('Thank you very much','wp-piwik'); ?>, <a href="http://blogu.programeshqip.org/">Besnik Bleta</a>, <a href="http://www.fatcow.com/">FatCow</a>, <a href="http://www.pamukkaleturkey.com/">Rene</a>, Fab, <a href="http://ezbizniz.com/">EzBizNiz</a>, Gormer, Natalya, <a href="www.aggeliopolis.gr">AggelioPolis</a><?php _e(', and', 'wp-piwik'); ?> <a href="http://wwww.webhostinggeeks.com">Web Hosting Geeks</a>, <a href="http://www.webhostingrating.com">Web Hosting Rating</a>, <a href="http://www.webhostinghub.com">Nata Strazda (Web Hosting Hub)</a>, <a href="http://www.libreoffice.ir">Hossein, LibreOffice localization team</a>, <a href="http://www.vogliaditerra.com">Ste</a> & Chris <?php _e('for your translation work','wp-piwik'); ?>! </td> </tr> <tr> diff --git a/wp-content/plugins/wp-piwik/settings/homepage.php b/wp-content/plugins/wp-piwik/settings/homepage.php index 3ac1dcc4d..919b6f96d 100644 --- a/wp-content/plugins/wp-piwik/settings/homepage.php +++ b/wp-content/plugins/wp-piwik/settings/homepage.php @@ -5,7 +5,7 @@ $strVersion = $this->callPiwikAPI('API.getPiwikVersion'); <tr><td><?php if (is_array($strVersion) && $strVersion['result'] == 'error') self::showErrorMessage($strVersion['message']); elseif (empty($strVersion)) self::showErrorMessage('Piwik did not answer. Please check your entered Piwik URL.'); -else echo __('You are using Piwik','wp-piwik').' '.$strVersion.' '.__('and', 'wp-piwik').' WP-Piwik '.self::$strVersion.(is_plugin_active_for_network('wp-piwik/wp-piwik.php')?' '.__('in network mode'):'').'.'; +else echo __('You are using Piwik','wp-piwik').' '.$strVersion.' '.__('and', 'wp-piwik').' WP-Piwik '.self::$strVersion.(is_plugin_active_for_network('wp-piwik/wp-piwik.php')?' '.__('in network mode', 'wp-piwik'):'').'.'; ?></td></tr> -<tr><td><?php _e('Auto site configuration is','wp-piwik'); ?> <strong><?php echo (self::$aryGlobalSettings['auto_site_config']?__('enabled','wp-piwik'):__('disabled','wp-piwik')); ?>.</strong></td></tr> -<tr><td><?php _e('Tracking code insertion is','wp-piwik'); ?> <strong><?php echo (self::$aryGlobalSettings['add_tracking_code']?__('enabled','wp-piwik'):__('disabled','wp-piwik')); ?>.</strong></td></tr> \ No newline at end of file +<tr><td><?php _e('Auto site configuration is','wp-piwik'); ?> <strong><?php echo (self::$settings->getGlobalOption('auto_site_config')?__('enabled','wp-piwik'):__('disabled','wp-piwik')); ?>.</strong></td></tr> +<tr><td><?php _e('Tracking code insertion is','wp-piwik'); ?> <strong><?php echo (self::$settings->getGlobalOption('add_tracking_code')?__('enabled','wp-piwik'):__('disabled','wp-piwik')); ?>.</strong></td></tr> \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/settings/index.php b/wp-content/plugins/wp-piwik/settings/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/settings/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/settings/piwik.php b/wp-content/plugins/wp-piwik/settings/piwik.php index 3bb836f80..d732d22db 100644 --- a/wp-content/plugins/wp-piwik/settings/piwik.php +++ b/wp-content/plugins/wp-piwik/settings/piwik.php @@ -7,7 +7,7 @@ if (!$bolFOpen && !$bolCURL) { <strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.'); ?></strong> </td> </tr><?php } else { ?><tr> - <th colspan="2"> + <td colspan="2"> <?php _e('To enable Piwik statistics, please enter', 'wp-piwik'); ?>: <ol> <li><?php _e('your Piwik base URL (like http://mydomain.com/piwik) or your Piwik server path (like /var/www/mydomain.com/httpdocs/piwik/)', 'wp-piwik'); ?></li> @@ -17,20 +17,20 @@ if (!$bolFOpen && !$bolCURL) { <?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?> <p><?php _e('<strong>Important note:</strong> If you do not host this blog on your own, your site admin is able to get your auth token from the database.', 'wp-piwik'); ?></p> <?php } ?> - </th> + </td> </tr><tr> <th><?php _e('Piwik URL', 'wp-piwik'); ?> (REST API):</th> <td> - <input type="radio" name="wp-piwik_mode" onchange="javascript:$j('#wp-piwik_path,#wp-piwik_path-label').toggleClass('wp-piwik-input-hide');" value="http" <?php echo (self::$aryGlobalSettings['piwik_mode']=='http'?'checked="checked" ':''); ?>/> - <input id="wp-piwik_url" name="wp-piwik_url" type="text" value="<?php echo self::$aryGlobalSettings['piwik_url']; ?>" /> + <input type="radio" name="wp-piwik_mode" onchange="javascript:$j('#wp-piwik_path,#wp-piwik_path-label').toggleClass('wp-piwik-input-hide');" value="http" <?php echo (self::$settings->getGlobalOption('piwik_mode')=='http'?'checked="checked" ':''); ?>/> + <input id="wp-piwik_url" name="wp-piwik_url" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_url'); ?>" /> <label for="wp-piwik_url"></label> </td> </tr><tr> <th><?php _e('Piwik path', 'wp-piwik'); ?> (PHP API, beta):</th> <td> - <input type="radio" name="wp-piwik_mode" onchange="javascript:$j('#wp-piwik_path,#wp-piwik_path-label').toggleClass('wp-piwik-input-hide');" value="php" <?php echo (self::$aryGlobalSettings['piwik_mode']=='php'?'checked="checked" ':''); ?>/> - <input <?php echo (self::$aryGlobalSettings['piwik_mode']!='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_path" name="wp-piwik_path" type="text" value="<?php echo self::$aryGlobalSettings['piwik_path']; ?>" /> - <label <?php echo (self::$aryGlobalSettings['piwik_mode']!='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_path-label" for="wp-piwik_path"><?php _e('If you like to use the PHP API and also to enable tracking by WP-Piwik, please enter your Piwik URL, too. Otherwise your tracking code may be erroneous.','wp-piwik'); ?> [<a href="http://dev.piwik.org/trac/ticket/3220">Details</a>]</label> + <input type="radio" name="wp-piwik_mode" onchange="javascript:$j('#wp-piwik_path,#wp-piwik_path-label').toggleClass('wp-piwik-input-hide');" value="php" <?php echo (self::$settings->getGlobalOption('piwik_mode')=='php'?'checked="checked" ':''); ?>/> + <input <?php echo (self::$settings->getGlobalOption('piwik_mode')!='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_path" name="wp-piwik_path" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_path'); ?>" /> + <label <?php echo (self::$settings->getGlobalOption('piwik_mode')!='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_path-label" for="wp-piwik_path"><?php _e('If you like to use the PHP API and also to enable tracking by WP-Piwik, please enter your Piwik URL, too. Otherwise your tracking code may be erroneous.','wp-piwik'); ?> [<a href="http://dev.piwik.org/trac/ticket/3220">Details</a>]</label> <?php if (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path']) && realpath($_POST['wp-piwik_path']) === false) echo '<p class="wp-piwik-eyecatcher">'.__('Invalid path. Please enter the file path to Piwik.', 'wp-piwik').'</p>'; @@ -39,18 +39,23 @@ if (!$bolFOpen && !$bolCURL) { </tr><tr> <th><?php _e('Auth token', 'wp-piwik'); ?>:</th> <td> - <input name="wp-piwik_token" id="wp-piwik_token" type="text" value="<?php echo self::$aryGlobalSettings['piwik_token']; ?>" /> + <input name="wp-piwik_token" id="wp-piwik_token" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_token'); ?>" /> <label for="wp-piwik_token"></label> </td> -</tr><?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?><tr> +</tr><tr><th><?php _e('Enable cache', 'wp-piwik'); ?>:</th><td> + <input type="checkbox" value="1" id="wp-piwik_cache" name="wp-piwik_cache"<?php echo (self::$settings->getGlobalOption('cache')?' checked="checked"':''); ?> /> + <label for="wp-piwik_cache"><?php _e('Cache API calls, which not contain today\'s values, for a week', 'wp-piwik'); ?>.</label> +</td></tr> + +<?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?><tr> <th><?php _e('Auto config', 'wp-piwik'); ?>:</th> <td> - <input name="wp-piwik_auto_site_config" id="wp-piwik_auto_site_config" value="1" type="checkbox"<?php echo (self::$aryGlobalSettings['auto_site_config']?' checked="checked"':'') ?>/> + <input name="wp-piwik_auto_site_config" id="wp-piwik_auto_site_config" value="1" type="checkbox"<?php echo (self::$settings->getGlobalOption('auto_site_config')?' checked="checked"':'') ?>/> <label for="wp-piwik_auto_site_config"><?php _e('Check this to automatically choose your blog from your Piwik sites by URL. If your blog is not added to Piwik yet, WP-Piwik will add a new site.', 'wp-piwik') ?></label> </td> </tr> <?php -if (!empty(self::$aryGlobalSettings['piwik_url']) && !empty(self::$aryGlobalSettings['piwik_token'])) { +if (self::$settings->getGlobalOption('piwik_url') && self::$settings->getGlobalOption('piwik_token')) { $aryData = $this->callPiwikAPI('SitesManager.getSitesWithAtLeastViewAccess'); if (empty($aryData)) { echo '<tr><td colspan="2">'; @@ -61,28 +66,29 @@ if (!empty(self::$aryGlobalSettings['piwik_url']) && !empty(self::$aryGlobalSett echo '<tr><td colspan="2">'; self::showErrorMessage($aryData['message']); echo '</td></tr>'; - } else if (!self::$aryGlobalSettings['auto_site_config']) { + } elseif (!self::$settings->getGlobalOption('auto_site_config')) { echo '<tr><th>'.__('Choose site', 'wp-piwik').':</th><td>'; echo '<select name="wp-piwik_siteid" id="wp-piwik_siteid">'; $aryOptions = array(); foreach ($aryData as $arySite) $aryOptions[$arySite['name'].'#'.$arySite['idsite']] = '<option value="'.$arySite['idsite']. - '"'.($arySite['idsite']==self::$arySettings['site_id']?' selected="selected"':''). + '"'.($arySite['idsite']==self::$settings->getOption('site_id')?' selected="selected"':''). '>'.htmlentities($arySite['name'], ENT_QUOTES, 'utf-8'). '</option>'; ksort($aryOptions); foreach ($aryOptions as $strOption) echo $strOption; echo '</select></td></tr>'; } else { - if (empty(self::$arySettings['site_id'])) + if (!self::$settings->getOption('site_id')) $this->addPiwikSite(); echo '<tr><th>'.__('Determined site', 'wp-piwik').':</th><td>'; echo '<div class="input-text-wrap">'; - if (is_array(self::$arySettings['site_id']) && self::$arySettings['site_id']['result'] == 'error') - self::showErrorMessage(self::$arySettings['site_id']['message']); + $siteId = self::$settings->getOption('site_id'); + if (is_array($siteId) && $siteId['result'] == 'error') + self::showErrorMessage($siteId['message']); else foreach ($aryData as $arySite) - if ($arySite['idsite'] == self::$arySettings['site_id']) {echo '<em>'.htmlentities($arySite['name'], ENT_QUOTES, 'utf-8').'</em>'; break;} - echo '<input type="hidden" name="wp-piwik_siteid" id="wp-piwik_siteid" value="'.(int)self::$arySettings['site_id'].'" /></td></tr>'; + if ($arySite['idsite'] == $siteId) {echo '<em>'.htmlentities($arySite['name'], ENT_QUOTES, 'utf-8').'</em>'; break;} + echo '<input type="hidden" name="wp-piwik_siteid" id="wp-piwik_siteid" value="'.(int)$siteId.'" /></td></tr>'; } } }} @@ -92,24 +98,24 @@ if (!empty(self::$aryGlobalSettings['piwik_url']) && !empty(self::$aryGlobalSett </tr><tr> <th><label><?php _e('Connection timeout', 'wp-piwik'); ?>:</label></th> <td> - <input style="width:50px;" type="text" name="wp-piwik_timeout" value="<?php echo self::$aryGlobalSettings['connection_timeout']; ?>" /> + <input style="width:50px;" type="text" name="wp-piwik_timeout" value="<?php echo self::$settings->getGlobalOption('connection_timeout'); ?>" /> </td> </tr> <?php if (function_exists('curl_init')) { ?> <tr> - <th><label <?php echo (self::$aryGlobalSettings['piwik_mode']=='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_disable_ssl_verify-label"><?php _e('Disable SSL peer verification', 'wp-piwik'); ?>:</label></th> + <th><label <?php echo (self::$settings->getGlobalOption('piwik_mode')=='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_disable_ssl_verify-label"><?php _e('Disable SSL peer verification', 'wp-piwik'); ?>:</label></th> <td> - <input <?php echo (self::$aryGlobalSettings['piwik_mode']=='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_disable_ssl_verify" name="wp-piwik_disable_ssl_verify" type="checkbox"<?php echo (self::$aryGlobalSettings['disable_ssl_verify']?'checked="checked"':''); ?> /> (<?php _e('not recommended','wp-piwik'); ?>) + <input <?php echo (self::$settings->getGlobalOption('piwik_mode')=='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_disable_ssl_verify" name="wp-piwik_disable_ssl_verify" type="checkbox"<?php echo (self::$settings->getGlobalOption('disable_ssl_verify')?'checked="checked"':''); ?> /> (<?php _e('not recommended','wp-piwik'); ?>) </td> </tr><tr> <th><label><?php _e('User agent', 'wp-piwik'); ?>:</label></th> <td> - <input type="radio" onchange="javascript:$j('#wp-piwik-useragent').toggleClass('readonly="readonly"');" name="wp-piwik_useragent" value="php" <?php echo (self::$aryGlobalSettings['piwik_useragent']=='php'?'checked="checked" ':''); ?>/> PHP default (<?php echo ini_get('user_agent'); ?>) + <input type="radio" onchange="javascript:$j('#wp-piwik-useragent').toggleClass('readonly="readonly"');" name="wp-piwik_useragent" value="php" <?php echo (self::$settings->getGlobalOption('piwik_useragent')=='php'?'checked="checked" ':''); ?>/> PHP default (<?php echo ini_get('user_agent'); ?>) </td> </tr><tr> <th></th> <td> - <input type="radio" onchange="javascript:$j('#wp-piwik-useragent').toggleClass('wp-piwik-useragent-disable');" name="wp-piwik_useragent" value="own" <?php echo (self::$aryGlobalSettings['piwik_useragent']=='own'?'checked="checked" ':''); ?>/> <input type="text" id="wp-piwik-useragent" name="wp-piwik_useragent_string" value="<?php echo self::$aryGlobalSettings['piwik_useragent_string']; ?>" /> + <input type="radio" onchange="javascript:$j('#wp-piwik-useragent').toggleClass('wp-piwik-useragent-disable');" name="wp-piwik_useragent" value="own" <?php echo (self::$settings->getGlobalOption('piwik_useragent')=='own'?'checked="checked" ':''); ?>/> <input type="text" id="wp-piwik-useragent" name="wp-piwik_useragent_string" value="<?php echo self::$settings->getGlobalOption('piwik_useragent_string'); ?>" /> </td> </tr> <?php } else { ?> diff --git a/wp-content/plugins/wp-piwik/settings/sitebrowser.php b/wp-content/plugins/wp-piwik/settings/sitebrowser.php index 0f0fde76b..ffac8d094 100644 --- a/wp-content/plugins/wp-piwik/settings/sitebrowser.php +++ b/wp-content/plugins/wp-piwik/settings/sitebrowser.php @@ -12,8 +12,9 @@ if (!$bolFOpen && !$bolCURL) { if (!class_exists('WP_List_Table')) require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); -if (isset($_GET['wpmu_show_stats']) && ($_GET['wpmu_show_stats'] == (int) $_GET['wpmu_show_stats'])) +if (isset($_GET['wpmu_show_stats']) && ($_GET['wpmu_show_stats'] == (int) $_GET['wpmu_show_stats'])) { $this->addPiwikSite(); +} // See wpengineer.com/2426/wp_list_table-a-step-by-step-guide/ class SiteBrowser extends WP_List_Table { diff --git a/wp-content/plugins/wp-piwik/settings/support.php b/wp-content/plugins/wp-piwik/settings/support.php index a8426b7ba..3c6af523e 100644 --- a/wp-content/plugins/wp-piwik/settings/support.php +++ b/wp-content/plugins/wp-piwik/settings/support.php @@ -1,8 +1,5 @@ <tr> - <td><a href="http://peepbo.de/board/viewforum.php?f=3"><?php _e('WP-Piwik support board','wp-piwik'); ?></a> (<?php _e('no registration required, English & German','wp-piwik'); ?>)</td> -</tr> -<tr> - <td><a href="http://wordpress.org/tags/wp-piwik?forum_id=10"><?php _e('WordPress.org forum about WP-Piwik','wp-piwik'); ?></a> (<?php _e('WordPress.org registration required, English','wp-piwik'); ?>)</td> + <td><a href="http://wordpress.org/tags/wp-piwik?forum_id=10"><?php _e('WordPress.org forum about WP-Piwik','wp-piwik'); ?></a></td> </tr> <tr> <td><?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a href="http://wordpress.org/extend/plugins/wp-piwik/">WordPress.org Plugin Directory</a>.</td> @@ -23,7 +20,7 @@ _e('enabled','wp-piwik'); ?></strong>.</li> </ol> -<?php if (!(empty(self::$aryGlobalSettings['piwik_token']) || empty(self::$aryGlobalSettings['piwik_url']))) { ?> +<?php if (self::$settings->getGlobalOption('piwik_token') && self::$settings->getGlobalOption('piwik_url')) { ?> <?php if (isset($_GET['mode'])) { switch ($_GET['mode']) { @@ -37,7 +34,7 @@ case 'resetconfirmed': // Increase time limit before resetting set_time_limit(0); - self::resetSettings((isset($_GET['full']) && $_GET['full'])); + self::$settings->resetSettings((isset($_GET['full']) && $_GET['full'])); echo '<p class="wp-piwik-eyecatcher"><strong>'.__('WP-Piwik reset done','wp-piwik').'</strong></p>'; default: } diff --git a/wp-content/plugins/wp-piwik/settings/tracking.php b/wp-content/plugins/wp-piwik/settings/tracking.php index cd481693a..98a081669 100644 --- a/wp-content/plugins/wp-piwik/settings/tracking.php +++ b/wp-content/plugins/wp-piwik/settings/tracking.php @@ -10,85 +10,107 @@ if (!$bolFOpen && !$bolCURL) { <tr><td colspan="2"><?php _e('Add tracking code', 'wp-piwik'); ?>: <input onchange="javascript:$j('#wp-piwik-tracking-settings').toggleClass('wp-piwik-form-table-hide');" - type="checkbox" value="1" id="wp-piwik_addjs" name="wp-piwik_addjs"<?php echo (self::$aryGlobalSettings['add_tracking_code']?' checked="checked"':''); ?> /> + type="checkbox" value="1" id="wp-piwik_addjs" name="wp-piwik_addjs"<?php echo (self::$settings->getGlobalOption('add_tracking_code')?' checked="checked"':''); ?> /> <label for="wp-piwik_addjs"><?php _e('If your template uses wp_footer(), WP-Piwik can automatically add the Piwik javascript code to your blog.', 'wp-piwik'); ?></label> </td></tr> </table> <?php -if (self::$aryGlobalSettings['add_tracking_code']) { +if (self::$settings->getGlobalOption('add_tracking_code')) { $strJavaScript = $this->callPiwikAPI('SitesManager.getJavascriptTag'); if (is_array($strJavaScript)) { if (isset($strJavaScript['result']) && $strJavaScript['result'] == 'error') self::showErrorMessage(__($strJavaScript['message'],'wp-piwik')); } else { // Save javascript code - self::$arySettings['tracking_code'] = $strJavaScript; + self::$settings->setOption('tracking_code', $strJavaScript); } - self::saveSettings(); + self::$settings->save(); } ?> -<table id="wp-piwik-tracking-settings" class="wp-piwik-form-table form-table<?php echo (!self::$aryGlobalSettings['add_tracking_code']?' wp-piwik-form-table-hide':''); ?>"> +<table id="wp-piwik-tracking-settings" class="wp-piwik-form-table form-table<?php echo (!self::$settings->getGlobalOption('add_tracking_code')?' wp-piwik-form-table-hide':''); ?>"> <tr><th><?php _e('Tracking code preview', 'wp-piwik'); ?>:</th><td> <textarea id="wp-piwik_jscode" name="wp-piwik_jscode" readonly="readonly" rows="13" cols="80"> -<?php echo (is_plugin_active_for_network('wp-piwik/wp-piwik.php')?'*** SITE SPECIFIC EXAMPLE CODE ***'."\n":'').htmlentities(self::$arySettings['tracking_code']); ?> +<?php echo (is_plugin_active_for_network('wp-piwik/wp-piwik.php')?'*** SITE SPECIFIC EXAMPLE CODE ***'."\n":'').htmlentities(self::$settings->getOption('tracking_code')); ?> </textarea> </td></tr> <tr><th><?php _e('<noscript> code preview', 'wp-piwik'); ?>:</th><td> <textarea id="wp-piwik_nocode" name="wp-piwik_nocode" readonly="readonly" rows="2" cols="80"> -<?php echo (is_plugin_active_for_network('wp-piwik/wp-piwik.php')?'*** SITE SPECIFIC EXAMPLE CODE ***'."\n":'').htmlentities(self::$arySettings['noscript_code']); ?> +<?php echo (is_plugin_active_for_network('wp-piwik/wp-piwik.php')?'*** SITE SPECIFIC EXAMPLE CODE ***'."\n":'').htmlentities(self::$settings->getOption('noscript_code')); ?> </textarea> </td></tr> <tr><th><?php _e('Default tracking', 'wp-piwik'); ?>:</th><td> - <input type="radio" value="0" id="wp-piwik_default" name="wp-piwik_trackingmode"<?php echo (self::$aryGlobalSettings['track_mode']==0?' checked="checked"':''); ?> /> + <input type="radio" value="0" id="wp-piwik_default" name="wp-piwik_trackingmode"<?php echo (self::$settings->getGlobalOption('track_mode')==0?' checked="checked"':''); ?> /> <label for="wp-piwik_compress"><?php _e('WP-Piwik uses the Piwik default tracking code.', 'wp-piwik'); ?> <a href="http://demo.piwik.org/js/README">js/README</a>.</label> </td></tr> <tr><th><?php _e('Use js/index.php', 'wp-piwik'); ?>:</th><td> - <input type="radio" value="1" id="wp-piwik_compress" name="wp-piwik_trackingmode"<?php echo (self::$aryGlobalSettings['track_mode']==1?' checked="checked"':''); ?> /> + <input type="radio" value="1" id="wp-piwik_compress" name="wp-piwik_trackingmode"<?php echo (self::$settings->getGlobalOption('track_mode')==1?' checked="checked"':''); ?> /> <label for="wp-piwik_compress"><?php _e('WP-Piwik can automatically use js/index.php instead of piwik.js and piwik.php. See', 'wp-piwik'); ?> <a href="http://demo.piwik.org/js/README">js/README</a>.</label> </td></tr> <tr><th><?php _e('Use proxy script', 'wp-piwik'); ?>:</th><td> - <input type="radio" value="2" id="wp-piwik_proxy" name="wp-piwik_trackingmode"<?php echo (self::$aryGlobalSettings['track_mode']==2?' checked="checked"':''); ?> /> + <input type="radio" value="2" id="wp-piwik_proxy" name="wp-piwik_trackingmode"<?php echo (self::$settings->getGlobalOption('track_mode')==2?' checked="checked"':''); ?> /> <label for="wp-piwik_compress"><?php _e('WP-Piwik will use the piwik.php proxy script. See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/how-to/#faq_132">Piwik FAQ</a>.</label> </td></tr> <tr><th><?php _e('Add <noscript>', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_noscript" name="wp-piwik_noscript"<?php echo (self::$aryGlobalSettings['track_noscript']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_noscript" name="wp-piwik_noscript"<?php echo (self::$settings->getGlobalOption('track_noscript')?' checked="checked"':''); ?> /> <label for="wp-piwik_noscript"><?php echo _e('Adds the <noscript> code to your footer.', 'wp-piwik'); ?> <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label> </td></tr> +<tr><th><?php _e('Add rec parameter to noscript code', 'wp-piwik'); ?>:</th><td> + <input type="checkbox" value="1" id="wp-piwik_nojavascript" name="wp-piwik_nojavascript"<?php echo (self::$settings->getGlobalOption('track_nojavascript')?' checked="checked"':''); ?> /> + <label for="wp-piwik_nojavascript"><?php echo _e('Enable tracking for visitors without JavaScript (not recommended). See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/how-to/#faq_176">Piwik FAQ</a>. <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label> +</td></tr> + <tr><th><?php _e('Disable cookies', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_disable_cookies" name="wp-piwik_disable_cookies"<?php echo (self::$aryGlobalSettings['disable_cookies']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_disable_cookies" name="wp-piwik_disable_cookies"<?php echo (self::$settings->getGlobalOption('disable_cookies')?' checked="checked"':''); ?> /> <label for="wp-piwik_disable_cookies"><?php echo _e('Disable all tracking cookies for a visitor.', 'wp-piwik'); ?></label> </td></tr> <tr><th><?php _e('Track search', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_search" name="wp-piwik_search"<?php echo (self::$aryGlobalSettings['track_search']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_search" name="wp-piwik_search"<?php echo (self::$settings->getGlobalOption('track_search')?' checked="checked"':''); ?> /> <label for="wp-piwik_search"><?php echo _e('Use Piwik\'s advanced Site Search Analytics feature. See', 'wp-piwik'); ?> <a href="http://piwik.org/docs/javascript-tracking/#toc-tracking-internal-search-keywords-categories-and-no-result-search-keywords">Piwik documentation</a>.</label> </td></tr> <tr><th><?php _e('Track 404', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_404" name="wp-piwik_404"<?php echo (self::$aryGlobalSettings['track_404']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_404" name="wp-piwik_404"<?php echo (self::$settings->getGlobalOption('track_404')?' checked="checked"':''); ?> /> <label for="wp-piwik_404"><?php echo _e('WP-Piwik can automatically add a 404-category to track 404-page-visits.', 'wp-piwik'); ?></label> </td></tr> + <tr><th><?php _e('Avoid mod_security', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_reqpost" name="wp-piwik_reqpost"<?php echo (self::$aryGlobalSettings['track_post']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_reqpost" name="wp-piwik_reqpost"<?php echo (self::$settings->getGlobalOption('track_post')?' checked="checked"':''); ?> /> <label for="wp-piwik_reqpost"><?php _e('WP-Piwik can automatically force the Tracking Code to sent data in POST. See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/troubleshooting/#faq_100">Piwik FAQ</a>. <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label> </td></tr> <tr><th><?php _e('CDN URL', 'wp-piwik'); ?>:</th><td> - http://<input type="text" value="<?php echo self::$aryGlobalSettings['track_cdnurl']; ?>" id="wp-piwik_cdnurl" name="wp-piwik_cdnurl" /> https://<input type="text" value="<?php echo self::$aryGlobalSettings['track_cdnurlssl']; ?>" id="wp-piwik_cdnurlssl" name="wp-piwik_cdnurlssl" /><br /> + http://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurl'); ?>" id="wp-piwik_cdnurl" name="wp-piwik_cdnurl" /> https://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurlssl'); ?>" id="wp-piwik_cdnurlssl" name="wp-piwik_cdnurlssl" /><br /> <label for="wp-piwik_reqpost"><?php _e('Leave blank if you do not want to define a CDN URL or you do not know what this is.', 'wp-piwik'); ?></label> </td></tr> +<tr><th><?php _e('Track admin pages', 'wp-piwik'); ?>:</th><td> + <input type="checkbox" value="1" id="wp-piwik_trackadmin" name="wp-piwik_trackadmin"<?php echo (self::$settings->getGlobalOption('track_admin')?' checked="checked"':''); ?> /> + <label for="wp-piwik_trackadmin"><?php _e('Enable to track users on admin pages (remember to configure the tracking filter appropriately).', 'wp-piwik'); ?></label> +</td></tr> + +<tr><th><?php _e('Track RSS feeds', 'wp-piwik'); ?>:</th><td> + <input type="checkbox" value="1" id="wp-piwik_trackfeed" name="wp-piwik_trackfeed"<?php echo (self::$settings->getGlobalOption('track_feed')?' checked="checked"':''); ?> /> + <label for="wp-piwik_trackfeed"><?php _e('Enable to track posts in feeds via tracking pixel.', 'wp-piwik'); ?></label> +</td></tr> + +<tr><th><?php _e('Track RSS feed links as campaign', 'wp-piwik'); ?>:</th><td> + <input type="checkbox" value="1" id="wp-piwik_trackfeed_addcampaign" name="wp-piwik_trackfeed_addcampaign"<?php echo (self::$settings->getGlobalOption('track_feed_addcampaign')?' checked="checked"':''); ?> /> + <label for="wp-piwik_trackfeed_addcampaign"><?php _e('This will add Piwik campaign parameters to the RSS feed links.', 'wp-piwik'); ?> (<a href="https://piwik.org/docs/tracking-campaigns/">Piwik: Tracking campaign</a>)</label><br /> + <?php _e('Campaign', 'wp-piwik'); ?>: <input type="text" value="<?php echo self::$settings->getGlobalOption('track_feed_campaign'); ?>" id="wp-piwik_trackfeed_campaign" name="wp-piwik_trackfeed_campaign"> <?php _e('Keyword: post name.', 'wp-piwik'); ?> +</td></tr> + <tr><th><?php _e('Tracking filter', 'wp-piwik'); ?>:</th><td> <?php global $wp_roles; - $aryFilter = self::$aryGlobalSettings['capability_stealth']; + $aryFilter = self::$settings->getGlobalOption('capability_stealth'); foreach($wp_roles->role_names as $strKey => $strName) { echo '<input type="checkbox" '.(isset($aryFilter[$strKey]) && $aryFilter[$strKey]?'checked="checked" ':'').'value="1" name="wp-piwik_filter['.$strKey.']" /> '.$strName.' '; } diff --git a/wp-content/plugins/wp-piwik/settings/views.php b/wp-content/plugins/wp-piwik/settings/views.php index 9e92aa89c..70469416e 100644 --- a/wp-content/plugins/wp-piwik/settings/views.php +++ b/wp-content/plugins/wp-piwik/settings/views.php @@ -7,50 +7,59 @@ if (!$bolFOpen && !$bolCURL) { <strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.'); ?></strong> </td> </tr><?php } else { ?> +<tr><th><?php _e('WP-Piwik display name', 'wp-piwik'); ?>:</th><td> + <input type="text" id="wp-piwik_displayname" name="wp-piwik_displayname" value="<?php echo self::$settings->getGlobalOption('plugin_display_name'); ?>" /> + <label for="wp-piwik_displayname"><?php echo _e('Plugin name shown in WordPress.', 'wp-piwik'); ?></label> +</td></tr> <tr><th>Piwik <?php _e('Default date', 'wp-piwik'); ?>:</th><td> <select id="wp-piwik_default_date" name="wp-piwik_default_date"> - <option value="yesterday"<?php echo (self::$aryGlobalSettings['default_date'] == 'yesterday'?' selected="selected"':'');?>> <?php _e('yesterday', 'wp-piwik');?></option> - <option value="today"<?php echo (self::$aryGlobalSettings['default_date'] == 'today'?' selected="selected"':'');?>> <?php _e('today', 'wp-piwik');?></option> + <option value="yesterday"<?php echo (self::$settings->getGlobalOption('default_date') == 'yesterday'?' selected="selected"':'');?>> <?php _e('yesterday', 'wp-piwik');?></option> + <option value="today"<?php echo (self::$settings->getGlobalOption('default_date') == 'today'?' selected="selected"':'');?>> <?php _e('today', 'wp-piwik');?></option> </select> <label for="wp-piwik_default_date"><?php echo _e('Default date shown on statistics page.', 'wp-piwik'); ?></label> </td></tr> <tr><th><?php _e('Home Dashboard', 'wp-piwik'); ?>:</th><td> <select id="wp-piwik_dbwidget" name="wp-piwik_dbwidget"> - <option value="0"'<?php echo (!self::$aryGlobalSettings['dashboard_widget']?' selected="selected"':''); ?>><?php _e('Hide overview', 'wp-piwik'); ?></option> - <option value="yesterday"<?php echo (self::$aryGlobalSettings['dashboard_widget'] == 'yesterday'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('yesterday', 'wp-piwik').')'; ?></option> - <option value="today"<?php echo (self::$aryGlobalSettings['dashboard_widget'] == 'today'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('today', 'wp-piwik').')'; ?></option> - <option value="last30"<?php echo (self::$aryGlobalSettings['dashboard_widget'] == 'last30'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('last 30 days','wp-piwik').')'; ?></option> + <option value="0"'<?php echo (!self::$settings->getGlobalOption('dashboard_widget')?' selected="selected"':''); ?>><?php _e('Hide overview', 'wp-piwik'); ?></option> + <option value="yesterday"<?php echo (self::$settings->getGlobalOption('dashboard_widget') == 'yesterday'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('yesterday', 'wp-piwik').')'; ?></option> + <option value="today"<?php echo (self::$settings->getGlobalOption('dashboard_widget') == 'today'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('today', 'wp-piwik').')'; ?></option> + <option value="last30"<?php echo (self::$settings->getGlobalOption('dashboard_widget') == 'last30'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('last 30 days','wp-piwik').')'; ?></option> </select> - <input type="checkbox" value="1" name="wp-piwik_dbchart" id="wp-piwik_dbchart"<?php echo (self::$aryGlobalSettings['dashboard_chart']?' checked="checked"':""); ?>/> <?php _e('Chart', 'wp-piwik'); ?> - <input type="checkbox" value="1" name="wp-piwik_dbseo" id="wp-piwik_dbseo"<?php echo (self::$aryGlobalSettings['dashboard_seo']?' checked="checked"':""); ?>/> <?php _e('SEO <em>(slow!)</em>', 'wp-piwik'); ?> + <input type="checkbox" value="1" name="wp-piwik_dbchart" id="wp-piwik_dbchart"<?php echo (self::$settings->getGlobalOption('dashboard_chart')?' checked="checked"':""); ?>/> <?php _e('Chart', 'wp-piwik'); ?> + <input type="checkbox" value="1" name="wp-piwik_dbseo" id="wp-piwik_dbseo"<?php echo (self::$settings->getGlobalOption('dashboard_seo')?' checked="checked"':""); ?>/> <?php _e('SEO <em>(slow!)</em>', 'wp-piwik'); ?> <br><?php _e('Configure WP-Piwik widgets to be shown on your WordPress Home Dashboard.', 'wp-piwik'); ?> </td></tr> <tr><th><?php _e('Show graph on WordPress Toolbar', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_toolbar" name="wp-piwik_toolbar"<?php echo (self::$aryGlobalSettings['toolbar']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_toolbar" name="wp-piwik_toolbar"<?php echo (self::$settings->getGlobalOption('toolbar')?' checked="checked"':''); ?> /> <label for="wp-piwik_toolbar"><?php echo _e('Display the last 30 days visitor stats on WordPress Toolbar.', 'wp-piwik'); ?></label> </td></tr> <tr><th><?php _e('SEO data', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_statsseo" name="wp-piwik_statsseo"<?php echo (self::$aryGlobalSettings['stats_seo']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_statsseo" name="wp-piwik_statsseo"<?php echo (self::$settings->getGlobalOption('stats_seo')?' checked="checked"':''); ?> /> <label for="wp-piwik_statsseo"><?php echo _e('Display SEO ranking data on statistics page. <em>(Slow!)</em>', 'wp-piwik'); ?></label> </td></tr> <tr><th>Piwik <?php _e('Shortcut', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_piwiklink" name="wp-piwik_piwiklink"<?php echo (self::$aryGlobalSettings['piwik_shortcut']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_piwiklink" name="wp-piwik_piwiklink"<?php echo (self::$settings->getGlobalOption('piwik_shortcut')?' checked="checked"':''); ?> /> <label for="wp-piwik_piwiklink"><?php echo _e('Display a shortcut to Piwik itself.', 'wp-piwik'); ?></label> </td></tr> <tr><th>Piwik <?php _e('Display to', 'wp-piwik'); ?>:</th><td> <?php global $wp_roles; + $aryCapability = self::$settings->getGlobalOption('capability_read_stats'); foreach($wp_roles->role_names as $strKey => $strName) - echo '<input name="wp-piwik_displayto['.$strKey.']" type="checkbox" value="1"'.(isset(self::$aryGlobalSettings['capability_read_stats'][$strKey]) && self::$aryGlobalSettings['capability_read_stats'][$strKey]?' checked="checked"':'').'/> '.$strName.' '; + echo '<input name="wp-piwik_displayto['.$strKey.']" type="checkbox" value="1"'.(isset($aryCapability[$strKey]) && $aryCapability[$strKey]?' checked="checked"':'').'/> '.$strName.' '; ?> <br><?php echo _e('Choose user roles allowed to see the statistics page.', 'wp-piwik'); ?> </td></tr> <tr><th><?php _e('Disable time limit', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_disabletimelimit" name="wp-piwik_disabletimelimit"<?php echo (self::$aryGlobalSettings['disable_timelimit']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_disabletimelimit" name="wp-piwik_disabletimelimit"<?php echo (self::$settings->getGlobalOption('disable_timelimit')?' checked="checked"':''); ?> /> <label for="wp-piwik_disabletimelimit"><?php echo _e('Use set_time_limit(0) if stats page causes a time out.', 'wp-piwik'); ?></label> </td></tr> +<tr><th><?php _e('Show per post stats', 'wp-piwik'); ?>:</th><td> + <input type="checkbox" value="1" id="wp-piwik_perpost" name="wp-piwik_perpost"<?php echo (self::$settings->getGlobalOption('perpost_stats')?' checked="checked"':''); ?> /> + <label for="wp-piwik_perpost"><?php echo _e('Show stats about single posts at the post edit admin page.', 'wp-piwik'); ?></label> +</td></tr> <tr><th><?php _e('Enable shortcodes', 'wp-piwik'); ?>:</th><td> - <input type="checkbox" value="1" id="wp-piwik_shortcodes" name="wp-piwik_shortcodes"<?php echo (self::$aryGlobalSettings['shortcodes']?' checked="checked"':''); ?> /> + <input type="checkbox" value="1" id="wp-piwik_shortcodes" name="wp-piwik_shortcodes"<?php echo (self::$settings->getGlobalOption('shortcodes')?' checked="checked"':''); ?> /> <label for="wp-piwik_shortcodes"><?php echo _e('Enable shortcodes in post or page content.', 'wp-piwik'); ?></label> </td></tr> <?php } ?> \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/shortcodes/index.php b/wp-content/plugins/wp-piwik/shortcodes/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/shortcodes/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/shortcodes/overview.php b/wp-content/plugins/wp-piwik/shortcodes/overview.php index f5e946a12..5a3987383 100644 --- a/wp-content/plugins/wp-piwik/shortcodes/overview.php +++ b/wp-content/plugins/wp-piwik/shortcodes/overview.php @@ -8,7 +8,7 @@ $aryData = $this->callPiwikAPI('VisitsSummary.get', $this->aryAttributes['limit'] ); -$this->strResult = '<table><tr><th>'.__('Overview', 'wp-piwik').($this->aryAttributes['title']?' '.$this->aryAttributes['title']:'').'</th></tr>'; +$this->strResult = '<table><tr><th colspan="2">'.__('Overview', 'wp-piwik').($this->aryAttributes['title']?' '.$this->aryAttributes['title']:'').'</th></tr>'; function summize($aryData) { $aryTmp = array(); diff --git a/wp-content/plugins/wp-piwik/update/80403.php b/wp-content/plugins/wp-piwik/update/80403.php index 41561b7f6..7af7d2b5f 100644 --- a/wp-content/plugins/wp-piwik/update/80403.php +++ b/wp-content/plugins/wp-piwik/update/80403.php @@ -12,7 +12,7 @@ if (!is_array($strDisplayToLevel) && isset($aryTranslate[$strDisplayToLevel])) $ else $aryDisplayToCap = array('administrator' => true); // Build settings arrays $aryDashboardWidgetRange = array(0 => false, 1 => 'yesterday', 2 => 'today', 3 => 'last30'); -if (self::$bolWPMU) self::$aryGlobalSettings = array( +if (self::$bolWPMU) $aryGlobal = array( 'revision' => get_site_option('wpmu-piwik_revision', 0), 'add_tracking_code' => true, 'last_settings_update' => get_site_option('wpmu-piwik_settingsupdate', time()), @@ -23,7 +23,7 @@ if (self::$bolWPMU) self::$aryGlobalSettings = array( 'capability_read_stats' => $aryDisplayToCap, 'piwik_shortcut' => false, ); -else self::$aryGlobalSettings = array( +else $aryGlobal = array( 'revision' => get_option('wp-piwik_revision',0), 'add_tracking_code' => get_option('wp-piwik_addjs'), 'last_settings_update' => get_option('wp-piwik_settingsupdate', time()), @@ -44,4 +44,6 @@ $aryRemoveOptions = array( foreach ($aryRemoveOptions as $strRemoveOption) { if (self::$bolWPMU) delete_site_option($strRemoveOption); else delete_option($strRemoveOption); -} \ No newline at end of file +} +foreach ($aryGlobal as $key => $value) + self::$settings->setGlobalOption($key, $value); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/80502.php b/wp-content/plugins/wp-piwik/update/80502.php index be662b104..0624396e8 100644 --- a/wp-content/plugins/wp-piwik/update/80502.php +++ b/wp-content/plugins/wp-piwik/update/80502.php @@ -1,2 +1,2 @@ <?php -self::$aryGlobalSettings['default_date'] = 'yesterday'; \ No newline at end of file +self::$settings->setGlobalOption('default_date', 'yesterday'); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/80602.php b/wp-content/plugins/wp-piwik/update/80602.php index 9945b4253..d0015e439 100644 --- a/wp-content/plugins/wp-piwik/update/80602.php +++ b/wp-content/plugins/wp-piwik/update/80602.php @@ -1,2 +1,2 @@ <?php -self::$aryGlobalSettings['dashboard_chart'] = false; \ No newline at end of file +self::$settings->setGlobalOption('dashboard_chart', false); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/80800.php b/wp-content/plugins/wp-piwik/update/80800.php index af60505eb..8b781201a 100644 --- a/wp-content/plugins/wp-piwik/update/80800.php +++ b/wp-content/plugins/wp-piwik/update/80800.php @@ -1,2 +1,2 @@ <?php -self::$aryGlobalSettings['piwik_url'] = self::checkURL(self::$aryGlobalSettings['piwik_url']); \ No newline at end of file +self::$settings->setGlobalOption('piwik_url', self::checkURL(self::$settings->getGlobalOption('piwik_url'))); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/90001.php b/wp-content/plugins/wp-piwik/update/90001.php index 25fad7c14..af42fa4fb 100644 --- a/wp-content/plugins/wp-piwik/update/90001.php +++ b/wp-content/plugins/wp-piwik/update/90001.php @@ -1,12 +1,13 @@ <?php $aryWPMUConfig = get_site_option('wpmu-piwik_global-settings',false); if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && $aryWPMUConfig) { - self::$aryGlobalSettings = $aryWPMUConfig; + foreach ($aryWPMUConfig as $key => $value) + self::$settings->setGlobalOption($key, $value); delete_site_option('wpmu-piwik_global-settings'); - self::$aryGlobalSettings['auto_site_config'] = true; -} else self::$aryGlobalSettings['auto_site_config'] = false; -self::$aryGlobalSettings['dashboard_seo'] = false; -self::$aryGlobalSettings['stats_seo'] = false; -self::$aryGlobalSettings['track_404'] = self::$arySettings['track_404']; -self::$aryGlobalSettings['track_compress'] = false; -self::$aryGlobalSettings['track_post'] = false; \ No newline at end of file + self::$settings->setGlobalOption('auto_site_config', true); +} else self::$settings->setGlobalOption('auto_site_config', false); +self::$settings->setGlobalOption('dashboard_seo', false); +self::$settings->setGlobalOption('stats_seo', false); +self::$settings->setGlobalOption('track_404', self::$settings->getOption('track_404')); +self::$settings->setGlobalOption('track_compress', false); +self::$settings->setGlobalOption('track_post', false); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/90206.php b/wp-content/plugins/wp-piwik/update/90206.php index 9870b9aec..efd3f59fb 100644 --- a/wp-content/plugins/wp-piwik/update/90206.php +++ b/wp-content/plugins/wp-piwik/update/90206.php @@ -1,2 +1,2 @@ <?php -self::$aryGlobalSettings['disable_timelimit'] = false; \ No newline at end of file +self::$settings->setGlobalOption('disable_timelimit', false); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/90405.php b/wp-content/plugins/wp-piwik/update/90405.php index bce3d92b1..df11ad814 100644 --- a/wp-content/plugins/wp-piwik/update/90405.php +++ b/wp-content/plugins/wp-piwik/update/90405.php @@ -1,5 +1,5 @@ <?php -self::$aryGlobalSettings['piwik_mode'] = 'http'; -self::$aryGlobalSettings['piwik_path'] = ''; -self::$aryGlobalSettings['toolbar'] = false; -self::$aryGlobalSettings['disable_cookies'] = false; +self::$settings->setGlobalOption('piwik_mode', 'http'); +self::$settings->setGlobalOption('piwik_path', ''); +self::$settings->setGlobalOption('toolbar', false); +self::$settings->setGlobalOption('disable_cookies', false); diff --git a/wp-content/plugins/wp-piwik/update/90601.php b/wp-content/plugins/wp-piwik/update/90601.php index 6f383a938..1e74ba5e2 100644 --- a/wp-content/plugins/wp-piwik/update/90601.php +++ b/wp-content/plugins/wp-piwik/update/90601.php @@ -1,3 +1,3 @@ <?php -self::$aryGlobalSettings['piwik_useragent'] = 'php'; -self::$aryGlobalSettings['piwik_useragent_string'] = 'WP-Piwik'; \ No newline at end of file +self::$settings->setGlobalOption('piwik_useragent', 'php'); +self::$settings->setGlobalOption('piwik_useragent_string', 'WP-Piwik'); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/90700.php b/wp-content/plugins/wp-piwik/update/90700.php index 6f1b8d64b..761cc35b1 100644 --- a/wp-content/plugins/wp-piwik/update/90700.php +++ b/wp-content/plugins/wp-piwik/update/90700.php @@ -1,2 +1,2 @@ <?php -self::$aryGlobalSettings['shortcodes'] = false; \ No newline at end of file +self::$settings->setGlobalOption('shortcodes', false); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/90801.php b/wp-content/plugins/wp-piwik/update/90801.php index aa1ad670f..ec3490fab 100644 --- a/wp-content/plugins/wp-piwik/update/90801.php +++ b/wp-content/plugins/wp-piwik/update/90801.php @@ -1,10 +1,7 @@ <?php -self::$aryGlobalSettings['track_search'] = false; -self::$aryGlobalSettings['connection_timeout'] = 5; -if (isset(self::$aryGlobalSettings['track_compress']) && self::$aryGlobalSettings['track_compress']) - self::$aryGlobalSettings['track_mode'] = 1; +self::$settings->setGlobalOption('track_search', false); +self::$settings->setGlobalOption('connection_timeout', 5); +if (self::$settings->getGlobalOption('track_compress')) + self::$settings->setGlobalOption('track_mode', 1); else - self::$aryGlobalSettings['track_mode'] = 0; - -if (isset(self::$aryGlobalSettings['track_compress'])) - unset(self::$aryGlobalSettings['track_compress']); \ No newline at end of file + self::$settings->setGlobalOption('track_mode', 0); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/90821.php b/wp-content/plugins/wp-piwik/update/90821.php index 254d2055d..703d9c24a 100644 --- a/wp-content/plugins/wp-piwik/update/90821.php +++ b/wp-content/plugins/wp-piwik/update/90821.php @@ -1,2 +1,2 @@ <?php -self::$aryGlobalSettings['track_cdnurl'] = ''; +self::$settings->setGlobalOption('track_cdnurl', ''); diff --git a/wp-content/plugins/wp-piwik/update/90910.php b/wp-content/plugins/wp-piwik/update/90910.php index 1caa7e0b0..a9d4ade2c 100644 --- a/wp-content/plugins/wp-piwik/update/90910.php +++ b/wp-content/plugins/wp-piwik/update/90910.php @@ -1,3 +1,3 @@ <?php -self::$aryGlobalSettings['track_cdnurlssl'] = self::$aryGlobalSettings['track_cdnurl']; -self::$aryGlobalSettings['track_noscript'] = false; \ No newline at end of file +self::$settings->setGlobalOption('track_cdnurlssl', self::$settings->getGlobalOption('track_cdnurl')); +self::$settings->setGlobalOption('track_noscript', false); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/90920.php b/wp-content/plugins/wp-piwik/update/90920.php new file mode 100644 index 000000000..ff5eaedc2 --- /dev/null +++ b/wp-content/plugins/wp-piwik/update/90920.php @@ -0,0 +1,2 @@ +<?php +self::$settings->setGlobalOption('plugin_display_name', 'WP-Piwik'); diff --git a/wp-content/plugins/wp-piwik/update/90940.php b/wp-content/plugins/wp-piwik/update/90940.php new file mode 100644 index 000000000..7d32cd42f --- /dev/null +++ b/wp-content/plugins/wp-piwik/update/90940.php @@ -0,0 +1,2 @@ +<?php +self::$settings->setGlobalOption('track_nojavascript', false); diff --git a/wp-content/plugins/wp-piwik/update/90961.php b/wp-content/plugins/wp-piwik/update/90961.php new file mode 100644 index 000000000..cfc616675 --- /dev/null +++ b/wp-content/plugins/wp-piwik/update/90961.php @@ -0,0 +1,2 @@ +<?php +self::$settings->setGlobalOption('cache', true); diff --git a/wp-content/plugins/wp-piwik/update/90971.php b/wp-content/plugins/wp-piwik/update/90971.php new file mode 100644 index 000000000..d79b5251f --- /dev/null +++ b/wp-content/plugins/wp-piwik/update/90971.php @@ -0,0 +1,3 @@ +<?php +self::$settings->setGlobalOption('track_admin', false); +self::$settings->setGlobalOption('perpost_stats', false); diff --git a/wp-content/plugins/wp-piwik/update/90980.php b/wp-content/plugins/wp-piwik/update/90980.php new file mode 100644 index 000000000..6bb0c186d --- /dev/null +++ b/wp-content/plugins/wp-piwik/update/90980.php @@ -0,0 +1,6 @@ +<?php +self::$settings->setGlobalOption('track_feed', false); +self::$settings->setGlobalOption('track_feed_goal', false); +self::$settings->setGlobalOption('track_feed_revenue', false); +self::$settings->setGlobalOption('track_feed_campaign', 'feed'); +self::$settings->setGlobalOption('track_feed_addcampaign', false); \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/update/index.php b/wp-content/plugins/wp-piwik/update/index.php new file mode 100644 index 000000000..9b3347dc3 --- /dev/null +++ b/wp-content/plugins/wp-piwik/update/index.php @@ -0,0 +1,2 @@ +<?php + // Nothing to see... \ No newline at end of file diff --git a/wp-content/plugins/wp-piwik/wp-piwik.php b/wp-content/plugins/wp-piwik/wp-piwik.php index fd22e2a0c..35900c8ae 100755 --- a/wp-content/plugins/wp-piwik/wp-piwik.php +++ b/wp-content/plugins/wp-piwik/wp-piwik.php @@ -6,12 +6,12 @@ Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/ Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress header. -Version: 0.9.9.1 +Version: 0.9.9.8 Author: André Bräkling Author URI: http://www.braekling.de ****************************************************************************************** - Copyright (C) 2009-2013 Andre Braekling (email: webmaster@braekling.de) + Copyright (C) 2009-2014 Andre Braekling (email: webmaster@braekling.de) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,144 +27,52 @@ Author URI: http://www.braekling.de along with this program. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************************/ -/** - * Avoid direct calls to this file if wp core files not present - * seen (as some other parts) in Heiko Rabe's metabox demo plugin - * - * @see http://tinyurl.com/5r5vnzs - */ +// Avoid direct calls to this file if wp core files not present if (!function_exists ('add_action')) { header('Status: 403 Forbidden'); header('HTTP/1.1 403 Forbidden'); exit(); } -/** - * Makes sure all required include files are loaded before trying to use it - * - * @see http://codex.wordpress.org/Function_Reference/is_plugin_active_for_network - * @see http://codex.wordpress.org/Function_Reference/get_current_screen - */ +// Makes sure all required include files are loaded before trying to use it if (!function_exists('is_plugin_active_for_network')) require_once(ABSPATH.'/wp-admin/includes/plugin.php'); +if (!class_exists('wp_piwik')) { class wp_piwik { private static - $intRevisionId = 90910, - $strVersion = '0.9.9.1', + $intRevisionId = 90983, + $strVersion = '0.9.9.8', + $blog_id, $intDashboardID = 30, $strPluginBasename = NULL, $bolJustActivated = false, - $aryGlobalSettings = array( - 'revision' => 90910, - 'add_tracking_code' => false, - 'last_settings_update' => 0, - 'piwik_token' => '', - 'piwik_url' => '', - 'piwik_path' => '', - 'piwik_mode' => 'http', - 'piwik_useragent' => 'php', - 'piwik_useragent_string' => 'WP-Piwik', - 'connection_timeout' => 5, - 'dashboard_widget' => false, - 'dashboard_chart' => false, - 'dashboard_seo' => false, - 'stats_seo' => false, - 'capability_stealth' => array(), - 'capability_read_stats' => array('administrator' => true), - 'piwik_shortcut' => false, - 'default_date' => 'yesterday', - 'auto_site_config' => true, - 'track_404' => false, - 'track_search' => false, - 'track_mode' => 0, - 'track_post' => false, - 'track_proxy' => false, - 'track_cdnurlssl' => '', - 'track_noscript' => false, - 'disable_timelimit' => false, - 'disable_ssl_verify' => false, - 'disable_cookies' => false, - 'toolbar' => false, - 'shortcodes' => false - ), - $arySettings = array( - 'name' => '', - 'tracking_code' => '', - 'site_id' => NULL, - 'last_tracking_code_update' => 0, - 'dashboard_revision' => 0, - 'noscript_code' => '' - ); - + $logger, + $settings; + private $intStatsPage = NULL, $bolNetwork = false, $aryAttributes = array(), $strResult = ''; - /** - * Load plugin settings - */ - static function loadSettings() { - // Get global settings - self::$aryGlobalSettings = (is_plugin_active_for_network('wp-piwik/wp-piwik.php')? - get_site_option('wp-piwik_global-settings',self::$aryGlobalSettings): - get_option('wp-piwik_global-settings',self::$aryGlobalSettings) - ); - // Get site settings - self::$arySettings = get_option('wp-piwik_settings',self::$arySettings); - - return array( - 'global' => self::$aryGlobalSettings, - 'specific' => self::$arySettings - ); - } - - /** - * Save plugin settings - */ - static function saveSettings() { - // Save global settings - if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) - update_site_option('wp-piwik_global-settings',self::$aryGlobalSettings); - else - update_option('wp-piwik_global-settings',self::$aryGlobalSettings); - // Save blog settings - update_option('wp-piwik_settings',self::$arySettings); - // Load WP_Roles class - global $wp_roles; - if (!is_object($wp_roles)) - $wp_roles = new WP_Roles(); - if (!is_object($wp_roles)) die("STILL NO OBJECT"); - // Assign capabilities to roles - foreach($wp_roles->role_names as $strKey => $strName) { - $objRole = get_role($strKey); - foreach (array('stealth', 'read_stats') as $strCap) - if (isset(self::$aryGlobalSettings['capability_'.$strCap][$strKey]) && self::$aryGlobalSettings['capability_'.$strCap][$strKey]) - $objRole->add_cap('wp-piwik_'.$strCap); - else $objRole->remove_cap('wp-piwik_'.$strCap); - } - } - - /** - * Constructor - */ - function __construct() { + public function __construct() { + global $blog_id; + self::$blog_id = (isset($blog_id)?$blog_id:'n/a'); + $this->openLogger(); + $this->openSettings(); // Call install function on activation register_activation_hook(__FILE__, array($this, 'installPlugin')); // Store plugin basename self::$strPluginBasename = plugin_basename(__FILE__); - // Load current settings - self::loadSettings(); // Upgrade? - if (self::$aryGlobalSettings['revision'] < self::$intRevisionId) $this->upgradePlugin(); + if (self::$settings->getGlobalOption('revision') && self::$settings->getGlobalOption('revision') < self::$intRevisionId) $this->upgradePlugin(); // Settings changed? if (isset($_POST['action']) && $_POST['action'] == 'save_wp-piwik_settings') $this->applySettings(); // Set Piwik globals if PHP API is used - elseif (isset(self::$aryGlobalSettings['piwik_mode']) && self::$aryGlobalSettings['piwik_mode'] == 'php') + elseif (self::$settings->getGlobalOption('piwik_mode') && self::$settings->getGlobalOption('piwik_mode') == 'php') self::definePiwikConstants(); // Load language file load_plugin_textdomain('wp-piwik', false, dirname(self::$strPluginBasename)."/languages/"); @@ -184,148 +92,140 @@ class wp_piwik { add_action('load-post-new.php', array(&$this, 'postMetaboxes')); // Add dashboard widget if enabled /* TODO: Use bitmask here */ - if (self::$aryGlobalSettings['dashboard_widget'] || self::$aryGlobalSettings['dashboard_chart'] || self::$aryGlobalSettings['dashboard_seo']) + if (self::$settings->getGlobalOption('dashboard_widget') || self::$settings->getGlobalOption('dashboard_chart') || self::$settings->getGlobalOption('dashboard_seo')) add_action('wp_dashboard_setup', array($this, 'extendWordPressDashboard')); // Add Toolbar graph if enabled - if (self::$aryGlobalSettings['toolbar']) { + if (self::$settings->getGlobalOption('toolbar')) { add_action(is_admin()?'admin_head':'wp_head', array($this, 'loadToolbarRequirements')); add_action('admin_bar_menu', array(&$this, 'extendWordPressToolbar'), 1000); } // Enable shortcodes if enabled - if (self::$aryGlobalSettings['shortcodes']) + if (self::$settings->getGlobalOption('shortcodes')) add_shortcode( 'wp-piwik', array(&$this, 'shortcode')); // Add tracking code to header if enabled - if (self::$aryGlobalSettings['add_tracking_code']) { + if (self::$settings->getGlobalOption('add_tracking_code')) { add_action('wp_head', array($this, 'site_header')); // Add <noscript> code if enabled - if (self::$aryGlobalSettings['track_noscript']) add_action('wp_footer', array($this, 'site_footer')); + if (self::$settings->getGlobalOption('track_noscript')) add_action('wp_footer', array($this, 'site_footer')); + // Add tracking code to admin page header if enabled + if (self::$settings->getGlobalOption('track_admin')) + add_action('admin_head', array($this, 'addAdminHeaderTracking')); + // Add tracking image to feed if enabled + if (self::$settings->getGlobalOption('track_feed')) { + add_filter('the_excerpt_rss', array(&$this, 'addFeedTracking')); + add_filter('the_content', array(&$this, 'addFeedTracking')); + } + if (self::$settings->getGlobalOption('track_feed_addcampaign')) + add_filter('post_link', array(&$this, 'addFeedCampaign')); } + self::$settings->save(); } - /** - * Destructor - */ - function __destruct() {} - - /** - * Include WP-Piwik files - */ + function __destruct() { + $this->closeLogger(); + } + private function includeFile($strFile) { + self::$logger->log('Include '.$strFile.'.php'); if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.$strFile.'.php')) include(dirname(__FILE__).DIRECTORY_SEPARATOR.$strFile.'.php'); } - /** - * Install - */ function installPlugin() { - // Keep activation/installation/upgrade in mind - self::$bolJustActivated = true; - // Show an info message after upgrade/install + self::$logger->log('Running WP-Piwik installation'); add_action('admin_notices', array($this, 'updateMessage')); - // Set current revision ID - self::$aryGlobalSettings['revision'] = self::$intRevisionId; - self::$aryGlobalSettings['last_settings_update'] = time(); - // Save upgraded or default settings - self::saveSettings(); - // Reload settings - self::loadSettings(); + self::$bolJustActivated = true; + self::$settings->setGlobalOption('revision', self::$intRevisionId); + self::$settings->setGlobalOption('last_settings_update', time()); } - /** - * Uninstall - */ static function uninstallPlugin() { + self::$logger->log('Running WP-Piwik uninstallation'); // Check if uninstall call is valid if (!defined('WP_UNINSTALL_PLUGIN')) exit(); - self::resetSettings(true); + self::$settings->resetSettings(true); } - /** - * Upgrade - */ function upgradePlugin() { + self::$logger->log('Upgrade WP-Piwik to '.self::$strVersion); add_action('admin_notices', array($this, 'updateMessage')); // Update: Translate options - if (self::$aryGlobalSettings['revision'] < 80403) + if (self::$settings->getGlobalOption('revision') < 80403) self::includeFile('update/80403'); - if (self::$aryGlobalSettings['revision'] < 80502) + if (self::$settings->getGlobalOption('revision') < 80502) self::includeFile('update/80502'); - if (self::$aryGlobalSettings['revision'] < 80602) + if (self::$settings->getGlobalOption('revision') < 80602) self::includeFile('update/80602'); - if (self::$aryGlobalSettings['revision'] < 80800) + if (self::$settings->getGlobalOption('revision') < 80800) self::includeFile('update/80800'); - if (self::$aryGlobalSettings['revision'] < 90001) + if (self::$settings->getGlobalOption('revision') < 90001) self::includeFile('update/90001'); - if (self::$aryGlobalSettings['revision'] < 90206) + if (self::$settings->getGlobalOption('revision') < 90206) self::includeFile('update/90206'); - if (self::$aryGlobalSettings['revision'] < 90405) + if (self::$settings->getGlobalOption('revision') < 90405) self::includeFile('update/90405'); - if (self::$aryGlobalSettings['revision'] < 90601) + if (self::$settings->getGlobalOption('revision') < 90601) self::includeFile('update/90601'); - if (self::$aryGlobalSettings['revision'] < 90700) + if (self::$settings->getGlobalOption('revision') < 90700) self::includeFile('update/90700'); - if (self::$aryGlobalSettings['revision'] < 90805) + if (self::$settings->getGlobalOption('revision') < 90805) self::includeFile('update/90801'); - if (self::$aryGlobalSettings['revision'] < 90821) + if (self::$settings->getGlobalOption('revision') < 90821) self::includeFile('update/90821'); - if (self::$aryGlobalSettings['revision'] < 90910) + if (self::$settings->getGlobalOption('revision') < 90910) self::includeFile('update/90910'); - + if (self::$settings->getGlobalOption('revision') < 90921) + self::includeFile('update/90920'); + if (self::$settings->getGlobalOption('revision') < 90940) + self::includeFile('update/90940'); + if (self::$settings->getGlobalOption('revision') < 90961) + self::includeFile('update/90961'); + if (self::$settings->getGlobalOption('revision') < 90971) + self::includeFile('update/90971'); + if (self::$settings->getGlobalOption('revision') < 90983) + self::includeFile('update/90980'); + // Install new version $this->installPlugin(); } - /** - * Upgrade outdated site settings - */ function updateSite() { + self::$logger->log('Reset site settings to force a site setting update. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id')); self::$arySettings = array( 'tracking_code' => '', 'site_id' => get_option('wp-piwik_siteid', NULL), 'last_tracking_code_update' => 0, 'dashboard_revision' => get_option('wp-piwik_dashboardid', 0) ); - self::$aryGlobalSettings['last_settings_update'] = time(); + self::$settings->setGlobalOption('last_settings_update', time()); // Remove deprecated option values $aryRemoveOptions = array('wp-piwik_siteid','wp-piwik_404','wp-piwik_scriptupdate','wp-piwik_dashboardid','wp-piwik_jscode'); foreach ($aryRemoveOptions as $strRemoveOption) delete_option($strRemoveOption); // Save upgraded or default settings self::saveSettings(); - // Reload settings - self::loadSettings(); } - /** - * Send a message after installing/updating - */ function updateMessage() { - // Message text - $strText = 'WP-Piwik '.self::$strVersion.' '.__('installed','wp-piwik').'.'; - // Next step information - $strSettings = (!self::isConfigured()? - __('Next you should connect to Piwik','wp-piwik'): - __('Please validate your configuration','wp-piwik') - ); - // Create settings Link + $strText = self::$settings->getGlobalOption('plugin_display_name').' '.self::$strVersion.' '.__('installed','wp-piwik').'.'; + $strNotice = (!self::isConfigured()?__('Next you should connect to Piwik','wp-piwik'):__('Please validate your configuration','wp-piwik')); $strLink = sprintf('<a href="'.(is_plugin_active_for_network('wp-piwik/wp-piwik.php')?'settings':'options-general').'.php?page=%s">%s</a>', self::$strPluginBasename, __('Settings', 'wp-piwik')); - // Display message - echo '<div class="updated fade"><p>'.$strText.' <strong>'.__('Important', 'wp-piwik').':</strong> '.$strSettings.': '.$strLink.'.</p></div>'; + echo '<div class="updated fade"><p>'.$strText.' <strong>'.__('Important', 'wp-piwik').':</strong> '.$strNotice.': '.$strLink.'.</p></div>'; } - /** - * Add tracking code - */ function site_header() { + global $blod_id; // Hotfix: Custom capability problem with WP multisite if (is_multisite()) { - foreach (self::$aryGlobalSettings['capability_stealth'] as $strKey => $strVal) - if ($strVal && current_user_can($strKey)) + foreach (self::$settings->getGlobalOption('capability_stealth') as $strKey => $strVal) + if ($strVal && current_user_can($strKey)) { + self::$logger->log('Do not add tracking code to site header (user should not be tracked) Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id')); return; + } // Don't add tracking code? } elseif (current_user_can('wp-piwik_stealth')) { + self::$logger->log('Do not add tracking code to site header (user should not be tracked) Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id')); echo '<!-- *** WP-Piwik - see http://wordpress.org/extend/plugins/wp-piwik/ ******** -->'."\n"; echo '<!-- Current user should not be tracked. -->'."\n"; echo '<!-- *** /WP-Piwik *********************************************************** -->'."\n"; @@ -334,25 +234,29 @@ class wp_piwik { // Hotfix: Update network site if not done yet if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && get_option('wp-piwik_siteid', false)) $this->updateSite(); // Autohandle site if no tracking code available - if (empty(self::$arySettings['tracking_code'])) + if (!self::$settings->getOption('tracking_code')) $aryReturn = $this->addPiwikSite(); // Update/get code if outdated/unknown - if (self::$arySettings['last_tracking_code_update'] < self::$aryGlobalSettings['last_settings_update'] || empty(self::$arySettings['tracking_code'])) { - self::$arySettings['tracking_code'] = $this->callPiwikAPI('SitesManager.getJavascriptTag'); - self::saveSettings(); + if (self::$settings->getOption('last_tracking_code_update') < self::$settings->getGlobalOption('last_settings_update') || !self::$settings->getOption('tracking_code')) { + self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag')); + self::$settings->save(); } // Change code if 404 - if (is_404() && self::$aryGlobalSettings['track_404']) - $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setDocumentTitle', '404/URL = '+String(document.location.pathname+document.location.search).replace(/\//g,'%2f') + '/From = ' + String(document.referrer).replace(/\//g,'%2f')]);\n_paq.push(['trackPageView']);", self::$arySettings['tracking_code']); + if (is_404() && self::$settings->getGlobalOption('track_404')) { + self::$logger->log('Apply 404 changes. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id')); + $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setDocumentTitle', '404/URL = '+String(document.location.pathname+document.location.search).replace(/\//g,'%2f') + '/From = ' + String(document.referrer).replace(/\//g,'%2f')]);\n_paq.push(['trackPageView']);", self::$settings->getOption('tracking_code')); + } // Change code if search result - elseif (is_search() && self::$aryGlobalSettings['track_search']) { + elseif (is_search() && self::$settings->getGlobalOption('track_search')) { + self::$logger->log('Apply search tracking changes. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id')); $objSearch = new WP_Query("s=" . get_search_query() . '&showposts=-1'); $intResultCount = $objSearch->post_count; - $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['trackSiteSearch','".get_search_query()."', false, ".$intResultCount."]);\n_paq.push(['trackPageView']);", self::$arySettings['tracking_code']); + $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['trackSiteSearch','".get_search_query()."', false, ".$intResultCount."]);\n_paq.push(['trackPageView']);", self::$settings->getOption('tracking_code')); // Use default tracking code } else - $strTrackingCode = self::$arySettings['tracking_code']; + $strTrackingCode = self::$settings->getOption('tracking_code'); // Send tracking code + self::$logger->log('Add tracking code. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id')); echo '<!-- *** WP-Piwik - see http://wordpress.org/extend/plugins/wp-piwik/ ******** -->'."\n"; // Add custom variables if set: if (is_single()) { @@ -367,12 +271,12 @@ class wp_piwik { if (!empty($strMetaKey) && !empty($strMetaVal)) $strCustomVars .= "_paq.push(['setCustomVariable',".$i.", '".$strMetaKey."', '".$strMetaVal."', 'page']);\n"; } - if (!empty($strMetaKey)) $strTrackingCode = str_replace("_paq.push(['trackPageView']);", $strCustomVars."_paq.push(['trackPageView']);", $strTrackingCode); + if (!empty($strCustomVars)) $strTrackingCode = str_replace("_paq.push(['trackPageView']);", $strCustomVars."_paq.push(['trackPageView']);", $strTrackingCode); } echo $strTrackingCode; echo '<!-- *** /WP-Piwik *********************************************************** -->'."\n"; $strName = get_bloginfo('name'); - if (!isset(self::$arySettings['name']) || self::$arySettings['name'] != $strName) + if (self::$settings->getOption('name') != $strName) $this->updatePiwikSite(); } @@ -382,14 +286,15 @@ class wp_piwik { function site_footer() { // Hotfix: Custom capability problem with WP multisite if (is_multisite()) { - foreach (self::$aryGlobalSettings['capability_stealth'] as $strKey => $strVal) + foreach (self::$settings->getGlobalOption('capability_stealth') as $strKey => $strVal) if ($strVal && current_user_can($strKey)) return; // Don't add tracking code? } elseif (current_user_can('wp-piwik_stealth')) return; // Send tracking code + self::$logger->log('Add noscript code. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id')); echo '<!-- *** WP-Piwik - see http://wordpress.org/extend/plugins/wp-piwik/ ******** -->'."\n"; - echo self::$arySettings['noscript_code']."\n"; + echo self::$settings->getOption('noscript_code')."\n"; echo '<!-- *** /WP-Piwik *********************************************************** -->'."\n"; } @@ -411,7 +316,7 @@ class wp_piwik { ), $aryAttributes); switch ($this->aryAttributes['module']) { case 'opt-out': - $this->strResult = '<iframe frameborder="no" width="'.$this->aryAttributes['width'].'" height="'.$this->aryAttributes['height'].'" src="'.self::$aryGlobalSettings['piwik_url'].'index.php?module=CoreAdminHome&action=optOut&language='.$this->aryAttributes['language'].'"></iframe>'; + $this->strResult = '<iframe frameborder="no" width="'.$this->aryAttributes['width'].'" height="'.$this->aryAttributes['height'].'" src="'.self::$settings->getGlobalOption('piwik_url').'index.php?module=CoreAdminHome&action=optOut&language='.$this->aryAttributes['language'].'"></iframe>'; break; case 'overview': default: @@ -426,6 +331,11 @@ class wp_piwik { function postMetaboxes() { add_action('add_meta_boxes', array(&$this, 'postAddMetaboxes')); add_action('save_post', array(&$this, 'postCustomvarsSave'), 10, 2); + // Show per post stats if enabled + if (self::$settings->getGlobalOption('perpost_stats')) { + $this->includeFile('classes/WP_Piwik_MetaBox_PerPost_Stats'); + add_action('add_meta_boxes', array(new WP_Piwik_MetaBox_PerPost_Stats($this->subClassConfig()), 'addMetabox')); + } } /** @@ -503,7 +413,7 @@ class wp_piwik { // Add dashboard page $this->intStatsPage = add_dashboard_page( __('Piwik Statistics', 'wp-piwik'), - __('WP-Piwik', 'wp-piwik'), + self::$settings->getGlobalOption('plugin_display_name'), 'wp-piwik_read_stats', 'wp-piwik_stats', array($this, 'showStats') @@ -520,8 +430,8 @@ class wp_piwik { if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { // Add options page $intOptionsPage = add_options_page( - __('WP-Piwik', 'wp-piwik'), - __('WP-Piwik', 'wp-piwik'), + self::$settings->getGlobalOption('plugin_display_name'), + self::$settings->getGlobalOption('plugin_display_name'), 'activate_plugins', __FILE__, array($this, 'showSettings') @@ -544,7 +454,7 @@ class wp_piwik { // Add dashboard page $this->intStatsPage = add_dashboard_page( __('Piwik Statistics', 'wp-piwik'), - __('WP-Piwik', 'wp-piwik'), + self::$settings->getGlobalOption('plugin_display_name'), 'manage_sites', 'wp-piwik_stats', array($this, 'showStatsNetwork') @@ -560,8 +470,8 @@ class wp_piwik { } $intOptionsPage = add_submenu_page( 'settings.php', - __('WP-Piwik', 'wp-piwik'), - __('WP-Piwik', 'wp-piwik'), + self::$settings->getGlobalOption('plugin_display_name'), + self::$settings->getGlobalOption('plugin_display_name'), 'manage_sites', __FILE__, array($this, 'showSettings') @@ -592,10 +502,10 @@ class wp_piwik { if (current_user_can('wp-piwik_read_stats')) { // TODO: Use bitmask here // Add data widget if enabled - if (self::$aryGlobalSettings['dashboard_widget']) + if (self::$settings->getGlobalOption('dashboard_widget')) $this->addWordPressDashboardWidget(); // Add chart widget if enabled - if (self::$aryGlobalSettings['dashboard_chart']) { + if (self::$settings->getGlobalOption('dashboard_chart')) { // Add required scripts add_action('admin_print_scripts-index.php', array($this, 'loadStatsScripts')); // Add required styles @@ -605,7 +515,7 @@ class wp_piwik { $this->addWordPressDashboardChart(); } // Add SEO widget if enabled - if (self::$aryGlobalSettings['dashboard_seo']) + if (self::$settings->getGlobalOption('dashboard_seo')) $this->addWordPressDashboardSEO(); } } @@ -635,13 +545,13 @@ class wp_piwik { */ function addWordPressDashboardWidget() { $aryConfig = array( - 'params' => array('period' => 'day','date' => self::$aryGlobalSettings['dashboard_widget'],'limit' => null), + 'params' => array('period' => 'day','date' => self::$settings->getGlobalOption('dashboard_widget'),'limit' => null), 'inline' => true, ); $strFile = 'overview'; add_meta_box( 'wp-piwik_stats-dashboard-overview', - __('WP-Piwik', 'wp-piwik').' - '.__(self::$aryGlobalSettings['dashboard_widget'], 'wp-piwik'), + self::$settings->getGlobalOption('plugin_display_name').' - '.__(self::$settings->getGlobalOption('dashboard_widget'), 'wp-piwik'), array(&$this, 'createDashboardWidget'), 'dashboard', 'side', @@ -661,7 +571,7 @@ class wp_piwik { $strFile = 'visitors'; add_meta_box( 'wp-piwik_stats-dashboard-chart', - __('WP-Piwik', 'wp-piwik').' - '.__('Visitors', 'wp-piwik'), + self::$settings->getGlobalOption('plugin_display_name').' - '.__('Visitors', 'wp-piwik'), array(&$this, 'createDashboardWidget'), 'dashboard', 'side', @@ -681,7 +591,7 @@ class wp_piwik { $strFile = 'seo'; add_meta_box( 'wp-piwik_stats-dashboard-seo', - __('WP-Piwik', 'wp-piwik').' - '.__('SEO', 'wp-piwik'), + self::$settings->getGlobalOption('plugin_display_name').' - '.__('SEO', 'wp-piwik'), array(&$this, 'createDashboardWidget'), 'dashboard', 'side', @@ -727,7 +637,7 @@ class wp_piwik { // Only load if user is allowed to see stats if (current_user_can('wp-piwik_read_stats')) { // Load Sparklines - wp_enqueue_script('wp-piwik-sparkline',$this->getPluginURL().'js/sparkline/jquery.sparkline.min.js',array('jquery')); + wp_enqueue_script('wp-piwik-sparkline',$this->getPluginURL().'js/sparkline/jquery.sparkline.min.js',array('jquery'),'2.1.1'); // Load CSS wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik-spark.css'); } @@ -748,6 +658,51 @@ class wp_piwik { wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik.css',array(),self::$strVersion); } + /** + * Add tracking code to admin header + */ + function addAdminHeaderTracking() { + $this->site_header(); + } + + /** + * Add tracking image to feeds + **/ + function addFeedTracking($content) { + global $post; + if(is_feed()) { + self::$logger->log('Add tracking image to feed entry.'); + if (!self::$settings->getOption('site_id')) + self::addPiwikSite(); + $title = the_title(null,null,false); + $posturl = get_permalink($post->ID); + $urlref = get_bloginfo('rss2_url'); + $url = self::$settings->getGlobalOption('piwik_url'); + if (substr($url, -10, 10) == '/index.php') + $url = str_replace('/index.php', '/piwik.php', $url); + else $url .= 'piwik.php'; + $trackingImage = $url.'?idsite='.self::$settings->getOption('site_id').'&rec=1'. + '&url='.urlencode($posturl). + '&action_name='.urlencode($title). + '&urlref='.urlencode($urlref); + $content .= '<img src="'.$trackingImage.'" style="border:0;width:0;height:0" width="0" height="0" alt="" />'; + } + return $content; + } + + /** + * Add tracking image to feeds + **/ + function addFeedCampaign($permalink) { + global $post; + if(is_feed()) { + self::$logger->log('Add campaign to feed permalink.'); + $sep = (strpos($permalink, '?') === false?'?':'&'); + $permalink .= $sep.'pk_campaign='.urlencode(self::$settings->getGlobalOption('track_feed_campaign')).'&pk_kwd='.urlencode($post->post_name); + } + return $permalink; + } + /** * Add required header tags to stats page */ @@ -780,7 +735,7 @@ class wp_piwik { * @param $strURL Remote file URL */ function callREST($strURL) { - $strPiwikURL = self::$aryGlobalSettings['piwik_url']; + $strPiwikURL = self::$settings->getGlobalOption('piwik_url'); if (substr($strPiwikURL, -1, 1) != '/') $strPiwikURL .= '/'; $strURL = $strPiwikURL.'?module=API'.$strURL; // Use cURL if available @@ -788,20 +743,21 @@ class wp_piwik { // Init cURL $c = curl_init($strURL); // Disable SSL peer verification if asked to - curl_setopt($c, CURLOPT_SSL_VERIFYPEER, !self::$aryGlobalSettings['disable_ssl_verify']); + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, !self::$settings->getGlobalOption('disable_ssl_verify')); // Set user agent - curl_setopt($c, CURLOPT_USERAGENT, self::$aryGlobalSettings['piwik_useragent']=='php'?ini_get('user_agent'):self::$aryGlobalSettings['piwik_useragent_string']); + curl_setopt($c, CURLOPT_USERAGENT, self::$settings->getGlobalOption('piwik_useragent')=='php'?ini_get('user_agent'):self::$settings->getGlobalOption('piwik_useragent_string')); // Configure cURL CURLOPT_RETURNTRANSFER = 1 curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // Configure cURL CURLOPT_HEADER = 0 curl_setopt($c, CURLOPT_HEADER, 0); // Set cURL timeout - curl_setopt($c, CURLOPT_TIMEOUT, self::$aryGlobalSettings['connection_timeout']); - if (WP_HTTP_Proxy::is_enabled() && WP_HTTP_Proxy::send_through_proxy($strURL)) { - curl_setopt($c, CURLOPT_PROXY, WP_HTTP_Proxy::host()); - curl_setopt($c, CURLOPT_PROXYPORT, WP_HTTP_Proxy::port()); - if (WP_HTTP_Proxy::use_authentication()) - curl_setopt($c, CURLOPT_PROXYUSERPWD, WP_HTTP_Proxy::username().':'.WP_HTTP_Proxy::password()); + curl_setopt($c, CURLOPT_TIMEOUT, self::$settings->getGlobalOption('connection_timeout')); + $httpProxyClass = new WP_HTTP_Proxy(); + if ($httpProxyClass->is_enabled() && $httpProxyClass->send_through_proxy($strURL)) { + curl_setopt($c, CURLOPT_PROXY, $httpProxyClass->host()); + curl_setopt($c, CURLOPT_PROXYPORT, $httpProxyClass->port()); + if ($httpProxyClass->use_authentication()) + curl_setopt($c, CURLOPT_PROXYUSERPWD, $httpProxyClass->username().':'.$httpProxyClass->password()); } // Get result $strResult = curl_exec($c); @@ -810,7 +766,7 @@ class wp_piwik { // cURL not available but url fopen allowed } elseif (ini_get('allow_url_fopen')) { // Set timeout - $resContext = stream_context_create(array('http'=>array('timeout' => self::$aryGlobalSettings['connection_timeout']))); + $resContext = stream_context_create(array('http'=>array('timeout' => self::$settings->getGlobalOption('connection_timeout')))); // Get file using file_get_contents $strResult = @file_get_contents($strURL, false, $strContext); // Error: Not possible to get remote file @@ -829,7 +785,7 @@ class wp_piwik { */ function callPHP($strParams) { if (PIWIK_INCLUDE_PATH === FALSE) - return serialize(array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' "'.htmlentities(self::$aryGlobalSettings['piwik_path']).'": '.__('realpath() returns false','wp-piwik').'.')); + return serialize(array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' "'.htmlentities(self::$settings->getGlobalOption('piwik_path')).'": '.__('realpath() returns false','wp-piwik').'.')); if (file_exists(PIWIK_INCLUDE_PATH . "/index.php")) require_once PIWIK_INCLUDE_PATH . "/index.php"; if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php")) @@ -837,7 +793,7 @@ class wp_piwik { if (class_exists('Piwik_FrontController')) Piwik_FrontController::getInstance()->init(); // Add Piwik URL to params - $strParams .= '&piwikUrl='.urlencode(self::$aryGlobalSettings['piwik_url']); + $strParams .= '&piwikUrl='.urlencode(self::$settings->getGlobalOption('piwik_url')); // This inits the API Request with the specified parameters if (class_exists('Piwik_API_Request')) $objRequest = new Piwik_API_Request($strParams); @@ -852,7 +808,7 @@ class wp_piwik { * @param String $strURL Remote file URL */ function getRemoteFile($strURL) { - if (self::$aryGlobalSettings['piwik_mode'] == 'php') + if (self::$settings->getGlobalOption('piwik_mode') == 'php') return $this->callPHP($strURL); else return $this->callREST($strURL); @@ -864,39 +820,42 @@ class wp_piwik { */ function addPiwikSite() { if (isset($_GET['wpmu_show_stats']) && is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { + self::$logger->log('Switch blog ID: '.(int) $_GET['wpmu_show_stats']); switch_to_blog((int) $_GET['wpmu_show_stats']); - self::loadSettings(); } - $strBlogURL = get_bloginfo('url'); + self::$logger->log('Get the blog\'s site ID by URL: '.get_bloginfo('url')); // Check if blog URL already known $strURL = '&method=SitesManager.getSitesIdFromSiteUrl'; - $strURL .= '&url='.urlencode($strBlogURL); + $strURL .= '&url='.urlencode(get_bloginfo('url')); $strURL .= '&format=PHP'; - $strURL .= '&token_auth='.self::$aryGlobalSettings['piwik_token']; + $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token'); $aryResult = unserialize($this->getRemoteFile($strURL)); if (!empty($aryResult) && isset($aryResult[0]['idsite'])) { - self::$arySettings['site_id'] = (int)$aryResult[0]['idsite']; - self::$arySettings['last_tracking_code_update'] = time(); + self::$settings->setOption('site_id', (int) $aryResult[0]['idsite']); // Otherwise create new site } elseif (self::isConfigured() && !empty($strURL)) { + self::$logger->log('Blog not known yet - create new site'); $strName = get_bloginfo('name'); - if (empty($strName)) $strName = $strBlogURL; - self::$arySettings['name'] = $strName; + if (empty($strName)) $strName = get_bloginfo('url'); + self::$settings->setOption('name', $strName); $strURL .= '&method=SitesManager.addSite'; - $strURL .= '&siteName='.urlencode($strName).'&urls='.urlencode($strBlogURL); + $strURL .= '&siteName='.urlencode($strName).'&urls='.urlencode(get_bloginfo('url')); $strURL .= '&format=PHP'; - $strURL .= '&token_auth='.self::$aryGlobalSettings['piwik_token']; + $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token'); $strResult = unserialize($this->getRemoteFile($strURL)); - if (!empty($strResult)) self::$arySettings['site_id'] = (int) $strResult; + if (!empty($strResult)) self::$settings->setOption('site_id', (int) $strResult); } // Store new data if site created - if (!empty(self::$arySettings['site_id'])) { - self::$arySettings['tracking_code'] = $this->callPiwikAPI('SitesManager.getJavascriptTag'); - self::saveSettings(); - } else self::$arySettings['tracking_code'] = ''; - if (isset($_GET['wpmu_show_stats']) && is_plugin_active_for_network('wp-piwik/wp-piwik.php')) + if (self::$settings->getOption('site_id')) { + self::$logger->log('Get the site\'s tracking code'); + self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag')); + } else self::$settings->getOption('tracking_code', ''); + self::$settings->save(); + if (isset($_GET['wpmu_show_stats']) && is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { + self::$logger->log('Back to current blog'); restore_current_blog(); - return array('js' => self::$arySettings['tracking_code'], 'id' => self::$arySettings['site_id']); + } + return array('js' => self::$settings->getOption('tracking_code'), 'id' => self::$settings->getOption('site_id')); } /** @@ -907,49 +866,57 @@ class wp_piwik { // Check if blog URL already known $strName = get_bloginfo('name'); if (empty($strName)) $strName = $strBlogURL; - self::$arySettings['name'] = $strName; + self::$settings->setOption('name', $strName); $strURL = '&method=SitesManager.updateSite'; - $strURL .= '&idSite='.self::$arySettings['site_id']; + $strURL .= '&idSite='.self::$settings->getOption('site_id'); $strURL .= '&siteName='.urlencode($strName).'&urls='.urlencode($strBlogURL); $strURL .= '&format=PHP'; - $strURL .= '&token_auth='.self::$aryGlobalSettings['piwik_token']; + $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token'); $strResult = unserialize($this->getRemoteFile($strURL)); // Store new data - self::$arySettings['tracking_code'] = $this->callPiwikAPI('SitesManager.getJavascriptTag'); - self::saveSettings(); + self::$settings->getOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag')); + self::$settings->save(); } /** * Apply configured Tracking Code changes */ function applyJSCodeChanges($strCode) { + self::$logger->log('Apply tracking code changes.'); + self::$settings->setOption('last_tracking_code_update', time()); + $strCode = html_entity_decode($strCode); // Change code if js/index.php should be used - if (self::$aryGlobalSettings['track_mode'] == 1) { + if (self::$settings->getGlobalOption('track_mode') == 1) { $strCode = str_replace('piwik.js', 'js/', $strCode); $strCode = str_replace('piwik.php', 'js/', $strCode); - } elseif (self::$aryGlobalSettings['track_mode'] == 2) { + } elseif (self::$settings->getGlobalOption('track_mode') == 2) { $strCode = str_replace('piwik.js', 'piwik.php', $strCode); - $strURL = str_replace('https://', '://', self::$aryGlobalSettings['piwik_url']); - $strURL = str_replace('http://', '://', self::$aryGlobalSettings['piwik_url']); - $strProxy = str_replace('https://', '://', plugins_url('wp-piwik/')); - $strProxy = str_replace('http://', '://', plugins_url('wp-piwik/')); + $strURL = str_replace('https://', '://', self::$settings->getGlobalOption('piwik_url')); + $strURL = str_replace('http://', '://', $strURL); + $strProxy = str_replace('https://', '://', plugins_url('wp-piwik')); + $strProxy = str_replace('http://', '://', $strProxy); + $strProxy .= '/'; $strCode = str_replace($strURL, $strProxy, $strCode); } - if (!empty(self::$aryGlobalSettings['track_cdnurl'])||!empty(self::$aryGlobalSettings['track_cdnurlssl'])) { - $strCode = str_replace("var d=doc", "var ucdn=(('https:' == document.location.protocol) ? 'https://".(!empty(self::$aryGlobalSettings['track_cdnurlssl'])?self::$aryGlobalSettings['track_cdnurlssl']:self::$aryGlobalSettings['track_cdnurl'])."/' : 'http://".(!empty(self::$aryGlobalSettings['track_cdnurl'])?self::$aryGlobalSettings['track_cdnurl']:self::$aryGlobalSettings['track_cdnurlssl'])."/');\nvar d=doc", $strCode); + $strCode = str_replace('//";','/"',$strCode); + if (self::$settings->getGlobalOption('track_cdnurl')||self::$settings->getGlobalOption('track_cdnurlssl')) { + $strCode = str_replace("var d=doc", "var ucdn=(('https:' == document.location.protocol) ? 'https://".(self::$settings->getGlobalOption('track_cdnurlssl')?self::$settings->getGlobalOption('track_cdnurlssl'):self::$settings->getGlobalOption('track_cdnurl'))."/' : 'http://".(self::$settings->getGlobalOption('track_cdnurl')?self::$settings->getGlobalOption('track_cdnurl'):self::$settings->getGlobalOption('track_cdnurlssl'))."/');\nvar d=doc", $strCode); $strCode = str_replace("g.src=u+", "g.src=ucdn+", $strCode); } // Change code if POST is forced to be used - if (self::$aryGlobalSettings['track_post'] && self::$aryGlobalSettings['track_mode'] != 2) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setRequestMethod', 'POST']);\n_paq.push(['trackPageView']);", $strCode); + if (self::$settings->getGlobalOption('track_post') && self::$settings->getGlobalOption('track_mode') != 2) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setRequestMethod', 'POST']);\n_paq.push(['trackPageView']);", $strCode); // Change code if cookies are disabled - if (self::$aryGlobalSettings['disable_cookies']) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['disableCookies']);\n_paq.push(['trackPageView']);", $strCode); + if (self::$settings->getGlobalOption('disable_cookies')) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['disableCookies']);\n_paq.push(['trackPageView']);", $strCode); // Store <noscript> code $aryNoscript = array(); - preg_match('/<noscript>(.*)<\/noscript>/', $strCode, $aryNoscript); - if (isset($aryNoscript[0])) - self::$arySettings['noscript_code'] = html_entity_decode($aryNoscript[0]); + preg_match('/<noscript>(.*)<\/noscript>/', $strCode, $aryNoscript); + if (isset($aryNoscript[0])) { + if (self::$settings->getGlobalOption('track_nojavascript')) + $aryNoscript[0] = str_replace('?idsite', '?rec=1&idsite', $aryNoscript[0]); + self::$settings->setOption('noscript_code', $aryNoscript[0]); + } // Remove <noscript> code - $strCode = preg_replace('/<noscript>(.*)<\/noscript>/', '', $strCode); + $strCode = preg_replace('/<noscript>(.*)<\/noscript>/', '', $strCode); // Return code without empty lines return preg_replace('/\s+(\r\n|\r|\n)/', '$1', $strCode); } @@ -980,31 +947,36 @@ class wp_piwik { /** * Call Piwik's API */ - function callPiwikAPI($strMethod, $strPeriod='', $strDate='', $intLimit='',$bolExpanded=false, $intId = false, $strFormat = 'PHP') { + function callPiwikAPI($strMethod, $strPeriod='', $strDate='', $intLimit='',$bolExpanded=false, $intId = false, $strFormat = 'PHP', $strPageURL = '', $useCache = true) { // Create unique cache key - $strKey = $strMethod.'_'.$strPeriod.'_'.$strDate.'_'.$intLimit; + $strKey = 'wp-piwik_'.md5($strMethod.'_'.$strPeriod.'_'.$strDate.'_'.$intLimit.'_'.self::$settings->getGlobalOption('piwik_token').'_'.self::$settings->getGlobalOption('piwik_url').'_'.$intId.'_'.$strPageURL); // Call API if data not cached - if (empty($this->aryCache[$strKey])) { - $strToken = self::$aryGlobalSettings['piwik_token']; + if (self::$settings->getGlobalOption('cache') && $useCache) { + $result = get_transient($strKey); + self::$logger->log('API method: '.$strMethod.' Fetch call from cache: '.$strKey); + } else $result = false; + if ($strMethod == "SitesManager.getSitesWithAtLeastViewAccess" || false === $result) { + $strToken = self::$settings->getGlobalOption('piwik_token'); // If multisite stats are shown, maybe the super admin wants to show other blog's stats. if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && function_exists('is_super_admin') && function_exists('wp_get_current_user') && is_super_admin() && isset($_GET['wpmu_show_stats'])) { $aryOptions = get_blog_option((int) $_GET['wpmu_show_stats'], 'wp-piwik_settings' , array()); if (!empty($aryOptions) && isset($aryOptions['site_id'])) $intSite = $aryOptions['site_id']; - else $intSite = self::$arySettings['site_id']; + else $intSite = self::$settings->getOption('site_id'); // Otherwise use the current site's id. } else { - if (empty(self::$arySettings['site_id'])) - $aryNewSite = self::addPiwikSite(); - $intSite = self::$arySettings['site_id']; + if (!self::$settings->getOption('site_id')) + self::addPiwikSite(); + $intSite = self::$settings->getOption('site_id'); } + //die($intSite); // Create error message if WP-Piwik isn't configured if (!self::isConfigured()) { - $this->aryCache[$strKey] = array( + $result = array( 'result' => 'error', 'message' => 'Piwik URL/path or auth token not set.' ); - return $this->aryCache[$strKey]; + return $result; } // Build URL $strURL = '&method='.$strMethod; @@ -1013,20 +985,28 @@ class wp_piwik { $strURL .= '&token_auth='.$strToken; $strURL .= '&expanded='.$bolExpanded; $strURL .= '&url='.urlencode(get_bloginfo('url')); - $strURL .= '&format='.$strFormat; + $strURL .= '&format='.$strFormat; + $strURL .= ($strPageURL?'&pageUrl='.urlencode($strPageURL):''); // Fetch data if site exists if (!empty($intSite) || $strMethod='SitesManager.getSitesWithAtLeastViewAccess') { + self::$logger->log('API method: '.$strMethod.' API call: '.$strURL); $strResult = (string) $this->getRemoteFile($strURL); - $this->aryCache[$strKey] = ($strFormat == 'PHP'?unserialize($strResult):$strResult); + $result = ($strFormat == 'PHP'?unserialize($strResult):$strResult); // Apply tracking code changes if configured - if ($strMethod == 'SitesManager.getJavascriptTag') { - $this->aryCache[$strKey] = html_entity_decode((is_string($this->aryCache[$strKey])?$this->applyJSCodeChanges($this->aryCache[$strKey]):'<!-- WP-Piwik ERROR: Tracking code not availbale -->'."\n")); - self::$arySettings['last_tracking_code_update'] = time(); + if ($strMethod == 'SitesManager.getJavascriptTag' && !empty($result)) { + $result = is_string($result)?$this->applyJSCodeChanges($result):'<!-- WP-Piwik ERROR: Tracking code not availbale -->'."\n"; } // Otherwise return error message - } else $this->aryCache[$strKey] = array('result' => 'error', 'message' => 'Unknown site/blog.'); - } - return $this->aryCache[$strKey]; + } else $result = array('result' => 'error', 'message' => 'Unknown site/blog.'); + if ( + $strMethod != 'SitesManager.getJavascriptTag' && + $strDate != 'today' && $strDate != date('Ymd') && substr($strDate, 0, 4) != 'last' && + self::$settings->getGlobalOption('cache') && + !(isset($result['result']) && $result['result'] == 'error')&& + !empty($result) + ) set_transient($strKey, $result, WEEK_IN_SECONDS); + } + return $result; } /* TODO: Add post stats @@ -1045,8 +1025,8 @@ class wp_piwik { wp_enqueue_script('common'); wp_enqueue_script('wp-lists'); wp_enqueue_script('postbox'); - $strToken = self::$aryGlobalSettings['piwik_token']; - $strPiwikURL = self::$aryGlobalSettings['piwik_url']; + $strToken = self::$settings->getGlobalOption('piwik_token'); + $strPiwikURL = self::$settings->getGlobalOption('piwik_url'); $aryDashboard = array(); // Set default configuration $arySortOrder = array( @@ -1069,7 +1049,7 @@ class wp_piwik { ) ); // Don't show SEO stats if disabled - if (!self::$aryGlobalSettings['stats_seo']) + if (!self::$settings->getGlobalOption('stats_seo')) unset($arySortOrder['side']['seo']); foreach ($arySortOrder as $strCol => $aryWidgets) { @@ -1085,7 +1065,7 @@ class wp_piwik { if (isset($_GET['date']) && preg_match('/^[0-9]{8}$/', $_GET['date']) && $strFile != 'visitors') $aryDashboard[$strCol][$strFile]['params']['date'] = $_GET['date']; elseif ($strFile != 'visitors') - $aryDashboard[$strCol][$strFile]['params']['date'] = self::$aryGlobalSettings['default_date']; + $aryDashboard[$strCol][$strFile]['params']['date'] = self::$settings->getGlobalOption('default_date'); } } $intSideBoxCnt = $intContentBox = 0; @@ -1129,7 +1109,7 @@ class wp_piwik { function showStats() { // Disabled time limit if required - if (isset(self::$aryGlobalSettings['disable_timelimit']) && self::$aryGlobalSettings['disable_timelimit']) + if (self::$settings->getGlobalOption('disable_timelimit') && self::$settings->getGlobalOption('disable_timelimit')) set_time_limit(0); //we need the global screen column value to be able to have a sidebar in WordPress 2.8 global $screen_layout_columns; @@ -1137,32 +1117,12 @@ class wp_piwik { /***************************************************************************/ ?> <div id="wp-piwik-stats-general" class="wrap"> <?php screen_icon('options-general'); ?> - <h2><?php _e('Piwik Statistics', 'wp-piwik'); ?></h2> + <h2><?php echo (self::$settings->getGlobalOption('plugin_display_name') == 'WP-Piwik'?'Piwik '.__('Statistics', 'wp-piwik'):self::$settings->getGlobalOption('plugin_display_name')); ?></h2> <?php /************************************************************************/ if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && function_exists('is_super_admin') && is_super_admin() && $this->bolNetwork) { - /* global $blog_id; - global $wpdb; - $aryBlogs = $wpdb->get_results($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id')); - if (isset($_GET['wpmu_show_stats'])) { - switch_to_blog((int) $_GET['wpmu_show_stats']); - self::loadSettings(); - } - echo '<form method="GET" action="">'."\n"; - echo '<input type="hidden" name="page" value="wp-piwik_stats" />'; - echo '<input type="hidden" name="date" value="'.(isset($_GET['date']) && preg_match('/^[0-9]{8}$/', $_GET['date'])?$_GET['date']:'').'" />'; - echo '<select name="wpmu_show_stats">'."\n"; - $aryOptions = array(); - foreach ($aryBlogs as $aryBlog) { - $objBlog = get_blog_details($aryBlog->blog_id, true); - $aryOptions[$objBlog->blogname.'#'.$objBlog->blog_id] = '<option value="'.$objBlog->blog_id.'"'.($blog_id == $objBlog->blog_id?' selected="selected"':'').'>'.$objBlog->blog_id.' - '.$objBlog->blogname.'</option>'."\n"; - } - // Show blogs in alphabetical order - ksort($aryOptions); - foreach ($aryOptions as $strOption) echo $strOption; - echo '</select><input type="submit" value="'.__('Change').'" />'."\n "; */ if (isset($_GET['wpmu_show_stats'])) { switch_to_blog((int) $_GET['wpmu_show_stats']); - self::loadSettings(); + // TODO OPTIMIZE } else { $this->includeFile('settings/sitebrowser'); return; @@ -1203,7 +1163,7 @@ class wp_piwik { //]]> </script> <?php /************************************************************************/ - if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && function_exists('is_super_admin') && is_super_admin() && $bolNetwork) { + if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && function_exists('is_super_admin') && is_super_admin()) { restore_current_blog(); } } @@ -1256,57 +1216,68 @@ class wp_piwik { */ function applySettings() { $strTab = (isset($_GET['tab'])?$_GET['tab']:'homepage'); - self::$aryGlobalSettings['last_settings_update'] = time(); + self::$logger->log('Apply changes: '.$strTab); switch ($strTab) { case 'views': - self::$aryGlobalSettings['dashboard_widget'] = (isset($_POST['wp-piwik_dbwidget'])?$_POST['wp-piwik_dbwidget']:0); - self::$aryGlobalSettings['dashboard_chart'] = (isset($_POST['wp-piwik_dbchart'])?$_POST['wp-piwik_dbchart']:false); - self::$aryGlobalSettings['dashboard_seo'] = (isset($_POST['wp-piwik_dbseo'])?$_POST['wp-piwik_dbseo']:false); - self::$aryGlobalSettings['stats_seo'] = (isset($_POST['wp-piwik_statsseo'])?$_POST['wp-piwik_statsseo']:false); - self::$aryGlobalSettings['piwik_shortcut'] = (isset($_POST['wp-piwik_piwiklink'])?$_POST['wp-piwik_piwiklink']:false); - self::$aryGlobalSettings['default_date'] = (isset($_POST['wp-piwik_default_date'])?$_POST['wp-piwik_default_date']:'yesterday'); - self::$aryGlobalSettings['capability_read_stats'] = (isset($_POST['wp-piwik_displayto'])?$_POST['wp-piwik_displayto']:array()); - self::$aryGlobalSettings['disable_timelimit'] = (isset($_POST['wp-piwik_disabletimelimit'])?$_POST['wp-piwik_disabletimelimit']:false); - self::$aryGlobalSettings['toolbar'] = (isset($_POST['wp-piwik_toolbar'])?$_POST['wp-piwik_toolbar']:false); - self::$aryGlobalSettings['shortcodes'] = (isset($_POST['wp-piwik_shortcodes'])?$_POST['wp-piwik_shortcodes']:false); + self::$settings->setGlobalOption('plugin_display_name', (!empty($_POST['wp-piwik_displayname'])?htmlentities($_POST['wp-piwik_displayname']):'WP-Piwk')); + self::$settings->setGlobalOption('dashboard_widget',(isset($_POST['wp-piwik_dbwidget'])?$_POST['wp-piwik_dbwidget']:0)); + self::$settings->setGlobalOption('dashboard_chart',(isset($_POST['wp-piwik_dbchart'])?$_POST['wp-piwik_dbchart']:false)); + self::$settings->setGlobalOption('dashboard_seo',(isset($_POST['wp-piwik_dbseo'])?$_POST['wp-piwik_dbseo']:false)); + self::$settings->setGlobalOption('stats_seo',(isset($_POST['wp-piwik_statsseo'])?$_POST['wp-piwik_statsseo']:false)); + self::$settings->setGlobalOption('piwik_shortcut', (isset($_POST['wp-piwik_piwiklink'])?$_POST['wp-piwik_piwiklink']:false)); + self::$settings->setGlobalOption('default_date', (isset($_POST['wp-piwik_default_date'])?$_POST['wp-piwik_default_date']:'yesterday')); + self::$settings->setGlobalOption('capability_read_stats', (isset($_POST['wp-piwik_displayto'])?$_POST['wp-piwik_displayto']:array())); + self::$settings->setGlobalOption('disable_timelimit', (isset($_POST['wp-piwik_disabletimelimit'])?$_POST['wp-piwik_disabletimelimit']:false)); + self::$settings->setGlobalOption('toolbar', (isset($_POST['wp-piwik_toolbar'])?$_POST['wp-piwik_toolbar']:false)); + self::$settings->setGlobalOption('shortcodes', (isset($_POST['wp-piwik_shortcodes'])?$_POST['wp-piwik_shortcodes']:false)); + self::$settings->setGlobalOption('perpost_stats', (isset($_POST['wp-piwik_perpost'])?$_POST['wp-piwik_perpost']:false)); break; case 'tracking': - self::$aryGlobalSettings['add_tracking_code'] = (isset($_POST['wp-piwik_addjs'])?$_POST['wp-piwik_addjs']:false); - self::$aryGlobalSettings['track_404'] = (isset($_POST['wp-piwik_404'])?$_POST['wp-piwik_404']:false); - self::$aryGlobalSettings['track_search'] = (isset($_POST['wp-piwik_search'])?$_POST['wp-piwik_search']:false); - self::$aryGlobalSettings['track_mode'] = (isset($_POST['wp-piwik_trackingmode'])?(int)$_POST['wp-piwik_trackingmode']:0); - self::$aryGlobalSettings['track_post'] = (isset($_POST['wp-piwik_reqpost'])?$_POST['wp-piwik_reqpost']:false); - self::$aryGlobalSettings['track_proxy'] = (isset($_POST['wp-piwik_proxy'])?$_POST['wp-piwik_proxy']:false); - self::$aryGlobalSettings['track_cdnurl'] = trim(isset($_POST['wp-piwik_cdnurl'])?$_POST['wp-piwik_cdnurl']:''); - self::$aryGlobalSettings['track_cdnurlssl'] = trim(isset($_POST['wp-piwik_cdnurlssl'])?$_POST['wp-piwik_cdnurlssl']:self::$aryGlobalSettings['track_cdnurl']); - self::$aryGlobalSettings['track_noscript'] = (isset($_POST['wp-piwik_noscript'])?$_POST['wp-piwik_noscript']:false); - self::$aryGlobalSettings['capability_stealth'] = (isset($_POST['wp-piwik_filter'])?$_POST['wp-piwik_filter']:array()); - self::$aryGlobalSettings['disable_cookies'] = (isset($_POST['wp-piwik_disable_cookies'])?$_POST['wp-piwik_disable_cookies']:false); + self::$settings->setGlobalOption('add_tracking_code', (isset($_POST['wp-piwik_addjs'])?$_POST['wp-piwik_addjs']:false)); + self::$settings->setGlobalOption('track_404', (isset($_POST['wp-piwik_404'])?$_POST['wp-piwik_404']:false)); + self::$settings->setGlobalOption('track_search', (isset($_POST['wp-piwik_search'])?$_POST['wp-piwik_search']:false)); + self::$settings->setGlobalOption('track_mode', (isset($_POST['wp-piwik_trackingmode'])?(int)$_POST['wp-piwik_trackingmode']:0)); + self::$settings->setGlobalOption('track_post', (isset($_POST['wp-piwik_reqpost'])?$_POST['wp-piwik_reqpost']:false)); + self::$settings->setGlobalOption('track_proxy', (isset($_POST['wp-piwik_proxy'])?$_POST['wp-piwik_proxy']:false)); + self::$settings->setGlobalOption('track_cdnurl', trim(isset($_POST['wp-piwik_cdnurl'])?$_POST['wp-piwik_cdnurl']:'')); + self::$settings->setGlobalOption('track_cdnurlssl', trim(isset($_POST['wp-piwik_cdnurlssl'])?$_POST['wp-piwik_cdnurlssl']:self::$settings->getGlobalOption('track_cdnurl'))); + self::$settings->setGlobalOption('track_noscript', (isset($_POST['wp-piwik_noscript'])?$_POST['wp-piwik_noscript']:false)); + self::$settings->setGlobalOption('track_nojavascript', (isset($_POST['wp-piwik_nojavascript'])?$_POST['wp-piwik_nojavascript']:false)); + self::$settings->setGlobalOption('track_admin', (isset($_POST['wp-piwik_trackadmin'])?$_POST['wp-piwik_trackadmin']:false)); + self::$settings->setGlobalOption('track_feed', (isset($_POST['wp-piwik_trackfeed'])?$_POST['wp-piwik_trackfeed']:false)); + self::$settings->setGlobalOption('track_feed_goal', (isset($_POST['wp-piwik_trackfeed_goal'])&&!empty($_POST['wp-piwik_trackfeed_goal'])?(int)$_POST['wp-piwik_trackfeed_goal']:'')); + self::$settings->setGlobalOption('track_feed_revenue', (isset($_POST['wp-piwik_trackfeed_revenue'])&&!empty($_POST['wp-piwik_trackfeed_revenue'])?(int)$_POST['wp-piwik_trackfeed_revenue']:'')); + self::$settings->setGlobalOption('track_feed_campaign', (isset($_POST['wp-piwik_trackfeed_campaign'])?$_POST['wp-piwik_trackfeed_campaign']:'feed')); + self::$settings->setGlobalOption('track_feed_addcampaign', (isset($_POST['wp-piwik_trackfeed_addcampaign'])?$_POST['wp-piwik_trackfeed_addcampaign']:false)); + self::$settings->setGlobalOption('capability_stealth', (isset($_POST['wp-piwik_filter'])?$_POST['wp-piwik_filter']:array())); + self::$settings->setGlobalOption('disable_cookies', (isset($_POST['wp-piwik_disable_cookies'])?$_POST['wp-piwik_disable_cookies']:false)); + self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag')); break; case 'piwik': - self::$aryGlobalSettings['piwik_token'] = (isset($_POST['wp-piwik_token'])?$_POST['wp-piwik_token']:''); - self::$aryGlobalSettings['piwik_url'] = self::checkURL((isset($_POST['wp-piwik_url'])?$_POST['wp-piwik_url']:'')); - self::$aryGlobalSettings['piwik_path'] = (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path'])?realpath($_POST['wp-piwik_path']):''); - self::$aryGlobalSettings['piwik_mode'] = (isset($_POST['wp-piwik_mode'])?$_POST['wp-piwik_mode']:'http'); - self::$aryGlobalSettings['piwik_useragent'] = (isset($_POST['wp-piwik_useragent'])?$_POST['wp-piwik_useragent']:'php'); - self::$aryGlobalSettings['connection_timeout'] = (isset($_POST['wp-piwik_timeout'])?(int)$_POST['wp-piwik_timeout']:5); - self::$aryGlobalSettings['piwik_useragent_string'] = (isset($_POST['wp-piwik_useragent_string'])?$_POST['wp-piwik_useragent_string']:'WP-Piwik'); - self::$aryGlobalSettings['disable_ssl_verify'] = (isset($_POST['wp-piwik_disable_ssl_verify'])?$_POST['wp-piwik_disable_ssl_verify']:false); + self::$settings->setGlobalOption('piwik_token', (isset($_POST['wp-piwik_token'])?$_POST['wp-piwik_token']:'')); + self::$settings->setGlobalOption('piwik_url', self::checkURL((isset($_POST['wp-piwik_url'])?$_POST['wp-piwik_url']:''))); + self::$settings->setGlobalOption('piwik_path', (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path'])?realpath($_POST['wp-piwik_path']):'')); + self::$settings->setGlobalOption('cache', (isset($_POST['wp-piwik_cache'])?$_POST['wp-piwik_cache']:false)); + self::$settings->setGlobalOption('piwik_mode', (isset($_POST['wp-piwik_mode'])?$_POST['wp-piwik_mode']:'http')); + self::$settings->setGlobalOption('piwik_useragent', (isset($_POST['wp-piwik_useragent'])?$_POST['wp-piwik_useragent']:'php')); + self::$settings->setGlobalOption('connection_timeout', (isset($_POST['wp-piwik_timeout'])?(int)$_POST['wp-piwik_timeout']:5)); + self::$settings->setGlobalOption('piwik_useragent_string', (isset($_POST['wp-piwik_useragent_string'])?$_POST['wp-piwik_useragent_string']:'WP-Piwik')); + self::$settings->setGlobalOption('disable_ssl_verify', (isset($_POST['wp-piwik_disable_ssl_verify'])?$_POST['wp-piwik_disable_ssl_verify']:false)); if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { - self::$aryGlobalSettings['auto_site_config'] = (isset($_POST['wp-piwik_auto_site_config'])?$_POST['wp-piwik_auto_site_config']:false); - if (!self::$aryGlobalSettings['auto_site_config']) - self::$arySettings['site_id'] = (isset($_POST['wp-piwik_siteid'])?$_POST['wp-piwik_siteid']:self::$arySettings['site_id']); - } else self::$aryGlobalSettings['auto_site_config'] = true; + self::$settings->setGlobalOption('auto_site_config', (isset($_POST['wp-piwik_auto_site_config'])?$_POST['wp-piwik_auto_site_config']:false)); + if (!self::$settings->getGlobalOption('auto_site_config')) + self::$settings->setOption('site_id', (isset($_POST['wp-piwik_siteid'])?$_POST['wp-piwik_siteid']:self::$settings->getOption('site_id'))); + } else self::$settings->setGlobalOption('auto_site_config', true); break; } - if (self::$aryGlobalSettings['auto_site_config'] && self::isConfigured()) { - if (self::$aryGlobalSettings['piwik_mode'] == 'php' && !defined('PIWIK_INCLUDE_PATH')) + if (self::$settings->getGlobalOption('auto_site_config') && self::isConfigured()) { + if (self::$settings->getGlobalOption('piwik_mode') == 'php' && !defined('PIWIK_INCLUDE_PATH')) self::definePiwikConstants(); $aryReturn = $this->addPiwikSite(); - self::$arySettings['tracking_code'] = $aryReturn['js']; - self::$arySettings['site_id'] = $aryReturn['id']; + self::$settings->getOption('tracking_code', $aryReturn['js']); + self::$settings->getOption('site_id', $aryReturn['id']); } - self::saveSettings(); + self::$settings->setGlobalOption('last_settings_update', time()); } /** @@ -1330,7 +1301,7 @@ class wp_piwik { if (isset($_POST['wp-piwik_settings_submit']) && $_POST['wp-piwik_settings_submit'] == 'Y') echo '<div id="message" class="updated fade"><p>'.__('Changes saved','wp-piwik').'</p></div>'; // Show settings page title - echo '<div class="wrap"><h2>'.__('WP-Piwik Settings', 'wp-piwik').'</h2>'; + echo '<div class="wrap"><h2>'.self::$settings->getGlobalOption('plugin_display_name').' '.__('Settings', 'wp-piwik').'</h2>'; // Show tabs $strTab = $this->showSettingsTabs(self::isConfigured(), $strTab); if ($strTab != 'sitebrowser') { @@ -1415,71 +1386,16 @@ class wp_piwik { private static function loadTestscript() { require_once('debug/testscript.php'); } - - /** - * Reset all WP-Piwik settings - */ - private static function resetSettings($bolFull = false) { - global $wpdb; - // Backup auth data - $aryKeep = array( - 'revision' => self::$intRevisionId, - 'add_tracking_code' => false, - 'last_settings_update' => 0, - 'piwik_token' => self::$aryGlobalSettings['piwik_token'], - 'piwik_url' => self::$aryGlobalSettings['piwik_url'], - 'piwik_path' => self::$aryGlobalSettings['piwik_path'], - 'piwik_mode' => self::$aryGlobalSettings['piwik_mode'], - 'dashboard_widget' => false, - 'dashboard_chart' => false, - 'dashboard_seo' => false, - 'stats_seo' => false, - 'capability_stealth' => array(), - 'capability_read_stats' => array('administrator' => true), - 'piwik_shortcut' => false, - 'default_date' => 'yesterday', - 'auto_site_config' => true, - 'track_404' => false, - 'track_search' => false, - 'track_mode' => 0, - 'track_post' => false, - 'track_proxy' => false, - 'track_cdnurl' => '', - 'track_cdnurlssl' => '', - 'track_noscript' => false, - 'disable_timelimit' => false, - 'disable_cookies' => false, - 'toolbar' => false, - 'piwik_useragent' => 'php', - 'connection_timeout' => 5, - 'piwik_useragent_string' => 'WP-Piwik', - 'disable_ssl_verify' => false, - 'shortcodes' => false - ); - // Reset network settings - if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { - delete_site_option('wp-piwik_global-settings'); - $aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id'); - foreach ($aryBlogs as $aryBlog) - delete_blog_option($aryBlog->blog_id, 'wp-piwik_settings'); - if (!$bolFull) update_site_option('wp-piwik_global-settings', $aryKeep); - // Reset simple settings - } else { - delete_option('wp-piwik_global-settings'); - delete_option('wp-piwik_settings'); - if (!$bolFull) update_option('wp-piwik_global-settings', $aryKeep); - } - } /** * Get a blog's piwik ID */ public static function getSiteID($intBlogID = null) { - $intResult = self::$arySettings['site_id']; + $intResult = self::$settings->getOption('site_id'); if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && !empty($intBlogID)) { $aryResult = get_blog_option($intBlogID, 'wp-piwik_settings'); $intResult = $aryResult['site_id']; - } + } return (is_int($intResult)?$intResult:'n/a'); } @@ -1488,12 +1404,12 @@ class wp_piwik { */ public static function isConfigured() { return ( - !empty(self::$aryGlobalSettings['piwik_token']) + self::$settings->getGlobalOption('piwik_token') && ( ( - (self::$aryGlobalSettings['piwik_mode'] == 'http') && !empty(self::$aryGlobalSettings['piwik_url']) + (self::$settings->getGlobalOption('piwik_mode') == 'http') && (self::$settings->getGlobalOption('piwik_url')) ) || ( - (self::$aryGlobalSettings['piwik_mode'] == 'php') && !empty(self::$aryGlobalSettings['piwik_path']) + (self::$settings->getGlobalOption('piwik_mode') == 'php') && (self::$settings->getGlobalOption('piwik_path')) ) ) ); @@ -1503,14 +1419,47 @@ class wp_piwik { * Set Piwik PHP API constants */ private static function definePiwikConstants() { - define('PIWIK_INCLUDE_PATH', self::$aryGlobalSettings['piwik_path']); - define('PIWIK_USER_PATH', self::$aryGlobalSettings['piwik_path']); + define('PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption('piwik_path')); + define('PIWIK_USER_PATH', self::$settings->getGlobalOption('piwik_path')); define('PIWIK_ENABLE_DISPATCH', false); define('PIWIK_ENABLE_ERROR_HANDLER', false); define('PIWIK_ENABLE_SESSION_START', false); - } + } + + private function openLogger() { + switch (WP_PIWIK_ACTIVATE_LOGGER) { + case 2: + require_once('classes/WP_Piwik_Logger_File.php'); + self::$logger = new WP_Piwik_Logger_File(__CLASS__); + break; + default: + require_once('classes/WP_Piwik_Logger_Dummy.php'); + self::$logger = new WP_Piwik_Logger_Dummy(__CLASS__); + } + } + + private function closeLogger() { + self::$logger = null; + } + + private function openSettings() { + $this->includeFile('classes/WP_Piwik_Settings'); + self::$settings = new WP_Piwik_Settings(self::$logger); + } + + private function subClassConfig() { + return array( + 'wp_piwik' => $this, + 'logger' => self::$logger, + 'settings' => self::$settings + ); + } } +} + +require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.php'); + if (class_exists('wp_piwik')) $GLOBALS['wp_piwik'] = new wp_piwik(); -- GitLab